]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/win32/patches/openssl-w64.patch
Restore win32 dir from Branch-5.2 and update it
[bacula/bacula] / bacula / src / win32 / patches / openssl-w64.patch
1 diff -Naur ../openssl-0.9.8j/Configure ./Configure
2 --- ../openssl-0.9.8j/Configure 2008-12-29 01:18:23.000000000 +0100
3 +++ ./Configure 2009-01-08 10:24:35.000000000 +0100
4 @@ -477,6 +477,8 @@
5  # MinGW
6  "mingw", "gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall -D_WIN32_WINNT=0x333:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin -shared:.dll.a",
7  
8 +"mingw64", "mingw32-gcc:-mno-cygwin -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -fomit-frame-pointer -O3 -Wall -D_WIN32_WINNT=0x333:::MINGW64:-lws2_32 -lgdi32:SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${no_asm}:win32:cygwin-shared:-D_WINDLL:-mno-cygwin:.dll.a",
9 +
10  # UWIN 
11  "UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
12  
13 @@ -1055,7 +1057,7 @@
14  
15  $no_shared = 0 if ($fipsdso && !$IsMK1MF);
16  
17 -$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target eq "mingw");
18 +$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target =~ /^mingw/);
19  $exe_ext=".nlm" if ($target =~ /netware/);
20  $exe_ext=".pm"  if ($target =~ /vos/);
21  if ($openssldir eq "" and $prefix eq "")
22 @@ -1501,6 +1503,7 @@
23         s/^SHLIB_TARGET=.*/SHLIB_TARGET=$shared_target/;
24         s/^SHLIB_MARK=.*/SHLIB_MARK=$shared_mark/;
25         s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_FIPS) \$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared);
26 +        s/^DIRS=   crypto ssl engines apps test tools/DIRS=   crypto ssl apps test tools/ if ($disabled{'hw'});
27         if ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*$/)
28                 {
29                 my $sotmp = $1;
30 diff -Naur ../openssl-0.9.8j/Configure.orig ./Configure.orig
31 --- ../openssl-0.9.8j/Configure.orig    1970-01-01 01:00:00.000000000 +0100
32 +++ ./Configure.orig    2008-12-29 01:18:23.000000000 +0100
33 @@ -0,0 +1,2030 @@
34 +:
35 +eval 'exec perl -S $0 ${1+"$@"}'
36 +    if $running_under_some_shell;
37 +##
38 +##  Configure -- OpenSSL source tree configuration script
39 +##
40 +
41 +require 5.000;
42 +eval 'use strict;';
43 +
44 +print STDERR "Warning: perl module strict not found.\n" if ($@);
45 +
46 +# see INSTALL for instructions.
47 +
48 +my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimental-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [enable-montasm] [no-asm] [no-dso] [no-krb5] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]\n";
49 +
50 +# Options:
51 +#
52 +# --openssldir  install OpenSSL in OPENSSLDIR (Default: DIR/ssl if the
53 +#               --prefix option is given; /usr/local/ssl otherwise)
54 +# --prefix      prefix for the OpenSSL include, lib and bin directories
55 +#               (Default: the OPENSSLDIR directory)
56 +#
57 +# --install_prefix  Additional prefix for package builders (empty by
58 +#               default).  This needn't be set in advance, you can
59 +#               just as well use "make INSTALL_PREFIX=/whatever install".
60 +#
61 +# --with-krb5-dir  Declare where Kerberos 5 lives.  The libraries are expected
62 +#              to live in the subdirectory lib/ and the header files in
63 +#              include/.  A value is required.
64 +# --with-krb5-lib  Declare where the Kerberos 5 libraries live.  A value is
65 +#              required.
66 +#              (Default: KRB5_DIR/lib)
67 +# --with-krb5-include  Declare where the Kerberos 5 header files live.  A
68 +#              value is required.
69 +#              (Default: KRB5_DIR/include)
70 +# --with-krb5-flavor  Declare what flavor of Kerberos 5 is used.  Currently
71 +#              supported values are "MIT" and "Heimdal".  A value is required.
72 +#
73 +# --test-sanity Make a number of sanity checks on the data in this file.
74 +#               This is a debugging tool for OpenSSL developers.
75 +#
76 +# no-hw-xxx     do not compile support for specific crypto hardware.
77 +#               Generic OpenSSL-style methods relating to this support
78 +#               are always compiled but return NULL if the hardware
79 +#               support isn't compiled.
80 +# no-hw         do not compile support for any crypto hardware.
81 +# [no-]threads  [don't] try to create a library that is suitable for
82 +#               multithreaded applications (default is "threads" if we
83 +#               know how to do it)
84 +# [no-]shared  [don't] try to create shared libraries when supported.
85 +# no-asm        do not use assembler
86 +# no-dso        do not compile in any native shared-library methods. This
87 +#               will ensure that all methods just return NULL.
88 +# no-krb5       do not compile in any KRB5 library or code.
89 +# [no-]zlib     [don't] compile support for zlib compression.
90 +# zlib-dynamic Like "zlib", but the zlib library is expected to be a shared
91 +#              library and will be loaded in run-time by the OpenSSL library.
92 +# enable-montasm 0.9.8 branch only: enable Montgomery x86 assembler backport
93 +#               from 0.9.9
94 +# 386           generate 80386 code
95 +# no-sse2      disables IA-32 SSE2 code, above option implies no-sse2
96 +# no-<cipher>   build without specified algorithm (rsa, idea, rc5, ...)
97 +# -<xxx> +<xxx> compiler options are passed through 
98 +#
99 +# DEBUG_SAFESTACK use type-safe stacks to enforce type-safety on stack items
100 +#              provided to stack calls. Generates unique stack functions for
101 +#              each possible stack type.
102 +# DES_PTR      use pointer lookup vs arrays in the DES in crypto/des/des_locl.h
103 +# DES_RISC1    use different DES_ENCRYPT macro that helps reduce register
104 +#              dependancies but needs to more registers, good for RISC CPU's
105 +# DES_RISC2    A different RISC variant.
106 +# DES_UNROLL   unroll the inner DES loop, sometimes helps, somtimes hinders.
107 +# DES_INT      use 'int' instead of 'long' for DES_LONG in crypto/des/des.h
108 +#              This is used on the DEC Alpha where long is 8 bytes
109 +#              and int is 4
110 +# BN_LLONG     use the type 'long long' in crypto/bn/bn.h
111 +# MD2_CHAR     use 'char' instead of 'int' for MD2_INT in crypto/md2/md2.h
112 +# MD2_LONG     use 'long' instead of 'int' for MD2_INT in crypto/md2/md2.h
113 +# IDEA_SHORT   use 'short' instead of 'int' for IDEA_INT in crypto/idea/idea.h
114 +# IDEA_LONG    use 'long' instead of 'int' for IDEA_INT in crypto/idea/idea.h
115 +# RC2_SHORT    use 'short' instead of 'int' for RC2_INT in crypto/rc2/rc2.h
116 +# RC2_LONG     use 'long' instead of 'int' for RC2_INT in crypto/rc2/rc2.h
117 +# RC4_CHAR     use 'char' instead of 'int' for RC4_INT in crypto/rc4/rc4.h
118 +# RC4_LONG     use 'long' instead of 'int' for RC4_INT in crypto/rc4/rc4.h
119 +# RC4_INDEX    define RC4_INDEX in crypto/rc4/rc4_locl.h.  This turns on
120 +#              array lookups instead of pointer use.
121 +# RC4_CHUNK    enables code that handles data aligned at long (natural CPU
122 +#              word) boundary.
123 +# RC4_CHUNK_LL enables code that handles data aligned at long long boundary
124 +#              (intended for 64-bit CPUs running 32-bit OS).
125 +# BF_PTR       use 'pointer arithmatic' for Blowfish (unsafe on Alpha).
126 +# BF_PTR2      intel specific version (generic version is more efficient).
127 +#
128 +# Following are set automatically by this script
129 +#
130 +# MD5_ASM      use some extra md5 assember,
131 +# SHA1_ASM     use some extra sha1 assember, must define L_ENDIAN for x86
132 +# RMD160_ASM   use some extra ripemd160 assember,
133 +# SHA256_ASM   sha256_block is implemented in assembler
134 +# SHA512_ASM   sha512_block is implemented in assembler
135 +# AES_ASM      ASE_[en|de]crypt is implemented in assembler
136 +
137 +my $x86_gcc_des="DES_PTR DES_RISC1 DES_UNROLL";
138 +
139 +# MD2_CHAR slags pentium pros
140 +my $x86_gcc_opts="RC4_INDEX MD2_INT";
141 +
142 +# MODIFY THESE PARAMETERS IF YOU ARE GOING TO USE THE 'util/speed.sh SCRIPT
143 +# Don't worry about these normally
144 +
145 +my $tcc="cc";
146 +my $tflags="-fast -Xa";
147 +my $tbn_mul="";
148 +my $tlib="-lnsl -lsocket";
149 +#$bits1="SIXTEEN_BIT ";
150 +#$bits2="THIRTY_TWO_BIT ";
151 +my $bits1="THIRTY_TWO_BIT ";
152 +my $bits2="SIXTY_FOUR_BIT ";
153 +
154 +my $x86_elf_asm="x86cpuid-elf.o:bn86-elf.o co86-elf.o MAYBE-MO86-elf.o:dx86-elf.o yx86-elf.o:ax86-elf.o:bx86-elf.o:mx86-elf.o:sx86-elf.o s512sse2-elf.o:cx86-elf.o:rx86-elf.o rc4_skey.o:rm86-elf.o:r586-elf.o";
155 +my $x86_coff_asm="x86cpuid-cof.o:bn86-cof.o co86-cof.o MAYBE-MO86-cof.o:dx86-cof.o yx86-cof.o:ax86-cof.o:bx86-cof.o:mx86-cof.o:sx86-cof.o s512sse2-cof.o:cx86-cof.o:rx86-cof.o rc4_skey.o:rm86-cof.o:r586-cof.o";
156 +my $x86_out_asm="x86cpuid-out.o:bn86-out.o co86-out.o MAYBE-MO86-out.o:dx86-out.o yx86-out.o:ax86-out.o:bx86-out.o:mx86-out.o:sx86-out.o s512sse2-out.o:cx86-out.o:rx86-out.o rc4_skey.o:rm86-out.o:r586-out.o";
157 +
158 +my $x86_64_asm="x86_64cpuid.o:x86_64-gcc.o x86_64-mont.o::aes-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o::rc4-x86_64.o::";
159 +my $ia64_asm=":bn-ia64.o::aes_core.o aes_cbc.o aes-ia64.o:::sha1-ia64.o sha256-ia64.o sha512-ia64.o::rc4-ia64.o rc4_skey.o::";
160 +
161 +my $no_asm="::::::::::";
162 +
163 +# As for $BSDthreads. Idea is to maintain "collective" set of flags,
164 +# which would cover all BSD flavors. -pthread applies to them all, 
165 +# but is treated differently. OpenBSD expands is as -D_POSIX_THREAD
166 +# -lc_r, which is sufficient. FreeBSD 4.x expands it as -lc_r,
167 +# which has to be accompanied by explicit -D_THREAD_SAFE and
168 +# sometimes -D_REENTRANT. FreeBSD 5.x expands it as -lc_r, which
169 +# seems to be sufficient?
170 +my $BSDthreads="-pthread -D_THREAD_SAFE -D_REENTRANT";
171 +
172 +#config-string $cc : $cflags : $unistd : $thread_cflag : $sys_id : $lflags : $bn_ops : $cpuid_obj : $bn_obj : $des_obj : $aes_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $dso_scheme : $shared_target : $shared_cflag : $shared_ldflag : $shared_extension : $ranlib : $arflags
173 +
174 +my %table=(
175 +# File 'TABLE' (created by 'make TABLE') contains the data from this list,
176 +# formatted for better readability.
177 +
178 +
179 +#"b",          "${tcc}:${tflags}::${tlib}:${bits1}:${tbn_mul}::",
180 +#"bl-4c-2c",   "${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR MD2_CHAR:${tbn_mul}::",
181 +#"bl-4c-ri",   "${tcc}:${tflags}::${tlib}:${bits1}BN_LLONG RC4_CHAR RC4_INDEX:${tbn_mul}::",
182 +#"b2-is-ri-dp",        "${tcc}:${tflags}::${tlib}:${bits2}IDEA_SHORT RC4_INDEX DES_PTR:${tbn_mul}::",
183 +
184 +# Our development configs
185 +"purify",      "purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::",
186 +"debug",       "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror::(unknown)::-lefence::::",
187 +"debug-ben",   "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown):::::bn86-elf.o co86-elf.o",
188 +"debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
189 +"debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
190 +"debug-ben-debug",     "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::::",
191 +"debug-ben-strict",    "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith -Wcast-qual -Wwrite-strings -pipe::(unknown)::::::",
192 +"debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
193 +"debug-bodo",  "gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -march=i486 -pedantic -Wshadow -Wall -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
194 +"debug-ulf", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DBN_DEBUG_RAND -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations:::CYGWIN32:::${no_asm}:win32:cygwin-shared:::.dll",
195 +"debug-steve64", "gcc:-m64 -DL_ENDIAN -DTERMIO -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -DOPENSSL_NO_DEPRECATED -g -pedantic -Wall -Werror -Wno-long-long -Wsign-compare -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
196 +"debug-steve32", "gcc:-m32 -DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -DOPENSSL_NO_DEPRECATED -g -pedantic -Wno-long-long -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
197 +"debug-steve", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -m32 -g -pedantic -Wno-long-long -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared",
198 +"debug-steve-opt",     "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -m32 -O3 -g -pedantic -Wno-long-long -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared",
199 +"debug-steve-linux-pseudo64",  "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DOPENSSL_NO_ASM -g -mcpu=i486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:SIXTY_FOUR_BIT:${no_asm}:dlfcn:linux-shared",
200 +"debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
201 +"debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
202 +"debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
203 +"debug-levitte-linux-noasm-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
204 +"debug-geoff","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
205 +"debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
206 +"debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
207 +"debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall::-D_REENTRANT::-lefence -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
208 +"debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
209 +"dist",                "cc:-O::(unknown)::::::",
210 +
211 +# Basic configs that should work on any (32 and less bit) box
212 +"gcc",         "gcc:-O3::(unknown):::BN_LLONG:::",
213 +"cc",          "cc:-O::(unknown)::::::",
214 +
215 +####VOS Configurations
216 +"vos-gcc","gcc:-O3 -Wall -D_POSIX_C_SOURCE=200112L -D_BSD -DB_ENDIAN::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:",
217 +"debug-vos-gcc","gcc:-O0 -g -Wall -D_POSIX_C_SOURCE=200112L -D_BSD -DB_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:",
218 +
219 +#### Solaris x86 with GNU C setups
220 +# -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it
221 +# here because whenever GNU C instantiates an assembler template it
222 +# surrounds it with #APP #NO_APP comment pair which (at least Solaris
223 +# 7_x86) /usr/ccs/bin/as fails to assemble with "Illegal mnemonic"
224 +# error message.
225 +"solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -march=pentium -Wall -DL_ENDIAN -DOPENSSL_NO_INLINE_ASM::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
226 +# -shared -static-libgcc might appear controversial, but modules taken
227 +# from static libgcc do not have relocations and linking them into our
228 +# shared objects doesn't have any negative side-effects. On the contrary,
229 +# doing so makes it possible to use gcc shared build with Sun C. Given
230 +# that gcc generates faster code [thanks to inline assembler], I would
231 +# actually recommend to consider using gcc shared build even with vendor
232 +# compiler:-)
233 +#                                              <appro@fy.chalmers.se>
234 +"solaris64-x86_64-gcc","gcc:-m64 -O3 -Wall -DL_ENDIAN -DMD32_REG_T=int::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:solaris-shared:-fPIC:-m64 -shared -static-libgcc:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
235
236 +#### Solaris x86 with Sun C setups
237 +"solaris-x86-cc","cc:-fast -O -Xa::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
238 +"solaris64-x86_64-cc","cc:-fast -xarch=amd64 -xstrconst -Xa -DL_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:solaris-shared:-KPIC:-xarch=amd64 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
239 +
240 +#### SPARC Solaris with GNU C setups
241 +"solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
242 +"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
243 +# -m32 should be safe to add as long as driver recognizes -mcpu=ultrasparc
244 +"solaris-sparcv9-gcc","gcc:-m32 -mcpu=ultrasparc -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
245 +"solaris64-sparcv9-gcc","gcc:-m64 -mcpu=ultrasparc -O3 -Wall -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:::des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-fPIC:-m64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
246 +####
247 +"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8.o::::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
248 +"debug-solaris-sparcv9-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG_ALL -DPEDANTIC -O -g -mcpu=ultrasparc -pedantic -ansi -Wall -Wshadow -Wno-long-long -D__EXTENSIONS__ -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
249 +
250 +#### SPARC Solaris with Sun C setups
251 +# SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2.
252 +# SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8
253 +# SC5.0 note: Compiler common patch 107357-01 or later is required!
254 +"solaris-sparcv7-cc","cc:-xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
255 +"solaris-sparcv8-cc","cc:-xarch=v8 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
256 +"solaris-sparcv9-cc","cc:-xtarget=ultra -xarch=v8plus -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
257 +"solaris64-sparcv9-cc","cc:-xtarget=ultra -xarch=v9 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:::des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-KPIC:-xarch=v9 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):/usr/ccs/bin/ar rs",
258 +####
259 +"debug-solaris-sparcv8-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG_ALL -xarch=v8 -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::sparcv8.o::::::::::dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
260 +"debug-solaris-sparcv9-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG_ALL -xtarget=ultra -xarch=v8plus -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR::sparcv8plus.o::::::::::dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", 
261 +
262 +#### SunOS configs, assuming sparc for the gcc one.
263 +#"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown):SUNOS::DES_UNROLL:${no_asm}::",
264 +"sunos-gcc","gcc:-O3 -mv8 -Dssize_t=int::(unknown):SUNOS::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1:${no_asm}::",
265 +
266 +#### IRIX 5.x configs
267 +# -mips2 flag is added by ./config when appropriate.
268 +"irix-gcc","gcc:-O3 -DTERMIOS -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK DES_UNROLL DES_RISC2 DES_PTR BF_PTR:${no_asm}:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
269 +"irix-cc", "cc:-O2 -use_readonly_const -DTERMIOS -DB_ENDIAN::(unknown):::BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC2 DES_UNROLL BF_PTR:${no_asm}:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
270 +#### IRIX 6.x configs
271 +# Only N32 and N64 ABIs are supported. If you need O32 ABI build, invoke
272 +# './Configure irix-cc -o32' manually.
273 +"irix-mips3-gcc","gcc:-mabi=n32 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT::bn-mips3.o::::::::::dlfcn:irix-shared::-mabi=n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
274 +"irix-mips3-cc", "cc:-n32 -mips3 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT::bn-mips3.o::::::::::dlfcn:irix-shared::-n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
275 +# N64 ABI builds.
276 +"irix64-mips4-gcc","gcc:-mabi=64 -mips4 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG::bn-mips3.o::::::::::dlfcn:irix-shared::-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
277 +"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG::bn-mips3.o::::::::::dlfcn:irix-shared::-64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
278 +
279 +#### Unified HP-UX ANSI C configs.
280 +# Special notes:
281 +# - Originally we were optimizing at +O4 level. It should be noted
282 +#   that the only difference between +O3 and +O4 is global inter-
283 +#   procedural analysis. As it has to be performed during the link
284 +#   stage the compiler leaves behind certain pseudo-code in lib*.a
285 +#   which might be release or even patch level specific. Generating
286 +#   the machine code for and analyzing the *whole* program appears
287 +#   to be *extremely* memory demanding while the performance gain is
288 +#   actually questionable. The situation is intensified by the default
289 +#   HP-UX data set size limit (infamous 'maxdsiz' tunable) of 64MB
290 +#   which is way too low for +O4. In other words, doesn't +O3 make
291 +#   more sense?
292 +# - Keep in mind that the HP compiler by default generates code
293 +#   suitable for execution on the host you're currently compiling at.
294 +#   If the toolkit is ment to be used on various PA-RISC processors
295 +#   consider './config +DAportable'.
296 +# - +DD64 is chosen in favour of +DA2.0W because it's meant to be
297 +#   compatible with *future* releases.
298 +# - If you run ./Configure hpux-parisc-[g]cc manually don't forget to
299 +#   pass -D_REENTRANT on HP-UX 10 and later.
300 +# - -DMD32_XARRAY triggers workaround for compiler bug we ran into in
301 +#   32-bit message digests. (For the moment of this writing) HP C
302 +#   doesn't seem to "digest" too many local variables (they make "him"
303 +#   chew forever:-). For more details look-up MD32_XARRAY comment in
304 +#   crypto/sha/sha_lcl.h.
305 +#                                      <appro@fy.chalmers.se>
306 +#
307 +# Since there is mention of this in shlib/hpux10-cc.sh
308 +"hpux-parisc-cc-o4","cc:-Ae +O4 +ESlit -z -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::-D_REENTRANT::-ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
309 +"hpux-parisc-gcc","gcc:-O3 -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
310 +"hpux-parisc2-gcc","gcc:-march=2.0 -O3 -DB_ENDIAN -D_REENTRANT::::-Wl,+s -ldld:SIXTY_FOUR_BIT RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL DES_RISC1::pa-risc2.o::::::::::dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
311 +"hpux64-parisc2-gcc","gcc:-O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2W.o::::::::::dlfcn:hpux-shared:-fpic:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
312 +
313 +# More attempts at unified 10.X and 11.X targets for HP C compiler.
314 +#
315 +# Chris Ruemmler <ruemmler@cup.hp.com>
316 +# Kevin Steves <ks@hp.se>
317 +"hpux-parisc-cc","cc:+O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
318 +"hpux-parisc1_0-cc","cc:+DAportable +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
319 +"hpux-parisc2-cc","cc:+DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT::::-Wl,+s -ldld:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2.o::::::::::dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
320 +"hpux64-parisc2-cc","cc:+DD64 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2W.o::::::::::dlfcn:hpux-shared:+Z:+DD64 -b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
321 +
322 +# HP/UX IA-64 targets
323 +"hpux-ia64-cc","cc:-Ae +DD32 +O2 +Olit=all -z -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:+Z:+DD32 -b:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
324 +# Frank Geurts <frank.geurts@nl.abnamro.com> has patiently assisted with
325 +# with debugging of the following config.
326 +"hpux64-ia64-cc","cc:-Ae +DD64 +O3 +Olit=all -z -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:+Z:+DD64 -b:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
327 +# GCC builds...
328 +"hpux-ia64-gcc","gcc:-O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:-fpic:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
329 +"hpux64-ia64-gcc","gcc:-mlp64 -O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:-fpic:-mlp64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", 
330 +
331 +# Legacy HPUX 9.X configs...
332 +"hpux-cc",     "cc:-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY -Ae +ESlit +O2 -z::(unknown)::-Wl,+s -ldld:DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
333 +"hpux-gcc",    "gcc:-DB_ENDIAN -DBN_DIV2W -O3::(unknown)::-Wl,+s -ldld:DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
334 +
335 +#### HP MPE/iX http://jazz.external.hp.com/src/openssl/
336 +"MPE/iX-gcc",  "gcc:-D_ENDIAN -DBN_DIV2W -O3 -D_POSIX_SOURCE -D_SOCKET_SOURCE -I/SYSLOG/PUB::(unknown):MPE:-L/SYSLOG/PUB -lsyslog -lsocket -lcurses:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
337 +
338 +# DEC Alpha OSF/1/Tru64 targets.
339 +#
340 +#      "What's in a name? That which we call a rose
341 +#       By any other word would smell as sweet."
342 +#
343 +# - William Shakespeare, "Romeo & Juliet", Act II, scene II.
344 +#
345 +# For gcc, the following gave a %50 speedup on a 164 over the 'DES_INT' version
346 +#
347 +"osf1-alpha-gcc", "gcc:-O3::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_RISC1:${no_asm}:dlfcn:alpha-osf1-shared:::.so",
348 +"osf1-alpha-cc",  "cc:-std1 -tune host -O4 -readonly_strings::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${no_asm}:dlfcn:alpha-osf1-shared:::.so",
349 +"tru64-alpha-cc", "cc:-std1 -tune host -fast -readonly_strings::-pthread:::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${no_asm}:dlfcn:alpha-osf1-shared::-msym:.so",
350 +
351 +####
352 +#### Variety of LINUX:-)
353 +####
354 +# *-generic* is endian-neutral target, but ./config is free to
355 +# throw in -D[BL]_ENDIAN, whichever appropriate...
356 +"linux-generic32","gcc:-DTERMIO -O3 -fomit-frame-pointer -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)",
357 +"linux-ppc",   "gcc:-DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL::linux_ppc32.o::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
358 +#### IA-32 targets...
359 +"linux-ia32-icc",      "icc:-DL_ENDIAN -DTERMIO -O2 -no_cpprt::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
360 +"linux-elf",   "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
361 +"linux-aout",  "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -march=i486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}",
362 +####
363 +"linux-generic64","gcc:-DTERMIO -O3 -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)",
364 +"linux-ppc64", "gcc:-m64 -DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL::linux_ppc64.o::::::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
365 +"linux-ia64",  "gcc:-DL_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
366 +"linux-ia64-ecc","ecc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
367 +"linux-ia64-icc","icc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
368 +"linux-x86_64",        "gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
369 +#### SPARC Linux setups
370 +# Ray Miller <ray.miller@computing-services.oxford.ac.uk> has patiently
371 +# assisted with debugging of following two configs.
372 +"linux-sparcv8","gcc:-mv8 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
373 +# it's a real mess with -mcpu=ultrasparc option under Linux, but
374 +# -Wa,-Av8plus should do the trick no matter what.
375 +"linux-sparcv9","gcc:-m32 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
376 +# GCC 3.1 is a requirement
377 +"linux64-sparcv9","gcc:-m64 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:ULTRASPARC:-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::::::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
378 +#### Alpha Linux with GNU C and Compaq C setups
379 +# Special notes:
380 +# - linux-alpha+bwx-gcc is ment to be used from ./config only. If you
381 +#   ought to run './Configure linux-alpha+bwx-gcc' manually, do
382 +#   complement the command line with -mcpu=ev56, -mcpu=ev6 or whatever
383 +#   which is appropriate.
384 +# - If you use ccc keep in mind that -fast implies -arch host and the
385 +#   compiler is free to issue instructions which gonna make elder CPU
386 +#   choke. If you wish to build "blended" toolkit, add -arch generic
387 +#   *after* -fast and invoke './Configure linux-alpha-ccc' manually.
388 +#
389 +#                                      <appro@fy.chalmers.se>
390 +#
391 +"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
392 +"linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
393 +"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${no_asm}",
394 +"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${no_asm}",
395 +
396 +#### *BSD [do see comment about ${BSDthreads} above!]
397 +"BSD-generic32","gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
398 +"BSD-x86",     "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
399 +"BSD-x86-elf", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
400 +"debug-BSD-x86-elf",   "gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall -g::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
401 +"BSD-sparcv8", "gcc:-DB_ENDIAN -DTERMIOS -O3 -mv8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL::sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
402 +
403 +"BSD-generic64","gcc:-DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
404 +# -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
405 +# simply *happens* to work around a compiler bug in gcc 3.3.3,
406 +# triggered by RIPEMD160 code.
407 +"BSD-sparc64", "gcc:-DB_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:::des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
408 +"BSD-ia64",    "gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
409 +"BSD-x86_64",  "gcc:-DL_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
410 +
411 +"bsdi-elf-gcc",     "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
412 +
413 +"nextstep",    "cc:-O -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
414 +"nextstep3.3", "cc:-O3 -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
415 +
416 +# NCR MP-RAS UNIX ver 02.03.01
417 +"ncr-scde","cc:-O6 -Xa -Hoff=BEHAVED -686 -Hwide -Hiw::(unknown)::-lsocket -lnsl -lc89:${x86_gcc_des} ${x86_gcc_opts}:::",
418 +
419 +# QNX
420 +"qnx4",        "cc:-DL_ENDIAN -DTERMIO::(unknown):::${x86_gcc_des} ${x86_gcc_opts}:",
421 +"qnx6",        "cc:-DL_ENDIAN -DTERMIOS::(unknown)::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:",
422 +
423 +#### SCO/Caldera targets.
424 +#
425 +# Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc.
426 +# Now we only have blended unixware-* as it's the only one used by ./config.
427 +# If you want to optimize for particular microarchitecture, bypass ./config
428 +# and './Configure unixware-7 -Kpentium_pro' or whatever appropriate.
429 +# Note that not all targets include assembler support. Mostly because of
430 +# lack of motivation to support out-of-date platforms with out-of-date
431 +# compiler drivers and assemblers. Tim Rice <tim@multitalents.net> has
432 +# patiently assisted to debug most of it.
433 +#
434 +# UnixWare 2.0x fails destest with -O.
435 +"unixware-2.0","cc:-DFILIO_H -DNO_STRINGS_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
436 +"unixware-2.1","cc:-O -DFILIO_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
437 +"unixware-7","cc:-O -DFILIO_H -Kalloca::-Kthread::-lsocket -lnsl:BN_LLONG MD2_CHAR RC4_INDEX ${x86_gcc_des}:${x86_elf_asm}:dlfcn:svr5-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
438 +"unixware-7-gcc","gcc:-DL_ENDIAN -DFILIO_H -O3 -fomit-frame-pointer -march=pentium -Wall::-D_REENTRANT::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:gnu-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
439 +# SCO 5 - Ben Laurie <ben@algroup.co.uk> says the -O breaks the SCO cc.
440 +"sco5-cc",  "cc:-belf::(unknown)::-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:svr3-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
441 +"sco5-gcc",  "gcc:-O3 -fomit-frame-pointer::(unknown)::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:svr3-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
442 +
443 +#### IBM's AIX.
444 +"aix3-cc",  "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::",
445 +"aix-gcc",  "gcc:-O -DB_ENDIAN::-pthread:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared::-shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
446 +"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-pthread:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-maix64 -shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64",
447 +# Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE
448 +# at build time. $OBJECT_MODE is respected at ./config stage!
449 +"aix-cc",   "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared::-q32 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
450 +"aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64",
451 +
452 +#
453 +# Cray T90 and similar (SDSC)
454 +# It's Big-endian, but the algorithms work properly when B_ENDIAN is NOT
455 +# defined.  The T90 ints and longs are 8 bytes long, and apparently the
456 +# B_ENDIAN code assumes 4 byte ints.  Fortunately, the non-B_ENDIAN and
457 +# non L_ENDIAN code aligns the bytes in each word correctly.
458 +#
459 +# The BIT_FIELD_LIMITS define is to avoid two fatal compiler errors:
460 +#'Taking the address of a bit field is not allowed. '
461 +#'An expression with bit field exists as the operand of "sizeof" '
462 +# (written by Wayne Schroeder <schroede@SDSC.EDU>)
463 +#
464 +# j90 is considered the base machine type for unicos machines,
465 +# so this configuration is now called "cray-j90" ...
466 +"cray-j90", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG DES_INT:::",
467 +
468 +#
469 +# Cray T3E (Research Center Juelich, beckman@acl.lanl.gov)
470 +#
471 +# The BIT_FIELD_LIMITS define was written for the C90 (it seems).  I added
472 +# another use.  Basically, the problem is that the T3E uses some bit fields
473 +# for some st_addr stuff, and then sizeof and address-of fails
474 +# I could not use the ams/alpha.o option because the Cray assembler, 'cam'
475 +# did not like it.
476 +"cray-t3e", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT:::",
477 +
478 +# DGUX, 88100.
479 +"dgux-R3-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown):::RC4_INDEX DES_UNROLL:::",
480 +"dgux-R4-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown)::-lnsl -lsocket:RC4_INDEX DES_UNROLL:::",
481 +"dgux-R4-x86-gcc",     "gcc:-O3 -fomit-frame-pointer -DL_ENDIAN::(unknown)::-lnsl -lsocket:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
482 +
483 +# Sinix/ReliantUNIX RM400
484 +# NOTE: The CDS++ Compiler up to V2.0Bsomething has the IRIX_CC_BUG optimizer problem. Better use -g  */
485 +"ReliantUNIX","cc:-KPIC -g -DTERMIOS -DB_ENDIAN::-Kthread:SNI:-lsocket -lnsl -lc -L/usr/ucblib -lucb:BN_LLONG DES_PTR DES_RISC2 DES_UNROLL BF_PTR:${no_asm}:dlfcn:reliantunix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
486 +"SINIX","cc:-O::(unknown):SNI:-lsocket -lnsl -lc -L/usr/ucblib -lucb:RC4_INDEX RC4_CHAR:::",
487 +"SINIX-N","/usr/ucb/cc:-O2 -misaligned::(unknown)::-lucb:RC4_INDEX RC4_CHAR:::",
488 +
489 +# SIEMENS BS2000/OSD: an EBCDIC-based mainframe
490 +"BS2000-OSD","c89:-O -XLLML -XLLMK -XL -DB_ENDIAN -DTERMIOS -DCHARSET_EBCDIC::(unknown)::-lsocket -lnsl:THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
491 +
492 +# OS/390 Unix an EBCDIC-based Unix system on IBM mainframe
493 +# You need to compile using the c89.sh wrapper in the tools directory, because the
494 +# IBM compiler does not like the -L switch after any object modules.
495 +#
496 +"OS390-Unix","c89.sh:-O -DB_ENDIAN -DCHARSET_EBCDIC -DNO_SYS_PARAM_H  -D_ALL_SOURCE::(unknown):::THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
497 +
498 +# Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64
499 +"VC-WIN64I","cl::::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${no_asm}:win32",
500 +"VC-WIN64A","cl::::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${no_asm}:win32",
501 +
502 +# Visual C targets
503 +"VC-NT","cl::::WINNT::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
504 +"VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
505 +"VC-WIN32","cl::::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
506 +
507 +# Borland C++ 4.5
508 +"BC-32","bcc32::::WIN32::BN_LLONG DES_PTR RC4_INDEX EXPORT_VAR_AS_FN:${no_asm}:win32",
509 +
510 +# MinGW
511 +"mingw", "gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall -D_WIN32_WINNT=0x333:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin -shared:.dll.a",
512 +
513 +# UWIN 
514 +"UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
515 +
516 +# Cygwin
517 +"Cygwin-pre1.3", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown):CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
518 +"Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_coff_asm}:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
519 +"debug-Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror:::CYGWIN32:::${no_asm}:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
520 +
521 +# NetWare from David Ward (dsward@novell.com)
522 +# requires either MetroWerks NLM development tools, or gcc / nlmconv
523 +# NetWare defaults socket bio to WinSock sockets. However,
524 +# the builds can be configured to use BSD sockets instead.
525 +# netware-clib => legacy CLib c-runtime support
526 +"netware-clib", "mwccnlm::::::${x86_gcc_opts}::",
527 +"netware-clib-bsdsock", "mwccnlm::::::${x86_gcc_opts}::",
528 +"netware-clib-gcc", "i586-netware-gcc:-nostdinc -I/ndk/nwsdk/include/nlm -I/ndk/ws295sdk/include -DL_ENDIAN -DNETWARE_CLIB -DOPENSSL_SYSNAME_NETWARE -O2 -Wall:::::${x86_gcc_opts}::",
529 +"netware-clib-bsdsock-gcc", "i586-netware-gcc:-nostdinc -I/ndk/nwsdk/include/nlm -DNETWARE_BSDSOCK -DNETDB_USE_INTERNET -DL_ENDIAN -DNETWARE_CLIB -DOPENSSL_SYSNAME_NETWARE -O2 -Wall:::::${x86_gcc_opts}::",
530 +# netware-libc => LibC/NKS support
531 +"netware-libc", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
532 +"netware-libc-bsdsock", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
533 +"netware-libc-gcc", "i586-netware-gcc:-nostdinc -I/ndk/libc/include -I/ndk/libc/include/winsock -DL_ENDIAN -DNETWARE_LIBC -DOPENSSL_SYSNAME_NETWARE -DTERMIO -O2 -Wall:::::BN_LLONG ${x86_gcc_opts}::",
534 +"netware-libc-bsdsock-gcc", "i586-netware-gcc:-nostdinc -I/ndk/libc/include -DNETWARE_BSDSOCK -DL_ENDIAN -DNETWARE_LIBC -DOPENSSL_SYSNAME_NETWARE -DTERMIO -O2 -Wall:::::BN_LLONG ${x86_gcc_opts}::",
535 +
536 +# DJGPP
537 +"DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:",
538 +
539 +# Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at>
540 +"ultrix-cc","cc:-std1 -O -Olimit 2500 -DL_ENDIAN::(unknown):::::::",
541 +"ultrix-gcc","gcc:-O3 -DL_ENDIAN::(unknown):::BN_LLONG::::",
542 +# K&R C is no longer supported; you need gcc on old Ultrix installations
543 +##"ultrix","cc:-O2 -DNOPROTO -DNOCONST -DL_ENDIAN::(unknown):::::::",
544 +
545 +##### MacOS X (a.k.a. Rhapsody or Darwin) setup
546 +"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::",
547 +"darwin-ppc-cc","cc:-arch ppc -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::osx_ppc32.o::::::::::dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
548 +"darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::osx_ppc64.o::::::::::dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
549 +"darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
550 +"debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
551 +"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -fomit-frame-pointer -DL_ENDIAN -DMD32_REG_T=int -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
552 +"debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::osx_ppc32.o::::::::::dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
553 +
554 +##### A/UX
555 +"aux3-gcc","gcc:-O2 -DTERMIO::(unknown):AUX:-lbsd:RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::",
556 +
557 +##### Sony NEWS-OS 4.x
558 +"newsos4-gcc","gcc:-O -DB_ENDIAN::(unknown):NEWS4:-lmld -liberty:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::",
559 +
560 +##### GNU Hurd
561 +"hurd-x86",  "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC",
562 +
563 +##### OS/2 EMX
564 +"OS2-EMX", "gcc::::::::",
565 +
566 +##### VxWorks for various targets
567 +"vxworks-ppc405","ccppc:-g -msoft-float -mlongcall -DCPU=PPC405 -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
568 +"vxworks-ppc750","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h \$(DEBUG_FLAG):::VXWORKS:-r:::::",
569 +"vxworks-ppc750-debug","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DDEBUG -g:::VXWORKS:-r:::::",
570 +"vxworks-ppc860","ccppc:-nostdinc -msoft-float -DCPU=PPC860 -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
571 +"vxworks-mipsle","ccmips:-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -DL_ENDIAN -EL -Wl,-EL -mips2 -mno-branch-likely -G 0 -fno-builtin -msoft-float -DCPU=MIPS32 -DMIPSEL -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r::${no_asm}::::::ranlibmips:",
572 +
573 +##### Compaq Non-Stop Kernel (Tandem)
574 +"tandem-c89","c89:-Ww -D__TANDEM -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D_TANDEM_SOURCE -DB_ENDIAN::(unknown):::THIRTY_TWO_BIT:::",
575 +
576 +);
577 +
578 +my @MK1MF_Builds=qw(VC-WIN64I VC-WIN64A
579 +                   VC-NT VC-CE VC-WIN32
580 +                   BC-32 OS2-EMX
581 +                   netware-clib netware-clib-bsdsock
582 +                   netware-libc netware-libc-bsdsock);
583 +
584 +my $idx = 0;
585 +my $idx_cc = $idx++;
586 +my $idx_cflags = $idx++;
587 +my $idx_unistd = $idx++;
588 +my $idx_thread_cflag = $idx++;
589 +my $idx_sys_id = $idx++;
590 +my $idx_lflags = $idx++;
591 +my $idx_bn_ops = $idx++;
592 +my $idx_cpuid_obj = $idx++;
593 +my $idx_bn_obj = $idx++;
594 +my $idx_des_obj = $idx++;
595 +my $idx_aes_obj = $idx++;
596 +my $idx_bf_obj = $idx++;
597 +my $idx_md5_obj = $idx++;
598 +my $idx_sha1_obj = $idx++;
599 +my $idx_cast_obj = $idx++;
600 +my $idx_rc4_obj = $idx++;
601 +my $idx_rmd160_obj = $idx++;
602 +my $idx_rc5_obj = $idx++;
603 +my $idx_dso_scheme = $idx++;
604 +my $idx_shared_target = $idx++;
605 +my $idx_shared_cflag = $idx++;
606 +my $idx_shared_ldflag = $idx++;
607 +my $idx_shared_extension = $idx++;
608 +my $idx_ranlib = $idx++;
609 +my $idx_arflags = $idx++;
610 +
611 +my $prefix="";
612 +my $openssldir="";
613 +my $exe_ext="";
614 +my $install_prefix="";
615 +my $fipslibdir="/usr/local/ssl/fips-1.0/lib/";
616 +my $nofipscanistercheck=0;
617 +my $fipsdso=0;
618 +my $fipscanisterinternal="n";
619 +my $baseaddr="0xFB00000";
620 +my $no_threads=0;
621 +my $threads=0;
622 +my $no_shared=0; # but "no-shared" is default
623 +my $zlib=1;      # but "no-zlib" is default
624 +my $no_krb5=0;   # but "no-krb5" is implied unless "--with-krb5-..." is used
625 +my $no_rfc3779=1; # but "no-rfc3779" is default
626 +my $montasm=1;   # but "no-montasm" is default
627 +my $no_asm=0;
628 +my $no_dso=0;
629 +my $no_gmp=0;
630 +my @skip=();
631 +my $Makefile="Makefile";
632 +my $des_locl="crypto/des/des_locl.h";
633 +my $des        ="crypto/des/des.h";
634 +my $bn ="crypto/bn/bn.h";
635 +my $md2        ="crypto/md2/md2.h";
636 +my $rc4        ="crypto/rc4/rc4.h";
637 +my $rc4_locl="crypto/rc4/rc4_locl.h";
638 +my $idea       ="crypto/idea/idea.h";
639 +my $rc2        ="crypto/rc2/rc2.h";
640 +my $bf ="crypto/bf/bf_locl.h";
641 +my $bn_asm     ="bn_asm.o";
642 +my $des_enc="des_enc.o fcrypt_b.o";
643 +my $fips_des_enc="fips_des_enc.o";
644 +my $aes_enc="aes_core.o aes_cbc.o";
645 +my $bf_enc     ="bf_enc.o";
646 +my $cast_enc="c_enc.o";
647 +my $rc4_enc="rc4_enc.o rc4_skey.o";
648 +my $rc5_enc="rc5_enc.o";
649 +my $md5_obj="";
650 +my $sha1_obj="";
651 +my $rmd160_obj="";
652 +my $processor="";
653 +my $default_ranlib;
654 +my $perl;
655 +my $fips=0;
656 +
657 +
658 +# All of the following is disabled by default (RC5 was enabled before 0.9.8):
659 +
660 +my %disabled = ( # "what"         => "comment" [or special keyword "experimental"]
661 +                 "camellia"       => "default",
662 +                 "capieng"        => "default",
663 +                 "cms"            => "default",
664 +                 "gmp"            => "default",
665 +                 "jpake"          => "experimental",
666 +                 "mdc2"           => "default",
667 +                 "montasm"        => "default", # explicit option in 0.9.8 only (implicitly enabled in 0.9.9)
668 +                 "rc5"            => "default",
669 +                 "rfc3779"        => "default",
670 +                 "seed"           => "default",
671 +                 "shared"         => "default",
672 +                 "zlib"           => "default",
673 +                 "zlib-dynamic"   => "default"
674 +               );
675 +my @experimental = ();
676 +
677 +# This is what $depflags will look like with the above defaults
678 +# (we need this to see if we should advise the user to run "make depend"):
679 +my $default_depflags = " -DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_CAPIENG -DOPENSSL_NO_CMS -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SEED";
680 +
681 +
682 +# Explicit "no-..." options will be collected in %disabled along with the defaults.
683 +# To remove something from %disabled, use "enable-foo" (unless it's experimental).
684 +# For symmetry, "disable-foo" is a synonym for "no-foo".
685 +
686 +# For features called "experimental" here, a more explicit "experimental-foo" is needed to enable.
687 +# We will collect such requests in @experimental.
688 +# To avoid accidental use of experimental features, applications will have to use -DOPENSSL_EXPERIMENTAL_FOO.
689 +
690 +
691 +my $no_sse2=0;
692 +
693 +&usage if ($#ARGV < 0);
694 +
695 +my $flags;
696 +my $depflags;
697 +my $openssl_experimental_defines;
698 +my $openssl_algorithm_defines;
699 +my $openssl_thread_defines;
700 +my $openssl_sys_defines="";
701 +my $openssl_other_defines;
702 +my $libs;
703 +my $libkrb5="";
704 +my $target;
705 +my $options;
706 +my $symlink;
707 +my $make_depend=0;
708 +my %withargs=();
709 +
710 +my @argvcopy=@ARGV;
711 +my $argvstring="";
712 +my $argv_unprocessed=1;
713 +
714 +while($argv_unprocessed)
715 +       {
716 +       $flags="";
717 +       $depflags="";
718 +       $openssl_experimental_defines="";
719 +       $openssl_algorithm_defines="";
720 +       $openssl_thread_defines="";
721 +       $openssl_sys_defines="";
722 +       $openssl_other_defines="";
723 +       $libs="";
724 +       $target="";
725 +       $options="";
726 +       $symlink=1;
727 +
728 +       $argv_unprocessed=0;
729 +       $argvstring=join(' ',@argvcopy);
730 +
731 +PROCESS_ARGS:
732 +       foreach (@argvcopy)
733 +               {
734 +               s /^-no-/no-/; # some people just can't read the instructions
735 +
736 +               # rewrite some options in "enable-..." form
737 +               s /^-?-?shared$/enable-shared/;
738 +               s /^threads$/enable-threads/;
739 +               s /^zlib$/enable-zlib/;
740 +               s /^zlib-dynamic$/enable-zlib-dynamic/;
741 +
742 +               if (/^no-(.+)$/ || /^disable-(.+)$/)
743 +                       {
744 +                       if (!($disabled{$1} eq "experimental"))
745 +                               {
746 +                               if ($1 eq "ssl")
747 +                                       {
748 +                                       $disabled{"ssl2"} = "option(ssl)";
749 +                                       $disabled{"ssl3"} = "option(ssl)";
750 +                                       }
751 +                               elsif ($1 eq "tls")
752 +                                       {
753 +                                       $disabled{"tls1"} = "option(tls)"
754 +                                       }
755 +                               else
756 +                                       {
757 +                                       $disabled{$1} = "option";
758 +                                       }
759 +                               }
760 +                       }                       
761 +               elsif (/^enable-(.+)$/ || /^experimental-(.+)$/)
762 +                       {
763 +                       my $algo = $1;
764 +                       if ($disabled{$algo} eq "experimental")
765 +                               {
766 +                               die "You are requesting an experimental feature; please say 'experimental-$algo' if you are sure\n"
767 +                                       unless (/^experimental-/);
768 +                               push @experimental, $algo;
769 +                               }
770 +                       delete $disabled{$algo};
771 +
772 +                       $threads = 1 if ($algo eq "threads");
773 +                       }
774 +               elsif (/^--test-sanity$/)
775 +                       {
776 +                       exit(&test_sanity());
777 +                       }
778 +               elsif (/^reconfigure/ || /^reconf/)
779 +                       {
780 +                       if (open(IN,"<$Makefile"))
781 +                               {
782 +                               while (<IN>)
783 +                                       {
784 +                                       chomp;
785 +                                       if (/^CONFIGURE_ARGS=(.*)/)
786 +                                               {
787 +                                               $argvstring=$1;
788 +                                               @argvcopy=split(' ',$argvstring);
789 +                                               die "Incorrect data to reconfigure, please do a normal configuration\n"
790 +                                                       if (grep(/^reconf/,@argvcopy));
791 +                                               print "Reconfiguring with: $argvstring\n";
792 +                                               $argv_unprocessed=1;
793 +                                               close(IN);
794 +                                               last PROCESS_ARGS;
795 +                                               }
796 +                                       }
797 +                               close(IN);
798 +                               }
799 +                       die "Insufficient data to reconfigure, please do a normal configuration\n";
800 +                       }
801 +               elsif (/^386$/)
802 +                       { $processor=386; }
803 +               elsif (/^fips$/)
804 +                       {
805 +                       $fips=1;
806 +                       }
807 +               elsif (/^rsaref$/)
808 +                       {
809 +                       # No RSAref support any more since it's not needed.
810 +                       # The check for the option is there so scripts aren't
811 +                       # broken
812 +                       }
813 +               elsif (/^nofipscanistercheck$/)
814 +                       {
815 +                       $fips = 1;
816 +                       $nofipscanistercheck = 1;
817 +                       }
818 +               elsif (/^fipscanisterbuild$/)
819 +                       {
820 +                       $fips = 1;
821 +                       $nofipscanistercheck = 1;
822 +                       $fipslibdir="";
823 +                       $fipscanisterinternal="y";
824 +                       }
825 +               elsif (/^fipsdso$/)
826 +                       {
827 +                       $fips = 1;
828 +                       $nofipscanistercheck = 1;
829 +                       $fipslibdir="";
830 +                       $fipscanisterinternal="y";
831 +                       $fipsdso = 1;
832 +                       }
833 +               elsif (/^[-+]/)
834 +                       {
835 +                       if (/^-[lL](.*)$/)
836 +                               {
837 +                               $libs.=$_." ";
838 +                               }
839 +                       elsif (/^-[^-]/ or /^\+/)
840 +                               {
841 +                               $flags.=$_." ";
842 +                               }
843 +                       elsif (/^--prefix=(.*)$/)
844 +                               {
845 +                               $prefix=$1;
846 +                               }
847 +                       elsif (/^--openssldir=(.*)$/)
848 +                               {
849 +                               $openssldir=$1;
850 +                               }
851 +                       elsif (/^--install.prefix=(.*)$/)
852 +                               {
853 +                               $install_prefix=$1;
854 +                               }
855 +                       elsif (/^--with-krb5-(dir|lib|include|flavor)=(.*)$/)
856 +                               {
857 +                               $withargs{"krb5-".$1}=$2;
858 +                               }
859 +                       elsif (/^--with-zlib-lib=(.*)$/)
860 +                               {
861 +                               $withargs{"zlib-lib"}=$1;
862 +                               }
863 +                       elsif (/^--with-zlib-include=(.*)$/)
864 +                               {
865 +                               $withargs{"zlib-include"}="-I$1";
866 +                               }
867 +                       elsif (/^--with-fipslibdir=(.*)$/)
868 +                               {
869 +                               $fipslibdir="$1/";
870 +                               }
871 +                       elsif (/^--with-baseaddr=(.*)$/)
872 +                               {
873 +                               $baseaddr="$1";
874 +                               }
875 +                       else
876 +                               {
877 +                               print STDERR $usage;
878 +                               exit(1);
879 +                               }
880 +                       }
881 +               elsif ($_ =~ /^([^:]+):(.+)$/)
882 +                       {
883 +                       eval "\$table{\$1} = \"$2\""; # allow $xxx constructs in the string
884 +                       $target=$1;
885 +                       }
886 +               else
887 +                       {
888 +                       die "target already defined - $target (offending arg: $_)\n" if ($target ne "");
889 +                       $target=$_;
890 +                       }
891 +
892 +               unless ($_ eq $target || /^no-/ || /^disable-/)
893 +                       {
894 +                       # "no-..." follows later after implied disactivations
895 +                       # have been derived.  (Don't take this too seroiusly,
896 +                       # we really only write OPTIONS to the Makefile out of
897 +                       # nostalgia.)
898 +
899 +                       if ($options eq "")
900 +                               { $options = $_; }
901 +                       else
902 +                               { $options .= " ".$_; }
903 +                       }
904 +               }
905 +       }
906 +
907 +
908 +
909 +if ($processor eq "386")
910 +       {
911 +       $disabled{"sse2"} = "forced";
912 +       }
913 +
914 +if (!defined($withargs{"krb5-flavor"}) || $withargs{"krb5-flavor"} eq "")
915 +       {
916 +       $disabled{"krb5"} = "krb5-flavor not specified";
917 +       }
918 +
919 +if (!defined($disabled{"zlib-dynamic"}))
920 +       {
921 +       # "zlib-dynamic" was specifically enabled, so enable "zlib"
922 +       delete $disabled{"zlib"};
923 +       }
924 +
925 +if (defined($disabled{"rijndael"}))
926 +       {
927 +       $disabled{"aes"} = "forced";
928 +       }
929 +if (defined($disabled{"des"}))
930 +       {
931 +       $disabled{"mdc2"} = "forced";
932 +       }
933 +if (defined($disabled{"ec"}))
934 +       {
935 +       $disabled{"ecdsa"} = "forced";
936 +       $disabled{"ecdh"} = "forced";
937 +       }
938 +
939 +# SSL 2.0 requires MD5 and RSA
940 +if (defined($disabled{"md5"}) || defined($disabled{"rsa"}))
941 +       {
942 +       $disabled{"ssl2"} = "forced";
943 +       }
944 +
945 +# SSL 3.0 and TLS requires MD5 and SHA and either RSA or DSA+DH
946 +if (defined($disabled{"md5"}) || defined($disabled{"sha"})
947 +    || (defined($disabled{"rsa"})
948 +        && (defined($disabled{"dsa"}) || defined($disabled{"dh"}))))
949 +       {
950 +       $disabled{"ssl3"} = "forced";
951 +       $disabled{"tls1"} = "forced";
952 +       }
953 +
954 +if (defined($disabled{"tls1"}))
955 +       {
956 +       $disabled{"tlsext"} = "forced";
957 +       }
958 +
959 +if ($target eq "TABLE") {
960 +       foreach $target (sort keys %table) {
961 +               print_table_entry($target);
962 +       }
963 +       exit 0;
964 +}
965 +
966 +if ($target eq "LIST") {
967 +       foreach (sort keys %table) {
968 +               print;
969 +               print "\n";
970 +       }
971 +       exit 0;
972 +}
973 +
974 +if ($target =~ m/^CygWin32(-.*)$/) {
975 +       $target = "Cygwin".$1;
976 +}
977 +
978 +print "Configuring for $target\n";
979 +
980 +&usage if (!defined($table{$target}));
981 +
982 +my @fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
983 +my $cc = $fields[$idx_cc];
984 +my $cflags = $fields[$idx_cflags];
985 +my $unistd = $fields[$idx_unistd];
986 +my $thread_cflag = $fields[$idx_thread_cflag];
987 +my $sys_id = $fields[$idx_sys_id];
988 +my $lflags = $fields[$idx_lflags];
989 +my $bn_ops = $fields[$idx_bn_ops];
990 +my $cpuid_obj = $fields[$idx_cpuid_obj];
991 +my $bn_obj = $fields[$idx_bn_obj];
992 +my $des_obj = $fields[$idx_des_obj];
993 +my $aes_obj = $fields[$idx_aes_obj];
994 +my $bf_obj = $fields[$idx_bf_obj];
995 +my $md5_obj = $fields[$idx_md5_obj];
996 +my $sha1_obj = $fields[$idx_sha1_obj];
997 +my $cast_obj = $fields[$idx_cast_obj];
998 +my $rc4_obj = $fields[$idx_rc4_obj];
999 +my $rmd160_obj = $fields[$idx_rmd160_obj];
1000 +my $rc5_obj = $fields[$idx_rc5_obj];
1001 +my $dso_scheme = $fields[$idx_dso_scheme];
1002 +my $shared_target = $fields[$idx_shared_target];
1003 +my $shared_cflag = $fields[$idx_shared_cflag];
1004 +my $shared_ldflag = $fields[$idx_shared_ldflag];
1005 +my $shared_extension = $fields[$idx_shared_extension];
1006 +my $ranlib = $fields[$idx_ranlib];
1007 +my $arflags = $fields[$idx_arflags];
1008 +
1009 +if ($fips)
1010 +       {
1011 +       delete $disabled{"shared"} if ($disabled{"shared"} eq "default");
1012 +       $disabled{"asm"}="forced"
1013 +               if ($target !~ "VC\-.*" &&
1014 +                   "$cpuid_obj:$bn_obj:$aes_obj:$des_obj:$sha1_obj" eq "::::");
1015 +       }
1016 +
1017 +foreach (sort @experimental)
1018 +       {
1019 +       my $ALGO;
1020 +       ($ALGO = $_) =~ tr/[a-z]/[A-Z]/;
1021 +
1022 +       # opensslconf.h will set OPENSSL_NO_... unless OPENSSL_EXPERIMENTAL_... is defined
1023 +       $openssl_experimental_defines .= "#define OPENSSL_NO_$ALGO\n";
1024 +       $cflags .= " -DOPENSSL_EXPERIMENTAL_$ALGO";
1025 +       }
1026 +
1027 +foreach (sort (keys %disabled))
1028 +       {
1029 +       $options .= " no-$_";
1030 +
1031 +       printf "    no-%-12s %-10s", $_, "[$disabled{$_}]";
1032 +
1033 +       if (/^dso$/)
1034 +               { $no_dso = 1; }
1035 +       elsif (/^threads$/)
1036 +               { $no_threads = 1; }
1037 +       elsif (/^shared$/)
1038 +               { $no_shared = 1; }
1039 +       elsif (/^zlib$/)
1040 +               { $zlib = 0; }
1041 +       elsif (/^montasm$/)
1042 +               { $montasm = 0; }
1043 +       elsif (/^static-engine$/)
1044 +               { }
1045 +       elsif (/^zlib-dynamic$/)
1046 +               { }
1047 +       elsif (/^symlinks$/)
1048 +               { $symlink = 0; }
1049 +       elsif (/^sse2$/)
1050 +               { $no_sse2 = 1; }
1051 +       else
1052 +               {
1053 +               my ($ALGO, $algo);
1054 +               ($ALGO = $algo = $_) =~ tr/[a-z]/[A-Z]/;
1055 +
1056 +               if (/^asm$/ || /^err$/ || /^hw$/ || /^hw-/)
1057 +                       {
1058 +                       $openssl_other_defines .= "#define OPENSSL_NO_$ALGO\n";
1059 +                       print " OPENSSL_NO_$ALGO";
1060 +               
1061 +                       if (/^err$/)    { $flags .= "-DOPENSSL_NO_ERR "; }
1062 +                       elsif (/^asm$/) { $no_asm = 1; }
1063 +                       }
1064 +               else
1065 +                       {
1066 +                       $openssl_algorithm_defines .= "#define OPENSSL_NO_$ALGO\n";
1067 +                       print " OPENSSL_NO_$ALGO";
1068 +
1069 +                       if (/^krb5$/)
1070 +                               { $no_krb5 = 1; }
1071 +                       else
1072 +                               {
1073 +                               push @skip, $algo;
1074 +                               print " (skip dir)";
1075 +
1076 +                               $depflags .= " -DOPENSSL_NO_$ALGO";
1077 +                               }
1078 +                       }
1079 +               }
1080 +
1081 +       print "\n";
1082 +       }
1083 +
1084 +
1085 +my $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds;
1086 +
1087 +$IsMK1MF=1 if ($target eq "mingw" && $^O ne "cygwin" && !is_msys());
1088 +
1089 +$no_shared = 0 if ($fipsdso && !$IsMK1MF);
1090 +
1091 +$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target eq "mingw");
1092 +$exe_ext=".nlm" if ($target =~ /netware/);
1093 +$exe_ext=".pm"  if ($target =~ /vos/);
1094 +if ($openssldir eq "" and $prefix eq "")
1095 +       {
1096 +       if ($fips)
1097 +               {
1098 +               $openssldir="/usr/local/ssl/fips";
1099 +               }
1100 +       else
1101 +               {
1102 +               $openssldir="/usr/local/ssl";
1103 +               }
1104 +       }
1105 +$prefix=$openssldir if $prefix eq "";
1106 +
1107 +$default_ranlib= &which("ranlib") or $default_ranlib="true";
1108 +$perl=$ENV{'PERL'} or $perl=&which("perl5") or $perl=&which("perl")
1109 +  or $perl="perl";
1110 +
1111 +chop $openssldir if $openssldir =~ /\/$/;
1112 +chop $prefix if $prefix =~ /.\/$/;
1113 +
1114 +$openssldir=$prefix . "/ssl" if $openssldir eq "";
1115 +$openssldir=$prefix . "/" . $openssldir if $openssldir !~ /(^\/|^[a-zA-Z]:[\\\/])/;
1116 +
1117 +
1118 +print "IsMK1MF=$IsMK1MF\n";
1119 +
1120 +# '%' in $lflags is used to split flags to "pre-" and post-flags
1121 +my ($prelflags,$postlflags)=split('%',$lflags);
1122 +if (defined($postlflags))      { $lflags=$postlflags;  }
1123 +else                           { $lflags=$prelflags; undef $prelflags; }
1124 +
1125 +my $no_shared_warn=0;
1126 +my $no_user_cflags=0;
1127 +
1128 +if ($flags ne "")      { $cflags="$flags$cflags"; }
1129 +else                   { $no_user_cflags=1;       }
1130 +
1131 +# Kerberos settings.  The flavor must be provided from outside, either through
1132 +# the script "config" or manually.
1133 +if (!$no_krb5)
1134 +       {
1135 +       my ($lresolv, $lpath, $lext);
1136 +       if ($withargs{"krb5-flavor"} =~ /^[Hh]eimdal$/)
1137 +               {
1138 +               die "Sorry, Heimdal is currently not supported\n";
1139 +               }
1140 +       ##### HACK to force use of Heimdal.
1141 +       ##### WARNING: Since we don't really have adequate support for Heimdal,
1142 +       #####          using this will break the build.  You'll have to make
1143 +       #####          changes to the source, and if you do, please send
1144 +       #####          patches to openssl-dev@openssl.org
1145 +       if ($withargs{"krb5-flavor"} =~ /^force-[Hh]eimdal$/)
1146 +               {
1147 +               warn "Heimdal isn't really supported.  Your build WILL break\n";
1148 +               warn "If you fix the problems, please send a patch to openssl-dev\@openssl.org\n";
1149 +               $withargs{"krb5-dir"} = "/usr/heimdal"
1150 +                       if $withargs{"krb5-dir"} eq "";
1151 +               $withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}.
1152 +                       "/lib -lgssapi -lkrb5 -lcom_err"
1153 +                       if $withargs{"krb5-lib"} eq "" && !$IsMK1MF;
1154 +               $cflags="-DKRB5_HEIMDAL $cflags";
1155 +               }
1156 +       if ($withargs{"krb5-flavor"} =~ /^[Mm][Ii][Tt]/)
1157 +               {
1158 +               $withargs{"krb5-dir"} = "/usr/kerberos"
1159 +                       if $withargs{"krb5-dir"} eq "";
1160 +               $withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}.
1161 +                       "/lib -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto"
1162 +                       if $withargs{"krb5-lib"} eq "" && !$IsMK1MF;
1163 +               $cflags="-DKRB5_MIT $cflags";
1164 +               $withargs{"krb5-flavor"} =~ s/^[Mm][Ii][Tt][._-]*//;
1165 +               if ($withargs{"krb5-flavor"} =~ /^1[._-]*[01]/)
1166 +                       {
1167 +                       $cflags="-DKRB5_MIT_OLD11 $cflags";
1168 +                       }
1169 +               }
1170 +       LRESOLV:
1171 +       foreach $lpath ("/lib", "/usr/lib")
1172 +               {
1173 +               foreach $lext ("a", "so")
1174 +                       {
1175 +                       $lresolv = "$lpath/libresolv.$lext";
1176 +                       last LRESOLV    if (-r "$lresolv");
1177 +                       $lresolv = "";
1178 +                       }
1179 +               }
1180 +       $withargs{"krb5-lib"} .= " -lresolv"
1181 +               if ("$lresolv" ne "");
1182 +       $withargs{"krb5-include"} = "-I".$withargs{"krb5-dir"}."/include"
1183 +               if $withargs{"krb5-include"} eq "" &&
1184 +                  $withargs{"krb5-dir"} ne "";
1185 +       }
1186 +
1187 +# The DSO code currently always implements all functions so that no
1188 +# applications will have to worry about that from a compilation point
1189 +# of view. However, the "method"s may return zero unless that platform
1190 +# has support compiled in for them. Currently each method is enabled
1191 +# by a define "DSO_<name>" ... we translate the "dso_scheme" config
1192 +# string entry into using the following logic;
1193 +my $dso_cflags;
1194 +if (!$no_dso && $dso_scheme ne "")
1195 +       {
1196 +       $dso_scheme =~ tr/[a-z]/[A-Z]/;
1197 +       if ($dso_scheme eq "DLFCN")
1198 +               {
1199 +               $dso_cflags = "-DDSO_DLFCN -DHAVE_DLFCN_H";
1200 +               }
1201 +       elsif ($dso_scheme eq "DLFCN_NO_H")
1202 +               {
1203 +               $dso_cflags = "-DDSO_DLFCN";
1204 +               }
1205 +       else
1206 +               {
1207 +               $dso_cflags = "-DDSO_$dso_scheme";
1208 +               }
1209 +       $cflags = "$dso_cflags $cflags";
1210 +       }
1211 +
1212 +my $thread_cflags;
1213 +my $thread_defines;
1214 +if ($thread_cflag ne "(unknown)" && !$no_threads)
1215 +       {
1216 +       # If we know how to do it, support threads by default.
1217 +       $threads = 1;
1218 +       }
1219 +if ($thread_cflag eq "(unknown)" && $threads)
1220 +       {
1221 +       # If the user asked for "threads", [s]he is also expected to
1222 +       # provide any system-dependent compiler options that are
1223 +       # necessary.
1224 +       if ($no_user_cflags)
1225 +               {
1226 +               print "You asked for multi-threading support, but didn't\n";
1227 +               print "provide any system-specific compiler options\n";
1228 +               exit(1);
1229 +               }
1230 +       $thread_cflags="-DOPENSSL_THREADS $cflags" ;
1231 +       $thread_defines .= "#define OPENSSL_THREADS\n";
1232 +       }
1233 +else
1234 +       {
1235 +       $thread_cflags="-DOPENSSL_THREADS $thread_cflag $cflags";
1236 +       $thread_defines .= "#define OPENSSL_THREADS\n";
1237 +#      my $def;
1238 +#      foreach $def (split ' ',$thread_cflag)
1239 +#              {
1240 +#              if ($def =~ s/^-D// && $def !~ /^_/)
1241 +#                      {
1242 +#                      $thread_defines .= "#define $def\n";
1243 +#                      }
1244 +#              }
1245 +       }       
1246 +
1247 +$lflags="$libs$lflags" if ($libs ne "");
1248 +
1249 +if ($no_asm)
1250 +       {
1251 +       $cpuid_obj=$bn_obj=$des_obj=$aes_obj=$bf_obj=$cast_obj=$rc4_obj=$rc5_obj="";
1252 +       $sha1_obj=$md5_obj=$rmd160_obj="";
1253 +       $cflags=~s/\-D[BL]_ENDIAN//             if ($fips);
1254 +       $thread_cflags=~s/\-D[BL]_ENDIAN//      if ($fips);
1255 +       }
1256 +if ($montasm)
1257 +       {
1258 +       $bn_obj =~ s/MAYBE-MO86-/mo86-/;
1259 +       }
1260 +else
1261 +       {
1262 +       $bn_obj =~ s/MAYBE-MO86-[a-z.]*//;
1263 +       }
1264 +
1265 +if (!$no_shared)
1266 +       {
1267 +       $cast_obj="";   # CAST assembler is not PIC
1268 +       }
1269 +
1270 +if ($threads)
1271 +       {
1272 +       $cflags=$thread_cflags;
1273 +       $openssl_thread_defines .= $thread_defines;
1274 +       }
1275 +
1276 +if ($zlib)
1277 +       {
1278 +       $cflags = "-DZLIB $cflags";
1279 +       if (defined($disabled{"zlib-dynamic"}))
1280 +               {
1281 +               $lflags = "$lflags -lz";
1282 +               }
1283 +       else
1284 +               {
1285 +               $cflags = "-DZLIB_SHARED $cflags";
1286 +               }
1287 +       }
1288 +
1289 +# You will find shlib_mark1 and shlib_mark2 explained in Makefile.org
1290 +my $shared_mark = "";
1291 +if ($shared_target eq "")
1292 +       {
1293 +       $no_shared_warn = 1 if !$no_shared && !$fips;
1294 +       $no_shared = 1;
1295 +       }
1296 +if (!$no_shared)
1297 +       {
1298 +       if ($shared_cflag ne "")
1299 +               {
1300 +               $cflags = "$shared_cflag -DOPENSSL_PIC $cflags";
1301 +               }
1302 +       }
1303 +
1304 +if (!$IsMK1MF)
1305 +       {
1306 +       if ($no_shared)
1307 +               {
1308 +               $openssl_other_defines.="#define OPENSSL_NO_DYNAMIC_ENGINE\n";
1309 +               }
1310 +       else
1311 +               {
1312 +               $openssl_other_defines.="#define OPENSSL_NO_STATIC_ENGINE\n";
1313 +               }
1314 +       }
1315 +
1316 +$cpuid_obj.=" uplink.o uplink-cof.o" if ($cflags =~ /\-DOPENSSL_USE_APPLINK/);
1317 +
1318 +#
1319 +# Platform fix-ups
1320 +#
1321 +if ($target =~ /\-icc$/)       # Intel C compiler
1322 +       {
1323 +       my $iccver=0;
1324 +       if (open(FD,"$cc -V 2>&1 |"))
1325 +               {
1326 +               while(<FD>) { $iccver=$1 if (/Version ([0-9]+)\./); }
1327 +               close(FD);
1328 +               }
1329 +       if ($iccver>=8)
1330 +               {
1331 +               # Eliminate unnecessary dependency from libirc.a. This is
1332 +               # essential for shared library support, as otherwise
1333 +               # apps/openssl can end up in endless loop upon startup...
1334 +               $cflags.=" -Dmemcpy=__builtin_memcpy -Dmemset=__builtin_memset";
1335 +               }
1336 +       if ($iccver>=9)
1337 +               {
1338 +               $cflags.=" -i-static";
1339 +               $cflags=~s/\-no_cpprt/-no-cpprt/;
1340 +               }
1341 +       if ($iccver>=10)
1342 +               {
1343 +               $cflags=~s/\-i\-static/-static-intel/;
1344 +               }
1345 +       }
1346 +
1347 +# Unlike other OSes (like Solaris, Linux, Tru64, IRIX) BSD run-time
1348 +# linkers (tested OpenBSD, NetBSD and FreeBSD) "demand" RPATH set on
1349 +# .so objects. Apparently application RPATH is not global and does
1350 +# not apply to .so linked with other .so. Problem manifests itself
1351 +# when libssl.so fails to load libcrypto.so. One can argue that we
1352 +# should engrave this into Makefile.shared rules or into BSD-* config
1353 +# lines above. Meanwhile let's try to be cautious and pass -rpath to
1354 +# linker only when --prefix is not /usr.
1355 +if ($target =~ /^BSD\-/)
1356 +       {
1357 +       $shared_ldflag.=" -Wl,-rpath,\$(LIBRPATH)" if ($prefix !~ m|^/usr[/]*$|);
1358 +       }
1359 +
1360 +if ($sys_id ne "")
1361 +       {
1362 +       #$cflags="-DOPENSSL_SYSNAME_$sys_id $cflags";
1363 +       $openssl_sys_defines="#define OPENSSL_SYSNAME_$sys_id\n";
1364 +       }
1365 +
1366 +if ($ranlib eq "")
1367 +       {
1368 +       $ranlib = $default_ranlib;
1369 +       }
1370 +
1371 +#my ($bn1)=split(/\s+/,$bn_obj);
1372 +#$bn1 = "" unless defined $bn1;
1373 +#$bn1=$bn_asm unless ($bn1 =~ /\.o$/);
1374 +#$bn_obj="$bn1";
1375 +
1376 +$cpuid_obj="" if ($processor eq "386");
1377 +
1378 +$bn_obj = $bn_asm unless $bn_obj ne "";
1379 +# bn86* is the only one implementing bn_*_part_words
1380 +$cflags.=" -DOPENSSL_BN_ASM_PART_WORDS" if ($bn_obj =~ /bn86/);
1381 +$cflags.=" -DOPENSSL_IA32_SSE2" if (!$no_sse2 && $bn_obj =~ /bn86/);
1382 +
1383 +$cflags.=" -DOPENSSL_BN_ASM_MONT" if ($bn_obj =~ /\-mont|mo86\-/);
1384 +
1385 +if ($fips)
1386 +       {
1387 +       $openssl_other_defines.="#define OPENSSL_FIPS\n";
1388 +       }
1389 +
1390 +$des_obj=$des_enc      unless ($des_obj =~ /\.o$/);
1391 +$bf_obj=$bf_enc                unless ($bf_obj =~ /\.o$/);
1392 +$cast_obj=$cast_enc    unless ($cast_obj =~ /\.o$/);
1393 +$rc4_obj=$rc4_enc      unless ($rc4_obj =~ /\.o$/);
1394 +$rc5_obj=$rc5_enc      unless ($rc5_obj =~ /\.o$/);
1395 +if ($sha1_obj =~ /\.o$/)
1396 +       {
1397 +#      $sha1_obj=$sha1_enc;
1398 +       $cflags.=" -DSHA1_ASM"   if ($sha1_obj =~ /sx86/ || $sha1_obj =~ /sha1/);
1399 +       $cflags.=" -DSHA256_ASM" if ($sha1_obj =~ /sha256/);
1400 +       $cflags.=" -DSHA512_ASM" if ($sha1_obj =~ /sha512/);
1401 +       if ($sha1_obj =~ /sse2/)
1402 +           {   if ($no_sse2)
1403 +               {   $sha1_obj =~ s/\S*sse2\S+//;        }
1404 +               elsif ($cflags !~ /OPENSSL_IA32_SSE2/)
1405 +               {   $cflags.=" -DOPENSSL_IA32_SSE2";    }
1406 +           }
1407 +       }
1408 +if ($md5_obj =~ /\.o$/)
1409 +       {
1410 +#      $md5_obj=$md5_enc;
1411 +       $cflags.=" -DMD5_ASM";
1412 +       }
1413 +if ($rmd160_obj =~ /\.o$/)
1414 +       {
1415 +#      $rmd160_obj=$rmd160_enc;
1416 +       $cflags.=" -DRMD160_ASM";
1417 +       }
1418 +if ($aes_obj =~ /\.o$/)
1419 +       {
1420 +       $cflags.=" -DAES_ASM";
1421 +       }
1422 +else   {
1423 +       $aes_obj=$aes_enc;
1424 +       }
1425 +
1426 +# "Stringify" the C flags string.  This permits it to be made part of a string
1427 +# and works as well on command lines.
1428 +$cflags =~ s/([\\\"])/\\\1/g;
1429 +
1430 +my $version = "unknown";
1431 +my $version_num = "unknown";
1432 +my $major = "unknown";
1433 +my $minor = "unknown";
1434 +my $shlib_version_number = "unknown";
1435 +my $shlib_version_history = "unknown";
1436 +my $shlib_major = "unknown";
1437 +my $shlib_minor = "unknown";
1438 +
1439 +open(IN,'<crypto/opensslv.h') || die "unable to read opensslv.h:$!\n";
1440 +while (<IN>)
1441 +       {
1442 +       $version=$1 if /OPENSSL.VERSION.TEXT.*OpenSSL (\S+) /;
1443 +       $version_num=$1 if /OPENSSL.VERSION.NUMBER.*0x(\S+)/;
1444 +       $shlib_version_number=$1 if /SHLIB_VERSION_NUMBER *"([^"]+)"/;
1445 +       $shlib_version_history=$1 if /SHLIB_VERSION_HISTORY *"([^"]*)"/;
1446 +       }
1447 +close(IN);
1448 +if ($shlib_version_history ne "") { $shlib_version_history .= ":"; }
1449 +
1450 +if ($version =~ /(^[0-9]*)\.([0-9\.]*)/)
1451 +       {
1452 +       $major=$1;
1453 +       $minor=$2;
1454 +       }
1455 +
1456 +if ($shlib_version_number =~ /(^[0-9]*)\.([0-9\.]*)/)
1457 +       {
1458 +       $shlib_major=$1;
1459 +       $shlib_minor=$2;
1460 +       }
1461 +
1462 +open(IN,'<Makefile.org') || die "unable to read Makefile.org:$!\n";
1463 +unlink("$Makefile.new") || die "unable to remove old $Makefile.new:$!\n" if -e "$Makefile.new";
1464 +open(OUT,">$Makefile.new") || die "unable to create $Makefile.new:$!\n";
1465 +print OUT "### Generated automatically from Makefile.org by Configure.\n\n";
1466 +my $sdirs=0;
1467 +while (<IN>)
1468 +       {
1469 +       chomp;
1470 +       $sdirs = 1 if /^SDIRS=/;
1471 +       if ($sdirs) {
1472 +               my $dir;
1473 +               foreach $dir (@skip) {
1474 +                       s/(\s)$dir\s/$1/;
1475 +                       s/\s$dir$//;
1476 +                       }
1477 +               }
1478 +       $sdirs = 0 unless /\\$/;
1479 +       s/^VERSION=.*/VERSION=$version/;
1480 +       s/^MAJOR=.*/MAJOR=$major/;
1481 +       s/^MINOR=.*/MINOR=$minor/;
1482 +       s/^SHLIB_VERSION_NUMBER=.*/SHLIB_VERSION_NUMBER=$shlib_version_number/;
1483 +       s/^SHLIB_VERSION_HISTORY=.*/SHLIB_VERSION_HISTORY=$shlib_version_history/;
1484 +       s/^SHLIB_MAJOR=.*/SHLIB_MAJOR=$shlib_major/;
1485 +       s/^SHLIB_MINOR=.*/SHLIB_MINOR=$shlib_minor/;
1486 +       s/^SHLIB_EXT=.*/SHLIB_EXT=$shared_extension/;
1487 +       s/^INSTALLTOP=.*$/INSTALLTOP=$prefix/;
1488 +       s/^OPENSSLDIR=.*$/OPENSSLDIR=$openssldir/;
1489 +       s/^INSTALL_PREFIX=.*$/INSTALL_PREFIX=$install_prefix/;
1490 +       s/^PLATFORM=.*$/PLATFORM=$target/;
1491 +       s/^OPTIONS=.*$/OPTIONS=$options/;
1492 +       s/^CONFIGURE_ARGS=.*$/CONFIGURE_ARGS=$argvstring/;
1493 +       s/^CC=.*$/CC= $cc/;
1494 +       s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $cc eq "gcc";
1495 +       s/^CFLAG=.*$/CFLAG= $cflags/;
1496 +       s/^DEPFLAG=.*$/DEPFLAG=$depflags/;
1497 +       s/^PEX_LIBS=.*$/PEX_LIBS= $prelflags/;
1498 +       s/^EX_LIBS=.*$/EX_LIBS= $lflags/;
1499 +       s/^EXE_EXT=.*$/EXE_EXT= $exe_ext/;
1500 +       s/^CPUID_OBJ=.*$/CPUID_OBJ= $cpuid_obj/;
1501 +       s/^BN_ASM=.*$/BN_ASM= $bn_obj/;
1502 +       s/^DES_ENC=.*$/DES_ENC= $des_obj/;
1503 +       s/^AES_ASM_OBJ=.*$/AES_ASM_OBJ= $aes_obj/;
1504 +       s/^BF_ENC=.*$/BF_ENC= $bf_obj/;
1505 +       s/^CAST_ENC=.*$/CAST_ENC= $cast_obj/;
1506 +       s/^RC4_ENC=.*$/RC4_ENC= $rc4_obj/;
1507 +       s/^RC5_ENC=.*$/RC5_ENC= $rc5_obj/;
1508 +       s/^MD5_ASM_OBJ=.*$/MD5_ASM_OBJ= $md5_obj/;
1509 +       s/^SHA1_ASM_OBJ=.*$/SHA1_ASM_OBJ= $sha1_obj/;
1510 +       s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/;
1511 +       s/^PROCESSOR=.*/PROCESSOR= $processor/;
1512 +       s/^RANLIB=.*/RANLIB= $ranlib/;
1513 +       s/^ARFLAGS=.*/ARFLAGS= $arflags/;
1514 +       s/^PERL=.*/PERL= $perl/;
1515 +       s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/;
1516 +       s/^LIBKRB5=.*/LIBKRB5=$withargs{"krb5-lib"}/;
1517 +       s/^LIBZLIB=.*/LIBZLIB=$withargs{"zlib-lib"}/;
1518 +       s/^ZLIB_INCLUDE=.*/ZLIB_INCLUDE=$withargs{"zlib-include"}/;
1519 +       s/^FIPSLIBDIR=.*/FIPSLIBDIR=$fipslibdir/;
1520 +       if ($fipsdso)
1521 +               {
1522 +               s/^FIPSCANLIB=.*/FIPSCANLIB=libfips/;
1523 +               s/^SHARED_FIPS=.*/SHARED_FIPS=libfips\$(SHLIB_EXT)/;
1524 +               s/^SHLIBDIRS=.*/SHLIBDIRS= crypto ssl fips/;
1525 +               }
1526 +       else
1527 +               {
1528 +               s/^FIPSCANLIB=.*/FIPSCANLIB=libcrypto/ if $fips;
1529 +               s/^SHARED_FIPS=.*/SHARED_FIPS=/;
1530 +               s/^SHLIBDIRS=.*/SHLIBDIRS= crypto ssl/;
1531 +               }
1532 +       s/^FIPSCANISTERINTERNAL=.*/FIPSCANISTERINTERNAL=$fipscanisterinternal/;
1533 +       s/^BASEADDR=.*/BASEADDR=$baseaddr/;
1534 +       s/^SHLIB_TARGET=.*/SHLIB_TARGET=$shared_target/;
1535 +       s/^SHLIB_MARK=.*/SHLIB_MARK=$shared_mark/;
1536 +       s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_FIPS) \$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared);
1537 +       if ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*$/)
1538 +               {
1539 +               my $sotmp = $1;
1540 +               s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp/;
1541 +               }
1542 +       elsif ($shared_extension ne "" && $shared_extension =~ /^\.[^\.]*\.dylib$/)
1543 +               {
1544 +               s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.dylib/;
1545 +               }
1546 +       elsif ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*\.[^\.]*$/)
1547 +               {
1548 +               my $sotmp = $1;
1549 +               s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp.\$(SHLIB_MAJOR) .s$sotmp/;
1550 +               }
1551 +       elsif ($shared_extension ne "" && $shared_extension =~ /^\.[^\.]*\.[^\.]*\.dylib$/)
1552 +               {
1553 +               s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.\$(SHLIB_MAJOR).dylib .dylib/;
1554 +               }
1555 +       s/^SHARED_LDFLAGS=.*/SHARED_LDFLAGS=$shared_ldflag/;
1556 +       print OUT $_."\n";
1557 +       }
1558 +close(IN);
1559 +close(OUT);
1560 +rename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile;
1561 +rename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n";
1562 +
1563 +print "CC            =$cc\n";
1564 +print "CFLAG         =$cflags\n";
1565 +print "EX_LIBS       =$lflags\n";
1566 +print "CPUID_OBJ     =$cpuid_obj\n";
1567 +print "BN_ASM        =$bn_obj\n";
1568 +print "DES_ENC       =$des_obj\n";
1569 +print "AES_ASM_OBJ   =$aes_obj\n";
1570 +print "BF_ENC        =$bf_obj\n";
1571 +print "CAST_ENC      =$cast_obj\n";
1572 +print "RC4_ENC       =$rc4_obj\n";
1573 +print "RC5_ENC       =$rc5_obj\n";
1574 +print "MD5_OBJ_ASM   =$md5_obj\n";
1575 +print "SHA1_OBJ_ASM  =$sha1_obj\n";
1576 +print "RMD160_OBJ_ASM=$rmd160_obj\n";
1577 +print "PROCESSOR     =$processor\n";
1578 +print "RANLIB        =$ranlib\n";
1579 +print "ARFLAGS       =$arflags\n";
1580 +print "PERL          =$perl\n";
1581 +print "KRB5_INCLUDES =",$withargs{"krb5-include"},"\n"
1582 +       if $withargs{"krb5-include"} ne "";
1583 +
1584 +my $des_ptr=0;
1585 +my $des_risc1=0;
1586 +my $des_risc2=0;
1587 +my $des_unroll=0;
1588 +my $bn_ll=0;
1589 +my $def_int=2;
1590 +my $rc4_int=$def_int;
1591 +my $md2_int=$def_int;
1592 +my $idea_int=$def_int;
1593 +my $rc2_int=$def_int;
1594 +my $rc4_idx=0;
1595 +my $rc4_chunk=0;
1596 +my $bf_ptr=0;
1597 +my @type=("char","short","int","long");
1598 +my ($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0);
1599 +my $export_var_as_fn=0;
1600 +
1601 +my $des_int;
1602 +
1603 +foreach (sort split(/\s+/,$bn_ops))
1604 +       {
1605 +       $des_ptr=1 if /DES_PTR/;
1606 +       $des_risc1=1 if /DES_RISC1/;
1607 +       $des_risc2=1 if /DES_RISC2/;
1608 +       $des_unroll=1 if /DES_UNROLL/;
1609 +       $des_int=1 if /DES_INT/;
1610 +       $bn_ll=1 if /BN_LLONG/;
1611 +       $rc4_int=0 if /RC4_CHAR/;
1612 +       $rc4_int=3 if /RC4_LONG/;
1613 +       $rc4_idx=1 if /RC4_INDEX/;
1614 +       $rc4_chunk=1 if /RC4_CHUNK/;
1615 +       $rc4_chunk=2 if /RC4_CHUNK_LL/;
1616 +       $md2_int=0 if /MD2_CHAR/;
1617 +       $md2_int=3 if /MD2_LONG/;
1618 +       $idea_int=1 if /IDEA_SHORT/;
1619 +       $idea_int=3 if /IDEA_LONG/;
1620 +       $rc2_int=1 if /RC2_SHORT/;
1621 +       $rc2_int=3 if /RC2_LONG/;
1622 +       $bf_ptr=1 if $_ eq "BF_PTR";
1623 +       $bf_ptr=2 if $_ eq "BF_PTR2";
1624 +       ($b64l,$b64,$b32,$b16,$b8)=(0,1,0,0,0) if /SIXTY_FOUR_BIT/;
1625 +       ($b64l,$b64,$b32,$b16,$b8)=(1,0,0,0,0) if /SIXTY_FOUR_BIT_LONG/;
1626 +       ($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0) if /THIRTY_TWO_BIT/;
1627 +       ($b64l,$b64,$b32,$b16,$b8)=(0,0,0,1,0) if /SIXTEEN_BIT/;
1628 +       ($b64l,$b64,$b32,$b16,$b8)=(0,0,0,0,1) if /EIGHT_BIT/;
1629 +       $export_var_as_fn=1 if /EXPORT_VAR_AS_FN/;
1630 +       }
1631 +
1632 +open(IN,'<crypto/opensslconf.h.in') || die "unable to read crypto/opensslconf.h.in:$!\n";
1633 +unlink("crypto/opensslconf.h.new") || die "unable to remove old crypto/opensslconf.h.new:$!\n" if -e "crypto/opensslconf.h.new";
1634 +open(OUT,'>crypto/opensslconf.h.new') || die "unable to create crypto/opensslconf.h.new:$!\n";
1635 +print OUT "/* opensslconf.h */\n";
1636 +print OUT "/* WARNING: Generated automatically from opensslconf.h.in by Configure. */\n\n";
1637 +
1638 +print OUT "/* OpenSSL was configured with the following options: */\n";
1639 +my $openssl_algorithm_defines_trans = $openssl_algorithm_defines;
1640 +$openssl_experimental_defines =~ s/^\s*#\s*define\s+OPENSSL_NO_(.*)/#ifndef OPENSSL_EXPERIMENTAL_$1\n# ifndef OPENSSL_NO_$1\n#  define OPENSSL_NO_$1\n# endif\n#endif/mg;
1641 +$openssl_algorithm_defines_trans =~ s/^\s*#\s*define\s+OPENSSL_(.*)/# if defined(OPENSSL_$1) \&\& !defined($1)\n#  define $1\n# endif/mg;
1642 +$openssl_algorithm_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
1643 +$openssl_algorithm_defines = "   /* no ciphers excluded */\n" if $openssl_algorithm_defines eq "";
1644 +$openssl_thread_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
1645 +$openssl_sys_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
1646 +$openssl_other_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
1647 +print OUT $openssl_sys_defines;
1648 +print OUT "#ifndef OPENSSL_DOING_MAKEDEPEND\n\n";
1649 +print OUT $openssl_experimental_defines;
1650 +print OUT "\n";
1651 +print OUT $openssl_algorithm_defines;
1652 +print OUT "\n#endif /* OPENSSL_DOING_MAKEDEPEND */\n\n";
1653 +print OUT $openssl_thread_defines;
1654 +print OUT $openssl_other_defines,"\n";
1655 +
1656 +print OUT "/* The OPENSSL_NO_* macros are also defined as NO_* if the application\n";
1657 +print OUT "   asks for it.  This is a transient feature that is provided for those\n";
1658 +print OUT "   who haven't had the time to do the appropriate changes in their\n";
1659 +print OUT "   applications.  */\n";
1660 +print OUT "#ifdef OPENSSL_ALGORITHM_DEFINES\n";
1661 +print OUT $openssl_algorithm_defines_trans;
1662 +print OUT "#endif\n\n";
1663 +
1664 +print OUT "#define OPENSSL_CPUID_OBJ\n\n" if ($cpuid_obj);
1665 +
1666 +while (<IN>)
1667 +       {
1668 +       if      (/^#define\s+OPENSSLDIR/)
1669 +               { print OUT "#define OPENSSLDIR \"$openssldir\"\n"; }
1670 +       elsif   (/^#define\s+ENGINESDIR/)
1671 +               { print OUT "#define ENGINESDIR \"$prefix/lib/engines\"\n"; }
1672 +       elsif   (/^#((define)|(undef))\s+OPENSSL_EXPORT_VAR_AS_FUNCTION/)
1673 +               { printf OUT "#undef OPENSSL_EXPORT_VAR_AS_FUNCTION\n"
1674 +                       if $export_var_as_fn;
1675 +                 printf OUT "#%s OPENSSL_EXPORT_VAR_AS_FUNCTION\n",
1676 +                       ($export_var_as_fn)?"define":"undef"; }
1677 +       elsif   (/^#define\s+OPENSSL_UNISTD/)
1678 +               {
1679 +               $unistd = "<unistd.h>" if $unistd eq "";
1680 +               print OUT "#define OPENSSL_UNISTD $unistd\n";
1681 +               }
1682 +       elsif   (/^#((define)|(undef))\s+SIXTY_FOUR_BIT_LONG/)
1683 +               { printf OUT "#%s SIXTY_FOUR_BIT_LONG\n",($b64l)?"define":"undef"; }
1684 +       elsif   (/^#((define)|(undef))\s+SIXTY_FOUR_BIT/)
1685 +               { printf OUT "#%s SIXTY_FOUR_BIT\n",($b64)?"define":"undef"; }
1686 +       elsif   (/^#((define)|(undef))\s+THIRTY_TWO_BIT/)
1687 +               { printf OUT "#%s THIRTY_TWO_BIT\n",($b32)?"define":"undef"; }
1688 +       elsif   (/^#((define)|(undef))\s+SIXTEEN_BIT/)
1689 +               { printf OUT "#%s SIXTEEN_BIT\n",($b16)?"define":"undef"; }
1690 +       elsif   (/^#((define)|(undef))\s+EIGHT_BIT/)
1691 +               { printf OUT "#%s EIGHT_BIT\n",($b8)?"define":"undef"; }
1692 +       elsif   (/^#((define)|(undef))\s+BN_LLONG\s*$/)
1693 +               { printf OUT "#%s BN_LLONG\n",($bn_ll)?"define":"undef"; }
1694 +       elsif   (/^\#define\s+DES_LONG\s+.*/)
1695 +               { printf OUT "#define DES_LONG unsigned %s\n",
1696 +                       ($des_int)?'int':'long'; }
1697 +       elsif   (/^\#(define|undef)\s+DES_PTR/)
1698 +               { printf OUT "#%s DES_PTR\n",($des_ptr)?'define':'undef'; }
1699 +       elsif   (/^\#(define|undef)\s+DES_RISC1/)
1700 +               { printf OUT "#%s DES_RISC1\n",($des_risc1)?'define':'undef'; }
1701 +       elsif   (/^\#(define|undef)\s+DES_RISC2/)
1702 +               { printf OUT "#%s DES_RISC2\n",($des_risc2)?'define':'undef'; }
1703 +       elsif   (/^\#(define|undef)\s+DES_UNROLL/)
1704 +               { printf OUT "#%s DES_UNROLL\n",($des_unroll)?'define':'undef'; }
1705 +       elsif   (/^#define\s+RC4_INT\s/)
1706 +               { printf OUT "#define RC4_INT unsigned %s\n",$type[$rc4_int]; }
1707 +       elsif   (/^#undef\s+RC4_CHUNK/)
1708 +               {
1709 +               printf OUT "#undef RC4_CHUNK\n" if $rc4_chunk==0;
1710 +               printf OUT "#define RC4_CHUNK unsigned long\n" if $rc4_chunk==1;
1711 +               printf OUT "#define RC4_CHUNK unsigned long long\n" if $rc4_chunk==2;
1712 +               }
1713 +       elsif   (/^#((define)|(undef))\s+RC4_INDEX/)
1714 +               { printf OUT "#%s RC4_INDEX\n",($rc4_idx)?"define":"undef"; }
1715 +       elsif (/^#(define|undef)\s+I386_ONLY/)
1716 +               { printf OUT "#%s I386_ONLY\n", ($processor eq "386")?
1717 +                       "define":"undef"; }
1718 +       elsif   (/^#define\s+MD2_INT\s/)
1719 +               { printf OUT "#define MD2_INT unsigned %s\n",$type[$md2_int]; }
1720 +       elsif   (/^#define\s+IDEA_INT\s/)
1721 +               {printf OUT "#define IDEA_INT unsigned %s\n",$type[$idea_int];}
1722 +       elsif   (/^#define\s+RC2_INT\s/)
1723 +               {printf OUT "#define RC2_INT unsigned %s\n",$type[$rc2_int];}
1724 +       elsif (/^#(define|undef)\s+BF_PTR/)
1725 +               {
1726 +               printf OUT "#undef BF_PTR\n" if $bf_ptr == 0;
1727 +               printf OUT "#define BF_PTR\n" if $bf_ptr == 1;
1728 +               printf OUT "#define BF_PTR2\n" if $bf_ptr == 2;
1729 +               }
1730 +       else
1731 +               { print OUT $_; }
1732 +       }
1733 +close(IN);
1734 +close(OUT);
1735 +rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h";
1736 +rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n";
1737 +
1738 +
1739 +# Fix the date
1740 +
1741 +print "SIXTY_FOUR_BIT_LONG mode\n" if $b64l;
1742 +print "SIXTY_FOUR_BIT mode\n" if $b64;
1743 +print "THIRTY_TWO_BIT mode\n" if $b32;
1744 +print "SIXTEEN_BIT mode\n" if $b16;
1745 +print "EIGHT_BIT mode\n" if $b8;
1746 +print "DES_PTR used\n" if $des_ptr;
1747 +print "DES_RISC1 used\n" if $des_risc1;
1748 +print "DES_RISC2 used\n" if $des_risc2;
1749 +print "DES_UNROLL used\n" if $des_unroll;
1750 +print "DES_INT used\n" if $des_int;
1751 +print "BN_LLONG mode\n" if $bn_ll;
1752 +print "RC4 uses u$type[$rc4_int]\n" if $rc4_int != $def_int;
1753 +print "RC4_INDEX mode\n" if $rc4_idx;
1754 +print "RC4_CHUNK is undefined\n" if $rc4_chunk==0;
1755 +print "RC4_CHUNK is unsigned long\n" if $rc4_chunk==1;
1756 +print "RC4_CHUNK is unsigned long long\n" if $rc4_chunk==2;
1757 +print "MD2 uses u$type[$md2_int]\n" if $md2_int != $def_int;
1758 +print "IDEA uses u$type[$idea_int]\n" if $idea_int != $def_int;
1759 +print "RC2 uses u$type[$rc2_int]\n" if $rc2_int != $def_int;
1760 +print "BF_PTR used\n" if $bf_ptr == 1; 
1761 +print "BF_PTR2 used\n" if $bf_ptr == 2; 
1762 +
1763 +if($IsMK1MF) {
1764 +       open (OUT,">crypto/buildinf.h") || die "Can't open buildinf.h";
1765 +       printf OUT <<EOF;
1766 +#ifndef MK1MF_BUILD
1767 +  /* auto-generated by Configure for crypto/cversion.c:
1768 +   * for Unix builds, crypto/Makefile.ssl generates functional definitions;
1769 +   * Windows builds (and other mk1mf builds) compile cversion.c with
1770 +   * -DMK1MF_BUILD and use definitions added to this file by util/mk1mf.pl. */
1771 +  #error "Windows builds (PLATFORM=$target) use mk1mf.pl-created Makefiles"
1772 +#endif
1773 +EOF
1774 +       close(OUT);
1775 +} else {
1776 +       my $make_command = "make PERL=\'$perl\'";
1777 +       my $make_targets = "";
1778 +       $make_targets .= " links" if $symlink;
1779 +       $make_targets .= " depend" if $depflags ne $default_depflags && $make_depend;
1780 +       $make_targets .= " gentests" if $symlink;
1781 +       (system $make_command.$make_targets) == 0 or exit $?
1782 +               if $make_targets ne "";
1783 +       if ( $perl =~ m@^/@) {
1784 +           &dofile("tools/c_rehash",$perl,'^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";');
1785 +           &dofile("apps/CA.pl",$perl,'^#!/', '#!%s');
1786 +       } else {
1787 +           # No path for Perl known ...
1788 +           &dofile("tools/c_rehash",'/usr/local/bin/perl','^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";');
1789 +           &dofile("apps/CA.pl",'/usr/local/bin/perl','^#!/', '#!%s');
1790 +       }
1791 +       if ($depflags ne $default_depflags && !$make_depend) {
1792 +               print <<EOF;
1793 +
1794 +Since you've disabled or enabled at least one algorithm, you need to do
1795 +the following before building:
1796 +
1797 +       make depend
1798 +EOF
1799 +       }
1800 +}
1801 +
1802 +# create the ms/version32.rc file if needed
1803 +if ($IsMK1MF && ($target !~ /^netware/)) {
1804 +       my ($v1, $v2, $v3, $v4);
1805 +       if ($version_num =~ /(^[0-9a-f]{1})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i) {
1806 +               $v1=hex $1;
1807 +               $v2=hex $2;
1808 +               $v3=hex $3;
1809 +               $v4=hex $4;
1810 +       }
1811 +       open (OUT,">ms/version32.rc") || die "Can't open ms/version32.rc";
1812 +       print OUT <<EOF;
1813 +#include <winver.h>
1814 +
1815 +LANGUAGE 0x09,0x01
1816 +
1817 +1 VERSIONINFO
1818 +  FILEVERSION $v1,$v2,$v3,$v4
1819 +  PRODUCTVERSION $v1,$v2,$v3,$v4
1820 +  FILEFLAGSMASK 0x3fL
1821 +#ifdef _DEBUG
1822 +  FILEFLAGS 0x01L
1823 +#else
1824 +  FILEFLAGS 0x00L
1825 +#endif
1826 +  FILEOS VOS__WINDOWS32
1827 +  FILETYPE VFT_DLL
1828 +  FILESUBTYPE 0x0L
1829 +BEGIN
1830 +    BLOCK "StringFileInfo"
1831 +    BEGIN
1832 +       BLOCK "040904b0"
1833 +       BEGIN
1834 +#if defined(FIPS)
1835 +           VALUE "Comments", "WARNING: TEST VERSION ONLY ***NOT*** FIPS 140-2 VALIDATED.\\0"
1836 +#endif
1837 +           // Required:            
1838 +           VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0"
1839 +#if defined(FIPS)
1840 +           VALUE "FileDescription", "TEST UNVALIDATED FIPS140-2 DLL\\0"
1841 +#else
1842 +           VALUE "FileDescription", "OpenSSL Shared Library\\0"
1843 +#endif
1844 +           VALUE "FileVersion", "$version\\0"
1845 +#if defined(CRYPTO)
1846 +           VALUE "InternalName", "libeay32\\0"
1847 +           VALUE "OriginalFilename", "libeay32.dll\\0"
1848 +#elif defined(SSL)
1849 +           VALUE "InternalName", "ssleay32\\0"
1850 +           VALUE "OriginalFilename", "ssleay32.dll\\0"
1851 +#elif defined(FIPS)
1852 +           VALUE "InternalName", "libosslfips\\0"
1853 +           VALUE "OriginalFilename", "libosslfips.dll\\0"
1854 +#endif
1855 +           VALUE "ProductName", "The OpenSSL Toolkit\\0"
1856 +           VALUE "ProductVersion", "$version\\0"
1857 +           // Optional:
1858 +           //VALUE "Comments", "\\0"
1859 +           VALUE "LegalCopyright", "Copyright Â© 1998-2007 The OpenSSL Project. Copyright Â© 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0"
1860 +           //VALUE "LegalTrademarks", "\\0"
1861 +           //VALUE "PrivateBuild", "\\0"
1862 +           //VALUE "SpecialBuild", "\\0"
1863 +       END
1864 +    END
1865 +    BLOCK "VarFileInfo"
1866 +    BEGIN
1867 +        VALUE "Translation", 0x409, 0x4b0
1868 +    END
1869 +END
1870 +EOF
1871 +       close(OUT);
1872 +  }
1873 +  
1874 +print <<EOF;
1875 +
1876 +Configured for $target.
1877 +EOF
1878 +
1879 +print <<\EOF if (!$no_threads && !$threads);
1880 +
1881 +The library could not be configured for supporting multi-threaded
1882 +applications as the compiler options required on this system are not known.
1883 +See file INSTALL for details if you need multi-threading.
1884 +EOF
1885 +
1886 +print <<\EOF if ($no_shared_warn);
1887 +
1888 +You gave the option 'shared'.  Normally, that would give you shared libraries.
1889 +Unfortunately, the OpenSSL configuration doesn't include shared library support
1890 +for this platform yet, so it will pretend you gave the option 'no-shared'.  If
1891 +you can inform the developpers (openssl-dev\@openssl.org) how to support shared
1892 +libraries on this platform, they will at least look at it and try their best
1893 +(but please first make sure you have tried with a current version of OpenSSL).
1894 +EOF
1895 +
1896 +print <<\EOF if ($fipscanisterinternal eq "y");
1897 +
1898 +WARNING: OpenSSL has been configured using unsupported option(s) to internally
1899 +generate a fipscanister.o object module for TESTING PURPOSES ONLY; that
1900 +compiled module is NOT FIPS 140-2 validated and CANNOT be used to replace the
1901 +OpenSSL FIPS Object Module as identified by the CMVP
1902 +(http://csrc.nist.gov/cryptval/) in any application requiring the use of FIPS
1903 +140-2 validated software. 
1904 +
1905 +This is an OpenSSL 0.9.8 test version.
1906 +
1907 +See the file README.FIPS for details of how to build a test library.
1908 +
1909 +EOF
1910 +
1911 +exit(0);
1912 +
1913 +sub usage
1914 +       {
1915 +       print STDERR $usage;
1916 +       print STDERR "\npick os/compiler from:\n";
1917 +       my $j=0;
1918 +       my $i;
1919 +        my $k=0;
1920 +       foreach $i (sort keys %table)
1921 +               {
1922 +               next if $i =~ /^debug/;
1923 +               $k += length($i) + 1;
1924 +               if ($k > 78)
1925 +                       {
1926 +                       print STDERR "\n";
1927 +                       $k=length($i);
1928 +                       }
1929 +               print STDERR $i . " ";
1930 +               }
1931 +       foreach $i (sort keys %table)
1932 +               {
1933 +               next if $i !~ /^debug/;
1934 +               $k += length($i) + 1;
1935 +               if ($k > 78)
1936 +                       {
1937 +                       print STDERR "\n";
1938 +                       $k=length($i);
1939 +                       }
1940 +               print STDERR $i . " ";
1941 +               }
1942 +       print STDERR "\n\nNOTE: If in doubt, on Unix-ish systems use './config'.\n";
1943 +       exit(1);
1944 +       }
1945 +
1946 +sub which
1947 +       {
1948 +       my($name)=@_;
1949 +       my $path;
1950 +       foreach $path (split /:/, $ENV{PATH})
1951 +               {
1952 +               if (-f "$path/$name$exe_ext" and -x _)
1953 +                       {
1954 +                       return "$path/$name$exe_ext" unless ($name eq "perl" and
1955 +                        system("$path/$name$exe_ext -e " . '\'exit($]<5.0);\''));
1956 +                       }
1957 +               }
1958 +       }
1959 +
1960 +sub dofile
1961 +       {
1962 +       my $f; my $p; my %m; my @a; my $k; my $ff;
1963 +       ($f,$p,%m)=@_;
1964 +
1965 +       open(IN,"<$f.in") || open(IN,"<$f") || die "unable to open $f:$!\n";
1966 +       @a=<IN>;
1967 +       close(IN);
1968 +       foreach $k (keys %m)
1969 +               {
1970 +               grep(/$k/ && ($_=sprintf($m{$k}."\n",$p)),@a);
1971 +               }
1972 +       open(OUT,">$f.new") || die "unable to open $f.new:$!\n";
1973 +       print OUT @a;
1974 +       close(OUT);
1975 +       rename($f,"$f.bak") || die "unable to rename $f\n" if -e $f;
1976 +       rename("$f.new",$f) || die "unable to rename $f.new\n";
1977 +       }
1978 +
1979 +sub print_table_entry
1980 +       {
1981 +       my $target = shift;
1982 +
1983 +       (my $cc,my $cflags,my $unistd,my $thread_cflag,my $sys_id,my $lflags,
1984 +       my $bn_ops,my $cpuid_obj,my $bn_obj,my $des_obj,my $aes_obj, my $bf_obj,
1985 +       my $md5_obj,my $sha1_obj,my $cast_obj,my $rc4_obj,my $rmd160_obj,
1986 +       my $rc5_obj,my $dso_scheme,my $shared_target,my $shared_cflag,
1987 +       my $shared_ldflag,my $shared_extension,my $ranlib,my $arflags)=
1988 +       split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
1989 +                       
1990 +       print <<EOF
1991 +
1992 +*** $target
1993 +\$cc           = $cc
1994 +\$cflags       = $cflags
1995 +\$unistd       = $unistd
1996 +\$thread_cflag = $thread_cflag
1997 +\$sys_id       = $sys_id
1998 +\$lflags       = $lflags
1999 +\$bn_ops       = $bn_ops
2000 +\$cpuid_obj    = $cpuid_obj
2001 +\$bn_obj       = $bn_obj
2002 +\$des_obj      = $des_obj
2003 +\$aes_obj      = $aes_obj
2004 +\$bf_obj       = $bf_obj
2005 +\$md5_obj      = $md5_obj
2006 +\$sha1_obj     = $sha1_obj
2007 +\$cast_obj     = $cast_obj
2008 +\$rc4_obj      = $rc4_obj
2009 +\$rmd160_obj   = $rmd160_obj
2010 +\$rc5_obj      = $rc5_obj
2011 +\$dso_scheme   = $dso_scheme
2012 +\$shared_target= $shared_target
2013 +\$shared_cflag = $shared_cflag
2014 +\$shared_ldflag = $shared_ldflag
2015 +\$shared_extension = $shared_extension
2016 +\$ranlib       = $ranlib
2017 +\$arflags      = $arflags
2018 +EOF
2019 +       }
2020 +
2021 +sub test_sanity
2022 +       {
2023 +       my $errorcnt = 0;
2024 +
2025 +       print STDERR "=" x 70, "\n";
2026 +       print STDERR "=== SANITY TESTING!\n";
2027 +       print STDERR "=== No configuration will be done, all other arguments will be ignored!\n";
2028 +       print STDERR "=" x 70, "\n";
2029 +
2030 +       foreach $target (sort keys %table)
2031 +               {
2032 +               @fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
2033 +
2034 +               if ($fields[$idx_dso_scheme-1] =~ /^(dl|dlfcn|win32|vms)$/)
2035 +                       {
2036 +                       $errorcnt++;
2037 +                       print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
2038 +                       print STDERR "              in the previous field\n";
2039 +                       }
2040 +               elsif ($fields[$idx_dso_scheme+1] =~ /^(dl|dlfcn|win32|vms)$/)
2041 +                       {
2042 +                       $errorcnt++;
2043 +                       print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
2044 +                       print STDERR "              in the following field\n";
2045 +                       }
2046 +               elsif ($fields[$idx_dso_scheme] !~ /^(dl|dlfcn|win32|vms|)$/)
2047 +                       {
2048 +                       $errorcnt++;
2049 +                       print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] field = ",$fields[$idx_dso_scheme],"\n";
2050 +                       print STDERR "              valid values are 'dl', 'dlfcn', 'win32' and 'vms'\n";
2051 +                       }
2052 +               }
2053 +       print STDERR "No sanity errors detected!\n" if $errorcnt == 0;
2054 +       return $errorcnt;
2055 +       }
2056 +
2057 +# Attempt to detect MSYS environment
2058 +
2059 +sub is_msys
2060 +       {
2061 +       return 1 if (exists $ENV{"TERM"} && $ENV{"TERM"} eq "msys");
2062 +       return 0;
2063 +       }
2064 diff -Naur ../openssl-0.9.8j/crypto/jpake/jpake.c ./crypto/jpake/jpake.c
2065 --- ../openssl-0.9.8j/crypto/jpake/jpake.c      2008-10-27 13:30:31.000000000 +0100
2066 +++ ./crypto/jpake/jpake.c      2009-01-08 10:24:35.000000000 +0100
2067 @@ -5,6 +5,7 @@
2068  #include <openssl/err.h>
2069  #include <memory.h>
2070  #include <assert.h>
2071 +#include <string.h>
2072  
2073  /*
2074   * In the definition, (xa, xb, xc, xd) are Alice's (x1, x2, x3, x4) or
2075 diff -Naur ../openssl-0.9.8j/crypto/sha/sha512.c ./crypto/sha/sha512.c
2076 --- ../openssl-0.9.8j/crypto/sha/sha512.c       2008-09-16 12:47:28.000000000 +0200
2077 +++ ./crypto/sha/sha512.c       2009-01-08 10:24:35.000000000 +0100
2078 @@ -314,7 +314,7 @@
2079  #ifndef PEDANTIC
2080  # if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
2081  #  if defined(__x86_64) || defined(__x86_64__)
2082 -#   define ROTR(a,n)   ({ unsigned long ret;           \
2083 +#   define ROTR(a,n)   ({ SHA_LONG64 ret;      \
2084                                 asm ("rorq %1,%0"       \
2085                                 : "=r"(ret)             \
2086                                 : "J"(n),"0"(a)         \
2087 diff -Naur ../openssl-0.9.8j/crypto/sha/sha512.c.orig ./crypto/sha/sha512.c.orig
2088 --- ../openssl-0.9.8j/crypto/sha/sha512.c.orig  1970-01-01 01:00:00.000000000 +0100
2089 +++ ./crypto/sha/sha512.c.orig  2009-01-08 10:24:35.000000000 +0100
2090 @@ -0,0 +1,547 @@
2091 +/* crypto/sha/sha512.c */
2092 +/* ====================================================================
2093 + * Copyright (c) 2004 The OpenSSL Project.  All rights reserved
2094 + * according to the OpenSSL license [found in ../../LICENSE].
2095 + * ====================================================================
2096 + */
2097 +#include <openssl/opensslconf.h>
2098 +#ifdef OPENSSL_FIPS
2099 +#include <openssl/fips.h>
2100 +#endif
2101 +
2102 +#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA512)
2103 +/*
2104 + * IMPLEMENTATION NOTES.
2105 + *
2106 + * As you might have noticed 32-bit hash algorithms:
2107 + *
2108 + * - permit SHA_LONG to be wider than 32-bit (case on CRAY);
2109 + * - optimized versions implement two transform functions: one operating
2110 + *   on [aligned] data in host byte order and one - on data in input
2111 + *   stream byte order;
2112 + * - share common byte-order neutral collector and padding function
2113 + *   implementations, ../md32_common.h;
2114 + *
2115 + * Neither of the above applies to this SHA-512 implementations. Reasons
2116 + * [in reverse order] are:
2117 + *
2118 + * - it's the only 64-bit hash algorithm for the moment of this writing,
2119 + *   there is no need for common collector/padding implementation [yet];
2120 + * - by supporting only one transform function [which operates on
2121 + *   *aligned* data in input stream byte order, big-endian in this case]
2122 + *   we minimize burden of maintenance in two ways: a) collector/padding
2123 + *   function is simpler; b) only one transform function to stare at;
2124 + * - SHA_LONG64 is required to be exactly 64-bit in order to be able to
2125 + *   apply a number of optimizations to mitigate potential performance
2126 + *   penalties caused by previous design decision;
2127 + *
2128 + * Caveat lector.
2129 + *
2130 + * Implementation relies on the fact that "long long" is 64-bit on
2131 + * both 32- and 64-bit platforms. If some compiler vendor comes up
2132 + * with 128-bit long long, adjustment to sha.h would be required.
2133 + * As this implementation relies on 64-bit integer type, it's totally
2134 + * inappropriate for platforms which don't support it, most notably
2135 + * 16-bit platforms.
2136 + *                                     <appro@fy.chalmers.se>
2137 + */
2138 +#include <stdlib.h>
2139 +#include <string.h>
2140 +
2141 +#include <openssl/crypto.h>
2142 +#include <openssl/sha.h>
2143 +#include <openssl/opensslv.h>
2144 +
2145 +#include "cryptlib.h"
2146 +
2147 +const char SHA512_version[]="SHA-512" OPENSSL_VERSION_PTEXT;
2148 +
2149 +#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
2150 +    defined(__x86_64) || defined(_M_AMD64) || defined(_M_X64) || \
2151 +    defined(__s390__) || defined(__s390x__) || \
2152 +    defined(SHA512_ASM)
2153 +#define SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA
2154 +#endif
2155 +
2156 +int SHA384_Init (SHA512_CTX *c)
2157 +       {
2158 +#ifdef OPENSSL_FIPS
2159 +       FIPS_selftest_check();
2160 +#endif
2161 +       c->h[0]=U64(0xcbbb9d5dc1059ed8);
2162 +       c->h[1]=U64(0x629a292a367cd507);
2163 +       c->h[2]=U64(0x9159015a3070dd17);
2164 +       c->h[3]=U64(0x152fecd8f70e5939);
2165 +       c->h[4]=U64(0x67332667ffc00b31);
2166 +       c->h[5]=U64(0x8eb44a8768581511);
2167 +       c->h[6]=U64(0xdb0c2e0d64f98fa7);
2168 +       c->h[7]=U64(0x47b5481dbefa4fa4);
2169 +        c->Nl=0;        c->Nh=0;
2170 +        c->num=0;       c->md_len=SHA384_DIGEST_LENGTH;
2171 +        return 1;
2172 +       }
2173 +
2174 +int SHA512_Init (SHA512_CTX *c)
2175 +       {
2176 +#ifdef OPENSSL_FIPS
2177 +       FIPS_selftest_check();
2178 +#endif
2179 +       c->h[0]=U64(0x6a09e667f3bcc908);
2180 +       c->h[1]=U64(0xbb67ae8584caa73b);
2181 +       c->h[2]=U64(0x3c6ef372fe94f82b);
2182 +       c->h[3]=U64(0xa54ff53a5f1d36f1);
2183 +       c->h[4]=U64(0x510e527fade682d1);
2184 +       c->h[5]=U64(0x9b05688c2b3e6c1f);
2185 +       c->h[6]=U64(0x1f83d9abfb41bd6b);
2186 +       c->h[7]=U64(0x5be0cd19137e2179);
2187 +        c->Nl=0;        c->Nh=0;
2188 +        c->num=0;       c->md_len=SHA512_DIGEST_LENGTH;
2189 +        return 1;
2190 +       }
2191 +
2192 +#ifndef SHA512_ASM
2193 +static
2194 +#endif
2195 +void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size_t num);
2196 +
2197 +int SHA512_Final (unsigned char *md, SHA512_CTX *c)
2198 +       {
2199 +       unsigned char *p=(unsigned char *)c->u.p;
2200 +       size_t n=c->num;
2201 +
2202 +       p[n]=0x80;      /* There always is a room for one */
2203 +       n++;
2204 +       if (n > (sizeof(c->u)-16))
2205 +               memset (p+n,0,sizeof(c->u)-n), n=0,
2206 +               sha512_block_data_order (c,p,1);
2207 +
2208 +       memset (p+n,0,sizeof(c->u)-16-n);
2209 +#ifdef B_ENDIAN
2210 +       c->u.d[SHA_LBLOCK-2] = c->Nh;
2211 +       c->u.d[SHA_LBLOCK-1] = c->Nl;
2212 +#else
2213 +       p[sizeof(c->u)-1]  = (unsigned char)(c->Nl);
2214 +       p[sizeof(c->u)-2]  = (unsigned char)(c->Nl>>8);
2215 +       p[sizeof(c->u)-3]  = (unsigned char)(c->Nl>>16);
2216 +       p[sizeof(c->u)-4]  = (unsigned char)(c->Nl>>24);
2217 +       p[sizeof(c->u)-5]  = (unsigned char)(c->Nl>>32);
2218 +       p[sizeof(c->u)-6]  = (unsigned char)(c->Nl>>40);
2219 +       p[sizeof(c->u)-7]  = (unsigned char)(c->Nl>>48);
2220 +       p[sizeof(c->u)-8]  = (unsigned char)(c->Nl>>56);
2221 +       p[sizeof(c->u)-9]  = (unsigned char)(c->Nh);
2222 +       p[sizeof(c->u)-10] = (unsigned char)(c->Nh>>8);
2223 +       p[sizeof(c->u)-11] = (unsigned char)(c->Nh>>16);
2224 +       p[sizeof(c->u)-12] = (unsigned char)(c->Nh>>24);
2225 +       p[sizeof(c->u)-13] = (unsigned char)(c->Nh>>32);
2226 +       p[sizeof(c->u)-14] = (unsigned char)(c->Nh>>40);
2227 +       p[sizeof(c->u)-15] = (unsigned char)(c->Nh>>48);
2228 +       p[sizeof(c->u)-16] = (unsigned char)(c->Nh>>56);
2229 +#endif
2230 +
2231 +       sha512_block_data_order (c,p,1);
2232 +
2233 +       if (md==0) return 0;
2234 +
2235 +       switch (c->md_len)
2236 +               {
2237 +               /* Let compiler decide if it's appropriate to unroll... */
2238 +               case SHA384_DIGEST_LENGTH:
2239 +                       for (n=0;n<SHA384_DIGEST_LENGTH/8;n++)
2240 +                               {
2241 +                               SHA_LONG64 t = c->h[n];
2242 +
2243 +                               *(md++) = (unsigned char)(t>>56);
2244 +                               *(md++) = (unsigned char)(t>>48);
2245 +                               *(md++) = (unsigned char)(t>>40);
2246 +                               *(md++) = (unsigned char)(t>>32);
2247 +                               *(md++) = (unsigned char)(t>>24);
2248 +                               *(md++) = (unsigned char)(t>>16);
2249 +                               *(md++) = (unsigned char)(t>>8);
2250 +                               *(md++) = (unsigned char)(t);
2251 +                               }
2252 +                       break;
2253 +               case SHA512_DIGEST_LENGTH:
2254 +                       for (n=0;n<SHA512_DIGEST_LENGTH/8;n++)
2255 +                               {
2256 +                               SHA_LONG64 t = c->h[n];
2257 +
2258 +                               *(md++) = (unsigned char)(t>>56);
2259 +                               *(md++) = (unsigned char)(t>>48);
2260 +                               *(md++) = (unsigned char)(t>>40);
2261 +                               *(md++) = (unsigned char)(t>>32);
2262 +                               *(md++) = (unsigned char)(t>>24);
2263 +                               *(md++) = (unsigned char)(t>>16);
2264 +                               *(md++) = (unsigned char)(t>>8);
2265 +                               *(md++) = (unsigned char)(t);
2266 +                               }
2267 +                       break;
2268 +               /* ... as well as make sure md_len is not abused. */
2269 +               default:        return 0;
2270 +               }
2271 +
2272 +       return 1;
2273 +       }
2274 +
2275 +int SHA384_Final (unsigned char *md,SHA512_CTX *c)
2276 +{   return SHA512_Final (md,c);   }
2277 +
2278 +int SHA512_Update (SHA512_CTX *c, const void *_data, size_t len)
2279 +       {
2280 +       SHA_LONG64      l;
2281 +       unsigned char  *p=c->u.p;
2282 +       const unsigned char *data=(const unsigned char *)_data;
2283 +
2284 +       if (len==0) return  1;
2285 +
2286 +       l = (c->Nl+(((SHA_LONG64)len)<<3))&U64(0xffffffffffffffff);
2287 +       if (l < c->Nl)          c->Nh++;
2288 +       if (sizeof(len)>=8)     c->Nh+=(((SHA_LONG64)len)>>61);
2289 +       c->Nl=l;
2290 +
2291 +       if (c->num != 0)
2292 +               {
2293 +               size_t n = sizeof(c->u) - c->num;
2294 +
2295 +               if (len < n)
2296 +                       {
2297 +                       memcpy (p+c->num,data,len), c->num += len;
2298 +                       return 1;
2299 +                       }
2300 +               else    {
2301 +                       memcpy (p+c->num,data,n), c->num = 0;
2302 +                       len-=n, data+=n;
2303 +                       sha512_block_data_order (c,p,1);
2304 +                       }
2305 +               }
2306 +
2307 +       if (len >= sizeof(c->u))
2308 +               {
2309 +#ifndef SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA
2310 +               if ((size_t)data%sizeof(c->u.d[0]) != 0)
2311 +                       while (len >= sizeof(c->u))
2312 +                               memcpy (p,data,sizeof(c->u)),
2313 +                               sha512_block_data_order (c,p,1),
2314 +                               len  -= sizeof(c->u),
2315 +                               data += sizeof(c->u);
2316 +               else
2317 +#endif
2318 +                       sha512_block_data_order (c,data,len/sizeof(c->u)),
2319 +                       data += len,
2320 +                       len  %= sizeof(c->u),
2321 +                       data -= len;
2322 +               }
2323 +
2324 +       if (len != 0)   memcpy (p,data,len), c->num = (int)len;
2325 +
2326 +       return 1;
2327 +       }
2328 +
2329 +int SHA384_Update (SHA512_CTX *c, const void *data, size_t len)
2330 +{   return SHA512_Update (c,data,len);   }
2331 +
2332 +void SHA512_Transform (SHA512_CTX *c, const unsigned char *data)
2333 +{   sha512_block_data_order (c,data,1);  }
2334 +
2335 +unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md)
2336 +       {
2337 +       SHA512_CTX c;
2338 +       static unsigned char m[SHA384_DIGEST_LENGTH];
2339 +
2340 +       if (md == NULL) md=m;
2341 +       SHA384_Init(&c);
2342 +       SHA512_Update(&c,d,n);
2343 +       SHA512_Final(md,&c);
2344 +       OPENSSL_cleanse(&c,sizeof(c));
2345 +       return(md);
2346 +       }
2347 +
2348 +unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md)
2349 +       {
2350 +       SHA512_CTX c;
2351 +       static unsigned char m[SHA512_DIGEST_LENGTH];
2352 +
2353 +       if (md == NULL) md=m;
2354 +       SHA512_Init(&c);
2355 +       SHA512_Update(&c,d,n);
2356 +       SHA512_Final(md,&c);
2357 +       OPENSSL_cleanse(&c,sizeof(c));
2358 +       return(md);
2359 +       }
2360 +
2361 +#ifndef SHA512_ASM
2362 +static const SHA_LONG64 K512[80] = {
2363 +        U64(0x428a2f98d728ae22),U64(0x7137449123ef65cd),
2364 +        U64(0xb5c0fbcfec4d3b2f),U64(0xe9b5dba58189dbbc),
2365 +        U64(0x3956c25bf348b538),U64(0x59f111f1b605d019),
2366 +        U64(0x923f82a4af194f9b),U64(0xab1c5ed5da6d8118),
2367 +        U64(0xd807aa98a3030242),U64(0x12835b0145706fbe),
2368 +        U64(0x243185be4ee4b28c),U64(0x550c7dc3d5ffb4e2),
2369 +        U64(0x72be5d74f27b896f),U64(0x80deb1fe3b1696b1),
2370 +        U64(0x9bdc06a725c71235),U64(0xc19bf174cf692694),
2371 +        U64(0xe49b69c19ef14ad2),U64(0xefbe4786384f25e3),
2372 +        U64(0x0fc19dc68b8cd5b5),U64(0x240ca1cc77ac9c65),
2373 +        U64(0x2de92c6f592b0275),U64(0x4a7484aa6ea6e483),
2374 +        U64(0x5cb0a9dcbd41fbd4),U64(0x76f988da831153b5),
2375 +        U64(0x983e5152ee66dfab),U64(0xa831c66d2db43210),
2376 +        U64(0xb00327c898fb213f),U64(0xbf597fc7beef0ee4),
2377 +        U64(0xc6e00bf33da88fc2),U64(0xd5a79147930aa725),
2378 +        U64(0x06ca6351e003826f),U64(0x142929670a0e6e70),
2379 +        U64(0x27b70a8546d22ffc),U64(0x2e1b21385c26c926),
2380 +        U64(0x4d2c6dfc5ac42aed),U64(0x53380d139d95b3df),
2381 +        U64(0x650a73548baf63de),U64(0x766a0abb3c77b2a8),
2382 +        U64(0x81c2c92e47edaee6),U64(0x92722c851482353b),
2383 +        U64(0xa2bfe8a14cf10364),U64(0xa81a664bbc423001),
2384 +        U64(0xc24b8b70d0f89791),U64(0xc76c51a30654be30),
2385 +        U64(0xd192e819d6ef5218),U64(0xd69906245565a910),
2386 +        U64(0xf40e35855771202a),U64(0x106aa07032bbd1b8),
2387 +        U64(0x19a4c116b8d2d0c8),U64(0x1e376c085141ab53),
2388 +        U64(0x2748774cdf8eeb99),U64(0x34b0bcb5e19b48a8),
2389 +        U64(0x391c0cb3c5c95a63),U64(0x4ed8aa4ae3418acb),
2390 +        U64(0x5b9cca4f7763e373),U64(0x682e6ff3d6b2b8a3),
2391 +        U64(0x748f82ee5defb2fc),U64(0x78a5636f43172f60),
2392 +        U64(0x84c87814a1f0ab72),U64(0x8cc702081a6439ec),
2393 +        U64(0x90befffa23631e28),U64(0xa4506cebde82bde9),
2394 +        U64(0xbef9a3f7b2c67915),U64(0xc67178f2e372532b),
2395 +        U64(0xca273eceea26619c),U64(0xd186b8c721c0c207),
2396 +        U64(0xeada7dd6cde0eb1e),U64(0xf57d4f7fee6ed178),
2397 +        U64(0x06f067aa72176fba),U64(0x0a637dc5a2c898a6),
2398 +        U64(0x113f9804bef90dae),U64(0x1b710b35131c471b),
2399 +        U64(0x28db77f523047d84),U64(0x32caab7b40c72493),
2400 +        U64(0x3c9ebe0a15c9bebc),U64(0x431d67c49c100d4c),
2401 +        U64(0x4cc5d4becb3e42b6),U64(0x597f299cfc657e2a),
2402 +        U64(0x5fcb6fab3ad6faec),U64(0x6c44198c4a475817) };
2403 +
2404 +#ifndef PEDANTIC
2405 +# if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
2406 +#  if defined(__x86_64) || defined(__x86_64__)
2407 +#   define ROTR(a,n)   ({ unsigned long ret;           \
2408 +                               asm ("rorq %1,%0"       \
2409 +                               : "=r"(ret)             \
2410 +                               : "J"(n),"0"(a)         \
2411 +                               : "cc"); ret;           })
2412 +#   if !defined(B_ENDIAN)
2413 +#    define PULL64(x) ({ SHA_LONG64 ret=*((const SHA_LONG64 *)(&(x))); \
2414 +                               asm ("bswapq    %0"             \
2415 +                               : "=r"(ret)                     \
2416 +                               : "0"(ret)); ret;               })
2417 +#   endif
2418 +#  elif (defined(__i386) || defined(__i386__)) && !defined(B_ENDIAN)
2419 +#   if defined(I386_ONLY)
2420 +#    define PULL64(x) ({ const unsigned int *p=(const unsigned int *)(&(x));\
2421 +                        unsigned int hi=p[0],lo=p[1];          \
2422 +                               asm("xchgb %%ah,%%al;xchgb %%dh,%%dl;"\
2423 +                                   "roll $16,%%eax; roll $16,%%edx; "\
2424 +                                   "xchgb %%ah,%%al;xchgb %%dh,%%dl;" \
2425 +                               : "=a"(lo),"=d"(hi)             \
2426 +                               : "0"(lo),"1"(hi) : "cc");      \
2427 +                               ((SHA_LONG64)hi)<<32|lo;        })
2428 +#   else
2429 +#    define PULL64(x) ({ const unsigned int *p=(const unsigned int *)(&(x));\
2430 +                        unsigned int hi=p[0],lo=p[1];                  \
2431 +                               asm ("bswapl %0; bswapl %1;"    \
2432 +                               : "=r"(lo),"=r"(hi)             \
2433 +                               : "0"(lo),"1"(hi));             \
2434 +                               ((SHA_LONG64)hi)<<32|lo;        })
2435 +#   endif
2436 +#  elif (defined(_ARCH_PPC) && defined(__64BIT__)) || defined(_ARCH_PPC64)
2437 +#   define ROTR(a,n)   ({ unsigned long ret;           \
2438 +                               asm ("rotrdi %0,%1,%2"  \
2439 +                               : "=r"(ret)             \
2440 +                               : "r"(a),"K"(n)); ret;  })
2441 +#  endif
2442 +# elif defined(_MSC_VER)
2443 +#  if defined(_WIN64)  /* applies to both IA-64 and AMD64 */
2444 +#   define ROTR(a,n)   _rotr64((a),n)
2445 +#  endif
2446 +#  if defined(_M_IX86) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
2447 +#   if defined(I386_ONLY)
2448 +    static SHA_LONG64 __fastcall __pull64be(const void *x)
2449 +    {  _asm    mov     edx, [ecx + 0]
2450 +       _asm    mov     eax, [ecx + 4]
2451 +       _asm    xchg    dh,dl
2452 +       _asm    xchg    ah,al
2453 +       _asm    rol     edx,16
2454 +       _asm    rol     eax,16
2455 +       _asm    xchg    dh,dl
2456 +       _asm    xchg    ah,al
2457 +    }
2458 +#   else
2459 +    static SHA_LONG64 __fastcall __pull64be(const void *x)
2460 +    {  _asm    mov     edx, [ecx + 0]
2461 +       _asm    mov     eax, [ecx + 4]
2462 +       _asm    bswap   edx
2463 +       _asm    bswap   eax
2464 +    }
2465 +#   endif
2466 +#   define PULL64(x) __pull64be(&(x))
2467 +#   if _MSC_VER<=1200
2468 +#    pragma inline_depth(0)
2469 +#   endif
2470 +#  endif
2471 +# endif
2472 +#endif
2473 +
2474 +#ifndef PULL64
2475 +#define B(x,j)    (((SHA_LONG64)(*(((const unsigned char *)(&x))+j)))<<((7-j)*8))
2476 +#define PULL64(x) (B(x,0)|B(x,1)|B(x,2)|B(x,3)|B(x,4)|B(x,5)|B(x,6)|B(x,7))
2477 +#endif
2478 +
2479 +#ifndef ROTR
2480 +#define ROTR(x,s)      (((x)>>s) | (x)<<(64-s))
2481 +#endif
2482 +
2483 +#define Sigma0(x)      (ROTR((x),28) ^ ROTR((x),34) ^ ROTR((x),39))
2484 +#define Sigma1(x)      (ROTR((x),14) ^ ROTR((x),18) ^ ROTR((x),41))
2485 +#define sigma0(x)      (ROTR((x),1)  ^ ROTR((x),8)  ^ ((x)>>7))
2486 +#define sigma1(x)      (ROTR((x),19) ^ ROTR((x),61) ^ ((x)>>6))
2487 +
2488 +#define Ch(x,y,z)      (((x) & (y)) ^ ((~(x)) & (z)))
2489 +#define Maj(x,y,z)     (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
2490 +
2491 +#if defined(OPENSSL_IA32_SSE2) && !defined(OPENSSL_NO_ASM) && !defined(I386_ONLY)
2492 +#define        GO_FOR_SSE2(ctx,in,num)         do {            \
2493 +       void    sha512_block_sse2(void *,const void *,size_t);  \
2494 +       if (!(OPENSSL_ia32cap_P & (1<<26))) break;      \
2495 +       sha512_block_sse2(ctx->h,in,num); return;       \
2496 +                                       } while (0)
2497 +#endif
2498 +
2499 +#ifdef OPENSSL_SMALL_FOOTPRINT
2500 +
2501 +static void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size_t num)
2502 +       {
2503 +       const SHA_LONG64 *W=in;
2504 +       SHA_LONG64      a,b,c,d,e,f,g,h,s0,s1,T1,T2;
2505 +       SHA_LONG64      X[16];
2506 +       int i;
2507 +
2508 +#ifdef GO_FOR_SSE2
2509 +       GO_FOR_SSE2(ctx,in,num);
2510 +#endif
2511 +
2512 +                       while (num--) {
2513 +
2514 +       a = ctx->h[0];  b = ctx->h[1];  c = ctx->h[2];  d = ctx->h[3];
2515 +       e = ctx->h[4];  f = ctx->h[5];  g = ctx->h[6];  h = ctx->h[7];
2516 +
2517 +       for (i=0;i<16;i++)
2518 +               {
2519 +#ifdef B_ENDIAN
2520 +               T1 = X[i] = W[i];
2521 +#else
2522 +               T1 = X[i] = PULL64(W[i]);
2523 +#endif
2524 +               T1 += h + Sigma1(e) + Ch(e,f,g) + K512[i];
2525 +               T2 = Sigma0(a) + Maj(a,b,c);
2526 +               h = g;  g = f;  f = e;  e = d + T1;
2527 +               d = c;  c = b;  b = a;  a = T1 + T2;
2528 +               }
2529 +
2530 +       for (;i<80;i++)
2531 +               {
2532 +               s0 = X[(i+1)&0x0f];     s0 = sigma0(s0);
2533 +               s1 = X[(i+14)&0x0f];    s1 = sigma1(s1);
2534 +
2535 +               T1 = X[i&0xf] += s0 + s1 + X[(i+9)&0xf];
2536 +               T1 += h + Sigma1(e) + Ch(e,f,g) + K512[i];
2537 +               T2 = Sigma0(a) + Maj(a,b,c);
2538 +               h = g;  g = f;  f = e;  e = d + T1;
2539 +               d = c;  c = b;  b = a;  a = T1 + T2;
2540 +               }
2541 +
2542 +       ctx->h[0] += a; ctx->h[1] += b; ctx->h[2] += c; ctx->h[3] += d;
2543 +       ctx->h[4] += e; ctx->h[5] += f; ctx->h[6] += g; ctx->h[7] += h;
2544 +
2545 +                       W+=SHA_LBLOCK;
2546 +                       }
2547 +       }
2548 +
2549 +#else
2550 +
2551 +#define        ROUND_00_15(i,a,b,c,d,e,f,g,h)          do {    \
2552 +       T1 += h + Sigma1(e) + Ch(e,f,g) + K512[i];      \
2553 +       h = Sigma0(a) + Maj(a,b,c);                     \
2554 +       d += T1;        h += T1;                } while (0)
2555 +
2556 +#define        ROUND_16_80(i,a,b,c,d,e,f,g,h,X)        do {    \
2557 +       s0 = X[(i+1)&0x0f];     s0 = sigma0(s0);        \
2558 +       s1 = X[(i+14)&0x0f];    s1 = sigma1(s1);        \
2559 +       T1 = X[(i)&0x0f] += s0 + s1 + X[(i+9)&0x0f];    \
2560 +       ROUND_00_15(i,a,b,c,d,e,f,g,h);         } while (0)
2561 +
2562 +static void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size_t num)
2563 +       {
2564 +       const SHA_LONG64 *W=in;
2565 +       SHA_LONG64      a,b,c,d,e,f,g,h,s0,s1,T1;
2566 +       SHA_LONG64      X[16];
2567 +       int i;
2568 +
2569 +#ifdef GO_FOR_SSE2
2570 +       GO_FOR_SSE2(ctx,in,num);
2571 +#endif
2572 +
2573 +                       while (num--) {
2574 +
2575 +       a = ctx->h[0];  b = ctx->h[1];  c = ctx->h[2];  d = ctx->h[3];
2576 +       e = ctx->h[4];  f = ctx->h[5];  g = ctx->h[6];  h = ctx->h[7];
2577 +
2578 +#ifdef B_ENDIAN
2579 +       T1 = X[0] = W[0];       ROUND_00_15(0,a,b,c,d,e,f,g,h);
2580 +       T1 = X[1] = W[1];       ROUND_00_15(1,h,a,b,c,d,e,f,g);
2581 +       T1 = X[2] = W[2];       ROUND_00_15(2,g,h,a,b,c,d,e,f);
2582 +       T1 = X[3] = W[3];       ROUND_00_15(3,f,g,h,a,b,c,d,e);
2583 +       T1 = X[4] = W[4];       ROUND_00_15(4,e,f,g,h,a,b,c,d);
2584 +       T1 = X[5] = W[5];       ROUND_00_15(5,d,e,f,g,h,a,b,c);
2585 +       T1 = X[6] = W[6];       ROUND_00_15(6,c,d,e,f,g,h,a,b);
2586 +       T1 = X[7] = W[7];       ROUND_00_15(7,b,c,d,e,f,g,h,a);
2587 +       T1 = X[8] = W[8];       ROUND_00_15(8,a,b,c,d,e,f,g,h);
2588 +       T1 = X[9] = W[9];       ROUND_00_15(9,h,a,b,c,d,e,f,g);
2589 +       T1 = X[10] = W[10];     ROUND_00_15(10,g,h,a,b,c,d,e,f);
2590 +       T1 = X[11] = W[11];     ROUND_00_15(11,f,g,h,a,b,c,d,e);
2591 +       T1 = X[12] = W[12];     ROUND_00_15(12,e,f,g,h,a,b,c,d);
2592 +       T1 = X[13] = W[13];     ROUND_00_15(13,d,e,f,g,h,a,b,c);
2593 +       T1 = X[14] = W[14];     ROUND_00_15(14,c,d,e,f,g,h,a,b);
2594 +       T1 = X[15] = W[15];     ROUND_00_15(15,b,c,d,e,f,g,h,a);
2595 +#else
2596 +       T1 = X[0]  = PULL64(W[0]);      ROUND_00_15(0,a,b,c,d,e,f,g,h);
2597 +       T1 = X[1]  = PULL64(W[1]);      ROUND_00_15(1,h,a,b,c,d,e,f,g);
2598 +       T1 = X[2]  = PULL64(W[2]);      ROUND_00_15(2,g,h,a,b,c,d,e,f);
2599 +       T1 = X[3]  = PULL64(W[3]);      ROUND_00_15(3,f,g,h,a,b,c,d,e);
2600 +       T1 = X[4]  = PULL64(W[4]);      ROUND_00_15(4,e,f,g,h,a,b,c,d);
2601 +       T1 = X[5]  = PULL64(W[5]);      ROUND_00_15(5,d,e,f,g,h,a,b,c);
2602 +       T1 = X[6]  = PULL64(W[6]);      ROUND_00_15(6,c,d,e,f,g,h,a,b);
2603 +       T1 = X[7]  = PULL64(W[7]);      ROUND_00_15(7,b,c,d,e,f,g,h,a);
2604 +       T1 = X[8]  = PULL64(W[8]);      ROUND_00_15(8,a,b,c,d,e,f,g,h);
2605 +       T1 = X[9]  = PULL64(W[9]);      ROUND_00_15(9,h,a,b,c,d,e,f,g);
2606 +       T1 = X[10] = PULL64(W[10]);     ROUND_00_15(10,g,h,a,b,c,d,e,f);
2607 +       T1 = X[11] = PULL64(W[11]);     ROUND_00_15(11,f,g,h,a,b,c,d,e);
2608 +       T1 = X[12] = PULL64(W[12]);     ROUND_00_15(12,e,f,g,h,a,b,c,d);
2609 +       T1 = X[13] = PULL64(W[13]);     ROUND_00_15(13,d,e,f,g,h,a,b,c);
2610 +       T1 = X[14] = PULL64(W[14]);     ROUND_00_15(14,c,d,e,f,g,h,a,b);
2611 +       T1 = X[15] = PULL64(W[15]);     ROUND_00_15(15,b,c,d,e,f,g,h,a);
2612 +#endif
2613 +
2614 +       for (i=16;i<80;i+=8)
2615 +               {
2616 +               ROUND_16_80(i+0,a,b,c,d,e,f,g,h,X);
2617 +               ROUND_16_80(i+1,h,a,b,c,d,e,f,g,X);
2618 +               ROUND_16_80(i+2,g,h,a,b,c,d,e,f,X);
2619 +               ROUND_16_80(i+3,f,g,h,a,b,c,d,e,X);
2620 +               ROUND_16_80(i+4,e,f,g,h,a,b,c,d,X);
2621 +               ROUND_16_80(i+5,d,e,f,g,h,a,b,c,X);
2622 +               ROUND_16_80(i+6,c,d,e,f,g,h,a,b,X);
2623 +               ROUND_16_80(i+7,b,c,d,e,f,g,h,a,X);
2624 +               }
2625 +
2626 +       ctx->h[0] += a; ctx->h[1] += b; ctx->h[2] += c; ctx->h[3] += d;
2627 +       ctx->h[4] += e; ctx->h[5] += f; ctx->h[6] += g; ctx->h[7] += h;
2628 +
2629 +                       W+=SHA_LBLOCK;
2630 +                       }
2631 +       }
2632 +
2633 +#endif
2634 +
2635 +#endif /* SHA512_ASM */
2636 +
2637 +#endif /* OPENSSL_NO_SHA512 */
2638 diff -Naur ../openssl-0.9.8j/engines/e_aep.c ./engines/e_aep.c
2639 --- ../openssl-0.9.8j/engines/e_aep.c   2008-12-30 14:30:57.000000000 +0100
2640 +++ ./engines/e_aep.c   2009-01-08 10:24:35.000000000 +0100
2641 @@ -62,8 +62,10 @@
2642  #include <unistd.h>
2643  #else
2644  #include <process.h>
2645 +#ifndef _PID_T_
2646  typedef int pid_t;
2647  #endif
2648 +#endif
2649  
2650  #if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB)
2651  #define getpid GetThreadID
2652 diff -Naur ../openssl-0.9.8j/e_os2.h ./e_os2.h
2653 --- ../openssl-0.9.8j/e_os2.h   2005-12-18 19:57:07.000000000 +0100
2654 +++ ./e_os2.h   2009-01-08 10:24:35.000000000 +0100
2655 @@ -264,7 +264,7 @@
2656  # define OPENSSL_IMPLEMENT_GLOBAL(type,name)                        \
2657         extern type _hide_##name;                                    \
2658         type *_shadow_##name(void) { return &_hide_##name; }         \
2659 -       static type _hide_##name
2660 +       type _hide_##name
2661  # define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void)
2662  # define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name()))
2663  #else