Browse code

openssl with ssl3 useflag

Hanno Böck authored on 15/10/2014 10:30:37
Showing 11 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,12 @@
1
+AUX gentoo.config-1.0.1 4980 SHA256 e7dd01bc76f0262c91b0a3a56bbf0675feedd6d5c6e61f8dcb5e3c538b113424 SHA512 1900cf603954dc4213d84d2f1f10fb74310dd8134f9c1bcf5f633a45e2ab27398f51656ac2f4165f86be78b19283374689766e3a5d7b43e16afeff884f31a1a0 WHIRLPOOL 2fd9eb3e46a262509f46f5ee6cef963e0bf32ff2c2dc3acb2fdf890326b4db801c0c90814df6f206fc6bc8aaf1184eb68289beb33e36dcebd890bb9e2855545a
2
+AUX openssl-1.0.0a-ldflags.patch 1095 SHA256 2489ffbae4af11e1642d54992c404ca81b0c2a9c169032281f4f7778d945836f SHA512 d5a3f90ca0e9755940da525b8daba5b5d09b2b251863e9ca4f2b3b0a5db461e0aa25b2ae7a7d36d13a92ff64f2a37d4809b70aff9672c0f43398369bc7099979 WHIRLPOOL b7c2fbc833be856388110f2ac891976903e7c5dd4030249bcd79f915ae94fa93bff955ff3eaaf4a4bab306a09512bd861099c2738f5af7027174b79d023f7261
3
+AUX openssl-1.0.0d-windres.patch 2912 SHA256 e5dbfd6af69bc3f69b51787cf1f6245207be9824dfffbdd9b4e278772ed8ab32 SHA512 d7a0238edea29aac7d20dca0778c67f8ae4dc0da190e5277e1b3519ae536f2c44533ac5dc1cbcd138bc4277ad669b13fca316bd962f26e2cb387f2ad3fd0111b WHIRLPOOL d62156820e55898d0a0393473c6ad8e49c5aa7bb9d3fc7043795de7102c3003d5f8b874c751e03cf832e306ac290790e871e1318bb830b3558a43e09be5b45b4
4
+AUX openssl-1.0.0h-pkg-config.patch 1363 SHA256 dbbcc175f02e5edced01a13dd1e7d35dc4322c0970f78a7fd781a6c0766886af SHA512 c2f7a68c96098bd742235a40f27d6b1e5a0ebece53ca32dd0be74b85210479064efa1d5dc76e457b786067185768492fab2ed53762a22c511c2a2e3d43ed137b WHIRLPOOL 7f795dbed2124d8d2d126886d106675662f09b8e79c70fa2af3298486fdb75b7f1285dc17a53daf985bd4af1e58c36e13e49f46d18af860f0dabad1b3898c3b0
5
+AUX openssl-1.0.1-parallel-build.patch 10614 SHA256 f3aa674880ffa53a891d3f9054a1ff162c4461b3ec160a365990275907636259 SHA512 439015b3b007adfbab047a1e3e12a9700030779a593bba1a30e9554c7c02eb1cffe9acb089546954e87163847cf86b13130abf9646eb5d00a2ff725b534f84d5 WHIRLPOOL 673f6f045765effb9ded607bf8116a81e7bfeee78ba0e8a34892081c272239a2b75fbb14f4c48b61d93593fac8e1b1e8bef7223f4cc64e8443e19c8f337ab6bc
6
+AUX openssl-1.0.1-x32.patch 3273 SHA256 a4f05b8757e225a05a9c5a3ea485159066760d878c9ee54c4eaf61760e33c6cf SHA512 6bed57fe2fbe2d0ced1279b53804d94426a679d5d6b80ad7d0ed18523a7fda397e02038032c08cdd4e6034f9ff6e82cad365ff2a724d49d91467cf2b77f47752 WHIRLPOOL 1366632e7dc1c6e54efc5b9791bf24833d20e7a61ca29aa38d31b5b9629febf926a29742e370b7cd6767c810c0a1676100ca9169f0d836dfd19ff0b2c29e49c1
7
+AUX openssl-1.0.1e-s_client-verify.patch 592 SHA256 6f540fce663eefbe68cee16ad7d8d561d6c898eeb4180c2f4a4caa7e43c6d0c9 SHA512 117b1017e1259667078d3ccdcd9fd46357c6f85cf2702794f49c612b37acdc044fe88f871dbe46fcad9ed4cd8aaaaee800dddb5286203322802efd7549a43b68 WHIRLPOOL 70a4cc36b1dcb24d7e9bcef016684fb2394977f7f20aa332ebd0aa15e3f4c16c74563d2fc0ba8d70669f6cc9a13bf8a30cdb28ebafe2d102cd2859a4e32c38d7
8
+AUX openssl-1.0.1f-revert-alpha-perl-generation.patch 3102 SHA256 6e502275b32ac0eca80f28448ae1bb88506f9135258f420fd857ea0b9b485778 SHA512 c80439da3d268e70fd492d0ca73c0a17ddb088b9330610794a338d1921ee13dad9caca4c81ca103b82a7541c8712f77e51f352ec1b1b02789d9aed291acb0cdc WHIRLPOOL cb760366c8759b1c78c5307134bb48c4fc12b1556276c2ef55455ea54725d20cb433ade966a7453f512d2feb5ae89a9798078ab535e4605366633a8e003c7ac6
9
+AUX openssl-1.0.1h-ipv6.patch 17788 SHA256 7adeeb88cc544f8b210efbe2baff48fccf5029b582dff7010ae70e0e1f097d7b SHA512 0f0990d4294abcb5f3e51c84080883046a054c710b57a23f99b3323727d5e9aeb5ddeb6b6c2565b4be364f7c21419c90ce5288154e404cd663678f87e0d1c259 WHIRLPOOL cfe7a2e141a4a6252ffcfe215b16dd1082bc14a757dad7eb01bb9819de41ef0ee51a4b2dbf110c27b52e483341c337bf4d1f77f4f9f3172d2fee9e348c30af7e
10
+DIST openssl-1.0.1i.tar.gz 4422117 SHA256 3c179f46ca77069a6a0bac70212a9b3b838b2f66129cb52d568837fc79d8fcc7 SHA512 6cbcdcec8568236e8f20f0461f93df8a193a0ad88102ff548443e6ec87e2a7f649e314beee1e6bafda693934b4fb142244b61d14bf736828dda09e277b941d93 WHIRLPOOL 4baefe8a203243d08c2ca4dc9e1019a539135604a8ddfb09b9a7f2711108ad6ebd45eef1cfa09331f19fe57defbe7e1390f9ac2de086437a484c5819cabb5a4a
11
+DIST openssl-c_rehash.sh.1.7 4167 SHA256 4999ee79892f52bd6a4a7baba9fac62262454d573bbffd72685d3aae9e48cee0 SHA512 55e8c2e827750a4f375cb83c86bfe2d166c01ffa5d7e9b16657b72b38b747c8985dd2c98f854c911dfbbee2ff3e92aff39fdf089d979b2e3534b7685ee8b80da WHIRLPOOL c88f06a3b8651f76b6289552cccceb64e13f6697c5f0ce3ff114c781ce1c218912b8ee308af9d087cd76a9600fdacda1953175bff07d7d3eb21b0c0b7f4f1ce1
12
+EBUILD openssl-1.0.1i.ebuild 8776 SHA256 99e7d64748e9448cd1f3d8738e1a97b5daab3c56b3e5f0168186f6644d83bbd8 SHA512 e1b922da0678ac59ed09f4cffd714b45ba8e028aa844e089a4385391fcb4e02b7fc731f855e2537acf10e817710e06aa61fac91233db78a053416212e83a9bf2 WHIRLPOOL 3537527dde49f7fd39c73c7a4053c5bf44fdf3e2544fd7148019729abd01120c7f3fe85e83a38b89630ff0bb38b7d044e42234cfaf4cf68612b630900e5b209a
0 13
new file mode 100755
... ...
@@ -0,0 +1,164 @@
1
+#!/usr/bin/env bash
2
+# Copyright 1999-2014 Gentoo Foundation
3
+# Distributed under the terms of the GNU General Public License v2
4
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/openssl/files/gentoo.config-1.0.1,v 1.2 2014/01/17 04:27:03 vapier Exp $
5
+#
6
+# Openssl doesn't play along nicely with cross-compiling
7
+# like autotools based projects, so let's teach it new tricks.
8
+#
9
+# Review the bundled 'config' script to see why kind of targets
10
+# we can pass to the 'Configure' script.
11
+
12
+
13
+# Testing routines
14
+if [[ $1 == "test" ]] ; then
15
+	for c in \
16
+		"arm-gentoo-linux-uclibc      |linux-generic32 -DL_ENDIAN" \
17
+		"armv5b-linux-gnu             |linux-armv4 -DB_ENDIAN" \
18
+		"x86_64-pc-linux-gnu          |linux-x86_64" \
19
+		"alpha-linux-gnu              |linux-alpha-gcc" \
20
+		"alphaev56-unknown-linux-gnu  |linux-alpha+bwx-gcc" \
21
+		"i686-pc-linux-gnu            |linux-elf" \
22
+		"whatever-gentoo-freebsdX.Y   |BSD-generic32" \
23
+		"i686-gentoo-freebsdX.Y       |BSD-x86-elf" \
24
+		"sparc64-alpha-freebsdX.Y     |BSD-sparc64" \
25
+		"ia64-gentoo-freebsd5.99234   |BSD-ia64" \
26
+		"x86_64-gentoo-freebsdX.Y     |BSD-x86_64" \
27
+		"hppa64-aldsF-linux-gnu5.3    |linux-generic32 -DB_ENDIAN" \
28
+		"powerpc-gentOO-linux-uclibc  |linux-ppc" \
29
+		"powerpc64-unk-linux-gnu      |linux-ppc64" \
30
+		"x86_64-apple-darwinX         |darwin64-x86_64-cc" \
31
+		"powerpc64-apple-darwinX      |darwin64-ppc-cc" \
32
+		"i686-apple-darwinX           |darwin-i386-cc" \
33
+		"i386-apple-darwinX           |darwin-i386-cc" \
34
+		"powerpc-apple-darwinX        |darwin-ppc-cc" \
35
+		"i586-pc-winnt                |winnt-parity" \
36
+		"s390-ibm-linux-gnu           |linux-generic32 -DB_ENDIAN" \
37
+		"s390x-linux-gnu              |linux64-s390x" \
38
+	;do
39
+		CHOST=${c/|*}
40
+		ret_want=${c/*|}
41
+		ret_got=$(CHOST=${CHOST} "$0")
42
+
43
+		if [[ ${ret_want} == "${ret_got}" ]] ; then
44
+			echo "PASS: ${CHOST}"
45
+		else
46
+			echo "FAIL: ${CHOST}"
47
+			echo -e "\twanted: ${ret_want}"
48
+			echo -e "\twe got: ${ret_got}"
49
+		fi
50
+	done
51
+	exit 0
52
+fi
53
+[[ -z ${CHOST} && -n $1 ]] && CHOST=$1
54
+
55
+
56
+# Detect the operating system
57
+case ${CHOST} in
58
+	*-aix*)          system="aix";;
59
+	*-darwin*)       system="darwin";;
60
+	*-freebsd*)      system="BSD";;
61
+	*-hpux*)         system="hpux";;
62
+	*-linux*)        system="linux";;
63
+	*-solaris*)      system="solaris";;
64
+	*-winnt*)        system="winnt";;
65
+	x86_64-*-mingw*) system="mingw64";;
66
+	*mingw*)         system="mingw";;
67
+	*)               exit 0;;
68
+esac
69
+
70
+
71
+# Compiler munging
72
+compiler="gcc"
73
+if [[ ${CC} == "ccc" ]] ; then
74
+	compiler=${CC}
75
+fi
76
+
77
+
78
+# Detect target arch
79
+machine=""
80
+chost_machine=${CHOST%%-*}
81
+case ${system} in
82
+linux)
83
+	case ${chost_machine}:${ABI} in
84
+		aarch64*be)   machine="generic64 -DB_ENDIAN";;
85
+		aarch64*)     machine="generic64 -DL_ENDIAN";;
86
+		alphaev56*|\
87
+		alphaev[678]*)machine=alpha+bwx-${compiler};;
88
+		alpha*)       machine=alpha-${compiler};;
89
+		armv[4-9]*b*) machine="armv4 -DB_ENDIAN";;
90
+		armv[4-9]*)   machine="armv4 -DL_ENDIAN";;
91
+		arm*b*)       machine="generic32 -DB_ENDIAN";;
92
+		arm*)         machine="generic32 -DL_ENDIAN";;
93
+		avr*)         machine="generic32 -DL_ENDIAN";;
94
+		bfin*)        machine="generic32 -DL_ENDIAN";;
95
+	#	hppa64*)      machine=parisc64;;
96
+		hppa*)        machine="generic32 -DB_ENDIAN";;
97
+		i[0-9]86*|\
98
+		x86_64*:x86)  machine=elf;;
99
+		ia64*)        machine=ia64;;
100
+		m68*)         machine="generic32 -DB_ENDIAN";;
101
+		mips*el*)     machine="generic32 -DL_ENDIAN";;
102
+		mips*)        machine="generic32 -DB_ENDIAN";;
103
+		powerpc64*le) machine="generic64 -DL_ENDIAN";;
104
+		powerpc64*)   machine=ppc64;;
105
+		powerpc*le)   machine="generic32 -DL_ENDIAN";;
106
+		powerpc*)     machine=ppc;;
107
+	#	sh64*)        machine=elf;;
108
+		sh*b*)        machine="generic32 -DB_ENDIAN";;
109
+		sh*)          machine="generic32 -DL_ENDIAN";;
110
+		sparc*v7*)    machine="generic32 -DB_ENDIAN";;
111
+		sparc64*)     machine=sparcv9;;
112
+		sparc*)       machine=sparcv8;;
113
+		s390x*)       machine=s390x system=linux64;;
114
+		s390*)        machine="generic32 -DB_ENDIAN";;
115
+		x86_64*:x32)  machine=x32;;
116
+		x86_64*)      machine=x86_64;;
117
+	esac
118
+	;;
119
+BSD)
120
+	case ${chost_machine} in
121
+		alpha*)       machine=generic64;;
122
+		i[6-9]86*)    machine=x86-elf;;
123
+		ia64*)        machine=ia64;;
124
+		sparc64*)     machine=sparc64;;
125
+		x86_64*)      machine=x86_64;;
126
+		*)            machine=generic32;;
127
+	esac
128
+	;;
129
+aix)
130
+	machine=${compiler}
131
+	;;
132
+darwin)
133
+	case ${chost_machine} in
134
+		powerpc64)    machine=ppc-cc; system=${system}64;;
135
+		powerpc)      machine=ppc-cc;;
136
+		i?86*)        machine=i386-cc;;
137
+		x86_64)       machine=x86_64-cc; system=${system}64;;
138
+	esac
139
+	;;
140
+hpux)
141
+	case ${chost_machine} in
142
+		ia64)	machine=ia64-${compiler} ;;
143
+	esac
144
+	;;
145
+solaris)
146
+	case ${chost_machine} in
147
+		i386)         machine=x86-${compiler} ;;
148
+		x86_64*)      machine=x86_64-${compiler}; system=${system}64;;
149
+		sparcv9*)     machine=sparcv9-${compiler}; system=${system}64;;
150
+		sparc*)       machine=sparcv8-${compiler};;
151
+	esac
152
+	;;
153
+winnt)
154
+	machine=parity
155
+	;;
156
+mingw*)
157
+	# special case ... no xxx-yyy style name
158
+	echo ${system}
159
+	;;
160
+esac
161
+
162
+
163
+# If we have something, show it
164
+[[ -n ${machine} ]] && echo ${system}-${machine}
0 165
new file mode 100644
... ...
@@ -0,0 +1,29 @@
1
+http://bugs.gentoo.org/181438
2
+http://bugs.gentoo.org/327421
3
+https://rt.openssl.org/Ticket/Display.html?id=3332&user=guest&pass=guest
4
+
5
+make sure we respect LDFLAGS
6
+
7
+also make sure we don't add useless -rpath flags to the system libdir
8
+
9
+--- Makefile.org
10
+@@ -189,6 +189,7 @@
11
+ 		MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD $(MAKEDEPPROG)' \
12
+ 		DEPFLAG='-DOPENSSL_NO_DEPRECATED $(DEPFLAG)'	\
13
+ 		MAKEDEPPROG='$(MAKEDEPPROG)'			\
14
++		LDFLAGS='${LDFLAGS}'				\
15
+ 		SHARED_LDFLAGS='$(SHARED_LDFLAGS)'		\
16
+ 		KRB5_INCLUDES='$(KRB5_INCLUDES)' LIBKRB5='$(LIBKRB5)'	\
17
+ 		ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)'	\
18
+--- Makefile.shared
19
+@@ -153,7 +153,7 @@
20
+ 	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
21
+ 	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"
22
+ 
23
+-DO_GNU_APP=LDFLAGS="$(CFLAGS) -Wl,-rpath,$(LIBRPATH)"
24
++DO_GNU_APP=LDFLAGS="$(LDFLAGS) $(CFLAGS)"
25
+ 
26
+ #This is rather special.  It's a special target with which one can link
27
+ #applications without bothering with any features that have anything to
0 28
new file mode 100644
... ...
@@ -0,0 +1,76 @@
1
+URL: http://rt.openssl.org/Ticket/Display.html?id=2558&user=guest&pass=guest
2
+Subject: make windres controllable via build env var settings
3
+
4
+atm, the windres code in openssl is only usable via the cross-compile prefix 
5
+option unlike all the other build tools. so add support for the standard $RC 
6
+/ $WINDRES env vars as well.
7
+
8
+Index: Configure
9
+===================================================================
10
+RCS file: /usr/local/src/openssl/CVSROOT/openssl/Configure,v
11
+retrieving revision 1.621.2.40
12
+diff -u -p -r1.621.2.40 Configure
13
+--- Configure	30 Nov 2010 22:19:26 -0000	1.621.2.40
14
+@@ -1094,6 +1094,7 @@ my $shared_extension = $fields[$idx_shar
15
+ my $ranlib = $ENV{'RANLIB'} || $fields[$idx_ranlib];
16
+ my $ar = $ENV{'AR'} || "ar";
17
+ my $arflags = $fields[$idx_arflags];
18
++my $windres = $ENV{'RC'} || $ENV{'WINDRES'} || "windres";
19
+ my $multilib = $fields[$idx_multilib];
20
+ 
21
+ # if $prefix/lib$multilib is not an existing directory, then
22
+@@ -1511,12 +1512,14 @@ while (<IN>)
23
+ 		s/^AR=\s*/AR= \$\(CROSS_COMPILE\)/;
24
+ 		s/^NM=\s*/NM= \$\(CROSS_COMPILE\)/;
25
+ 		s/^RANLIB=\s*/RANLIB= \$\(CROSS_COMPILE\)/;
26
++		s/^WINDRES=\s*/WINDRES= \$\(CROSS_COMPILE\)/;
27
+ 		s/^MAKEDEPPROG=.*$/MAKEDEPPROG= \$\(CROSS_COMPILE\)$cc/ if $cc eq "gcc";
28
+ 		}
29
+ 	else	{
30
+ 		s/^CC=.*$/CC= $cc/;
31
+ 		s/^AR=\s*ar/AR= $ar/;
32
+ 		s/^RANLIB=.*/RANLIB= $ranlib/;
33
++		s/^WINDRES=.*/WINDRES= $windres/;
34
+ 		s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $cc eq "gcc";
35
+ 		}
36
+ 	s/^CFLAG=.*$/CFLAG= $cflags/;
37
+Index: Makefile.org
38
+===================================================================
39
+RCS file: /usr/local/src/openssl/CVSROOT/openssl/Makefile.org,v
40
+retrieving revision 1.295.2.10
41
+diff -u -p -r1.295.2.10 Makefile.org
42
+--- Makefile.org	27 Jan 2010 16:06:58 -0000	1.295.2.10
43
+@@ -66,6 +66,7 @@ EXE_EXT= 
44
+ ARFLAGS=
45
+ AR=ar $(ARFLAGS) r
46
+ RANLIB= ranlib
47
++WINDRES= windres
48
+ NM= nm
49
+ PERL= perl
50
+ TAR= tar
51
+@@ -180,6 +181,7 @@ BUILDENV=	PLATFORM='$(PLATFORM)' PROCESS
52
+ 		CC='$(CC)' CFLAG='$(CFLAG)' 			\
53
+ 		AS='$(CC)' ASFLAG='$(CFLAG) -c'			\
54
+ 		AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)'	\
55
++		WINDRES='$(WINDRES)'				\
56
+ 		CROSS_COMPILE='$(CROSS_COMPILE)'	\
57
+ 		PERL='$(PERL)' ENGDIRS='$(ENGDIRS)'		\
58
+ 		SDIRS='$(SDIRS)' LIBRPATH='$(INSTALLTOP)/$(LIBDIR)'	\
59
+Index: Makefile.shared
60
+===================================================================
61
+RCS file: /usr/local/src/openssl/CVSROOT/openssl/Makefile.shared,v
62
+retrieving revision 1.72.2.4
63
+diff -u -p -r1.72.2.4 Makefile.shared
64
+--- Makefile.shared	21 Aug 2010 11:36:49 -0000	1.72.2.4
65
+@@ -293,7 +293,7 @@ link_a.cygwin:
66
+ 	fi; \
67
+ 	dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \
68
+ 	$(PERL) util/mkrc.pl $$dll_name | \
69
+-		$(CROSS_COMPILE)windres -o rc.o; \
70
++		$(WINDRES) -o rc.o; \
71
+ 	extras="$$extras rc.o"; \
72
+ 	ALLSYMSFLAGS='-Wl,--whole-archive'; \
73
+ 	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
0 74
new file mode 100644
... ...
@@ -0,0 +1,34 @@
1
+https://rt.openssl.org/Ticket/Display.html?id=3332&user=guest&pass=guest
2
+
3
+depend on other pc files rather than encoding library info directly in
4
+every pkg-config file
5
+
6
+--- a/Makefile.org
7
+@@ -335,11 +335,11 @@ libssl.pc: Makefile
8
+ 	    echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
9
+ 	    echo 'includedir=$${prefix}/include'; \
10
+ 	    echo ''; \
11
+-	    echo 'Name: OpenSSL'; \
12
++	    echo 'Name: OpenSSL-libssl'; \
13
+ 	    echo 'Description: Secure Sockets Layer and cryptography libraries'; \
14
+ 	    echo 'Version: '$(VERSION); \
15
+-	    echo 'Requires: '; \
16
+-	    echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
17
++	    echo 'Requires.private: libcrypto'; \
18
++	    echo 'Libs: -L$${libdir} -lssl'; \
19
+ 	    echo 'Libs.private: $(EX_LIBS)'; \
20
+ 	    echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc
21
+ 
22
+@@ -352,10 +353,7 @@ openssl.pc: Makefile
23
+ 	    echo 'Name: OpenSSL'; \
24
+ 	    echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
25
+ 	    echo 'Version: '$(VERSION); \
26
+-	    echo 'Requires: '; \
27
+-	    echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
28
+-	    echo 'Libs.private: $(EX_LIBS)'; \
29
+-	    echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
30
++	    echo 'Requires: libssl libcrypto' ) > openssl.pc
31
+ 
32
+ Makefile: Makefile.org Configure config
33
+ 	@echo "Makefile is older than Makefile.org, Configure or config."
0 34
new file mode 100644
... ...
@@ -0,0 +1,354 @@
1
+http://rt.openssl.org/Ticket/Display.html?id=2084
2
+
3
+--- a/Makefile.org
4
+@@ -247,17 +247,17 @@
5
+ build_libs: build_crypto build_ssl build_engines
6
+ 
7
+ build_crypto:
8
+-	@dir=crypto; target=all; $(BUILD_ONE_CMD)
9
++	+@dir=crypto; target=all; $(BUILD_ONE_CMD)
10
+-build_ssl:
11
++build_ssl: build_crypto
12
+-	@dir=ssl; target=all; $(BUILD_ONE_CMD)
13
++	+@dir=ssl; target=all; $(BUILD_ONE_CMD)
14
+-build_engines:
15
++build_engines: build_crypto
16
+-	@dir=engines; target=all; $(BUILD_ONE_CMD)
17
++	+@dir=engines; target=all; $(BUILD_ONE_CMD)
18
+-build_apps:
19
++build_apps: build_libs
20
+-	@dir=apps; target=all; $(BUILD_ONE_CMD)
21
++	+@dir=apps; target=all; $(BUILD_ONE_CMD)
22
+-build_tests:
23
++build_tests: build_libs
24
+-	@dir=test; target=all; $(BUILD_ONE_CMD)
25
++	+@dir=test; target=all; $(BUILD_ONE_CMD)
26
+-build_tools:
27
++build_tools: build_libs
28
+-	@dir=tools; target=all; $(BUILD_ONE_CMD)
29
++	+@dir=tools; target=all; $(BUILD_ONE_CMD)
30
+ 
31
+ all_testapps: build_libs build_testapps
32
+ build_testapps:
33
+@@ -497,9 +497,9 @@
34
+ dist_pem_h:
35
+ 	(cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean)
36
+ 
37
+-install: all install_docs install_sw
38
++install: install_docs install_sw
39
+ 
40
+-install_sw:
41
++install_dirs:
42
+ 	@$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
43
+ 		$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR) \
44
+ 		$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines \
45
+@@ -508,6 +508,13 @@
46
+ 		$(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
47
+ 		$(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
48
+ 		$(INSTALL_PREFIX)$(OPENSSLDIR)/private
49
++	@$(PERL) $(TOP)/util/mkdir-p.pl \
50
++		$(INSTALL_PREFIX)$(MANDIR)/man1 \
51
++		$(INSTALL_PREFIX)$(MANDIR)/man3 \
52
++		$(INSTALL_PREFIX)$(MANDIR)/man5 \
53
++		$(INSTALL_PREFIX)$(MANDIR)/man7
54
++
55
++install_sw: install_dirs
56
+ 	@set -e; headerlist="$(EXHEADER)"; for i in $$headerlist;\
57
+ 	do \
58
+ 	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
59
+@@ -511,7 +511,7 @@
60
+ 	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
61
+ 	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
62
+ 	done;
63
+-	@set -e; target=install; $(RECURSIVE_BUILD_CMD)
64
++	+@set -e; target=install; $(RECURSIVE_BUILD_CMD)
65
+ 	@set -e; liblist="$(LIBS)"; for i in $$liblist ;\
66
+ 	do \
67
+ 		if [ -f "$$i" ]; then \
68
+@@ -593,12 +600,7 @@
69
+ 		done; \
70
+ 	done
71
+ 
72
+-install_docs:
73
+-	@$(PERL) $(TOP)/util/mkdir-p.pl \
74
+-		$(INSTALL_PREFIX)$(MANDIR)/man1 \
75
+-		$(INSTALL_PREFIX)$(MANDIR)/man3 \
76
+-		$(INSTALL_PREFIX)$(MANDIR)/man5 \
77
+-		$(INSTALL_PREFIX)$(MANDIR)/man7
78
++install_docs: install_dirs
79
+ 	@pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \
80
+ 	here="`pwd`"; \
81
+ 	filecase=; \
82
+--- a/Makefile.shared
83
+@@ -105,6 +105,7 @@ LINK_SO=	\
84
+     SHAREDFLAGS="$${SHAREDFLAGS:-$(CFLAGS) $(SHARED_LDFLAGS)}"; \
85
+     LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
86
+     LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
87
++    [ -e $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX ] && exit 0; \
88
+     LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
89
+     $${SHAREDCMD} $${SHAREDFLAGS} \
90
+ 	-o $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX \
91
+@@ -122,6 +124,7 @@ SYMLINK_SO=	\
92
+ 			done; \
93
+ 		fi; \
94
+ 		if [ -n "$$SHLIB_SOVER" ]; then \
95
++			[ -e "$$SHLIB$$SHLIB_SUFFIX" ] || \
96
+ 			( $(SET_X); rm -f $$SHLIB$$SHLIB_SUFFIX; \
97
+ 			  ln -s $$prev $$SHLIB$$SHLIB_SUFFIX ); \
98
+ 		fi; \
99
+--- a/crypto/Makefile
100
+@@ -85,11 +85,11 @@
101
+ 	@if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
102
+ 
103
+ subdirs:
104
+-	@target=all; $(RECURSIVE_MAKE)
105
++	+@target=all; $(RECURSIVE_MAKE)
106
+ 
107
+ files:
108
+ 	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
109
+-	@target=files; $(RECURSIVE_MAKE)
110
++	+@target=files; $(RECURSIVE_MAKE)
111
+ 
112
+ links:
113
+ 	@$(PERL) $(TOP)/util/mklink.pl ../include/openssl $(EXHEADER)
114
+@@ -100,7 +100,7 @@
115
+ # lib: $(LIB): are splitted to avoid end-less loop
116
+ lib:	$(LIB)
117
+ 	@touch lib
118
+-$(LIB):	$(LIBOBJ)
119
++$(LIB):	$(LIBOBJ) | subdirs
120
+ 	$(AR) $(LIB) $(LIBOBJ)
121
+ 	$(RANLIB) $(LIB) || echo Never mind.
122
+ 
123
+@@ -110,7 +110,7 @@
124
+ 	fi
125
+ 
126
+ libs:
127
+-	@target=lib; $(RECURSIVE_MAKE)
128
++	+@target=lib; $(RECURSIVE_MAKE)
129
+ 
130
+ install:
131
+ 	@[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
132
+@@ -119,7 +119,7 @@
133
+ 	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
134
+ 	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
135
+ 	done;
136
+-	@target=install; $(RECURSIVE_MAKE)
137
++	+@target=install; $(RECURSIVE_MAKE)
138
+ 
139
+ lint:
140
+ 	@target=lint; $(RECURSIVE_MAKE)
141
+--- a/engines/Makefile
142
+@@ -72,7 +72,7 @@
143
+ 
144
+ all:	lib subdirs
145
+ 
146
+-lib:	$(LIBOBJ)
147
++lib:	$(LIBOBJ) | subdirs
148
+ 	@if [ -n "$(SHARED_LIBS)" ]; then \
149
+ 		set -e; \
150
+ 		for l in $(LIBNAMES); do \
151
+@@ -89,7 +89,7 @@
152
+ 
153
+ subdirs:
154
+ 	echo $(EDIRS)
155
+-	@target=all; $(RECURSIVE_MAKE)
156
++	+@target=all; $(RECURSIVE_MAKE)
157
+ 
158
+ files:
159
+ 	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
160
+@@ -128,7 +128,7 @@
161
+ 			  mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx ); \
162
+ 		done; \
163
+ 	fi
164
+-	@target=install; $(RECURSIVE_MAKE)
165
++	+@target=install; $(RECURSIVE_MAKE)
166
+ 
167
+ tags:
168
+ 	ctags $(SRC)
169
+--- a/test/Makefile
170
+@@ -123,7 +123,7 @@
171
+ tags:
172
+ 	ctags $(SRC)
173
+ 
174
+-tests:	exe apps $(TESTS)
175
++tests:	exe $(TESTS)
176
+ 
177
+ apps:
178
+ 	@(cd ..; $(MAKE) DIRS=apps all)
179
+@@ -365,109 +365,109 @@
180
+ 		link_app.$${shlib_target}
181
+ 
182
+ $(RSATEST)$(EXE_EXT): $(RSATEST).o $(DLIBCRYPTO)
183
+-	@target=$(RSATEST); $(BUILD_CMD)
184
++	+@target=$(RSATEST); $(BUILD_CMD)
185
+ 
186
+ $(BNTEST)$(EXE_EXT): $(BNTEST).o $(DLIBCRYPTO)
187
+-	@target=$(BNTEST); $(BUILD_CMD)
188
++	+@target=$(BNTEST); $(BUILD_CMD)
189
+ 
190
+ $(ECTEST)$(EXE_EXT): $(ECTEST).o $(DLIBCRYPTO)
191
+-	@target=$(ECTEST); $(BUILD_CMD)
192
++	+@target=$(ECTEST); $(BUILD_CMD)
193
+ 
194
+ $(EXPTEST)$(EXE_EXT): $(EXPTEST).o $(DLIBCRYPTO)
195
+-	@target=$(EXPTEST); $(BUILD_CMD)
196
++	+@target=$(EXPTEST); $(BUILD_CMD)
197
+ 
198
+ $(IDEATEST)$(EXE_EXT): $(IDEATEST).o $(DLIBCRYPTO)
199
+-	@target=$(IDEATEST); $(BUILD_CMD)
200
++	+@target=$(IDEATEST); $(BUILD_CMD)
201
+ 
202
+ $(MD2TEST)$(EXE_EXT): $(MD2TEST).o $(DLIBCRYPTO)
203
+-	@target=$(MD2TEST); $(BUILD_CMD)
204
++	+@target=$(MD2TEST); $(BUILD_CMD)
205
+ 
206
+ $(SHATEST)$(EXE_EXT): $(SHATEST).o $(DLIBCRYPTO)
207
+-	@target=$(SHATEST); $(BUILD_CMD)
208
++	+@target=$(SHATEST); $(BUILD_CMD)
209
+ 
210
+ $(SHA1TEST)$(EXE_EXT): $(SHA1TEST).o $(DLIBCRYPTO)
211
+-	@target=$(SHA1TEST); $(BUILD_CMD)
212
++	+@target=$(SHA1TEST); $(BUILD_CMD)
213
+ 
214
+ $(SHA256TEST)$(EXE_EXT): $(SHA256TEST).o $(DLIBCRYPTO)
215
+-	@target=$(SHA256TEST); $(BUILD_CMD)
216
++	+@target=$(SHA256TEST); $(BUILD_CMD)
217
+ 
218
+ $(SHA512TEST)$(EXE_EXT): $(SHA512TEST).o $(DLIBCRYPTO)
219
+-	@target=$(SHA512TEST); $(BUILD_CMD)
220
++	+@target=$(SHA512TEST); $(BUILD_CMD)
221
+ 
222
+ $(RMDTEST)$(EXE_EXT): $(RMDTEST).o $(DLIBCRYPTO)
223
+-	@target=$(RMDTEST); $(BUILD_CMD)
224
++	+@target=$(RMDTEST); $(BUILD_CMD)
225
+ 
226
+ $(MDC2TEST)$(EXE_EXT): $(MDC2TEST).o $(DLIBCRYPTO)
227
+-	@target=$(MDC2TEST); $(BUILD_CMD)
228
++	+@target=$(MDC2TEST); $(BUILD_CMD)
229
+ 
230
+ $(MD4TEST)$(EXE_EXT): $(MD4TEST).o $(DLIBCRYPTO)
231
+-	@target=$(MD4TEST); $(BUILD_CMD)
232
++	+@target=$(MD4TEST); $(BUILD_CMD)
233
+ 
234
+ $(MD5TEST)$(EXE_EXT): $(MD5TEST).o $(DLIBCRYPTO)
235
+-	@target=$(MD5TEST); $(BUILD_CMD)
236
++	+@target=$(MD5TEST); $(BUILD_CMD)
237
+ 
238
+ $(HMACTEST)$(EXE_EXT): $(HMACTEST).o $(DLIBCRYPTO)
239
+-	@target=$(HMACTEST); $(BUILD_CMD)
240
++	+@target=$(HMACTEST); $(BUILD_CMD)
241
+ 
242
+ $(WPTEST)$(EXE_EXT): $(WPTEST).o $(DLIBCRYPTO)
243
+-	@target=$(WPTEST); $(BUILD_CMD)
244
++	+@target=$(WPTEST); $(BUILD_CMD)
245
+ 
246
+ $(RC2TEST)$(EXE_EXT): $(RC2TEST).o $(DLIBCRYPTO)
247
+-	@target=$(RC2TEST); $(BUILD_CMD)
248
++	+@target=$(RC2TEST); $(BUILD_CMD)
249
+ 
250
+ $(BFTEST)$(EXE_EXT): $(BFTEST).o $(DLIBCRYPTO)
251
+-	@target=$(BFTEST); $(BUILD_CMD)
252
++	+@target=$(BFTEST); $(BUILD_CMD)
253
+ 
254
+ $(CASTTEST)$(EXE_EXT): $(CASTTEST).o $(DLIBCRYPTO)
255
+-	@target=$(CASTTEST); $(BUILD_CMD)
256
++	+@target=$(CASTTEST); $(BUILD_CMD)
257
+ 
258
+ $(RC4TEST)$(EXE_EXT): $(RC4TEST).o $(DLIBCRYPTO)
259
+-	@target=$(RC4TEST); $(BUILD_CMD)
260
++	+@target=$(RC4TEST); $(BUILD_CMD)
261
+ 
262
+ $(RC5TEST)$(EXE_EXT): $(RC5TEST).o $(DLIBCRYPTO)
263
+-	@target=$(RC5TEST); $(BUILD_CMD)
264
++	+@target=$(RC5TEST); $(BUILD_CMD)
265
+ 
266
+ $(DESTEST)$(EXE_EXT): $(DESTEST).o $(DLIBCRYPTO)
267
+-	@target=$(DESTEST); $(BUILD_CMD)
268
++	+@target=$(DESTEST); $(BUILD_CMD)
269
+ 
270
+ $(RANDTEST)$(EXE_EXT): $(RANDTEST).o $(DLIBCRYPTO)
271
+-	@target=$(RANDTEST); $(BUILD_CMD)
272
++	+@target=$(RANDTEST); $(BUILD_CMD)
273
+ 
274
+ $(DHTEST)$(EXE_EXT): $(DHTEST).o $(DLIBCRYPTO)
275
+-	@target=$(DHTEST); $(BUILD_CMD)
276
++	+@target=$(DHTEST); $(BUILD_CMD)
277
+ 
278
+ $(DSATEST)$(EXE_EXT): $(DSATEST).o $(DLIBCRYPTO)
279
+-	@target=$(DSATEST); $(BUILD_CMD)
280
++	+@target=$(DSATEST); $(BUILD_CMD)
281
+ 
282
+ $(METHTEST)$(EXE_EXT): $(METHTEST).o $(DLIBCRYPTO)
283
+-	@target=$(METHTEST); $(BUILD_CMD)
284
++	+@target=$(METHTEST); $(BUILD_CMD)
285
+ 
286
+ $(SSLTEST)$(EXE_EXT): $(SSLTEST).o $(DLIBSSL) $(DLIBCRYPTO)
287
+-	@target=$(SSLTEST); $(FIPS_BUILD_CMD)
288
++	+@target=$(SSLTEST); $(FIPS_BUILD_CMD)
289
+ 
290
+ $(ENGINETEST)$(EXE_EXT): $(ENGINETEST).o $(DLIBCRYPTO)
291
+-	@target=$(ENGINETEST); $(BUILD_CMD)
292
++	+@target=$(ENGINETEST); $(BUILD_CMD)
293
+ 
294
+ $(EVPTEST)$(EXE_EXT): $(EVPTEST).o $(DLIBCRYPTO)
295
+-	@target=$(EVPTEST); $(BUILD_CMD)
296
++	+@target=$(EVPTEST); $(BUILD_CMD)
297
+ 
298
+ $(ECDSATEST)$(EXE_EXT): $(ECDSATEST).o $(DLIBCRYPTO)
299
+-	@target=$(ECDSATEST); $(BUILD_CMD)
300
++	+@target=$(ECDSATEST); $(BUILD_CMD)
301
+ 
302
+ $(ECDHTEST)$(EXE_EXT): $(ECDHTEST).o $(DLIBCRYPTO)
303
+-	@target=$(ECDHTEST); $(BUILD_CMD)
304
++	+@target=$(ECDHTEST); $(BUILD_CMD)
305
+ 
306
+ $(IGETEST)$(EXE_EXT): $(IGETEST).o $(DLIBCRYPTO)
307
+-	@target=$(IGETEST); $(BUILD_CMD)
308
++	+@target=$(IGETEST); $(BUILD_CMD)
309
+ 
310
+ $(JPAKETEST)$(EXE_EXT): $(JPAKETEST).o $(DLIBCRYPTO)
311
+-	@target=$(JPAKETEST); $(BUILD_CMD)
312
++	+@target=$(JPAKETEST); $(BUILD_CMD)
313
+ 
314
+ $(ASN1TEST)$(EXE_EXT): $(ASN1TEST).o $(DLIBCRYPTO)
315
+-	@target=$(ASN1TEST); $(BUILD_CMD)
316
++	+@target=$(ASN1TEST); $(BUILD_CMD)
317
+ 
318
+ $(SRPTEST)$(EXE_EXT): $(SRPTEST).o $(DLIBCRYPTO)
319
+-	@target=$(SRPTEST); $(BUILD_CMD)
320
++	+@target=$(SRPTEST); $(BUILD_CMD)
321
+ 
322
+ #$(AESTEST).o: $(AESTEST).c
323
+ #	$(CC) -c $(CFLAGS) -DINTERMEDIATE_VALUE_KAT -DTRACE_KAT_MCT $(AESTEST).c
324
+@@ -480,7 +480,7 @@
325
+ #	fi
326
+ 
327
+ dummytest$(EXE_EXT): dummytest.o $(DLIBCRYPTO)
328
+-	@target=dummytest; $(BUILD_CMD)
329
++	+@target=dummytest; $(BUILD_CMD)
330
+ 
331
+ # DO NOT DELETE THIS LINE -- make depend depends on it.
332
+ 
333
+--- a/crypto/objects/Makefile
334
+@@ -44,11 +44,11 @@ obj_dat.h: obj_dat.pl obj_mac.h
335
+ # objects.pl both reads and writes obj_mac.num
336
+ obj_mac.h: objects.pl objects.txt obj_mac.num
337
+ 	$(PERL) objects.pl objects.txt obj_mac.num obj_mac.h
338
+-	@sleep 1; touch obj_mac.h; sleep 1
339
+ 
340
+-obj_xref.h: objxref.pl obj_xref.txt obj_mac.num
341
++# This doesn't really need obj_mac.h, but since that rule reads & writes
342
++# obj_mac.num, we can't run in parallel with it.
343
++obj_xref.h: objxref.pl obj_xref.txt obj_mac.num obj_mac.h
344
+ 	$(PERL) objxref.pl obj_mac.num obj_xref.txt > obj_xref.h
345
+-	@sleep 1; touch obj_xref.h; sleep 1
346
+ 
347
+ files:
348
+ 	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
0 349
new file mode 100644
... ...
@@ -0,0 +1,79 @@
1
+http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=51bfed2e26fc13a66e8b5710aa2ce1d7a04af721
2
+
3
+UpstreamStatus: Pending
4
+
5
+Received from H J Liu @ Intel
6
+Make the assembly syntax compatible with x32 gcc. Othewise x32 gcc throws errors.
7
+Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com> 2011/07/13
8
+
9
+ported the patch to the 1.0.0e version
10
+Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com> 2011/12/01
11
+Index: openssl-1.0.0e/Configure
12
+===================================================================
13
+--- openssl-1.0.0e.orig/Configure
14
+@@ -393,6 +393,7 @@ my %table=(
15
+ "debug-linux-generic32","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DTERMIO -g -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
16
+ "debug-linux-generic64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DTERMIO -g -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
17
+ "debug-linux-x86_64","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -m64 -DL_ENDIAN -DTERMIO -g -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
18
++"linux-x32",	"gcc:-DL_ENDIAN 	-DTERMIO -O2 -pipe -g -feliminate-unused-debug-types -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-mx32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
19
+ "dist",		"cc:-O::(unknown)::::::",
20
+ 
21
+ # Basic configs that should work on any (32 and less bit) box
22
+Index: openssl-1.0.0e/crypto/bn/asm/x86_64-gcc.c
23
+===================================================================
24
+--- openssl-1.0.0e.orig/crypto/bn/asm/x86_64-gcc.c
25
+@@ -55,7 +55,7 @@
26
+  *    machine.
27
+  */
28
+ 
29
+-#ifdef _WIN64
30
++#if defined _WIN64 || !defined __LP64__
31
+ #define BN_ULONG unsigned long long
32
+ #else
33
+ #define BN_ULONG unsigned long
34
+@@ -192,9 +192,9 @@ BN_ULONG bn_add_words (BN_ULONG *rp, con
35
+ 	asm (
36
+ 	"	subq	%2,%2		\n"
37
+ 	".p2align 4			\n"
38
+-	"1:	movq	(%4,%2,8),%0	\n"
39
+-	"	adcq	(%5,%2,8),%0	\n"
40
+-	"	movq	%0,(%3,%2,8)	\n"
41
++	"1:	movq	(%q4,%2,8),%0	\n"
42
++	"	adcq	(%q5,%2,8),%0	\n"
43
++	"	movq	%0,(%q3,%2,8)	\n"
44
+ 	"	leaq	1(%2),%2	\n"
45
+ 	"	loop	1b		\n"
46
+ 	"	sbbq	%0,%0		\n"
47
+@@ -215,9 +215,9 @@ BN_ULONG bn_sub_words (BN_ULONG *rp, con
48
+ 	asm (
49
+ 	"	subq	%2,%2		\n"
50
+ 	".p2align 4			\n"
51
+-	"1:	movq	(%4,%2,8),%0	\n"
52
+-	"	sbbq	(%5,%2,8),%0	\n"
53
+-	"	movq	%0,(%3,%2,8)	\n"
54
++	"1:	movq	(%q4,%2,8),%0	\n"
55
++	"	sbbq	(%q5,%2,8),%0	\n"
56
++	"	movq	%0,(%q3,%2,8)	\n"
57
+ 	"	leaq	1(%2),%2	\n"
58
+ 	"	loop	1b		\n"
59
+ 	"	sbbq	%0,%0		\n"
60
+Index: openssl-1.0.0e/crypto/bn/bn.h
61
+===================================================================
62
+--- openssl-1.0.0e.orig/crypto/bn/bn.h
63
+@@ -172,6 +172,13 @@ extern "C" {
64
+ # endif
65
+ #endif
66
+ 
67
++/* Address type.  */
68
++#ifdef _WIN64
69
++#define BN_ADDR unsigned long long
70
++#else
71
++#define BN_ADDR unsigned long
72
++#endif
73
++
74
+ /* assuming long is 64bit - this is the DEC Alpha
75
+  * unsigned long long is only 64 bits :-(, don't define
76
+  * BN_LLONG for the DEC Alpha */
0 77
new file mode 100644
... ...
@@ -0,0 +1,18 @@
1
+https://bugs.gentoo.org/472584
2
+http://rt.openssl.org/Ticket/Display.html?id=2387&user=guest&pass=guest
3
+
4
+fix verification handling in s_client.  when loading paths, make sure
5
+we properly fallback to setting the default paths.
6
+
7
+--- a/apps/s_client.c
8
+@@ -899,7 +899,7 @@
9
+ 	if (!set_cert_key_stuff(ctx,cert,key))
10
+ 		goto end;
11
+ 
12
+-	if ((!SSL_CTX_load_verify_locations(ctx,CAfile,CApath)) ||
13
++	if ((!SSL_CTX_load_verify_locations(ctx,CAfile,CApath)) &&
14
+ 		(!SSL_CTX_set_default_verify_paths(ctx)))
15
+ 		{
16
+ 		/* BIO_printf(bio_err,"error setting default verify locations\n"); */
17
+
0 18
new file mode 100644
... ...
@@ -0,0 +1,84 @@
1
+https://bugs.gentoo.org/499086
2
+https://rt.openssl.org/Ticket/Display.html?id=3333&user=guest&pass=guest
3
+
4
+when gcc is given a .s file and told to preprocess it, it outputs nothing
5
+
6
+From a2976461784ce463fc7f336cd0dce607d21c2fad Mon Sep 17 00:00:00 2001
7
+From: Mike Frysinger <vapier@gentoo.org>
8
+Date: Sat, 25 Jan 2014 05:44:47 -0500
9
+Subject: [PATCH] Revert "Make Makefiles OSF-make-friendly."
10
+
11
+This reverts commit d1cf23ac86c05b22b8780e2c03b67230564d2d34.
12
+---
13
+ crypto/Makefile       | 4 +---
14
+ crypto/bn/Makefile    | 4 +---
15
+ crypto/evp/Makefile   | 2 +-
16
+ crypto/modes/Makefile | 5 +----
17
+ crypto/sha/Makefile   | 4 +---
18
+ util/shlib_wrap.sh    | 6 +-----
19
+ 6 files changed, 6 insertions(+), 19 deletions(-)
20
+
21
+diff --git a/crypto/Makefile b/crypto/Makefile
22
+index b253f50..1de9d5f 100644
23
+--- a/crypto/Makefile
24
+@@ -86,9 +86,7 @@ ia64cpuid.s:	ia64cpuid.S;	$(CC) $(CFLAGS) -E ia64cpuid.S > $@
25
+ ppccpuid.s:	ppccpuid.pl;	$(PERL) ppccpuid.pl $(PERLASM_SCHEME) $@
26
+ pariscid.s:	pariscid.pl;	$(PERL) pariscid.pl $(PERLASM_SCHEME) $@
27
+ alphacpuid.s:	alphacpuid.pl
28
+-	(preproc=/tmp/$$$$.$@; trap "rm $$preproc" INT; \
29
+-	$(PERL) alphacpuid.pl > $$preproc && \
30
+-	$(CC) -E $$preproc > $@ && rm $$preproc)
31
++	$(PERL) $< | $(CC) -E - | tee $@ > /dev/null
32
+ 
33
+ subdirs:
34
+ 	@target=all; $(RECURSIVE_MAKE)
35
+diff --git a/crypto/bn/Makefile b/crypto/bn/Makefile
36
+index b62b676..6c03363 100644
37
+--- a/crypto/bn/Makefile
38
+@@ -136,9 +136,7 @@ ppc-mont.s:	asm/ppc-mont.pl;$(PERL) asm/ppc-mont.pl $(PERLASM_SCHEME) $@
39
+ ppc64-mont.s:	asm/ppc64-mont.pl;$(PERL) asm/ppc64-mont.pl $(PERLASM_SCHEME) $@
40
+ 
41
+ alpha-mont.s:	asm/alpha-mont.pl
42
+-	(preproc=/tmp/$$$$.$@; trap "rm $$preproc" INT; \
43
+-	$(PERL) asm/alpha-mont.pl > $$preproc && \
44
+-	$(CC) -E $$preproc > $@ && rm $$preproc)
45
++	$(PERL) $< | $(CC) -E - | tee $@ > /dev/null
46
+ 
47
+ # GNU make "catch all"
48
+ %-mont.S:	asm/%-mont.pl;	$(PERL) $< $(PERLASM_SCHEME) $@
49
+diff --git a/crypto/modes/Makefile b/crypto/modes/Makefile
50
+index ce0dcd6..88ac65e 100644
51
+--- a/crypto/modes/Makefile
52
+@@ -55,10 +55,7 @@ aesni-gcm-x86_64.s:	asm/aesni-gcm-x86_64.pl
53
+ ghash-sparcv9.s:	asm/ghash-sparcv9.pl
54
+ 	$(PERL) asm/ghash-sparcv9.pl $@ $(CFLAGS)
55
+ ghash-alpha.s:	asm/ghash-alpha.pl
56
+-	(preproc=/tmp/$$$$.$@; trap "rm $$preproc" INT; \
57
+-	$(PERL) asm/ghash-alpha.pl > $$preproc && \
58
+-	$(CC) -E $$preproc > $@ && rm $$preproc)
59
+-
60
++	$(PERL) $< | $(CC) -E - | tee $@ > /dev/null
61
+ ghash-parisc.s:	asm/ghash-parisc.pl
62
+ 	$(PERL) asm/ghash-parisc.pl $(PERLASM_SCHEME) $@
63
+ 
64
+diff --git a/crypto/sha/Makefile b/crypto/sha/Makefile
65
+index 64eab6c..63fba69 100644
66
+--- a/crypto/sha/Makefile
67
+@@ -60,9 +60,7 @@ sha256-armv4.S: asm/sha256-armv4.pl
68
+ 	$(PERL) $< $(PERLASM_SCHEME) $@
69
+ 
70
+ sha1-alpha.s:	asm/sha1-alpha.pl
71
+-	(preproc=/tmp/$$$$.$@; trap "rm $$preproc" INT; \
72
+-	$(PERL) asm/sha1-alpha.pl > $$preproc && \
73
+-	$(CC) -E $$preproc > $@ && rm $$preproc)
74
++	$(PERL) $< | $(CC) -E - | tee $@ > /dev/null
75
+ 
76
+ # Solaris make has to be explicitly told
77
+ sha1-x86_64.s:	asm/sha1-x86_64.pl;	$(PERL) asm/sha1-x86_64.pl $(PERLASM_SCHEME) > $@
78
+-- 
79
+1.8.5.3
80
+
0 81
new file mode 100644
... ...
@@ -0,0 +1,642 @@
1
+http://rt.openssl.org/Ticket/Display.html?id=2051&user=guest&pass=guest
2
+
3
+Forward ported from openssl-1.0.1e-ipv6.patch
4
+
5
+Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
6
+
7
+--- openssl-1.0.1h/apps/s_apps.h
8
+@@ -148,7 +148,7 @@
9
+ #define PORT_STR        "4433"
10
+ #define PROTOCOL        "tcp"
11
+ 
12
+-int do_server(int port, int type, int *ret, int (*cb) (char *hostname, int s, unsigned char *context), unsigned char *context);
13
++int do_server(int port, int type, int *ret, int (*cb) (char *hostname, int s, unsigned char *context), unsigned char *context, int use_ipv4, int use_ipv6);
14
+ #ifdef HEADER_X509_H
15
+ int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx);
16
+ #endif
17
+@@ -156,7 +156,7 @@
18
+ int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file);
19
+ int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key);
20
+ #endif
21
+-int init_client(int *sock, char *server, int port, int type);
22
++int init_client(int *sock, char *server, int port, int type, int use_ipv4, int use_ipv6);
23
+ int should_retry(int i);
24
+ int extract_port(char *str, short *port_ptr);
25
+ int extract_host_port(char *str,char **host_ptr,unsigned char *ip,short *p);
26
+--- openssl-1.0.1h/apps/s_client.c
27
+@@ -285,6 +285,10 @@
28
+ 	{
29
+ 	BIO_printf(bio_err,"usage: s_client args\n");
30
+ 	BIO_printf(bio_err,"\n");
31
++	BIO_printf(bio_err," -4             - use IPv4 only\n");
32
++#if OPENSSL_USE_IPV6
33
++	BIO_printf(bio_err," -6             - use IPv6 only\n");
34
++#endif
35
+ 	BIO_printf(bio_err," -host host     - use -connect instead\n");
36
+ 	BIO_printf(bio_err," -port port     - use -connect instead\n");
37
+ 	BIO_printf(bio_err," -connect host:port - who to connect to (default is %s:%s)\n",SSL_HOST_NAME,PORT_STR);
38
+@@ -568,6 +572,7 @@
39
+ 	int sbuf_len,sbuf_off;
40
+ 	fd_set readfds,writefds;
41
+ 	short port=PORT;
42
++	int use_ipv4, use_ipv6;
43
+ 	int full_log=1;
44
+ 	char *host=SSL_HOST_NAME;
45
+ 	char *cert_file=NULL,*key_file=NULL;
46
+@@ -613,7 +618,11 @@
47
+ #endif
48
+ 	char *sess_in = NULL;
49
+ 	char *sess_out = NULL;
50
+-	struct sockaddr peer;
51
++#if OPENSSL_USE_IPV6
52
++	struct sockaddr_storage peer;
53
++#else
54
++	struct sockaddr_in peer;
55
++#endif
56
+ 	int peerlen = sizeof(peer);
57
+ 	int enable_timeouts = 0 ;
58
+ 	long socket_mtu = 0;
59
+@@ -628,6 +637,12 @@
60
+ 
61
+ 	meth=SSLv23_client_method();
62
+ 
63
++	use_ipv4 = 1;
64
++#if OPENSSL_USE_IPV6
65
++	use_ipv6 = 1;
66
++#else
67
++	use_ipv6 = 0;
68
++#endif
69
+ 	apps_startup();
70
+ 	c_Pause=0;
71
+ 	c_quiet=0;
72
+@@ -949,6 +964,18 @@
73
+ 			jpake_secret = *++argv;
74
+ 			}
75
+ #endif
76
++		else if (strcmp(*argv,"-4") == 0)
77
++			{
78
++			use_ipv4 = 1;
79
++			use_ipv6 = 0;
80
++			}
81
++#if OPENSSL_USE_IPV6
82
++		else if (strcmp(*argv,"-6") == 0)
83
++			{
84
++			use_ipv4 = 0;
85
++			use_ipv6 = 1;
86
++			}
87
++#endif
88
+ #ifndef OPENSSL_NO_SRTP
89
+ 		else if (strcmp(*argv,"-use_srtp") == 0)
90
+ 			{
91
+@@ -1260,7 +1287,7 @@
92
+ 
93
+ re_start:
94
+ 
95
+-	if (init_client(&s,host,port,socket_type) == 0)
96
++	if (init_client(&s,host,port,socket_type,use_ipv4,use_ipv6) == 0)
97
+ 		{
98
+ 		BIO_printf(bio_err,"connect:errno=%d\n",get_last_socket_error());
99
+ 		SHUTDOWN(s);
100
+@@ -1286,7 +1313,7 @@
101
+ 		{
102
+ 
103
+ 		sbio=BIO_new_dgram(s,BIO_NOCLOSE);
104
+-		if (getsockname(s, &peer, (void *)&peerlen) < 0)
105
++		if (getsockname(s, (struct sockaddr *)&peer, (void *)&peerlen) < 0)
106
+ 			{
107
+ 			BIO_printf(bio_err, "getsockname:errno=%d\n",
108
+ 				get_last_socket_error());
109
+--- openssl-1.0.1h/apps/s_server.c
110
+@@ -560,6 +560,10 @@
111
+         BIO_printf(bio_err," -use_srtp profiles - Offer SRTP key management with a colon-separated profile list\n");
112
+ # endif
113
+ #endif
114
++	BIO_printf(bio_err," -4            - use IPv4 only\n");
115
++#if OPENSSL_USE_IPV6
116
++	BIO_printf(bio_err," -6            - use IPv6 only\n");
117
++#endif
118
+ 	BIO_printf(bio_err," -keymatexport label   - Export keying material using label\n");
119
+ 	BIO_printf(bio_err," -keymatexportlen len  - Export len bytes of keying material (default 20)\n");
120
+ 	}
121
+@@ -947,6 +951,7 @@
122
+ 	int state=0;
123
+ 	const SSL_METHOD *meth=NULL;
124
+ 	int socket_type=SOCK_STREAM;
125
++	int use_ipv4, use_ipv6;
126
+ 	ENGINE *e=NULL;
127
+ 	char *inrand=NULL;
128
+ 	int s_cert_format = FORMAT_PEM, s_key_format = FORMAT_PEM;
129
+@@ -975,6 +980,12 @@
130
+ #endif
131
+ 	meth=SSLv23_server_method();
132
+ 
133
++	use_ipv4 = 1;
134
++#if OPENSSL_USE_IPV6
135
++	use_ipv6 = 1;
136
++#else
137
++	use_ipv6 = 0;
138
++#endif
139
+ 	local_argc=argc;
140
+ 	local_argv=argv;
141
+ 
142
+@@ -1323,6 +1334,18 @@
143
+ 			jpake_secret = *(++argv);
144
+ 			}
145
+ #endif
146
++		else if (strcmp(*argv,"-4") == 0)
147
++			{
148
++			use_ipv4 = 1;
149
++			use_ipv6 = 0;
150
++			}
151
++#if OPENSSL_USE_IPV6
152
++		else if (strcmp(*argv,"-6") == 0)
153
++			{
154
++			use_ipv4 = 0;
155
++			use_ipv6 = 1;
156
++			}
157
++#endif
158
+ #ifndef OPENSSL_NO_SRTP
159
+ 		else if (strcmp(*argv,"-use_srtp") == 0)
160
+ 			{
161
+@@ -1881,9 +1904,9 @@
162
+ 	BIO_printf(bio_s_out,"ACCEPT\n");
163
+ 	(void)BIO_flush(bio_s_out);
164
+ 	if (www)
165
+-		do_server(port,socket_type,&accept_socket,www_body, context);
166
++		do_server(port,socket_type,&accept_socket,www_body, context, use_ipv4, use_ipv6);
167
+ 	else
168
+-		do_server(port,socket_type,&accept_socket,sv_body, context);
169
++		do_server(port,socket_type,&accept_socket,sv_body, context, use_ipv4, use_ipv6);
170
+ 	print_stats(bio_s_out,ctx);
171
+ 	ret=0;
172
+ end:
173
+--- openssl-1.0.1h/apps/s_socket.c
174
+@@ -97,16 +97,16 @@
175
+ #include "netdb.h"
176
+ #endif
177
+ 
178
+-static struct hostent *GetHostByName(char *name);
179
++static struct hostent *GetHostByName(char *name, int domain);
180
+ #if defined(OPENSSL_SYS_WINDOWS) || (defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK))
181
+ static void ssl_sock_cleanup(void);
182
+ #endif
183
+ static int ssl_sock_init(void);
184
+-static int init_client_ip(int *sock,unsigned char ip[4], int port, int type);
185
+-static int init_server(int *sock, int port, int type);
186
+-static int init_server_long(int *sock, int port,char *ip, int type);
187
++static int init_client_ip(int *sock,unsigned char *ip, int port, int type, int domain);
188
++static int init_server(int *sock, int port, int type, int use_ipv4, int use_ipv6);
189
++static int init_server_long(int *sock, int port,char *ip, int type, int use_ipv4, int use_ipv6);
190
+ static int do_accept(int acc_sock, int *sock, char **host);
191
+-static int host_ip(char *str, unsigned char ip[4]);
192
++static int host_ip(char *str, unsigned char *ip, int domain);
193
+ 
194
+ #ifdef OPENSSL_SYS_WIN16
195
+ #define SOCKET_PROTOCOL	0 /* more microsoft stupidity */
196
+@@ -234,38 +234,68 @@
197
+ 	return(1);
198
+ 	}
199
+ 
200
+-int init_client(int *sock, char *host, int port, int type)
201
++int init_client(int *sock, char *host, int port, int type, int use_ipv4, int use_ipv6)
202
+ 	{
203
++#if OPENSSL_USE_IPV6
204
++	unsigned char ip[16];
205
++#else
206
+ 	unsigned char ip[4];
207
++#endif
208
+ 
209
+-	memset(ip, '\0', sizeof ip);
210
+-	if (!host_ip(host,&(ip[0])))
211
+-		return 0;
212
+-	return init_client_ip(sock,ip,port,type);
213
+-	}
214
+-
215
+-static int init_client_ip(int *sock, unsigned char ip[4], int port, int type)
216
+-	{
217
+-	unsigned long addr;
218
++	if (use_ipv4)
219
++		if (host_ip(host,ip,AF_INET))
220
++			return(init_client_ip(sock,ip,port,type,AF_INET));
221
++#if OPENSSL_USE_IPV6
222
++	if (use_ipv6)
223
++		if (host_ip(host,ip,AF_INET6))
224
++			return(init_client_ip(sock,ip,port,type,AF_INET6));
225
++#endif
226
++	return 0;
227
++	}
228
++
229
++static int init_client_ip(int *sock, unsigned char ip[4], int port, int type, int domain)
230
++	{
231
++#if OPENSSL_USE_IPV6
232
++	struct sockaddr_storage them;
233
++	struct sockaddr_in *them_in = (struct sockaddr_in *)&them;
234
++	struct sockaddr_in6 *them_in6 = (struct sockaddr_in6 *)&them;
235
++#else
236
+ 	struct sockaddr_in them;
237
++	struct sockaddr_in *them_in = &them;
238
++#endif
239
++	socklen_t addr_len;
240
+ 	int s,i;
241
+ 
242
+ 	if (!ssl_sock_init()) return(0);
243
+ 
244
+ 	memset((char *)&them,0,sizeof(them));
245
+-	them.sin_family=AF_INET;
246
+-	them.sin_port=htons((unsigned short)port);
247
+-	addr=(unsigned long)
248
+-		((unsigned long)ip[0]<<24L)|
249
+-		((unsigned long)ip[1]<<16L)|
250
+-		((unsigned long)ip[2]<< 8L)|
251
+-		((unsigned long)ip[3]);
252
+-	them.sin_addr.s_addr=htonl(addr);
253
++	if (domain == AF_INET)
254
++		{
255
++		addr_len = (socklen_t)sizeof(struct sockaddr_in);
256
++		them_in->sin_family=AF_INET;
257
++		them_in->sin_port=htons((unsigned short)port);
258
++#ifndef BIT_FIELD_LIMITS
259
++		memcpy(&them_in->sin_addr.s_addr, ip, 4);
260
++#else
261
++		memcpy(&them_in->sin_addr, ip, 4);
262
++#endif
263
++		}
264
++	else
265
++#if OPENSSL_USE_IPV6
266
++		{
267
++		addr_len = (socklen_t)sizeof(struct sockaddr_in6);
268
++		them_in6->sin6_family=AF_INET6;
269
++		them_in6->sin6_port=htons((unsigned short)port);
270
++		memcpy(&(them_in6->sin6_addr), ip, sizeof(struct in6_addr));
271
++		}
272
++#else
273
++		return(0);
274
++#endif
275
+ 
276
+ 	if (type == SOCK_STREAM)
277
+-		s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL);
278
++		s=socket(domain,SOCK_STREAM,SOCKET_PROTOCOL);
279
+ 	else /* ( type == SOCK_DGRAM) */
280
+-		s=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
281
++		s=socket(domain,SOCK_DGRAM,IPPROTO_UDP);
282
+ 			
283
+ 	if (s == INVALID_SOCKET) { perror("socket"); return(0); }
284
+ 
285
+@@ -277,29 +307,27 @@
286
+ 		if (i < 0) { closesocket(s); perror("keepalive"); return(0); }
287
+ 		}
288
+ #endif
289
+-
290
+-	if (connect(s,(struct sockaddr *)&them,sizeof(them)) == -1)
291
++	if (connect(s,(struct sockaddr *)&them,addr_len) == -1)
292
+ 		{ closesocket(s); perror("connect"); return(0); }
293
+ 	*sock=s;
294
+ 	return(1);
295
+ 	}
296
+ 
297
+-int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, unsigned char *context), unsigned char *context)
298
++int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, unsigned char *context), unsigned char *context, int use_ipv4, int use_ipv6)
299
+ 	{
300
+ 	int sock;
301
+ 	char *name = NULL;
302
+ 	int accept_socket = 0;
303
+ 	int i;
304
+ 
305
+-	if (!init_server(&accept_socket,port,type)) return(0);
306
+-
307
++	if (!init_server(&accept_socket,port,type, use_ipv4, use_ipv6)) return(0);
308
+ 	if (ret != NULL)
309
+ 		{
310
+ 		*ret=accept_socket;
311
+ 		/* return(1);*/
312
+ 		}
313
+-  	for (;;)
314
+-  		{
315
++	for (;;)
316
++		{
317
+ 		if (type==SOCK_STREAM)
318
+ 			{
319
+ 			if (do_accept(accept_socket,&sock,&name) == 0)
320
+@@ -322,41 +350,88 @@
321
+ 		}
322
+ 	}
323
+ 
324
+-static int init_server_long(int *sock, int port, char *ip, int type)
325
++static int init_server_long(int *sock, int port, char *ip, int type, int use_ipv4, int use_ipv6)
326
+ 	{
327
+ 	int ret=0;
328
++	int domain;
329
++#if OPENSSL_USE_IPV6
330
++	struct sockaddr_storage server;
331
++	struct sockaddr_in *server_in = (struct sockaddr_in *)&server;
332
++	struct sockaddr_in6 *server_in6 = (struct sockaddr_in6 *)&server;
333
++#else
334
+ 	struct sockaddr_in server;
335
++	struct sockaddr_in *server_in = &server;
336
++#endif
337
++	socklen_t addr_len;
338
+ 	int s= -1;
339
+ 
340
++	if (!use_ipv4 && !use_ipv6)
341
++		goto err;
342
++#if OPENSSL_USE_IPV6
343
++	/* we are fine here */
344
++#else
345
++	if (use_ipv6)
346
++		goto err;
347
++#endif
348
+ 	if (!ssl_sock_init()) return(0);
349
+ 
350
+-	memset((char *)&server,0,sizeof(server));
351
+-	server.sin_family=AF_INET;
352
+-	server.sin_port=htons((unsigned short)port);
353
+-	if (ip == NULL)
354
+-		server.sin_addr.s_addr=INADDR_ANY;
355
+-	else
356
+-/* Added for T3E, address-of fails on bit field (beckman@acl.lanl.gov) */
357
+-#ifndef BIT_FIELD_LIMITS
358
+-		memcpy(&server.sin_addr.s_addr,ip,4);
359
++#if OPENSSL_USE_IPV6
360
++	domain = use_ipv6 ? AF_INET6 : AF_INET;
361
+ #else
362
+-		memcpy(&server.sin_addr,ip,4);
363
++	domain = AF_INET;
364
+ #endif
365
+-	
366
+-		if (type == SOCK_STREAM)
367
+-			s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL);
368
+-		else /* type == SOCK_DGRAM */
369
+-			s=socket(AF_INET, SOCK_DGRAM,IPPROTO_UDP);
370
++	if (type == SOCK_STREAM)
371
++		s=socket(domain,SOCK_STREAM,SOCKET_PROTOCOL);
372
++	else /* type == SOCK_DGRAM */
373
++		s=socket(domain, SOCK_DGRAM,IPPROTO_UDP);
374
+ 
375
+ 	if (s == INVALID_SOCKET) goto err;
376
+ #if defined SOL_SOCKET && defined SO_REUSEADDR
377
++	{
378
++	int j = 1;
379
++	setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
380
++		   (void *) &j, sizeof j);
381
++	}
382
++#endif
383
++#if OPENSSL_USE_IPV6
384
++	if ((use_ipv4 == 0) && (use_ipv6 == 1))
385
++		{
386
++		const int on = 1;
387
++
388
++		setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY,
389
++		           (const void *) &on, sizeof(int));
390
++		}
391
++#endif
392
++	if (domain == AF_INET)
393
++		{
394
++		addr_len = (socklen_t)sizeof(struct sockaddr_in);
395
++		memset(server_in, 0, sizeof(struct sockaddr_in));
396
++		server_in->sin_family=AF_INET;
397
++		server_in->sin_port = htons((unsigned short)port);
398
++		if (ip == NULL)
399
++			server_in->sin_addr.s_addr = htonl(INADDR_ANY);
400
++		else
401
++/* Added for T3E, address-of fails on bit field (beckman@acl.lanl.gov) */
402
++#ifndef BIT_FIELD_LIMITS
403
++			memcpy(&server_in->sin_addr.s_addr, ip, 4);
404
++#else
405
++			memcpy(&server_in->sin_addr, ip, 4);
406
++#endif
407
++		}
408
++#if OPENSSL_USE_IPV6
409
++	else
410
+ 		{
411
+-		int j = 1;
412
+-		setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
413
+-			   (void *) &j, sizeof j);
414
++		addr_len = (socklen_t)sizeof(struct sockaddr_in6);
415
++		memset(server_in6, 0, sizeof(struct sockaddr_in6));
416
++		server_in6->sin6_family = AF_INET6;
417
++		server_in6->sin6_port = htons((unsigned short)port);
418
++		if (ip == NULL)
419
++			server_in6->sin6_addr = in6addr_any;
420
++		else
421
++			memcpy(&server_in6->sin6_addr, ip, sizeof(struct in6_addr));
422
+ 		}
423
+ #endif
424
+-	if (bind(s,(struct sockaddr *)&server,sizeof(server)) == -1)
425
++	if (bind(s, (struct sockaddr *)&server, addr_len) == -1)
426
+ 		{
427
+ #ifndef OPENSSL_SYS_WINDOWS
428
+ 		perror("bind");
429
+@@ -375,16 +450,23 @@
430
+ 	return(ret);
431
+ 	}
432
+ 
433
+-static int init_server(int *sock, int port, int type)
434
++static int init_server(int *sock, int port, int type, int use_ipv4, int use_ipv6)
435
+ 	{
436
+-	return(init_server_long(sock, port, NULL, type));
437
++	return(init_server_long(sock, port, NULL, type, use_ipv4, use_ipv6));
438
+ 	}
439
+ 
440
+ static int do_accept(int acc_sock, int *sock, char **host)
441
+ 	{
442
+ 	int ret;
443
+ 	struct hostent *h1,*h2;
444
+-	static struct sockaddr_in from;
445
++#if OPENSSL_USE_IPV6
446
++	struct sockaddr_storage from;
447
++	struct sockaddr_in *from_in = (struct sockaddr_in *)&from;
448
++	struct sockaddr_in6 *from_in6 = (struct sockaddr_in6 *)&from;
449
++#else
450
++	struct sockaddr_in from;
451
++	struct sockaddr_in *from_in = &from;
452
++#endif
453
+ 	int len;
454
+ /*	struct linger ling; */
455
+ 
456
+@@ -431,13 +513,23 @@
457
+ */
458
+ 
459
+ 	if (host == NULL) goto end;
460
++#if OPENSSL_USE_IPV6
461
++	if (from.ss_family == AF_INET)
462
++#else
463
++	if (from.sin_family == AF_INET)
464
++#endif
465
+ #ifndef BIT_FIELD_LIMITS
466
+-	/* I should use WSAAsyncGetHostByName() under windows */
467
+-	h1=gethostbyaddr((char *)&from.sin_addr.s_addr,
468
+-		sizeof(from.sin_addr.s_addr),AF_INET);
469
++		/* I should use WSAAsyncGetHostByName() under windows */
470
++		h1=gethostbyaddr((char *)&from_in->sin_addr.s_addr,
471
++		                 sizeof(from_in->sin_addr.s_addr), AF_INET);
472
+ #else
473
+-	h1=gethostbyaddr((char *)&from.sin_addr,
474
+-		sizeof(struct in_addr),AF_INET);
475
++		h1=gethostbyaddr((char *)&from_in->sin_addr,
476
++		                 sizeof(struct in_addr), AF_INET);
477
++#endif
478
++#if OPENSSL_USE_IPV6
479
++	else
480
++		h1=gethostbyaddr((char *)&from_in6->sin6_addr,
481
++		                 sizeof(struct in6_addr), AF_INET6);
482
+ #endif
483
+ 	if (h1 == NULL)
484
+ 		{
485
+@@ -455,16 +547,25 @@
486
+ 			}
487
+ 		BUF_strlcpy(*host,h1->h_name,strlen(h1->h_name)+1);
488
+ 
489
+-		h2=GetHostByName(*host);
490
++#if OPENSSL_USE_IPV6		
491
++		h2=GetHostByName(*host, from.ss_family);
492
++#else
493
++		h2=GetHostByName(*host, from.sin_family);
494
++#endif
495
++
496
+ 		if (h2 == NULL)
497
+ 			{
498
+ 			BIO_printf(bio_err,"gethostbyname failure\n");
499
+ 			closesocket(ret);
500
+ 			return(0);
501
+ 			}
502
+-		if (h2->h_addrtype != AF_INET)
503
++#if OPENSSL_USE_IPV6
504
++		if (h2->h_addrtype != from.ss_family)
505
++#else
506
++		if (h2->h_addrtype != from.sin_family)
507
++#endif
508
+ 			{
509
+-			BIO_printf(bio_err,"gethostbyname addr is not AF_INET\n");
510
++			BIO_printf(bio_err,"gethostbyname addr address is not correct\n");
511
+ 			closesocket(ret);
512
+ 			return(0);
513
+ 			}
514
+@@ -480,7 +581,7 @@
515
+ 	char *h,*p;
516
+ 
517
+ 	h=str;
518
+-	p=strchr(str,':');
519
++	p=strrchr(str,':');
520
+ 	if (p == NULL)
521
+ 		{
522
+ 		BIO_printf(bio_err,"no port defined\n");
523
+@@ -488,7 +589,7 @@
524
+ 		}
525
+ 	*(p++)='\0';
526
+ 
527
+-	if ((ip != NULL) && !host_ip(str,ip))
528
++	if ((ip != NULL) && !host_ip(str,ip,AF_INET))
529
+ 		goto err;
530
+ 	if (host_ptr != NULL) *host_ptr=h;
531
+ 
532
+@@ -499,48 +600,58 @@
533
+ 	return(0);
534
+ 	}
535
+ 
536
+-static int host_ip(char *str, unsigned char ip[4])
537
++static int host_ip(char *str, unsigned char *ip, int domain)
538
+ 	{
539
+-	unsigned int in[4]; 
540
++	unsigned int in[4];
541
++	unsigned long l;
542
+ 	int i;
543
+ 
544
+-	if (sscanf(str,"%u.%u.%u.%u",&(in[0]),&(in[1]),&(in[2]),&(in[3])) == 4)
545
++	if ((domain == AF_INET) &&
546
++	    (sscanf(str,"%u.%u.%u.%u",&(in[0]),&(in[1]),&(in[2]),&(in[3])) == 4))
547
+ 		{
548
++		
549
+ 		for (i=0; i<4; i++)
550
+ 			if (in[i] > 255)