Compare commits
	
		
			130 Commits
		
	
	
		
			OpenSSL-fi
			...
			OpenSSL_0_
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					bfb7bac83b | ||
| 
						 | 
					ac4fb4a138 | ||
| 
						 | 
					75f7141ab4 | ||
| 
						 | 
					23a6dd83b5 | ||
| 
						 | 
					450b38c05b | ||
| 
						 | 
					0286cccbc1 | ||
| 
						 | 
					dc26d1193a | ||
| 
						 | 
					64892df03e | ||
| 
						 | 
					9e57ab615c | ||
| 
						 | 
					b16fee0aa7 | ||
| 
						 | 
					70bfcc895e | ||
| 
						 | 
					8de8bcbe2c | ||
| 
						 | 
					14e21742d5 | ||
| 
						 | 
					44963e4af7 | ||
| 
						 | 
					125a86113f | ||
| 
						 | 
					d06db8ad9e | ||
| 
						 | 
					ffa8e7b74c | ||
| 
						 | 
					85e8decc16 | ||
| 
						 | 
					3216de1ee5 | ||
| 
						 | 
					8f349c58f7 | ||
| 
						 | 
					cfafb6a73d | ||
| 
						 | 
					818c0b2e42 | ||
| 
						 | 
					aef8807e76 | ||
| 
						 | 
					4157fae6fe | ||
| 
						 | 
					15902f8341 | ||
| 
						 | 
					8bcd746e84 | ||
| 
						 | 
					56fe40191d | ||
| 
						 | 
					97c802588c | ||
| 
						 | 
					8c172bce1c | ||
| 
						 | 
					4fa9664f5e | ||
| 
						 | 
					483b312391 | ||
| 
						 | 
					1033449613 | ||
| 
						 | 
					f992081682 | ||
| 
						 | 
					5ad93a12b2 | ||
| 
						 | 
					efeb352163 | ||
| 
						 | 
					44dd6865b9 | ||
| 
						 | 
					bb82123707 | ||
| 
						 | 
					eb7bb58471 | ||
| 
						 | 
					7f9c37457a | ||
| 
						 | 
					86022a79a5 | ||
| 
						 | 
					88a8ae6aee | ||
| 
						 | 
					b58e24ac57 | ||
| 
						 | 
					496c4e1033 | ||
| 
						 | 
					0b948f3677 | ||
| 
						 | 
					7f911c668d | ||
| 
						 | 
					e81ef01a0a | ||
| 
						 | 
					d2033156c5 | ||
| 
						 | 
					e4c1c03c5b | ||
| 
						 | 
					5edd0f51e3 | ||
| 
						 | 
					1ecb88b95a | ||
| 
						 | 
					03ecfadf3d | ||
| 
						 | 
					64c6865427 | ||
| 
						 | 
					43894f9c0d | ||
| 
						 | 
					40007ad24d | ||
| 
						 | 
					c6e27dcf31 | ||
| 
						 | 
					a47e836efe | ||
| 
						 | 
					370358dfb4 | ||
| 
						 | 
					a77b16abd4 | ||
| 
						 | 
					061c8f977d | ||
| 
						 | 
					d70f5891da | ||
| 
						 | 
					901959c945 | ||
| 
						 | 
					a857495d17 | ||
| 
						 | 
					b1640e47e4 | ||
| 
						 | 
					5358bc44f4 | ||
| 
						 | 
					a7f14cb4c6 | ||
| 
						 | 
					531b538df5 | ||
| 
						 | 
					49ede900fa | ||
| 
						 | 
					7c6cf1b176 | ||
| 
						 | 
					fa5cea169a | ||
| 
						 | 
					83f22920c2 | ||
| 
						 | 
					bec15f2109 | ||
| 
						 | 
					43c0d77296 | ||
| 
						 | 
					46b7624b8e | ||
| 
						 | 
					9e356100d0 | ||
| 
						 | 
					7ca482062f | ||
| 
						 | 
					ef4c5802ec | ||
| 
						 | 
					fee38dcb9a | ||
| 
						 | 
					c116de76ad | ||
| 
						 | 
					6069bdbe27 | ||
| 
						 | 
					871fe9107d | ||
| 
						 | 
					2663f39ff9 | ||
| 
						 | 
					9f0856208b | ||
| 
						 | 
					fb4de3deed | ||
| 
						 | 
					4d4716dc03 | ||
| 
						 | 
					b5e4469150 | ||
| 
						 | 
					3e00d6c4bb | ||
| 
						 | 
					5e86220660 | ||
| 
						 | 
					4313847660 | ||
| 
						 | 
					3844adbf58 | ||
| 
						 | 
					d8e2073449 | ||
| 
						 | 
					e9f7ebd674 | ||
| 
						 | 
					5affe206e1 | ||
| 
						 | 
					1f4eccaaa5 | ||
| 
						 | 
					07bf82a71d | ||
| 
						 | 
					43d6233a22 | ||
| 
						 | 
					736ce650c6 | ||
| 
						 | 
					a8bb3d0e15 | ||
| 
						 | 
					f27a152f69 | ||
| 
						 | 
					63d494b22c | ||
| 
						 | 
					9ac9a29407 | ||
| 
						 | 
					bdb4a7e092 | ||
| 
						 | 
					0163602573 | ||
| 
						 | 
					bac2e26a9e | ||
| 
						 | 
					10eae14f9b | ||
| 
						 | 
					745c7356c2 | ||
| 
						 | 
					e31c121315 | ||
| 
						 | 
					dbf2ac31c9 | ||
| 
						 | 
					4108d365bf | ||
| 
						 | 
					03ef2c333c | ||
| 
						 | 
					7922ba2feb | ||
| 
						 | 
					d94b22235f | ||
| 
						 | 
					72d75ee206 | ||
| 
						 | 
					49bc4c1023 | ||
| 
						 | 
					0e92f7738a | ||
| 
						 | 
					d529f2a8f7 | ||
| 
						 | 
					141a64faff | ||
| 
						 | 
					035dcd3724 | ||
| 
						 | 
					3e9c37a386 | ||
| 
						 | 
					00a59641ee | ||
| 
						 | 
					90cce79346 | ||
| 
						 | 
					4eeaf52ed9 | ||
| 
						 | 
					3642f632d3 | ||
| 
						 | 
					aaa16d0001 | ||
| 
						 | 
					3b8ba6b610 | ||
| 
						 | 
					535aef9def | ||
| 
						 | 
					6e308baf5a | ||
| 
						 | 
					5a9d2d9081 | ||
| 
						 | 
					688791b22b | ||
| 
						 | 
					8e94e99ccb | ||
| 
						 | 
					e20db94948 | 
@@ -1,5 +1,5 @@
 | 
			
		||||
openssl.pc
 | 
			
		||||
Makefile.ssl
 | 
			
		||||
Makefile
 | 
			
		||||
MINFO
 | 
			
		||||
makefile.one
 | 
			
		||||
tmp
 | 
			
		||||
@@ -14,3 +14,4 @@ cctest.c
 | 
			
		||||
cctest.a
 | 
			
		||||
libcrypto.so.*
 | 
			
		||||
libssl.so.*
 | 
			
		||||
libcrypto.sha1
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										38
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								CHANGES
									
									
									
									
									
								
							@@ -2,9 +2,29 @@
 | 
			
		||||
 OpenSSL CHANGES
 | 
			
		||||
 _______________
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.7d and 0.9.7e  [XX xxx XXXX]
 | 
			
		||||
 Changes between 0.9.7d and 0.9.7e  [25 Oct 2004]
 | 
			
		||||
 | 
			
		||||
  *)
 | 
			
		||||
  *) Avoid a race condition when CRLs are checked in a multi threaded 
 | 
			
		||||
     environment. This would happen due to the reordering of the revoked
 | 
			
		||||
     entries during signature checking and serial number lookup. Now the
 | 
			
		||||
     encoding is cached and the serial number sort performed under a lock.
 | 
			
		||||
     Add new STACK function sk_is_sorted().
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Add Delta CRL to the extension code.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Various fixes to s3_pkt.c so alerts are sent properly.
 | 
			
		||||
     [David Holmes <d.holmes@f5.com>]
 | 
			
		||||
 | 
			
		||||
  *) Reduce the chances of duplicate issuer name and serial numbers (in
 | 
			
		||||
     violation of RFC3280) using the OpenSSL certificate creation utilities.
 | 
			
		||||
     This is done by creating a random 64 bit value for the initial serial
 | 
			
		||||
     number when a serial number file is created or when a self signed
 | 
			
		||||
     certificate is created using 'openssl req -x509'. The initial serial
 | 
			
		||||
     number file is created using 'openssl x509 -next_serial' in CA.pl
 | 
			
		||||
     rather than being initialized to 1.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.7c and 0.9.7d  [17 Mar 2004]
 | 
			
		||||
 | 
			
		||||
@@ -2041,6 +2061,20 @@ des-cbc           3624.96k     5258.21k     5530.91k     5624.30k     5628.26k
 | 
			
		||||
  *) Clean old EAY MD5 hack from e_os.h.
 | 
			
		||||
     [Richard Levitte]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.6l and 0.9.6m  [17 Mar 2004]
 | 
			
		||||
 | 
			
		||||
  *) Fix null-pointer assignment in do_change_cipher_spec() revealed
 | 
			
		||||
     by using the Codenomicon TLS Test Tool (CAN-2004-0079)
 | 
			
		||||
     [Joe Orton, Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.6k and 0.9.6l  [04 Nov 2003]
 | 
			
		||||
 | 
			
		||||
  *) Fix additional bug revealed by the NISCC test suite:
 | 
			
		||||
 | 
			
		||||
     Stop bug triggering large recursion when presented with
 | 
			
		||||
     certain ASN.1 tags (CAN-2003-0851)
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.6j and 0.9.6k  [30 Sep 2003]
 | 
			
		||||
 | 
			
		||||
  *) Fix various bugs revealed by running the NISCC test suite:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										73
									
								
								Configure
									
									
									
									
									
								
							
							
						
						
									
										73
									
								
								Configure
									
									
									
									
									
								
							@@ -10,7 +10,7 @@ use strict;
 | 
			
		||||
 | 
			
		||||
# see INSTALL for instructions.
 | 
			
		||||
 | 
			
		||||
my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-engine] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-krb5] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]\n";
 | 
			
		||||
my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-engine] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-krb5] [386] [[no-]fips] [debug] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]\n";
 | 
			
		||||
 | 
			
		||||
# Options:
 | 
			
		||||
#
 | 
			
		||||
@@ -135,15 +135,16 @@ my %table=(
 | 
			
		||||
# Our development configs
 | 
			
		||||
"purify",	"purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::",
 | 
			
		||||
"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::::",
 | 
			
		||||
"debug-ben",	"gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::asm/bn86-elf.o asm/co86-elf.o",
 | 
			
		||||
"debug-ben",	"gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -O2 -Wall -Wshadow -Werror -pipe::(unknown)::::asm/bn86-elf.o asm/co86-elf.o",
 | 
			
		||||
"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)::::",
 | 
			
		||||
"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)::::",
 | 
			
		||||
"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)::::::",
 | 
			
		||||
"debug-ben-debug",	"gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -g3 -O2 -Wall -Wshadow -Werror -pipe::(unknown)::::::",
 | 
			
		||||
"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)::::::",
 | 
			
		||||
"debug-ben-fips-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_FIPS -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::asm/bn86-elf.o asm/co86-elf.o",
 | 
			
		||||
"debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
 | 
			
		||||
"debug-bodo",	"gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -m486 -pedantic -Wshadow -Wall::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
 | 
			
		||||
"debug-ulf",	"gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -g -O2 -m486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT:::${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
 | 
			
		||||
"debug-steve",	"gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -mcpu=i486 -pedantic -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
 | 
			
		||||
"debug-steve",	"gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -mcpu=i486 -pedantic -Wno-long-long -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
 | 
			
		||||
"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::dlfcn",
 | 
			
		||||
"debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wmissing-prototypes -Wno-long-long -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wmissing-prototypes -Wno-long-long -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
@@ -155,6 +156,12 @@ my %table=(
 | 
			
		||||
"gcc",		"gcc:-O3::(unknown):::BN_LLONG:::",
 | 
			
		||||
"cc",		"cc:-O::(unknown)::::::",
 | 
			
		||||
 | 
			
		||||
####VOS Configurations
 | 
			
		||||
"vos-gcc","gcc:-b hppa1.1-stratus-vos -O3 -Wall -Wuninitialized -D_POSIX_C_SOURCE=200112L -D_BSD::(unknown):VOS:-Wl,-map:BN_LLONG:::::::::::::.so:",
 | 
			
		||||
"debug-vos-gcc","gcc:-b hppa1.1-stratus-vos -O0 -g -Wall -D_POSIX_C_SOURCE=200112L -D_BSD -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG::(unknown):VOS:-Wl,-map:BN_LLONG:::::::::::::.so:",
 | 
			
		||||
"vos-vcc","vcc:-b i386-stratus-vos -O3 -D_POSIX_C_SOURCE=200112L -D_BSD::(unknown):VOS:-Wl,-map::::::::::::::.so:",
 | 
			
		||||
"debug-vos-vcc","vcc:-b i386-stratus-vos -O0 -g -D_POSIX_C_SOURCE=200112L -D_BSD -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG::(unknown):VOS:-Wl,-map::::::::::::::.so:",
 | 
			
		||||
 | 
			
		||||
#### Solaris x86 with GNU C setups
 | 
			
		||||
# -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it
 | 
			
		||||
# here because whenever GNU C instantiates an assembler template it
 | 
			
		||||
@@ -382,7 +389,7 @@ my %table=(
 | 
			
		||||
"debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_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",
 | 
			
		||||
"debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_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",
 | 
			
		||||
"debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -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)",
 | 
			
		||||
"debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
 | 
			
		||||
"debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-aout",	"gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}",
 | 
			
		||||
"linux-mipsel",   "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL DES_RISC2::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-mips",   "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL DES_RISC2::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
@@ -415,7 +422,7 @@ my %table=(
 | 
			
		||||
"qnx6",	"cc:-DL_ENDIAN -DTERMIOS::(unknown)::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:",
 | 
			
		||||
 | 
			
		||||
# Linux on ARM
 | 
			
		||||
"linux-elf-arm","gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-elf-arm","gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
 | 
			
		||||
# SCO/Caldera targets.
 | 
			
		||||
#
 | 
			
		||||
@@ -609,7 +616,7 @@ my $threads=0;
 | 
			
		||||
my $no_asm=0;
 | 
			
		||||
my $no_dso=0;
 | 
			
		||||
my @skip=();
 | 
			
		||||
my $Makefile="Makefile.ssl";
 | 
			
		||||
my $Makefile="Makefile";
 | 
			
		||||
my $des_locl="crypto/des/des_locl.h";
 | 
			
		||||
my $des	="crypto/des/des.h";
 | 
			
		||||
my $bn	="crypto/bn/bn.h";
 | 
			
		||||
@@ -621,6 +628,7 @@ my $rc2	="crypto/rc2/rc2.h";
 | 
			
		||||
my $bf	="crypto/bf/bf_locl.h";
 | 
			
		||||
my $bn_asm	="bn_asm.o";
 | 
			
		||||
my $des_enc="des_enc.o fcrypt_b.o";
 | 
			
		||||
my $fips_des_enc="fips_des_enc.o";
 | 
			
		||||
my $bf_enc	="bf_enc.o";
 | 
			
		||||
my $cast_enc="c_enc.o";
 | 
			
		||||
my $rc4_enc="rc4_enc.o";
 | 
			
		||||
@@ -631,6 +639,8 @@ my $rmd160_obj="";
 | 
			
		||||
my $processor="";
 | 
			
		||||
my $default_ranlib;
 | 
			
		||||
my $perl;
 | 
			
		||||
my $fips=0;
 | 
			
		||||
my $debug=0;
 | 
			
		||||
 | 
			
		||||
my $no_ssl2=0;
 | 
			
		||||
my $no_ssl3=0;
 | 
			
		||||
@@ -640,10 +650,6 @@ my $no_sha=0;
 | 
			
		||||
my $no_rsa=0;
 | 
			
		||||
my $no_dh=0;
 | 
			
		||||
 | 
			
		||||
$default_ranlib= &which("ranlib") or $default_ranlib="true";
 | 
			
		||||
$perl=$ENV{'PERL'} or $perl=&which("perl5") or $perl=&which("perl")
 | 
			
		||||
  or $perl="perl";
 | 
			
		||||
 | 
			
		||||
&usage if ($#ARGV < 0);
 | 
			
		||||
 | 
			
		||||
my $flags;
 | 
			
		||||
@@ -739,6 +745,8 @@ PROCESS_ARGS:
 | 
			
		||||
			{ $no_ssl3 = 1; }
 | 
			
		||||
		elsif (/^no-tls1?$/)
 | 
			
		||||
			{ $no_tls1 = 1; }
 | 
			
		||||
		elsif (/^no-fips$/)
 | 
			
		||||
			{ $fips = 0; }
 | 
			
		||||
		elsif (/^no-(.+)$/)
 | 
			
		||||
			{
 | 
			
		||||
			my $algo=$1;
 | 
			
		||||
@@ -804,6 +812,14 @@ PROCESS_ARGS:
 | 
			
		||||
			}
 | 
			
		||||
		elsif (/^386$/)
 | 
			
		||||
			{ $processor=386; }
 | 
			
		||||
		elsif (/^fips$/)
 | 
			
		||||
			{
 | 
			
		||||
			$fips=1;
 | 
			
		||||
		        }
 | 
			
		||||
		elsif (/^debug$/)
 | 
			
		||||
			{
 | 
			
		||||
			$debug=1;
 | 
			
		||||
			}
 | 
			
		||||
		elsif (/^rsaref$/)
 | 
			
		||||
			{
 | 
			
		||||
			# No RSAref support any more since it's not needed.
 | 
			
		||||
@@ -922,9 +938,14 @@ my $IsWindows=scalar grep /^$target$/,@WinTargets;
 | 
			
		||||
 | 
			
		||||
$exe_ext=".exe" if ($target eq "Cygwin");
 | 
			
		||||
$exe_ext=".exe" if ($target eq "DJGPP");
 | 
			
		||||
$exe_ext=".pm" if ($target eq "vos-gcc" or $target eq "debug-vos-gcc" or $target eq "vos-vcc" or $target eq "debug-vos-vcc");
 | 
			
		||||
$openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq "");
 | 
			
		||||
$prefix=$openssldir if $prefix eq "";
 | 
			
		||||
 | 
			
		||||
$default_ranlib= &which("ranlib") or $default_ranlib="true";
 | 
			
		||||
$perl=$ENV{'PERL'} or $perl=&which("perl5") or $perl=&which("perl")
 | 
			
		||||
  or $perl="perl";
 | 
			
		||||
 | 
			
		||||
chop $openssldir if $openssldir =~ /\/$/;
 | 
			
		||||
chop $prefix if $prefix =~ /\/$/;
 | 
			
		||||
 | 
			
		||||
@@ -1139,12 +1160,20 @@ if ($ranlib eq "")
 | 
			
		||||
 | 
			
		||||
$bn_obj = $bn_asm unless $bn_obj ne "";
 | 
			
		||||
 | 
			
		||||
$des_obj=$des_enc	unless ($des_obj =~ /\.o$/);
 | 
			
		||||
if ($fips)
 | 
			
		||||
	{
 | 
			
		||||
	$des_obj=$sha1_obj="";
 | 
			
		||||
	$openssl_other_defines.="#define OPENSSL_FIPS\n";
 | 
			
		||||
	}
 | 
			
		||||
$des_obj=$des_enc	unless (!$fips && $des_obj =~ /\.o$/);
 | 
			
		||||
my $fips_des_obj='asm/fips-dx86-elf.o';
 | 
			
		||||
$fips_des_obj=$fips_des_enc unless $processor eq '386';
 | 
			
		||||
my $fips_sha1_obj='asm/sx86-elf.o' if $processor eq '386';
 | 
			
		||||
$bf_obj=$bf_enc		unless ($bf_obj =~ /\.o$/);
 | 
			
		||||
$cast_obj=$cast_enc	unless ($cast_obj =~ /\.o$/);
 | 
			
		||||
$rc4_obj=$rc4_enc	unless ($rc4_obj =~ /\.o$/);
 | 
			
		||||
$rc5_obj=$rc5_enc	unless ($rc5_obj =~ /\.o$/);
 | 
			
		||||
if ($sha1_obj =~ /\.o$/)
 | 
			
		||||
if ($sha1_obj =~ /\.o$/ || $fips_sha1_obj =~ /\.o$/)
 | 
			
		||||
	{
 | 
			
		||||
#	$sha1_obj=$sha1_enc;
 | 
			
		||||
	$cflags.=" -DSHA1_ASM";
 | 
			
		||||
@@ -1160,6 +1189,12 @@ if ($rmd160_obj =~ /\.o$/)
 | 
			
		||||
	$cflags.=" -DRMD160_ASM";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
if ($debug)
 | 
			
		||||
	{
 | 
			
		||||
	$cflags.=" -g";
 | 
			
		||||
	$cflags=~s/-fomit-frame-pointer//;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
# "Stringify" the C flags string.  This permits it to be made part of a string
 | 
			
		||||
# and works as well on command lines.
 | 
			
		||||
$cflags =~ s/([\\\"])/\\\1/g;
 | 
			
		||||
@@ -1232,12 +1267,14 @@ while (<IN>)
 | 
			
		||||
	s/^EXE_EXT=.*$/EXE_EXT= $exe_ext/;
 | 
			
		||||
	s/^BN_ASM=.*$/BN_ASM= $bn_obj/;
 | 
			
		||||
	s/^DES_ENC=.*$/DES_ENC= $des_obj/;
 | 
			
		||||
	s/^FIPS_DES_ENC=.*$/FIPS_DES_ENC= $fips_des_obj/;
 | 
			
		||||
	s/^BF_ENC=.*$/BF_ENC= $bf_obj/;
 | 
			
		||||
	s/^CAST_ENC=.*$/CAST_ENC= $cast_obj/;
 | 
			
		||||
	s/^RC4_ENC=.*$/RC4_ENC= $rc4_obj/;
 | 
			
		||||
	s/^RC5_ENC=.*$/RC5_ENC= $rc5_obj/;
 | 
			
		||||
	s/^MD5_ASM_OBJ=.*$/MD5_ASM_OBJ= $md5_obj/;
 | 
			
		||||
	s/^SHA1_ASM_OBJ=.*$/SHA1_ASM_OBJ= $sha1_obj/;
 | 
			
		||||
	s/^FIPS_SHA1_ASM_OBJ=.*$/FIPS_SHA1_ASM_OBJ= $fips_sha1_obj/;
 | 
			
		||||
	s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/;
 | 
			
		||||
	s/^PROCESSOR=.*/PROCESSOR= $processor/;
 | 
			
		||||
	s/^RANLIB=.*/RANLIB= $ranlib/;
 | 
			
		||||
@@ -1470,7 +1507,7 @@ if($IsWindows) {
 | 
			
		||||
	printf OUT <<EOF;
 | 
			
		||||
#ifndef MK1MF_BUILD
 | 
			
		||||
  /* auto-generated by Configure for crypto/cversion.c:
 | 
			
		||||
   * for Unix builds, crypto/Makefile.ssl generates functional definitions;
 | 
			
		||||
   * for Unix builds, crypto/Makefile generates functional definitions;
 | 
			
		||||
   * Windows builds (and other mk1mf builds) compile cversion.c with
 | 
			
		||||
   * -DMK1MF_BUILD and use definitions added to this file by util/mk1mf.pl. */
 | 
			
		||||
  #error "Windows builds (PLATFORM=$target) use mk1mf.pl-created Makefiles"
 | 
			
		||||
@@ -1478,7 +1515,7 @@ if($IsWindows) {
 | 
			
		||||
EOF
 | 
			
		||||
	close(OUT);
 | 
			
		||||
} else {
 | 
			
		||||
	my $make_command = "make -f Makefile.ssl PERL=\'$perl\'";
 | 
			
		||||
	my $make_command = "make PERL=\'$perl\'";
 | 
			
		||||
	my $make_targets = "";
 | 
			
		||||
	$make_targets .= " links" if $symlink;
 | 
			
		||||
	$make_targets .= " depend" if $depflags ne "" && $make_depend;
 | 
			
		||||
@@ -1569,10 +1606,10 @@ sub which
 | 
			
		||||
	my $path;
 | 
			
		||||
	foreach $path (split /:/, $ENV{PATH})
 | 
			
		||||
		{
 | 
			
		||||
		if (-f "$path/$name" and -x _)
 | 
			
		||||
		if (-f "$path/$name$exe_ext" and -x _)
 | 
			
		||||
			{
 | 
			
		||||
			return "$path/$name" unless ($name eq "perl" and
 | 
			
		||||
			 system("$path/$name -e " . '\'exit($]<5.0);\''));
 | 
			
		||||
			return "$path/$name$exe_ext" unless ($name eq "perl" and
 | 
			
		||||
			 system("$path/$name$exe_ext -e " . '\'exit($]<5.0);\''));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										32
									
								
								FAQ
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								FAQ
									
									
									
									
									
								
							@@ -52,6 +52,7 @@ OpenSSL  -  Frequently Asked Questions
 | 
			
		||||
* Is OpenSSL thread-safe?
 | 
			
		||||
* I've compiled a program under Windows and it crashes: why?
 | 
			
		||||
* How do I read or write a DER encoded buffer using the ASN1 functions?
 | 
			
		||||
* OpenSSL uses DER but I need BER format: does OpenSSL support BER?
 | 
			
		||||
* I've tried using <M_some_evil_pkcs12_macro> and I get errors why?
 | 
			
		||||
* I've called <some function> and it fails, why?
 | 
			
		||||
* I just get a load of numbers for the error output, what do they mean?
 | 
			
		||||
@@ -60,6 +61,7 @@ OpenSSL  -  Frequently Asked Questions
 | 
			
		||||
* Can I use OpenSSL's SSL library with non-blocking I/O?
 | 
			
		||||
* Why doesn't my server application receive a client certificate?
 | 
			
		||||
* Why does compilation fail due to an undefined symbol NID_uniqueIdentifier?
 | 
			
		||||
* I think I've detected a memory leak, is this a bug?
 | 
			
		||||
 | 
			
		||||
===============================================================================
 | 
			
		||||
 | 
			
		||||
@@ -68,7 +70,7 @@ OpenSSL  -  Frequently Asked Questions
 | 
			
		||||
* Which is the current version of OpenSSL?
 | 
			
		||||
 | 
			
		||||
The current version is available from <URL: http://www.openssl.org>.
 | 
			
		||||
OpenSSL 0.9.7d was released on March 17, 2004.
 | 
			
		||||
OpenSSL 0.9.7e was released on October 25, 2004.
 | 
			
		||||
 | 
			
		||||
In addition to the current stable release, you can also access daily
 | 
			
		||||
snapshots of the OpenSSL development version at <URL:
 | 
			
		||||
@@ -460,7 +462,7 @@ get the best result from OpenSSL.  A bit more complicated solution is the
 | 
			
		||||
following:
 | 
			
		||||
 | 
			
		||||
----- snip:start -----
 | 
			
		||||
  make DIRS=crypto SDIRS=sha "`grep '^CFLAG=' Makefile.ssl | \
 | 
			
		||||
  make DIRS=crypto SDIRS=sha "`grep '^CFLAG=' Makefile | \
 | 
			
		||||
       sed -e 's/ -O[0-9] / -O0 /'`"
 | 
			
		||||
  rm `ls crypto/*.o crypto/sha/*.o | grep -v 'sha_dgst\.o'`
 | 
			
		||||
  make
 | 
			
		||||
@@ -683,6 +685,20 @@ and attempts to free the buffer will have unpredictable results
 | 
			
		||||
because it no longer points to the same address.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
* OpenSSL uses DER but I need BER format: does OpenSSL support BER?
 | 
			
		||||
 | 
			
		||||
The short answer is yes, because DER is a special case of BER and OpenSSL
 | 
			
		||||
ASN1 decoders can process BER.
 | 
			
		||||
 | 
			
		||||
The longer answer is that ASN1 structures can be encoded in a number of
 | 
			
		||||
different ways. One set of ways is the Basic Encoding Rules (BER) with various
 | 
			
		||||
permissible encodings. A restriction of BER is the Distinguished Encoding
 | 
			
		||||
Rules (DER): these uniquely specify how a given structure is encoded.
 | 
			
		||||
 | 
			
		||||
Therefore, because DER is a special case of BER, DER is an acceptable encoding
 | 
			
		||||
for BER.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
* I've tried using <M_some_evil_pkcs12_macro> and I get errors why?
 | 
			
		||||
 | 
			
		||||
This usually happens when you try compiling something using the PKCS#12
 | 
			
		||||
@@ -765,5 +781,17 @@ The correct name according to RFC2256 (LDAP) is x500UniqueIdentifier.
 | 
			
		||||
Change your code to use the new name when compiling against OpenSSL 0.9.7.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
* I think I've detected a memory leak, is this a bug?
 | 
			
		||||
 | 
			
		||||
In most cases the cause of an apparent memory leak is an OpenSSL internal table
 | 
			
		||||
that is allocated when an application starts up. Since such tables do not grow
 | 
			
		||||
in size over time they are harmless.
 | 
			
		||||
 | 
			
		||||
These internal tables can be freed up when an application closes using various
 | 
			
		||||
functions.  Currently these include: EVP_cleanup(), ERR_remove_state(),
 | 
			
		||||
ERR_free_strings(), ENGINE_cleanup(), CONF_modules_unload() and
 | 
			
		||||
CRYPTO_cleanup_all_ex_data().
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
===============================================================================
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								INSTALL
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								INSTALL
									
									
									
									
									
								
							@@ -123,7 +123,7 @@
 | 
			
		||||
     generic configurations "cc" or "gcc" should usually work on 32 bit
 | 
			
		||||
     systems.
 | 
			
		||||
 | 
			
		||||
     Configure creates the file Makefile.ssl from Makefile.org and
 | 
			
		||||
     Configure creates the file Makefile from Makefile.org and
 | 
			
		||||
     defines various macros in crypto/opensslconf.h (generated from
 | 
			
		||||
     crypto/opensslconf.h.in).
 | 
			
		||||
 | 
			
		||||
@@ -159,7 +159,7 @@
 | 
			
		||||
     the failure that isn't a problem in OpenSSL itself (like a missing
 | 
			
		||||
     or malfunctioning bc).  If it is a problem with OpenSSL itself,
 | 
			
		||||
     try removing any compiler optimization flags from the CFLAG line
 | 
			
		||||
     in Makefile.ssl and run "make clean; make". Please send a bug
 | 
			
		||||
     in Makefile and run "make clean; make". Please send a bug
 | 
			
		||||
     report to <openssl-bugs@openssl.org>, including the output of
 | 
			
		||||
     "make report" in order to be added to the request tracker at
 | 
			
		||||
     http://www.openssl.org/support/rt2.html.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								INSTALL.W32
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								INSTALL.W32
									
									
									
									
									
								
							@@ -46,12 +46,13 @@
 | 
			
		||||
 http://www.kernel.org/pub/software/devel/nasm/binaries/win32/
 | 
			
		||||
 The NASM binary nasmw.exe needs to be installed anywhere on your PATH.
 | 
			
		||||
 | 
			
		||||
 Firstly you should run Configure:
 | 
			
		||||
 Firstly you should run Configure (to build a FIPS-certified variant of
 | 
			
		||||
 OpenSSL, add the option "fips"):
 | 
			
		||||
 | 
			
		||||
 > perl Configure VC-WIN32
 | 
			
		||||
 | 
			
		||||
 Next you need to build the Makefiles and optionally the assembly language
 | 
			
		||||
 files:
 | 
			
		||||
 files (to build a FIPS-certified variant of OpenSSL, add the argument "fips"):
 | 
			
		||||
 | 
			
		||||
 - If you are using MASM then run:
 | 
			
		||||
 | 
			
		||||
@@ -100,10 +101,12 @@
 | 
			
		||||
 Borland C++ builder 5
 | 
			
		||||
 ---------------------
 | 
			
		||||
 | 
			
		||||
 * Configure for building with Borland Builder:
 | 
			
		||||
 * Configure for building with Borland Builder (to build a FIPS-certified
 | 
			
		||||
   variant of OpenSSL, add the option "fips"):
 | 
			
		||||
   > perl Configure BC-32
 | 
			
		||||
 | 
			
		||||
 * Create the appropriate makefile
 | 
			
		||||
 * Create the appropriate makefile (to build a FIPS-certified variant of
 | 
			
		||||
   OpenSSL, add the argument "fips")
 | 
			
		||||
   > ms\do_nasm
 | 
			
		||||
 | 
			
		||||
 * Build
 | 
			
		||||
@@ -194,6 +197,8 @@
 | 
			
		||||
   occur, try
 | 
			
		||||
   > ms\mingw32 no-asm
 | 
			
		||||
   instead.
 | 
			
		||||
   If you want to build a FIPS-certified variant of OpenSSL, add the argument
 | 
			
		||||
   "fips"
 | 
			
		||||
 | 
			
		||||
   libcrypto.a and libssl.a are the static libraries. To use the DLLs,
 | 
			
		||||
   link with libeay32.a and libssl32.a instead.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										96
									
								
								Makefile.org
									
									
									
									
									
								
							
							
						
						
									
										96
									
								
								Makefile.org
									
									
									
									
									
								
							@@ -101,6 +101,7 @@ PROCESSOR=
 | 
			
		||||
 | 
			
		||||
# Set DES_ENC to des_enc.o if you want to use the C version
 | 
			
		||||
#There are 4 x86 assember options.
 | 
			
		||||
FIPS_DES_ENC= des_enc.o fcrypt_b.o
 | 
			
		||||
DES_ENC= asm/dx86-out.o asm/yx86-out.o
 | 
			
		||||
#DES_ENC= des_enc.o fcrypt_b.o          # C
 | 
			
		||||
#DES_ENC= asm/dx86-elf.o asm/yx86-elf.o # elf
 | 
			
		||||
@@ -153,6 +154,7 @@ MD5_ASM_OBJ= asm/mx86-out.o
 | 
			
		||||
 | 
			
		||||
# Also need SHA1_ASM defined
 | 
			
		||||
SHA1_ASM_OBJ= asm/sx86-out.o
 | 
			
		||||
FIPS_SHA1_ASM_OBJ= asm/sx86-out.o
 | 
			
		||||
#SHA1_ASM_OBJ= asm/sx86-elf.o       # elf
 | 
			
		||||
#SHA1_ASM_OBJ= asm/sx86-sol.o       # solaris
 | 
			
		||||
#SHA1_ASM_OBJ= asm/sx86-out.o       # a.out, FreeBSD
 | 
			
		||||
@@ -173,23 +175,24 @@ LIBKRB5=
 | 
			
		||||
# we might set SHLIB_MARK to '$(SHARED_LIBS)'.
 | 
			
		||||
SHLIB_MARK=
 | 
			
		||||
 | 
			
		||||
DIRS=   crypto ssl $(SHLIB_MARK) apps test tools
 | 
			
		||||
SHLIBDIRS= crypto ssl
 | 
			
		||||
DIRS=   crypto fips ssl $(SHLIB_MARK) sigs apps test tools
 | 
			
		||||
SHLIBDIRS= fips crypto ssl
 | 
			
		||||
 | 
			
		||||
# dirs in crypto to build
 | 
			
		||||
SDIRS=  \
 | 
			
		||||
SDIRS=  objects \
 | 
			
		||||
	md2 md4 md5 sha mdc2 hmac ripemd \
 | 
			
		||||
	des rc2 rc4 rc5 idea bf cast \
 | 
			
		||||
	bn ec rsa dsa dh dso engine aes \
 | 
			
		||||
	buffer bio stack lhash rand err objects \
 | 
			
		||||
	buffer bio stack lhash rand err \
 | 
			
		||||
	evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5
 | 
			
		||||
 | 
			
		||||
FDIRS=	sha1 rand des aes dsa rsa dh
 | 
			
		||||
 | 
			
		||||
# tests to perform.  "alltests" is a special word indicating that all tests
 | 
			
		||||
# should be performed.
 | 
			
		||||
TESTS = alltests
 | 
			
		||||
 | 
			
		||||
MAKEFILE= Makefile.ssl
 | 
			
		||||
MAKE=     make -f Makefile.ssl
 | 
			
		||||
MAKEFILE= Makefile
 | 
			
		||||
 | 
			
		||||
MANDIR=$(OPENSSLDIR)/man
 | 
			
		||||
MAN1=1
 | 
			
		||||
@@ -202,6 +205,7 @@ ONEDIRS=out tmp
 | 
			
		||||
EDIRS=  times doc bugs util include certs ms shlib mt demos perl sf dep VMS
 | 
			
		||||
WDIRS=  windows
 | 
			
		||||
LIBS=   libcrypto.a libssl.a
 | 
			
		||||
SIGS=	libcrypto.a.sha1
 | 
			
		||||
SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
 | 
			
		||||
SHARED_SSL=libssl$(SHLIB_EXT)
 | 
			
		||||
SHARED_LIBS=
 | 
			
		||||
@@ -219,14 +223,32 @@ HEADER=         e_os.h
 | 
			
		||||
# When we're prepared to use shared libraries in the programs we link here
 | 
			
		||||
# we might remove 'clean-shared' from the targets to perform at this stage
 | 
			
		||||
 | 
			
		||||
all: Makefile.ssl sub_all openssl.pc
 | 
			
		||||
all: Makefile sub_all openssl.pc
 | 
			
		||||
 | 
			
		||||
sigs:	$(SIGS)
 | 
			
		||||
libcrypto.a.sha1: libcrypto.a
 | 
			
		||||
	if egrep 'define OPENSSL_FIPS' $(TOP)/include/openssl/opensslconf.h > /dev/null; then \
 | 
			
		||||
		$(RANLIB) libcrypto.a; \
 | 
			
		||||
		fips/sha1/fips_standalone_sha1 libcrypto.a > libcrypto.a.sha1; \
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
sub_all:
 | 
			
		||||
	@for i in $(DIRS); \
 | 
			
		||||
	do \
 | 
			
		||||
	if [ -d "$$i" ]; then \
 | 
			
		||||
		(cd $$i && echo "making all in $$i..." && \
 | 
			
		||||
		$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' AS='${AS}' ASFLAG='${ASFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' all ) || exit 1; \
 | 
			
		||||
		$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' AS='${AS}' ASFLAG='${ASFLAG}' SDIRS='$(SDIRS)' FDIRS='$(FDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' FIPS_DES_ENC='${FIPS_DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' FIPS_SHA1_ASM_OBJ='${FIPS_SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' all ) || exit 1; \
 | 
			
		||||
	else \
 | 
			
		||||
		$(MAKE) $$i; \
 | 
			
		||||
	fi; \
 | 
			
		||||
	done;
 | 
			
		||||
 | 
			
		||||
sub_target:
 | 
			
		||||
	@for i in $(DIRS); \
 | 
			
		||||
	do \
 | 
			
		||||
	if [ -d "$$i" ]; then \
 | 
			
		||||
		(cd $$i && echo "making $(TARGET) in $$i..." && \
 | 
			
		||||
		$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' AS='${AS}' ASFLAG='${ASFLAG}' SDIRS='$(SDIRS)' FDIRS='$(FDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' FIPS_DES_ENC='${FIPS_DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' FIPS_SHA1_ASM_OBJ='${FIPS_SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' TARGET='$(TARGET)' sub_target ) || exit 1; \
 | 
			
		||||
	else \
 | 
			
		||||
		$(MAKE) $$i; \
 | 
			
		||||
	fi; \
 | 
			
		||||
@@ -392,6 +414,7 @@ do_solaris-shared:
 | 
			
		||||
		  set -x; ${CC} ${SHARED_LDFLAGS} -G -dy -z text \
 | 
			
		||||
			-o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
			
		||||
			-h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
			
		||||
			-Wl,-Bsymbolic \
 | 
			
		||||
			$${MINUSZ}allextract lib$$i.a $${MINUSZ}defaultextract \
 | 
			
		||||
			$$libs ${EX_LIBS} -lc ) || exit 1; \
 | 
			
		||||
		libs="-l$$i $$libs"; \
 | 
			
		||||
@@ -483,7 +506,7 @@ do_hpux-shared:
 | 
			
		||||
		libs="$(LIBKRB5) $$libs"; \
 | 
			
		||||
	fi; \
 | 
			
		||||
	( set -x; /usr/ccs/bin/ld ${SHARED_LDFLAGS} \
 | 
			
		||||
 		+vnocompatwarnings \
 | 
			
		||||
		+vnocompatwarnings \
 | 
			
		||||
		-b -z +s \
 | 
			
		||||
		-o lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
			
		||||
		+h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
			
		||||
@@ -506,7 +529,7 @@ do_hpux64-shared:
 | 
			
		||||
		libs="$(LIBKRB5) $$libs"; \
 | 
			
		||||
	fi; \
 | 
			
		||||
	( set -x; /usr/ccs/bin/ld ${SHARED_LDFLAGS} \
 | 
			
		||||
 		-b -z \
 | 
			
		||||
		-b -z \
 | 
			
		||||
		-o lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
			
		||||
		+h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
			
		||||
		+forceload lib$$i.a -ldl -lc ) || exit 1; \
 | 
			
		||||
@@ -577,7 +600,7 @@ do_reliantunix-shared:
 | 
			
		||||
	libs="-l$$i $$libs"; \
 | 
			
		||||
	done
 | 
			
		||||
 | 
			
		||||
openssl.pc: Makefile.ssl
 | 
			
		||||
openssl.pc: Makefile
 | 
			
		||||
	@ ( echo 'prefix=$(INSTALLTOP)'; \
 | 
			
		||||
	    echo 'exec_prefix=$${prefix}'; \
 | 
			
		||||
	    echo 'libdir=$${exec_prefix}/lib'; \
 | 
			
		||||
@@ -590,8 +613,8 @@ openssl.pc: Makefile.ssl
 | 
			
		||||
	    echo 'Libs: -L$${libdir} -lssl -lcrypto $(LIBKRB5) $(EX_LIBS)'; \
 | 
			
		||||
	    echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
 | 
			
		||||
 | 
			
		||||
Makefile.ssl: Makefile.org
 | 
			
		||||
	@echo "Makefile.ssl is older than Makefile.org."
 | 
			
		||||
Makefile: Makefile.org
 | 
			
		||||
	@echo "Makefile is older than Makefile.org."
 | 
			
		||||
	@echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
 | 
			
		||||
	@false
 | 
			
		||||
 | 
			
		||||
@@ -621,7 +644,7 @@ makefile.one: files
 | 
			
		||||
	sh util/do_ms.sh
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl > $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile > $(TOP)/MINFO
 | 
			
		||||
	@for i in $(DIRS) ;\
 | 
			
		||||
	do \
 | 
			
		||||
	if [ -d "$$i" ]; then \
 | 
			
		||||
@@ -631,19 +654,18 @@ files:
 | 
			
		||||
	done;
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@$(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
 | 
			
		||||
	@for i in $(DIRS); do \
 | 
			
		||||
	if [ -d "$$i" ]; then \
 | 
			
		||||
		(cd $$i && echo "making links in $$i..." && \
 | 
			
		||||
		$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PERL='${PERL}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' links ) || exit 1; \
 | 
			
		||||
		$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' FIPS_DES_ENC='${FIPS_DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' FIPS_SHA1_ASM_OBJ='${FIPS_SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PERL='${PERL}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' links ) || exit 1; \
 | 
			
		||||
	fi; \
 | 
			
		||||
	done;
 | 
			
		||||
 | 
			
		||||
gentests:
 | 
			
		||||
	@(cd test && echo "generating dummy tests (if needed)..." && \
 | 
			
		||||
	$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on generate );
 | 
			
		||||
	$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' FIPS_DES_ENC='${FIPS_DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' FIPS_SHA1_ASM_OBJ='${FIPS_SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on generate );
 | 
			
		||||
 | 
			
		||||
dclean:
 | 
			
		||||
	rm -f *.bak
 | 
			
		||||
@@ -657,7 +679,7 @@ dclean:
 | 
			
		||||
 | 
			
		||||
rehash: rehash.time
 | 
			
		||||
rehash.time: certs
 | 
			
		||||
	@(OPENSSL="`pwd`/apps/openssl"; OPENSSL_DEBUG_MEMORY=on; \
 | 
			
		||||
	@(OPENSSL="`pwd`/apps/openssl$(EXE_EXT)"; OPENSSL_DEBUG_MEMORY=on; \
 | 
			
		||||
		export OPENSSL OPENSSL_DEBUG_MEMORY; \
 | 
			
		||||
		LD_LIBRARY_PATH="`pwd`:$$LD_LIBRARY_PATH"; \
 | 
			
		||||
		DYLD_LIBRARY_PATH="`pwd`:$$DYLD_LIBRARY_PATH"; \
 | 
			
		||||
@@ -672,7 +694,7 @@ test:   tests
 | 
			
		||||
 | 
			
		||||
tests: rehash
 | 
			
		||||
	@(cd test && echo "testing..." && \
 | 
			
		||||
	$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on tests );
 | 
			
		||||
	$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' FIPS_DES_ENC='${FIPS_DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' FIPS_SHA1_ASM_OBJ='${FIPS_SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on tests );
 | 
			
		||||
	@LD_LIBRARY_PATH="`pwd`:$$LD_LIBRARY_PATH"; \
 | 
			
		||||
	DYLD_LIBRARY_PATH="`pwd`:$$DYLD_LIBRARY_PATH"; \
 | 
			
		||||
	SHLIB_PATH="`pwd`:$$SHLIB_PATH"; \
 | 
			
		||||
@@ -703,13 +725,8 @@ lint:
 | 
			
		||||
	done;
 | 
			
		||||
 | 
			
		||||
tags:
 | 
			
		||||
	@for i in $(DIRS) ;\
 | 
			
		||||
	do \
 | 
			
		||||
	if [ -d "$$i" ]; then \
 | 
			
		||||
		(cd $$i && echo "making tags $$i..." && \
 | 
			
		||||
		$(MAKE) SDIRS='${SDIRS}' tags ) || exit 1; \
 | 
			
		||||
	fi; \
 | 
			
		||||
	done;
 | 
			
		||||
	rm -f TAGS
 | 
			
		||||
	find . -name '[^.]*.[ch]' | xargs etags -a
 | 
			
		||||
 | 
			
		||||
errors:
 | 
			
		||||
	$(PERL) util/mkerr.pl -recurse -write
 | 
			
		||||
@@ -729,11 +746,14 @@ crypto/objects/obj_dat.h: crypto/objects/obj_dat.pl crypto/objects/obj_mac.h
 | 
			
		||||
crypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num
 | 
			
		||||
	$(PERL) crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num crypto/objects/obj_mac.h
 | 
			
		||||
 | 
			
		||||
apps/openssl-vms.cnf: apps/openssl.cnf
 | 
			
		||||
	$(PERL) VMS/VMSify-conf.pl < apps/openssl.cnf > apps/openssl-vms.cnf
 | 
			
		||||
 | 
			
		||||
TABLE: Configure
 | 
			
		||||
	(echo 'Output of `Configure TABLE'"':"; \
 | 
			
		||||
	$(PERL) Configure TABLE) > TABLE
 | 
			
		||||
 | 
			
		||||
update: depend errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h TABLE
 | 
			
		||||
update: depend errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h apps/openssl-vms.cnf TABLE
 | 
			
		||||
 | 
			
		||||
# Build distribution tar-file. As the list of files returned by "find" is
 | 
			
		||||
# pretty long, on several platforms a "too many arguments" error or similar
 | 
			
		||||
@@ -770,15 +790,16 @@ dist:
 | 
			
		||||
dist_pem_h:
 | 
			
		||||
	(cd crypto/pem; $(MAKE) CC='${CC}' SDIRS='${SDIRS}' CFLAG='${CFLAG}' pem.h; $(MAKE) clean)
 | 
			
		||||
 | 
			
		||||
install: all install_docs
 | 
			
		||||
install: all install_docs install_sw
 | 
			
		||||
 | 
			
		||||
install_sw:
 | 
			
		||||
	@$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
 | 
			
		||||
		$(INSTALL_PREFIX)$(INSTALLTOP)/lib \
 | 
			
		||||
		$(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig \
 | 
			
		||||
		$(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
 | 
			
		||||
		$(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
 | 
			
		||||
		$(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
 | 
			
		||||
		$(INSTALL_PREFIX)$(OPENSSLDIR)/private \
 | 
			
		||||
		$(INSTALL_PREFIX)$(OPENSSLDIR)/lib
 | 
			
		||||
		$(INSTALL_PREFIX)$(OPENSSLDIR)/private
 | 
			
		||||
	@for i in $(EXHEADER) ;\
 | 
			
		||||
	do \
 | 
			
		||||
	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
 | 
			
		||||
@@ -796,7 +817,11 @@ install: all install_docs
 | 
			
		||||
		if [ -f "$$i" ]; then \
 | 
			
		||||
		(       echo installing $$i; \
 | 
			
		||||
			cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
 | 
			
		||||
			$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
 | 
			
		||||
			if egrep 'define OPENSSL_FIPS' $(TOP)/include/openssl/opensslconf.h > /dev/null; then \
 | 
			
		||||
				: ; \
 | 
			
		||||
			else \
 | 
			
		||||
				$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
 | 
			
		||||
			fi; \
 | 
			
		||||
			chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
 | 
			
		||||
			mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
 | 
			
		||||
		fi; \
 | 
			
		||||
@@ -833,6 +858,15 @@ install: all install_docs
 | 
			
		||||
			sed -e '1,/^$$/d' doc/openssl-shared.txt; \
 | 
			
		||||
		fi; \
 | 
			
		||||
	fi
 | 
			
		||||
	@for i in $(SIGS) ;\
 | 
			
		||||
	do \
 | 
			
		||||
		if [ -f "$$i" ]; then \
 | 
			
		||||
		(       echo installing $$i; \
 | 
			
		||||
			cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
 | 
			
		||||
			chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
 | 
			
		||||
			mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
 | 
			
		||||
		fi; \
 | 
			
		||||
	done;
 | 
			
		||||
	cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig
 | 
			
		||||
	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig/openssl.pc
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								NEWS
									
									
									
									
									
								
							@@ -5,12 +5,17 @@
 | 
			
		||||
  This file gives a brief overview of the major changes between each OpenSSL
 | 
			
		||||
  release. For more details please read the CHANGES file.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7d and OpenSSL 0.9.7e:
 | 
			
		||||
 | 
			
		||||
      o Fix race condition in CRL checking code.
 | 
			
		||||
      o Fixes to PKCS#7 (S/MIME) code.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7c and OpenSSL 0.9.7d:
 | 
			
		||||
 | 
			
		||||
      o Security: Fix Kerberos ciphersuite SSL/TLS handshaking bug
 | 
			
		||||
      o Security: Fix null-pointer assignment in do_change_cipher_spec()
 | 
			
		||||
      o Allow multiple active certificates with same subject in CA index
 | 
			
		||||
      o Multiple X590 verification fixes
 | 
			
		||||
      o Multiple X509 verification fixes
 | 
			
		||||
      o Speed up HMAC and other operations
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7b and OpenSSL 0.9.7c:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								PROBLEMS
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								PROBLEMS
									
									
									
									
									
								
							@@ -12,8 +12,8 @@ along the whole library path before it bothers looking for .a libraries.  This
 | 
			
		||||
means that -L switches won't matter unless OpenSSL is built with shared
 | 
			
		||||
library support.
 | 
			
		||||
 | 
			
		||||
The workaround may be to change the following lines in apps/Makefile.ssl and
 | 
			
		||||
test/Makefile.ssl:
 | 
			
		||||
The workaround may be to change the following lines in apps/Makefile and
 | 
			
		||||
test/Makefile:
 | 
			
		||||
 | 
			
		||||
  LIBCRYPTO=-L.. -lcrypto
 | 
			
		||||
  LIBSSL=-L.. -lssl
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										16
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								README
									
									
									
									
									
								
							@@ -1,5 +1,5 @@
 | 
			
		||||
 | 
			
		||||
 OpenSSL 0.9.7d 17 Mar 2004
 | 
			
		||||
 OpenSSL 0.9.7e 25 Oct 2004
 | 
			
		||||
 | 
			
		||||
 Copyright (c) 1998-2004 The OpenSSL Project
 | 
			
		||||
 Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
 | 
			
		||||
@@ -173,11 +173,17 @@
 | 
			
		||||
 textual explanation of what your patch does.
 | 
			
		||||
 | 
			
		||||
 Note: For legal reasons, contributions from the US can be accepted only
 | 
			
		||||
 if a TSA notification and a copy of the patch is sent to crypt@bis.doc.gov;
 | 
			
		||||
 see http://www.bis.doc.gov/Encryption/PubAvailEncSourceCodeNofify.html [sic]
 | 
			
		||||
 and http://w3.access.gpo.gov/bis/ear/pdf/740.pdf (EAR Section 740.13(e)).
 | 
			
		||||
 if a TSU notification and a copy of the patch are sent to crypt@bis.doc.gov
 | 
			
		||||
 (formerly BXA) with a copy to the ENC Encryption Request Coordinator;
 | 
			
		||||
 please take some time to look at
 | 
			
		||||
    http://www.bis.doc.gov/Encryption/PubAvailEncSourceCodeNofify.html [sic]
 | 
			
		||||
 and
 | 
			
		||||
    http://w3.access.gpo.gov/bis/ear/pdf/740.pdf (EAR Section 740.13(e))
 | 
			
		||||
 for the details. If "your encryption source code is too large to serve as
 | 
			
		||||
 an email attachment", they are glad to receive it by fax instead; hope you
 | 
			
		||||
 have a cheap long-distance plan.
 | 
			
		||||
 | 
			
		||||
 The preferred format for changes is "diff -u" output. You might
 | 
			
		||||
 Our preferred format for changes is "diff -u" output. You might
 | 
			
		||||
 generate it like this:
 | 
			
		||||
 | 
			
		||||
 # cd openssl-work
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										143
									
								
								TABLE
									
									
									
									
									
								
							
							
						
						
									
										143
									
								
								TABLE
									
									
									
									
									
								
							@@ -1502,7 +1502,7 @@ $arflags      =
 | 
			
		||||
 | 
			
		||||
*** debug-ben
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -O2 -pedantic -Wall -Wshadow -Werror -pipe
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -O2 -Wall -Wshadow -Werror -pipe
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = (unknown)
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -1527,7 +1527,7 @@ $arflags      =
 | 
			
		||||
 | 
			
		||||
*** debug-ben-debug
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -g3 -O2 -Wall -Wshadow -Werror -pipe
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = (unknown)
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -1550,6 +1550,31 @@ $shared_extension =
 | 
			
		||||
$ranlib       = 
 | 
			
		||||
$arflags      = 
 | 
			
		||||
 | 
			
		||||
*** debug-ben-fips-debug
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_FIPS -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = (unknown)
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
$lflags       = 
 | 
			
		||||
$bn_ops       = 
 | 
			
		||||
$bn_obj       = asm/bn86-elf.o asm/co86-elf.o
 | 
			
		||||
$des_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      = 
 | 
			
		||||
 | 
			
		||||
*** debug-ben-openbsd
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -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
 | 
			
		||||
@@ -1793,10 +1818,10 @@ $rc4_obj      = asm/rx86-elf.o
 | 
			
		||||
$rmd160_obj   = asm/rm86-elf.o
 | 
			
		||||
$rc5_obj      = asm/r586-elf.o
 | 
			
		||||
$dso_scheme   = dlfcn
 | 
			
		||||
$shared_target= 
 | 
			
		||||
$shared_cflag = 
 | 
			
		||||
$shared_target= linux-shared
 | 
			
		||||
$shared_cflag = -fPIC
 | 
			
		||||
$shared_ldflag = 
 | 
			
		||||
$shared_extension = 
 | 
			
		||||
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
 | 
			
		||||
$ranlib       = 
 | 
			
		||||
$arflags      = 
 | 
			
		||||
 | 
			
		||||
@@ -1977,12 +2002,12 @@ $arflags      =
 | 
			
		||||
 | 
			
		||||
*** debug-steve
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -mcpu=i486 -pedantic -Wall -Werror -Wshadow -pipe
 | 
			
		||||
$cflags       = -DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -mcpu=i486 -pedantic -Wno-long-long -Wall -Werror -Wshadow -pipe
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
$lflags       = -rdynamic -ldl
 | 
			
		||||
$bn_ops       = DES_PTR DES_RISC1 DES_UNROLL RC4_INDEX MD2_INT
 | 
			
		||||
$lflags       = -ldl
 | 
			
		||||
$bn_ops       = BN_LLONG DES_PTR DES_RISC1 DES_UNROLL RC4_INDEX MD2_INT
 | 
			
		||||
$bn_obj       = asm/bn86-elf.o asm/co86-elf.o
 | 
			
		||||
$des_obj      = asm/dx86-elf.o asm/yx86-elf.o
 | 
			
		||||
$bf_obj       = asm/bx86-elf.o
 | 
			
		||||
@@ -2050,6 +2075,56 @@ $shared_extension =
 | 
			
		||||
$ranlib       = 
 | 
			
		||||
$arflags      = 
 | 
			
		||||
 | 
			
		||||
*** debug-vos-gcc
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -b hppa1.1-stratus-vos -O0 -g -Wall -D_POSIX_C_SOURCE=200112L -D_BSD -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = (unknown)
 | 
			
		||||
$sys_id       = VOS
 | 
			
		||||
$lflags       = -Wl,-map
 | 
			
		||||
$bn_ops       = BN_LLONG
 | 
			
		||||
$bn_obj       = 
 | 
			
		||||
$des_obj      = 
 | 
			
		||||
$bf_obj       = 
 | 
			
		||||
$md5_obj      = 
 | 
			
		||||
$sha1_obj     = 
 | 
			
		||||
$cast_obj     = 
 | 
			
		||||
$rc4_obj      = 
 | 
			
		||||
$rmd160_obj   = 
 | 
			
		||||
$rc5_obj      = 
 | 
			
		||||
$dso_scheme   = 
 | 
			
		||||
$shared_target= 
 | 
			
		||||
$shared_cflag = 
 | 
			
		||||
$shared_ldflag = .so
 | 
			
		||||
$shared_extension = 
 | 
			
		||||
$ranlib       = 
 | 
			
		||||
$arflags      = 
 | 
			
		||||
 | 
			
		||||
*** debug-vos-vcc
 | 
			
		||||
$cc           = vcc
 | 
			
		||||
$cflags       = -b i386-stratus-vos -O0 -g -D_POSIX_C_SOURCE=200112L -D_BSD -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = (unknown)
 | 
			
		||||
$sys_id       = VOS
 | 
			
		||||
$lflags       = -Wl,-map
 | 
			
		||||
$bn_ops       = 
 | 
			
		||||
$bn_obj       = 
 | 
			
		||||
$des_obj      = 
 | 
			
		||||
$bf_obj       = 
 | 
			
		||||
$md5_obj      = 
 | 
			
		||||
$sha1_obj     = 
 | 
			
		||||
$cast_obj     = 
 | 
			
		||||
$rc4_obj      = 
 | 
			
		||||
$rmd160_obj   = 
 | 
			
		||||
$rc5_obj      = 
 | 
			
		||||
$dso_scheme   = 
 | 
			
		||||
$shared_target= 
 | 
			
		||||
$shared_cflag = 
 | 
			
		||||
$shared_ldflag = .so
 | 
			
		||||
$shared_extension = 
 | 
			
		||||
$ranlib       = 
 | 
			
		||||
$arflags      = 
 | 
			
		||||
 | 
			
		||||
*** dgux-R3-gcc
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -O3 -fomit-frame-pointer
 | 
			
		||||
@@ -3006,7 +3081,7 @@ $cflags       = -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
$lflags       = 
 | 
			
		||||
$lflags       = -ldl
 | 
			
		||||
$bn_ops       = BN_LLONG
 | 
			
		||||
$bn_obj       = 
 | 
			
		||||
$des_obj      = 
 | 
			
		||||
@@ -4275,6 +4350,56 @@ $shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
 | 
			
		||||
$ranlib       = 
 | 
			
		||||
$arflags      = 
 | 
			
		||||
 | 
			
		||||
*** vos-gcc
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -b hppa1.1-stratus-vos -O3 -Wall -Wuninitialized -D_POSIX_C_SOURCE=200112L -D_BSD
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = (unknown)
 | 
			
		||||
$sys_id       = VOS
 | 
			
		||||
$lflags       = -Wl,-map
 | 
			
		||||
$bn_ops       = BN_LLONG
 | 
			
		||||
$bn_obj       = 
 | 
			
		||||
$des_obj      = 
 | 
			
		||||
$bf_obj       = 
 | 
			
		||||
$md5_obj      = 
 | 
			
		||||
$sha1_obj     = 
 | 
			
		||||
$cast_obj     = 
 | 
			
		||||
$rc4_obj      = 
 | 
			
		||||
$rmd160_obj   = 
 | 
			
		||||
$rc5_obj      = 
 | 
			
		||||
$dso_scheme   = 
 | 
			
		||||
$shared_target= 
 | 
			
		||||
$shared_cflag = 
 | 
			
		||||
$shared_ldflag = .so
 | 
			
		||||
$shared_extension = 
 | 
			
		||||
$ranlib       = 
 | 
			
		||||
$arflags      = 
 | 
			
		||||
 | 
			
		||||
*** vos-vcc
 | 
			
		||||
$cc           = vcc
 | 
			
		||||
$cflags       = -b i386-stratus-vos -O3 -D_POSIX_C_SOURCE=200112L -D_BSD
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = (unknown)
 | 
			
		||||
$sys_id       = VOS
 | 
			
		||||
$lflags       = -Wl,-map
 | 
			
		||||
$bn_ops       = 
 | 
			
		||||
$bn_obj       = 
 | 
			
		||||
$des_obj      = 
 | 
			
		||||
$bf_obj       = 
 | 
			
		||||
$md5_obj      = 
 | 
			
		||||
$sha1_obj     = 
 | 
			
		||||
$cast_obj     = 
 | 
			
		||||
$rc4_obj      = 
 | 
			
		||||
$rmd160_obj   = 
 | 
			
		||||
$rc5_obj      = 
 | 
			
		||||
$dso_scheme   = 
 | 
			
		||||
$shared_target= 
 | 
			
		||||
$shared_cflag = 
 | 
			
		||||
$shared_ldflag = .so
 | 
			
		||||
$shared_extension = 
 | 
			
		||||
$ranlib       = 
 | 
			
		||||
$arflags      = 
 | 
			
		||||
 | 
			
		||||
*** vxworks-mipsle
 | 
			
		||||
$cc           = ccmips
 | 
			
		||||
$cflags       = -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
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										34
									
								
								VMS/VMSify-conf.pl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								VMS/VMSify-conf.pl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
#! /usr/bin/perl
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
use warnings;
 | 
			
		||||
 | 
			
		||||
my @directory_vars = ( "dir", "certs", "crl_dir", "new_certs_dir" );
 | 
			
		||||
my @file_vars = ( "database", "certificate", "serial", "crlnumber",
 | 
			
		||||
		  "crl", "private_key", "RANDFILE" );
 | 
			
		||||
while(<STDIN>) {
 | 
			
		||||
    chomp;
 | 
			
		||||
    foreach my $d (@directory_vars) {
 | 
			
		||||
	if (/^(\s*\#?\s*${d}\s*=\s*)\.\/([^\s\#]*)([\s\#].*)$/) {
 | 
			
		||||
	    $_ = "$1sys\\\$disk:\[.$2$3";
 | 
			
		||||
	} elsif (/^(\s*\#?\s*${d}\s*=\s*)(\w[^\s\#]*)([\s\#].*)$/) {
 | 
			
		||||
	    $_ = "$1sys\\\$disk:\[.$2$3";
 | 
			
		||||
	}
 | 
			
		||||
	s/^(\s*\#?\s*${d}\s*=\s*\$\w+)\/([^\s\#]*)([\s\#].*)$/$1.$2\]$3/;
 | 
			
		||||
	while(/^(\s*\#?\s*${d}\s*=\s*(\$\w+\.|sys\\\$disk:\[\.)[\w\.]+)\/([^\]]*)\](.*)$/) {
 | 
			
		||||
	    $_ = "$1.$3]$4";
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
    foreach my $f (@file_vars) {
 | 
			
		||||
	s/^(\s*\#?\s*${f}\s*=\s*)\.\/(.*)$/$1sys\\\$disk:\[\/$2/;
 | 
			
		||||
	while(/^(\s*\#?\s*${f}\s*=\s*(\$\w+|sys\\\$disk:\[)[^\/]*)\/(\w+\/[^\s\#]*)([\s\#].*)$/) {
 | 
			
		||||
	    $_ = "$1.$3$4";
 | 
			
		||||
	}
 | 
			
		||||
	if (/^(\s*\#?\s*${f}\s*=\s*(\$\w+|sys\\\$disk:\[)[^\/]*)\/(\w+)([\s\#].*)$/) {
 | 
			
		||||
	    $_ = "$1]$3.$4";
 | 
			
		||||
	} elsif  (/^(\s*\#?\s*${f}\s*=\s*(\$\w+|sys\\\$disk:\[)[^\/]*)\/([^\s\#]*)([\s\#].*)$/) {
 | 
			
		||||
	    $_ = "$1]$3$4";
 | 
			
		||||
	}
 | 
			
		||||
   }
 | 
			
		||||
    print $_,"\n";
 | 
			
		||||
}
 | 
			
		||||
@@ -266,6 +266,14 @@ $             falsesum = falsesum + 1
 | 
			
		||||
$         endif
 | 
			
		||||
$         if plat_entry .eqs. "VMS" then truesum = truesum + 1
 | 
			
		||||
$         if plat_entry .eqs. "!VMS" then falsesum = falsesum + 1
 | 
			
		||||
$         if f$trnlnm("OPENSSL_FIPS") .nes. ""
 | 
			
		||||
$         then
 | 
			
		||||
$           if plat_entry .eqs. "OPENSSL_FIPS" then truesum = truesum + 1
 | 
			
		||||
$           if plat_entry .eqs. "!OPENSSL_FIPS" then falsesum = falsesum + 1
 | 
			
		||||
$         else
 | 
			
		||||
$           if plat_entry .eqs. "OPENSSL_FIPS" then falsesum = falsesum + 1
 | 
			
		||||
$           if plat_entry .eqs. "!OPENSSL_FIPS" then truesum = truesum + 1
 | 
			
		||||
$         endif
 | 
			
		||||
$	  goto loop1
 | 
			
		||||
$       endif
 | 
			
		||||
$     endloop1:
 | 
			
		||||
 
 | 
			
		||||
@@ -3,3 +3,4 @@ Makefile.save
 | 
			
		||||
der_chop
 | 
			
		||||
der_chop.bak
 | 
			
		||||
CA.pl
 | 
			
		||||
openssl.sha1
 | 
			
		||||
 
 | 
			
		||||
@@ -82,9 +82,6 @@ foreach (@ARGV) {
 | 
			
		||||
		mkdir "${CATOP}/crl", $DIRMODE ;
 | 
			
		||||
		mkdir "${CATOP}/newcerts", $DIRMODE;
 | 
			
		||||
		mkdir "${CATOP}/private", $DIRMODE;
 | 
			
		||||
		open OUT, ">${CATOP}/serial";
 | 
			
		||||
		print OUT "01\n";
 | 
			
		||||
		close OUT;
 | 
			
		||||
		open OUT, ">${CATOP}/index.txt";
 | 
			
		||||
		close OUT;
 | 
			
		||||
	    }
 | 
			
		||||
@@ -106,6 +103,10 @@ foreach (@ARGV) {
 | 
			
		||||
		    $RET=$?;
 | 
			
		||||
		}
 | 
			
		||||
	    }
 | 
			
		||||
	    if (! -f "${CATOP}/serial" ) {
 | 
			
		||||
		system ("$X509 -in ${CATOP}/$CACERT -noout "
 | 
			
		||||
			. "-next_serial -out ${CATOP}/serial");
 | 
			
		||||
	    }
 | 
			
		||||
	} elsif (/^-pkcs12$/) {
 | 
			
		||||
	    my $cname = $ARGV[1];
 | 
			
		||||
	    $cname = "My Certificate" unless defined $cname;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
#
 | 
			
		||||
#  apps/Makefile.ssl
 | 
			
		||||
#  apps/Makefile
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
DIR=		apps
 | 
			
		||||
@@ -10,10 +10,9 @@ CFLAG=		-g -static
 | 
			
		||||
INSTALL_PREFIX=
 | 
			
		||||
INSTALLTOP=	/usr/local/ssl
 | 
			
		||||
OPENSSLDIR=	/usr/local/ssl
 | 
			
		||||
MAKE=		make -f Makefile.ssl
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
MAKEFILE=	Makefile.ssl
 | 
			
		||||
MAKEFILE=	Makefile
 | 
			
		||||
PERL=		perl
 | 
			
		||||
RM=		rm -f
 | 
			
		||||
# KRB5 stuff
 | 
			
		||||
@@ -45,7 +44,7 @@ E_EXE=	verify asn1pars req dgst dh dhparam enc passwd gendh errstr \
 | 
			
		||||
	ca crl rsa rsautl dsa dsaparam \
 | 
			
		||||
	x509 genrsa gendsa s_server s_client speed \
 | 
			
		||||
	s_time version pkcs7 crl2pkcs7 sess_id ciphers nseq pkcs12 \
 | 
			
		||||
	pkcs8 spkac smime rand engine ocsp
 | 
			
		||||
	pkcs8 spkac smime rand engine ocsp prime
 | 
			
		||||
 | 
			
		||||
PROGS= $(PROGRAM).c
 | 
			
		||||
 | 
			
		||||
@@ -61,14 +60,14 @@ E_OBJ=	verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o er
 | 
			
		||||
	rsa.o rsautl.o dsa.o dsaparam.o \
 | 
			
		||||
	x509.o genrsa.o gendsa.o s_server.o s_client.o speed.o \
 | 
			
		||||
	s_time.o $(A_OBJ) $(S_OBJ) $(RAND_OBJ) version.o sess_id.o \
 | 
			
		||||
	ciphers.o nseq.o pkcs12.o pkcs8.o spkac.o smime.o rand.o engine.o ocsp.o
 | 
			
		||||
	ciphers.o nseq.o pkcs12.o pkcs8.o spkac.o smime.o rand.o engine.o ocsp.o prime.o
 | 
			
		||||
 | 
			
		||||
E_SRC=	verify.c asn1pars.c req.c dgst.c dh.c enc.c passwd.c gendh.c errstr.c ca.c \
 | 
			
		||||
	pkcs7.c crl2p7.c crl.c \
 | 
			
		||||
	rsa.c rsautl.c dsa.c dsaparam.c \
 | 
			
		||||
	x509.c genrsa.c gendsa.c s_server.c s_client.c speed.c \
 | 
			
		||||
	s_time.c $(A_SRC) $(S_SRC) $(RAND_SRC) version.c sess_id.c \
 | 
			
		||||
	ciphers.c nseq.c pkcs12.c pkcs8.c spkac.c smime.c rand.c engine.c ocsp.c
 | 
			
		||||
	ciphers.c nseq.c pkcs12.c pkcs8.c spkac.c smime.c rand.c engine.c ocsp.c prime.c
 | 
			
		||||
 | 
			
		||||
SRC=$(E_SRC)
 | 
			
		||||
 | 
			
		||||
@@ -84,7 +83,7 @@ top:
 | 
			
		||||
 | 
			
		||||
all:	exe
 | 
			
		||||
 | 
			
		||||
exe:	$(PROGRAM)
 | 
			
		||||
exe:	$(EXE)
 | 
			
		||||
 | 
			
		||||
req: sreq.o $(A_OBJ) $(DLIBCRYPTO)
 | 
			
		||||
	LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
 | 
			
		||||
@@ -94,7 +93,7 @@ sreq.o: req.c
 | 
			
		||||
	$(CC) -c $(INCLUDES) $(CFLAG) -o sreq.o req.c
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
 | 
			
		||||
install:
 | 
			
		||||
	@for i in $(EXE); \
 | 
			
		||||
@@ -121,7 +120,6 @@ tags:
 | 
			
		||||
tests:
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
@@ -143,15 +141,18 @@ $(DLIBSSL):
 | 
			
		||||
$(DLIBCRYPTO):
 | 
			
		||||
	(cd ..; $(MAKE) DIRS=crypto all)
 | 
			
		||||
 | 
			
		||||
$(PROGRAM): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL)
 | 
			
		||||
	$(RM) $(PROGRAM)
 | 
			
		||||
$(EXE): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL)
 | 
			
		||||
	$(RM) $(EXE)
 | 
			
		||||
	if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
 | 
			
		||||
	  $(CC) -o $(PROGRAM) $(CFLAGS) $(PROGRAM).o $(E_OBJ) $(PEX_LIBS) $(DLIBSSL) $(LIBKRB5) $(DLIBCRYPTO) $(EX_LIBS) ; \
 | 
			
		||||
	  $(CC) -o $(EXE) $(CFLAGS) $(PROGRAM).o $(E_OBJ) $(PEX_LIBS) $(DLIBSSL) $(LIBKRB5) $(DLIBCRYPTO) $(EX_LIBS) ; \
 | 
			
		||||
	else \
 | 
			
		||||
	  LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
 | 
			
		||||
	  $(CC) -o $(PROGRAM) $(CFLAGS) $(PROGRAM).o $(E_OBJ) $(PEX_LIBS) $(LIBSSL) $(LIBKRB5) $(LIBCRYPTO) $(EX_LIBS) ; \
 | 
			
		||||
	  $(CC) -o $(EXE) $(CFLAGS) $(PROGRAM).o $(E_OBJ) $(PEX_LIBS) $(LIBSSL) $(LIBKRB5) $(LIBCRYPTO) $(EX_LIBS) ; \
 | 
			
		||||
	fi
 | 
			
		||||
	-(cd ..; OPENSSL="`pwd`/apps/openssl"; export OPENSSL; \
 | 
			
		||||
	if egrep 'define OPENSSL_FIPS' $(TOP)/include/openssl/opensslconf.h > /dev/null; then \
 | 
			
		||||
		TOP=$(TOP) $(TOP)/fips/openssl_fips_fingerprint $(TOP)/libcrypto.a $(EXE); \
 | 
			
		||||
	fi
 | 
			
		||||
	-(cd ..; OPENSSL="`pwd`/apps/$(EXE)"; export OPENSSL; \
 | 
			
		||||
		LD_LIBRARY_PATH="`pwd`:$$LD_LIBRARY_PATH"; \
 | 
			
		||||
		DYLD_LIBRARY_PATH="`pwd`:$$DYLD_LIBRARY_PATH"; \
 | 
			
		||||
		SHLIB_PATH="`pwd`:$$SHLIB_PATH"; \
 | 
			
		||||
@@ -344,21 +345,22 @@ dgst.o: ../include/openssl/crypto.h ../include/openssl/des.h
 | 
			
		||||
dgst.o: ../include/openssl/des_old.h ../include/openssl/dh.h
 | 
			
		||||
dgst.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
 | 
			
		||||
dgst.o: ../include/openssl/engine.h ../include/openssl/err.h
 | 
			
		||||
dgst.o: ../include/openssl/evp.h ../include/openssl/idea.h
 | 
			
		||||
dgst.o: ../include/openssl/lhash.h ../include/openssl/md2.h
 | 
			
		||||
dgst.o: ../include/openssl/md4.h ../include/openssl/md5.h
 | 
			
		||||
dgst.o: ../include/openssl/mdc2.h ../include/openssl/obj_mac.h
 | 
			
		||||
dgst.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
 | 
			
		||||
dgst.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
 | 
			
		||||
dgst.o: ../include/openssl/pem.h ../include/openssl/pem2.h
 | 
			
		||||
dgst.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
 | 
			
		||||
dgst.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
 | 
			
		||||
dgst.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
 | 
			
		||||
dgst.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
 | 
			
		||||
dgst.o: ../include/openssl/sha.h ../include/openssl/stack.h
 | 
			
		||||
dgst.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
 | 
			
		||||
dgst.o: ../include/openssl/ui.h ../include/openssl/ui_compat.h
 | 
			
		||||
dgst.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h dgst.c
 | 
			
		||||
dgst.o: ../include/openssl/evp.h ../include/openssl/hmac.h
 | 
			
		||||
dgst.o: ../include/openssl/idea.h ../include/openssl/lhash.h
 | 
			
		||||
dgst.o: ../include/openssl/md2.h ../include/openssl/md4.h
 | 
			
		||||
dgst.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
 | 
			
		||||
dgst.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
 | 
			
		||||
dgst.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
 | 
			
		||||
dgst.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
 | 
			
		||||
dgst.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
 | 
			
		||||
dgst.o: ../include/openssl/rand.h ../include/openssl/rc2.h
 | 
			
		||||
dgst.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
 | 
			
		||||
dgst.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
 | 
			
		||||
dgst.o: ../include/openssl/safestack.h ../include/openssl/sha.h
 | 
			
		||||
dgst.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
 | 
			
		||||
dgst.o: ../include/openssl/txt_db.h ../include/openssl/ui.h
 | 
			
		||||
dgst.o: ../include/openssl/ui_compat.h ../include/openssl/x509.h
 | 
			
		||||
dgst.o: ../include/openssl/x509_vfy.h apps.h dgst.c
 | 
			
		||||
dh.o: ../e_os.h ../include/openssl/aes.h ../include/openssl/asn1.h
 | 
			
		||||
dh.o: ../include/openssl/bio.h ../include/openssl/blowfish.h
 | 
			
		||||
dh.o: ../include/openssl/bn.h ../include/openssl/buffer.h
 | 
			
		||||
@@ -637,24 +639,25 @@ openssl.o: ../include/openssl/des.h ../include/openssl/des_old.h
 | 
			
		||||
openssl.o: ../include/openssl/dh.h ../include/openssl/dsa.h
 | 
			
		||||
openssl.o: ../include/openssl/e_os2.h ../include/openssl/engine.h
 | 
			
		||||
openssl.o: ../include/openssl/err.h ../include/openssl/evp.h
 | 
			
		||||
openssl.o: ../include/openssl/idea.h ../include/openssl/kssl.h
 | 
			
		||||
openssl.o: ../include/openssl/lhash.h ../include/openssl/md2.h
 | 
			
		||||
openssl.o: ../include/openssl/md4.h ../include/openssl/md5.h
 | 
			
		||||
openssl.o: ../include/openssl/mdc2.h ../include/openssl/obj_mac.h
 | 
			
		||||
openssl.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
 | 
			
		||||
openssl.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
 | 
			
		||||
openssl.o: ../include/openssl/pem.h ../include/openssl/pem2.h
 | 
			
		||||
openssl.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
 | 
			
		||||
openssl.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
 | 
			
		||||
openssl.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
 | 
			
		||||
openssl.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
 | 
			
		||||
openssl.o: ../include/openssl/sha.h ../include/openssl/ssl.h
 | 
			
		||||
openssl.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
 | 
			
		||||
openssl.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
 | 
			
		||||
openssl.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 | 
			
		||||
openssl.o: ../include/openssl/txt_db.h ../include/openssl/ui.h
 | 
			
		||||
openssl.o: ../include/openssl/ui_compat.h ../include/openssl/x509.h
 | 
			
		||||
openssl.o: ../include/openssl/x509_vfy.h apps.h openssl.c progs.h s_apps.h
 | 
			
		||||
openssl.o: ../include/openssl/fips.h ../include/openssl/idea.h
 | 
			
		||||
openssl.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
 | 
			
		||||
openssl.o: ../include/openssl/md2.h ../include/openssl/md4.h
 | 
			
		||||
openssl.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
 | 
			
		||||
openssl.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
 | 
			
		||||
openssl.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
 | 
			
		||||
openssl.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
 | 
			
		||||
openssl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
 | 
			
		||||
openssl.o: ../include/openssl/rand.h ../include/openssl/rc2.h
 | 
			
		||||
openssl.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
 | 
			
		||||
openssl.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
 | 
			
		||||
openssl.o: ../include/openssl/safestack.h ../include/openssl/sha.h
 | 
			
		||||
openssl.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
 | 
			
		||||
openssl.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
 | 
			
		||||
openssl.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
 | 
			
		||||
openssl.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
 | 
			
		||||
openssl.o: ../include/openssl/ui.h ../include/openssl/ui_compat.h
 | 
			
		||||
openssl.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
 | 
			
		||||
openssl.o: openssl.c progs.h s_apps.h
 | 
			
		||||
passwd.o: ../e_os.h ../include/openssl/aes.h ../include/openssl/asn1.h
 | 
			
		||||
passwd.o: ../include/openssl/bio.h ../include/openssl/blowfish.h
 | 
			
		||||
passwd.o: ../include/openssl/bn.h ../include/openssl/buffer.h
 | 
			
		||||
@@ -749,6 +752,28 @@ pkcs8.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
 | 
			
		||||
pkcs8.o: ../include/openssl/txt_db.h ../include/openssl/ui.h
 | 
			
		||||
pkcs8.o: ../include/openssl/ui_compat.h ../include/openssl/x509.h
 | 
			
		||||
pkcs8.o: ../include/openssl/x509_vfy.h apps.h pkcs8.c
 | 
			
		||||
prime.o: ../e_os.h ../include/openssl/aes.h ../include/openssl/asn1.h
 | 
			
		||||
prime.o: ../include/openssl/bio.h ../include/openssl/blowfish.h
 | 
			
		||||
prime.o: ../include/openssl/bn.h ../include/openssl/buffer.h
 | 
			
		||||
prime.o: ../include/openssl/cast.h ../include/openssl/conf.h
 | 
			
		||||
prime.o: ../include/openssl/crypto.h ../include/openssl/des.h
 | 
			
		||||
prime.o: ../include/openssl/des_old.h ../include/openssl/dh.h
 | 
			
		||||
prime.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
 | 
			
		||||
prime.o: ../include/openssl/engine.h ../include/openssl/err.h
 | 
			
		||||
prime.o: ../include/openssl/evp.h ../include/openssl/idea.h
 | 
			
		||||
prime.o: ../include/openssl/lhash.h ../include/openssl/md2.h
 | 
			
		||||
prime.o: ../include/openssl/md4.h ../include/openssl/md5.h
 | 
			
		||||
prime.o: ../include/openssl/mdc2.h ../include/openssl/obj_mac.h
 | 
			
		||||
prime.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
 | 
			
		||||
prime.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
 | 
			
		||||
prime.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
 | 
			
		||||
prime.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
 | 
			
		||||
prime.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
 | 
			
		||||
prime.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
 | 
			
		||||
prime.o: ../include/openssl/sha.h ../include/openssl/stack.h
 | 
			
		||||
prime.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
 | 
			
		||||
prime.o: ../include/openssl/ui.h ../include/openssl/ui_compat.h
 | 
			
		||||
prime.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h prime.c
 | 
			
		||||
rand.o: ../e_os.h ../include/openssl/aes.h ../include/openssl/asn1.h
 | 
			
		||||
rand.o: ../include/openssl/bio.h ../include/openssl/blowfish.h
 | 
			
		||||
rand.o: ../include/openssl/bn.h ../include/openssl/buffer.h
 | 
			
		||||
							
								
								
									
										42
									
								
								apps/apps.c
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								apps/apps.c
									
									
									
									
									
								
							@@ -126,16 +126,6 @@
 | 
			
		||||
#include <openssl/engine.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef OPENSSL_SYS_WINDOWS
 | 
			
		||||
#define strcasecmp _stricmp
 | 
			
		||||
#else
 | 
			
		||||
#  ifdef NO_STRINGS_H
 | 
			
		||||
    int	strcasecmp();
 | 
			
		||||
#  else
 | 
			
		||||
#    include <strings.h>
 | 
			
		||||
#  endif /* NO_STRINGS_H */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define NON_MAIN
 | 
			
		||||
#include "apps.h"
 | 
			
		||||
#undef NON_MAIN
 | 
			
		||||
@@ -1448,12 +1438,9 @@ BIGNUM *load_serial(char *serialfile, int create, ASN1_INTEGER **retai)
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			ASN1_INTEGER_set(ai,1);
 | 
			
		||||
			ret=BN_new();
 | 
			
		||||
			if (ret == NULL)
 | 
			
		||||
			if (ret == NULL || !rand_serial(ret, ai))
 | 
			
		||||
				BIO_printf(bio_err, "Out of memory\n");
 | 
			
		||||
			else
 | 
			
		||||
				BN_one(ret);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
@@ -1615,6 +1602,33 @@ int rotate_serial(char *serialfile, char *new_suffix, char *old_suffix)
 | 
			
		||||
	return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int rand_serial(BIGNUM *b, ASN1_INTEGER *ai)
 | 
			
		||||
	{
 | 
			
		||||
	BIGNUM *btmp;
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
	if (b)
 | 
			
		||||
		btmp = b;
 | 
			
		||||
	else
 | 
			
		||||
		btmp = BN_new();
 | 
			
		||||
 | 
			
		||||
	if (!btmp)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	if (!BN_pseudo_rand(btmp, SERIAL_RAND_BITS, 0, 0))
 | 
			
		||||
		goto error;
 | 
			
		||||
	if (ai && !BN_to_ASN1_INTEGER(btmp, ai))
 | 
			
		||||
		goto error;
 | 
			
		||||
 | 
			
		||||
	ret = 1;
 | 
			
		||||
	
 | 
			
		||||
	error:
 | 
			
		||||
 | 
			
		||||
	if (!b)
 | 
			
		||||
		BN_free(btmp);
 | 
			
		||||
	
 | 
			
		||||
	return ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
CA_DB *load_index(char *dbfile, DB_ATTR *db_attr)
 | 
			
		||||
	{
 | 
			
		||||
	CA_DB *retdb = NULL;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								apps/apps.h
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								apps/apps.h
									
									
									
									
									
								
							@@ -141,12 +141,6 @@ long app_RAND_load_files(char *file); /* `file' is a list of files to read,
 | 
			
		||||
int WIN32_rename(char *oldname,char *newname);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* VMS below version 7.0 doesn't have strcasecmp() */
 | 
			
		||||
#ifdef OPENSSL_SYS_VMS
 | 
			
		||||
#define strcasecmp(str1,str2) VMS_strcasecmp((str1),(str2))
 | 
			
		||||
int VMS_strcasecmp(const char *str1, const char *str2);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef MONOLITH
 | 
			
		||||
 | 
			
		||||
#define MAIN(a,v)	main(a,v)
 | 
			
		||||
@@ -154,9 +148,11 @@ int VMS_strcasecmp(const char *str1, const char *str2);
 | 
			
		||||
#ifndef NON_MAIN
 | 
			
		||||
CONF *config=NULL;
 | 
			
		||||
BIO *bio_err=NULL;
 | 
			
		||||
int in_FIPS_mode=0;
 | 
			
		||||
#else
 | 
			
		||||
extern CONF *config;
 | 
			
		||||
extern BIO *bio_err;
 | 
			
		||||
extern int in_FIPS_mode;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
@@ -165,6 +161,7 @@ extern BIO *bio_err;
 | 
			
		||||
extern CONF *config;
 | 
			
		||||
extern char *default_config_file;
 | 
			
		||||
extern BIO *bio_err;
 | 
			
		||||
extern int in_FIPS_mode;
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -313,6 +310,7 @@ typedef struct ca_db_st
 | 
			
		||||
BIGNUM *load_serial(char *serialfile, int create, ASN1_INTEGER **retai);
 | 
			
		||||
int save_serial(char *serialfile, char *suffix, BIGNUM *serial, ASN1_INTEGER **retai);
 | 
			
		||||
int rotate_serial(char *serialfile, char *new_suffix, char *old_suffix);
 | 
			
		||||
int rand_serial(BIGNUM *b, ASN1_INTEGER *ai);
 | 
			
		||||
CA_DB *load_index(char *dbfile, DB_ATTR *dbattr);
 | 
			
		||||
int index_index(CA_DB *db);
 | 
			
		||||
int save_index(char *dbfile, char *suffix, CA_DB *db);
 | 
			
		||||
@@ -341,4 +339,6 @@ X509_NAME *do_subject(char *str, long chtype);
 | 
			
		||||
 | 
			
		||||
#define APP_PASS_LEN	1024
 | 
			
		||||
 | 
			
		||||
#define SERIAL_RAND_BITS	64
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -278,6 +278,7 @@ bad:
 | 
			
		||||
		tmplen=num;
 | 
			
		||||
		for (i=0; i<sk_num(osk); i++)
 | 
			
		||||
			{
 | 
			
		||||
			int typ;
 | 
			
		||||
			ASN1_TYPE *atmp;
 | 
			
		||||
			j=atoi(sk_value(osk,i));
 | 
			
		||||
			if (j == 0)
 | 
			
		||||
@@ -296,6 +297,15 @@ bad:
 | 
			
		||||
				ERR_print_errors(bio_err);
 | 
			
		||||
				goto end;
 | 
			
		||||
				}
 | 
			
		||||
			typ = ASN1_TYPE_get(at);
 | 
			
		||||
			if ((typ == V_ASN1_OBJECT)
 | 
			
		||||
				|| (typ == V_ASN1_NULL))
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_err, "Can't parse %s type\n",
 | 
			
		||||
					typ == V_ASN1_NULL ? "NULL" : "OBJECT");
 | 
			
		||||
				ERR_print_errors(bio_err);
 | 
			
		||||
				goto end;
 | 
			
		||||
				}
 | 
			
		||||
			/* hmm... this is a little evil but it works */
 | 
			
		||||
			tmpbuf=at->value.asn1_string->data;
 | 
			
		||||
			tmplen=at->value.asn1_string->length;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										25
									
								
								apps/ca.c
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								apps/ca.c
									
									
									
									
									
								
							@@ -76,16 +76,6 @@
 | 
			
		||||
#include <openssl/ocsp.h>
 | 
			
		||||
#include <openssl/pem.h>
 | 
			
		||||
 | 
			
		||||
#ifdef OPENSSL_SYS_WINDOWS
 | 
			
		||||
#define strcasecmp _stricmp
 | 
			
		||||
#else
 | 
			
		||||
#  ifdef NO_STRINGS_H
 | 
			
		||||
    int	strcasecmp();
 | 
			
		||||
#  else
 | 
			
		||||
#    include <strings.h>
 | 
			
		||||
#  endif /* NO_STRINGS_H */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef W_OK
 | 
			
		||||
#  ifdef OPENSSL_SYS_VMS
 | 
			
		||||
#    if defined(__DECC)
 | 
			
		||||
@@ -248,6 +238,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	{
 | 
			
		||||
	ENGINE *e = NULL;
 | 
			
		||||
	char *key=NULL,*passargin=NULL;
 | 
			
		||||
	int create_ser = 0;
 | 
			
		||||
	int free_key = 0;
 | 
			
		||||
	int total=0;
 | 
			
		||||
	int total_done=0;
 | 
			
		||||
@@ -547,10 +538,6 @@ bad:
 | 
			
		||||
 | 
			
		||||
	ERR_load_crypto_strings();
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	e = setup_engine(bio_err, engine, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	/*****************************************************************/
 | 
			
		||||
	tofree=NULL;
 | 
			
		||||
	if (configfile == NULL) configfile = getenv("OPENSSL_CONF");
 | 
			
		||||
@@ -595,6 +582,10 @@ bad:
 | 
			
		||||
	if (!load_config(bio_err, conf))
 | 
			
		||||
		goto err;
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	e = setup_engine(bio_err, engine, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	/* Lets get the config section we are using */
 | 
			
		||||
	if (section == NULL)
 | 
			
		||||
		{
 | 
			
		||||
@@ -666,8 +657,10 @@ bad:
 | 
			
		||||
			break;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
#ifdef RL_DEBUG
 | 
			
		||||
	else
 | 
			
		||||
		ERR_clear_error();
 | 
			
		||||
#ifdef RL_DEBUG
 | 
			
		||||
	if (!p)
 | 
			
		||||
		BIO_printf(bio_err, "DEBUG: unique_subject undefined\n", p);
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef RL_DEBUG
 | 
			
		||||
@@ -1106,7 +1099,7 @@ bad:
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if ((serial=load_serial(serialfile, 0, NULL)) == NULL)
 | 
			
		||||
		if ((serial=load_serial(serialfile, create_ser, NULL)) == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,"error while loading serial number\n");
 | 
			
		||||
			goto err;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										58
									
								
								apps/dgst.c
									
									
									
									
									
								
							
							
						
						
									
										58
									
								
								apps/dgst.c
									
									
									
									
									
								
							@@ -66,6 +66,7 @@
 | 
			
		||||
#include <openssl/objects.h>
 | 
			
		||||
#include <openssl/x509.h>
 | 
			
		||||
#include <openssl/pem.h>
 | 
			
		||||
#include <openssl/hmac.h>
 | 
			
		||||
 | 
			
		||||
#undef BUFSIZE
 | 
			
		||||
#define BUFSIZE	1024*8
 | 
			
		||||
@@ -73,9 +74,11 @@
 | 
			
		||||
#undef PROG
 | 
			
		||||
#define PROG	dgst_main
 | 
			
		||||
 | 
			
		||||
static HMAC_CTX hmac_ctx;
 | 
			
		||||
 | 
			
		||||
int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
 | 
			
		||||
	  EVP_PKEY *key, unsigned char *sigin, int siglen, const char *title,
 | 
			
		||||
	  const char *file);
 | 
			
		||||
	  const char *file,BIO *bmd,const char *hmac_key);
 | 
			
		||||
 | 
			
		||||
int MAIN(int, char **);
 | 
			
		||||
 | 
			
		||||
@@ -103,6 +106,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	char *engine=NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	char *hmac_key=NULL;
 | 
			
		||||
 | 
			
		||||
	apps_startup();
 | 
			
		||||
 | 
			
		||||
@@ -181,6 +185,12 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			out_bin = 1;
 | 
			
		||||
		else if (strcmp(*argv,"-d") == 0)
 | 
			
		||||
			debug=1;
 | 
			
		||||
		else if (!strcmp(*argv,"-hmac"))
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1)
 | 
			
		||||
				break;
 | 
			
		||||
			hmac_key=*++argv;
 | 
			
		||||
			}
 | 
			
		||||
		else if ((m=EVP_get_digestbyname(&((*argv)[1]))) != NULL)
 | 
			
		||||
			md=m;
 | 
			
		||||
		else
 | 
			
		||||
@@ -235,7 +245,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
        e = setup_engine(bio_err, engine, 0);
 | 
			
		||||
	e = setup_engine(bio_err, engine, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	in=BIO_new(BIO_s_file());
 | 
			
		||||
@@ -318,18 +328,22 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			goto end;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/* we use md as a filter, reading from 'in' */
 | 
			
		||||
	BIO_set_md(bmd,md);
 | 
			
		||||
	if (!BIO_set_md(bmd,md))
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err, "Error setting digest %s\n", pname);
 | 
			
		||||
		ERR_print_errors(bio_err);
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
	inp=BIO_push(bmd,in);
 | 
			
		||||
 | 
			
		||||
	if (argc == 0)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_set_fp(in,stdin,BIO_NOCLOSE);
 | 
			
		||||
		err=do_fp(out, buf,inp,separator, out_bin, sigkey, sigbuf,
 | 
			
		||||
			  siglen,"","(stdin)");
 | 
			
		||||
			  siglen,"","(stdin)",bmd,hmac_key);
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
@@ -347,14 +361,15 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
				}
 | 
			
		||||
			if(!out_bin)
 | 
			
		||||
				{
 | 
			
		||||
				size_t len = strlen(name)+strlen(argv[i])+5;
 | 
			
		||||
				size_t len = strlen(name)+strlen(argv[i])+(hmac_key ? 5 : 0)+5;
 | 
			
		||||
				tmp=tofree=OPENSSL_malloc(len);
 | 
			
		||||
				BIO_snprintf(tmp,len,"%s(%s)= ",name,argv[i]);
 | 
			
		||||
				BIO_snprintf(tmp,len,"%s%s(%s)= ",
 | 
			
		||||
							 hmac_key ? "HMAC-" : "",name,argv[i]);
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				tmp="";
 | 
			
		||||
			r=do_fp(out,buf,inp,separator,out_bin,sigkey,sigbuf,
 | 
			
		||||
				siglen,tmp,argv[i]);
 | 
			
		||||
				siglen,tmp,argv[i],bmd,hmac_key);
 | 
			
		||||
			if(r)
 | 
			
		||||
			    err=r;
 | 
			
		||||
			if(tofree)
 | 
			
		||||
@@ -379,11 +394,21 @@ end:
 | 
			
		||||
 | 
			
		||||
int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
 | 
			
		||||
	  EVP_PKEY *key, unsigned char *sigin, int siglen, const char *title,
 | 
			
		||||
	  const char *file)
 | 
			
		||||
	  const char *file,BIO *bmd,const char *hmac_key)
 | 
			
		||||
	{
 | 
			
		||||
	int len;
 | 
			
		||||
	unsigned int len;
 | 
			
		||||
	int i;
 | 
			
		||||
	EVP_MD_CTX *md_ctx;
 | 
			
		||||
 | 
			
		||||
	if (hmac_key)
 | 
			
		||||
		{
 | 
			
		||||
		EVP_MD *md;
 | 
			
		||||
 | 
			
		||||
		BIO_get_md(bmd,&md);
 | 
			
		||||
		HMAC_Init(&hmac_ctx,hmac_key,strlen(hmac_key),md);
 | 
			
		||||
		BIO_get_md_ctx(bmd,&md_ctx);
 | 
			
		||||
		BIO_set_md_ctx(bmd,&hmac_ctx.md_ctx);
 | 
			
		||||
		}
 | 
			
		||||
	for (;;)
 | 
			
		||||
		{
 | 
			
		||||
		i=BIO_read(bp,(char *)buf,BUFSIZE);
 | 
			
		||||
@@ -426,6 +451,11 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
 | 
			
		||||
			return 1;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	else if(hmac_key)
 | 
			
		||||
		{
 | 
			
		||||
		HMAC_Final(&hmac_ctx,buf,&len);
 | 
			
		||||
		HMAC_CTX_cleanup(&hmac_ctx);
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		len=BIO_gets(bp,(char *)buf,BUFSIZE);
 | 
			
		||||
 | 
			
		||||
@@ -433,7 +463,7 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
 | 
			
		||||
	else 
 | 
			
		||||
		{
 | 
			
		||||
		BIO_write(out,title,strlen(title));
 | 
			
		||||
		for (i=0; i<len; i++)
 | 
			
		||||
		for (i=0; (unsigned int)i<len; i++)
 | 
			
		||||
			{
 | 
			
		||||
			if (sep && (i != 0))
 | 
			
		||||
				BIO_printf(out, ":");
 | 
			
		||||
@@ -441,6 +471,10 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
 | 
			
		||||
			}
 | 
			
		||||
		BIO_printf(out, "\n");
 | 
			
		||||
		}
 | 
			
		||||
	if (hmac_key)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_set_md_ctx(bmd,md_ctx);
 | 
			
		||||
		}
 | 
			
		||||
	return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										29
									
								
								apps/enc.c
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								apps/enc.c
									
									
									
									
									
								
							@@ -114,6 +114,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	unsigned char salt[PKCS5_SALT_LEN];
 | 
			
		||||
	char *str=NULL, *passarg = NULL, *pass = NULL;
 | 
			
		||||
	char *hkey=NULL,*hiv=NULL,*hsalt = NULL;
 | 
			
		||||
	char *md=NULL;
 | 
			
		||||
	int enc=1,printkey=0,i,base64=0;
 | 
			
		||||
	int debug=0,olb64=0,nosalt=0;
 | 
			
		||||
	const EVP_CIPHER *cipher=NULL,*c;
 | 
			
		||||
@@ -124,6 +125,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	char *engine = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	const EVP_MD *dgst=NULL;
 | 
			
		||||
 | 
			
		||||
	apps_startup();
 | 
			
		||||
 | 
			
		||||
@@ -253,6 +255,11 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			hiv= *(++argv);
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-md") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			md= *(++argv);
 | 
			
		||||
			}
 | 
			
		||||
		else if	((argv[0][0] == '-') &&
 | 
			
		||||
			((c=EVP_get_cipherbyname(&(argv[0][1]))) != NULL))
 | 
			
		||||
			{
 | 
			
		||||
@@ -271,8 +278,10 @@ bad:
 | 
			
		||||
			BIO_printf(bio_err,"%-14s encrypt\n","-e");
 | 
			
		||||
			BIO_printf(bio_err,"%-14s decrypt\n","-d");
 | 
			
		||||
			BIO_printf(bio_err,"%-14s base64 encode/decode, depending on encryption flag\n","-a/-base64");
 | 
			
		||||
			BIO_printf(bio_err,"%-14s key is the next argument\n","-k");
 | 
			
		||||
			BIO_printf(bio_err,"%-14s key is the first line of the file argument\n","-kfile");
 | 
			
		||||
			BIO_printf(bio_err,"%-14s passphrase is the next argument\n","-k");
 | 
			
		||||
			BIO_printf(bio_err,"%-14s passphrase is the first line of the file argument\n","-kfile");
 | 
			
		||||
			BIO_printf(bio_err,"%-14s the next argument is the md to use to create a key\n","-md");
 | 
			
		||||
			BIO_printf(bio_err,"%-14s   from a passphrase.  One of md2, md5, sha or sha1\n","");
 | 
			
		||||
			BIO_printf(bio_err,"%-14s key/iv in hex is the next argument\n","-K/-iv");
 | 
			
		||||
			BIO_printf(bio_err,"%-14s print the iv/key (then exit if -P)\n","-[pP]");
 | 
			
		||||
			BIO_printf(bio_err,"%-14s buffer size\n","-bufsize <n>");
 | 
			
		||||
@@ -296,6 +305,20 @@ bad:
 | 
			
		||||
        e = setup_engine(bio_err, engine, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (md && (dgst=EVP_get_digestbyname(md)) == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,"%s is an unsupported message digest type\n",md);
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (dgst == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		if (in_FIPS_mode)
 | 
			
		||||
			dgst = EVP_sha1();
 | 
			
		||||
		else
 | 
			
		||||
			dgst = EVP_md5();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (bufsize != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		unsigned long n;
 | 
			
		||||
@@ -483,7 +506,7 @@ bad:
 | 
			
		||||
				sptr = salt;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			EVP_BytesToKey(cipher,EVP_md5(),sptr,
 | 
			
		||||
			EVP_BytesToKey(cipher,dgst,sptr,
 | 
			
		||||
				(unsigned char *)str,
 | 
			
		||||
				strlen(str),1,key,iv);
 | 
			
		||||
			/* zero the complete buffer or the string
 | 
			
		||||
 
 | 
			
		||||
@@ -142,13 +142,13 @@ $ LIB_FILES = "VERIFY;ASN1PARS;REQ;DGST;DH;DHPARAM;ENC;PASSWD;GENDH;ERRSTR;"+-
 | 
			
		||||
	      "RSA;RSAUTL;DSA;DSAPARAM;"+-
 | 
			
		||||
	      "X509;GENRSA;GENDSA;S_SERVER;S_CLIENT;SPEED;"+-
 | 
			
		||||
	      "S_TIME;APPS;S_CB;S_SOCKET;APP_RAND;VERSION;SESS_ID;"+-
 | 
			
		||||
	      "CIPHERS;NSEQ;PKCS12;PKCS8;SPKAC;SMIME;RAND;ENGINE;OCSP"
 | 
			
		||||
	      "CIPHERS;NSEQ;PKCS12;PKCS8;SPKAC;SMIME;RAND;ENGINE;OCSP;PRIME"
 | 
			
		||||
$ APP_FILES := OPENSSL,'OBJ_DIR'VERIFY.OBJ,ASN1PARS.OBJ,REQ.OBJ,DGST.OBJ,DH.OBJ,DHPARAM.OBJ,ENC.OBJ,PASSWD.OBJ,GENDH.OBJ,ERRSTR.OBJ,-
 | 
			
		||||
	       CA.OBJ,PKCS7.OBJ,CRL2P7.OBJ,CRL.OBJ,-
 | 
			
		||||
	       RSA.OBJ,RSAUTL.OBJ,DSA.OBJ,DSAPARAM.OBJ,-
 | 
			
		||||
	       X509.OBJ,GENRSA.OBJ,GENDSA.OBJ,S_SERVER.OBJ,S_CLIENT.OBJ,SPEED.OBJ,-
 | 
			
		||||
	       S_TIME.OBJ,APPS.OBJ,S_CB.OBJ,S_SOCKET.OBJ,APP_RAND.OBJ,VERSION.OBJ,SESS_ID.OBJ,-
 | 
			
		||||
	       CIPHERS.OBJ,NSEQ.OBJ,PKCS12.OBJ,PKCS8.OBJ,SPKAC.OBJ,SMIME.OBJ,RAND.OBJ,ENGINE.OBJ,OCSP.OBJ
 | 
			
		||||
	       CIPHERS.OBJ,NSEQ.OBJ,PKCS12.OBJ,PKCS8.OBJ,SPKAC.OBJ,SMIME.OBJ,RAND.OBJ,ENGINE.OBJ,OCSP.OBJ,PRIME.OBJ
 | 
			
		||||
$ TCPIP_PROGRAMS = ",,"
 | 
			
		||||
$ IF COMPILER .EQS. "VAXC" THEN -
 | 
			
		||||
     TCPIP_PROGRAMS = ",OPENSSL,"
 | 
			
		||||
@@ -679,7 +679,7 @@ $     IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
 | 
			
		||||
	 THEN CC = "CC/DECC"
 | 
			
		||||
$     CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + -
 | 
			
		||||
           "/NOLIST/PREFIX=ALL" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[-])" + CCEXTRAFLAGS
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS
 | 
			
		||||
$!
 | 
			
		||||
$!    Define The Linker Options File Name.
 | 
			
		||||
$!
 | 
			
		||||
@@ -711,7 +711,7 @@ $	EXIT
 | 
			
		||||
$     ENDIF
 | 
			
		||||
$     IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC"
 | 
			
		||||
$     CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[-])" + CCEXTRAFLAGS
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS
 | 
			
		||||
$     CCDEFS = CCDEFS + ",""VAXC"""
 | 
			
		||||
$!
 | 
			
		||||
$!    Define <sys> As SYS$COMMON:[SYSLIB]
 | 
			
		||||
@@ -743,7 +743,7 @@ $!    Use GNU C...
 | 
			
		||||
$!
 | 
			
		||||
$     IF F$TYPE(GCC) .EQS. "" THEN GCC := GCC
 | 
			
		||||
$     CC = GCC+"/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[-])" + CCEXTRAFLAGS
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS
 | 
			
		||||
$!
 | 
			
		||||
$!    Define The Linker Options File Name.
 | 
			
		||||
$!
 | 
			
		||||
 
 | 
			
		||||
@@ -3,8 +3,13 @@
 | 
			
		||||
# This is mostly being used for generation of certificate requests.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# This definition stops the following lines choking if HOME isn't
 | 
			
		||||
# defined.
 | 
			
		||||
HOME			= .
 | 
			
		||||
RANDFILE		= $ENV::HOME/.rnd
 | 
			
		||||
oid_file		= $ENV::HOME/.oid
 | 
			
		||||
 | 
			
		||||
# Extra OBJECT IDENTIFIER info:
 | 
			
		||||
#oid_file		= $ENV::HOME/.oid
 | 
			
		||||
oid_section		= new_oids
 | 
			
		||||
 | 
			
		||||
# To use this configuration file with the "-extfile" option of the
 | 
			
		||||
@@ -29,22 +34,35 @@ default_ca	= CA_default		# The default ca section
 | 
			
		||||
####################################################################
 | 
			
		||||
[ CA_default ]
 | 
			
		||||
 | 
			
		||||
dir		= sys\$disk:[.demoCA	# Where everything is kept
 | 
			
		||||
dir		= sys\$disk:[.demoCA		# Where everything is kept
 | 
			
		||||
certs		= $dir.certs]		# Where the issued certs are kept
 | 
			
		||||
crl_dir		= $dir.crl]		# Where the issued crl are kept
 | 
			
		||||
database	= $dir]index.txt	# database index file.
 | 
			
		||||
new_certs_dir	= $dir.newcerts]	# default place for new certs.
 | 
			
		||||
#unique_subject	= no			# Set to 'no' to allow creation of
 | 
			
		||||
					# several ctificates with same subject.
 | 
			
		||||
new_certs_dir	= $dir.newcerts]		# default place for new certs.
 | 
			
		||||
 | 
			
		||||
certificate	= $dir]cacert.pem 	# The CA certificate
 | 
			
		||||
serial		= $dir]serial.		# The current serial number
 | 
			
		||||
serial		= $dir]serial. 		# The current serial number
 | 
			
		||||
#crlnumber	= $dir]crlnumber.	# the current crl number must be
 | 
			
		||||
					# commented out to leave a V1 CRL
 | 
			
		||||
crl		= $dir]crl.pem 		# The current CRL
 | 
			
		||||
private_key	= $dir.private]cakey.pem# The private key
 | 
			
		||||
RANDFILE	= $dir.private].rand	# private random number file
 | 
			
		||||
 | 
			
		||||
x509_extensions	= usr_cert		# The extentions to add to the cert
 | 
			
		||||
 | 
			
		||||
# Comment out the following two lines for the "traditional"
 | 
			
		||||
# (and highly broken) format.
 | 
			
		||||
name_opt 	= ca_default		# Subject Name options
 | 
			
		||||
cert_opt 	= ca_default		# Certificate field options
 | 
			
		||||
 | 
			
		||||
# Extension copying option: use with caution.
 | 
			
		||||
# copy_extensions = copy
 | 
			
		||||
 | 
			
		||||
# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
 | 
			
		||||
# so this is commented out by default to leave a V1 CRL.
 | 
			
		||||
# crlnumber must also be commented out to leave a V1 CRL.
 | 
			
		||||
# crl_extensions	= crl_ext
 | 
			
		||||
 | 
			
		||||
default_days	= 365			# how long to certify for
 | 
			
		||||
@@ -86,16 +104,19 @@ distinguished_name	= req_distinguished_name
 | 
			
		||||
attributes		= req_attributes
 | 
			
		||||
x509_extensions	= v3_ca	# The extentions to add to the self signed cert
 | 
			
		||||
 | 
			
		||||
# This sets the permitted types in a DirectoryString. There are several
 | 
			
		||||
# options. 
 | 
			
		||||
# Passwords for private keys if not present they will be prompted for
 | 
			
		||||
# input_password = secret
 | 
			
		||||
# output_password = secret
 | 
			
		||||
 | 
			
		||||
# This sets a mask for permitted string types. There are several options. 
 | 
			
		||||
# default: PrintableString, T61String, BMPString.
 | 
			
		||||
# pkix	 : PrintableString, BMPString.
 | 
			
		||||
# utf8only: only UTF8Strings.
 | 
			
		||||
# nobmp : PrintableString, T61String (no BMPStrings).
 | 
			
		||||
# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
 | 
			
		||||
# MASK:XXXX a literal mask value.
 | 
			
		||||
# WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings
 | 
			
		||||
# so use this option with caution!
 | 
			
		||||
dirstring_type = nobmp
 | 
			
		||||
string_mask = nombstr
 | 
			
		||||
 | 
			
		||||
# req_extensions = v3_req # The extensions to add to a certificate request
 | 
			
		||||
 | 
			
		||||
@@ -124,7 +145,7 @@ commonName			= Common Name (eg, YOUR name)
 | 
			
		||||
commonName_max			= 64
 | 
			
		||||
 | 
			
		||||
emailAddress			= Email Address
 | 
			
		||||
emailAddress_max		= 40
 | 
			
		||||
emailAddress_max		= 64
 | 
			
		||||
 | 
			
		||||
# SET-ex3			= SET extension number 3
 | 
			
		||||
 | 
			
		||||
@@ -172,6 +193,9 @@ authorityKeyIdentifier=keyid,issuer:always
 | 
			
		||||
# This stuff is for subjectAltName and issuerAltname.
 | 
			
		||||
# Import the email address.
 | 
			
		||||
# subjectAltName=email:copy
 | 
			
		||||
# An alternative to produce certificates that aren't
 | 
			
		||||
# deprecated according to PKIX.
 | 
			
		||||
# subjectAltName=email:move
 | 
			
		||||
 | 
			
		||||
# Copy subject details
 | 
			
		||||
# issuerAltName=issuer:copy
 | 
			
		||||
 
 | 
			
		||||
@@ -129,6 +129,7 @@
 | 
			
		||||
#include "progs.h"
 | 
			
		||||
#include "s_apps.h"
 | 
			
		||||
#include <openssl/err.h>
 | 
			
		||||
#include <openssl/fips.h>
 | 
			
		||||
 | 
			
		||||
/* The LHASH callbacks ("hash" & "cmp") have been replaced by functions with the
 | 
			
		||||
 * base prototypes (we cast each variable inside the function to the required
 | 
			
		||||
@@ -147,6 +148,7 @@ char *default_config_file=NULL;
 | 
			
		||||
#ifdef MONOLITH
 | 
			
		||||
CONF *config=NULL;
 | 
			
		||||
BIO *bio_err=NULL;
 | 
			
		||||
int in_FIPS_mode=0;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -227,10 +229,31 @@ int main(int Argc, char *Argv[])
 | 
			
		||||
	char **argv,*p;
 | 
			
		||||
	LHASH *prog=NULL;
 | 
			
		||||
	long errline;
 | 
			
		||||
 
 | 
			
		||||
 | 
			
		||||
	arg.data=NULL;
 | 
			
		||||
	arg.count=0;
 | 
			
		||||
 | 
			
		||||
	in_FIPS_mode = 0;
 | 
			
		||||
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
	if(getenv("OPENSSL_FIPS")) {
 | 
			
		||||
#if defined(_WIN32)
 | 
			
		||||
		char filename[MAX_PATH] = "";
 | 
			
		||||
		GetModuleFileName( NULL, filename, MAX_PATH) ;
 | 
			
		||||
		p = filename;
 | 
			
		||||
#else
 | 
			
		||||
		p = Argv[0];
 | 
			
		||||
#endif
 | 
			
		||||
		if (!FIPS_mode_set(1,p)) {
 | 
			
		||||
			ERR_load_crypto_strings();
 | 
			
		||||
			ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
 | 
			
		||||
			exit(1);
 | 
			
		||||
		}
 | 
			
		||||
		in_FIPS_mode = 1;
 | 
			
		||||
		if (getenv("OPENSSL_FIPS_MD5"))
 | 
			
		||||
			FIPS_allow_md5(1);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
	if (bio_err == NULL)
 | 
			
		||||
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
			
		||||
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
			
		||||
 
 | 
			
		||||
@@ -44,8 +44,8 @@ new_certs_dir	= $dir/newcerts		# default place for new certs.
 | 
			
		||||
 | 
			
		||||
certificate	= $dir/cacert.pem 	# The CA certificate
 | 
			
		||||
serial		= $dir/serial 		# The current serial number
 | 
			
		||||
#crlnumber	= $dir/crlnumber	# the current crl number
 | 
			
		||||
					# must be commented out to leave a V1 CRL
 | 
			
		||||
#crlnumber	= $dir/crlnumber	# the current crl number must be
 | 
			
		||||
					# commented out to leave a V1 CRL
 | 
			
		||||
crl		= $dir/crl.pem 		# The current CRL
 | 
			
		||||
private_key	= $dir/private/cakey.pem# The private key
 | 
			
		||||
RANDFILE	= $dir/private/.rand	# private random number file
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										297
									
								
								apps/pkcs8.c
									
									
									
									
									
								
							
							
						
						
									
										297
									
								
								apps/pkcs8.c
									
									
									
									
									
								
							@@ -1,6 +1,6 @@
 | 
			
		||||
/* pkcs8.c */
 | 
			
		||||
/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
 | 
			
		||||
 * project 1999.
 | 
			
		||||
 * project 1999-2004.
 | 
			
		||||
 */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
@@ -68,7 +68,7 @@
 | 
			
		||||
int MAIN(int, char **);
 | 
			
		||||
 | 
			
		||||
int MAIN(int argc, char **argv)
 | 
			
		||||
{
 | 
			
		||||
	{
 | 
			
		||||
	ENGINE *e = NULL;
 | 
			
		||||
	char **args, *infile = NULL, *outfile = NULL;
 | 
			
		||||
	char *passargin = NULL, *passargout = NULL;
 | 
			
		||||
@@ -100,43 +100,70 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	ERR_load_crypto_strings();
 | 
			
		||||
	OpenSSL_add_all_algorithms();
 | 
			
		||||
	args = argv + 1;
 | 
			
		||||
	while (!badarg && *args && *args[0] == '-') {
 | 
			
		||||
		if (!strcmp(*args,"-v2")) {
 | 
			
		||||
			if (args[1]) {
 | 
			
		||||
	while (!badarg && *args && *args[0] == '-')
 | 
			
		||||
		{
 | 
			
		||||
		if (!strcmp(*args,"-v2"))
 | 
			
		||||
			{
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				cipher=EVP_get_cipherbyname(*args);
 | 
			
		||||
				if(!cipher) {
 | 
			
		||||
				if (!cipher)
 | 
			
		||||
					{
 | 
			
		||||
					BIO_printf(bio_err,
 | 
			
		||||
						 "Unknown cipher %s\n", *args);
 | 
			
		||||
					badarg = 1;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			} else badarg = 1;
 | 
			
		||||
		} else if (!strcmp(*args,"-v1")) {
 | 
			
		||||
			if (args[1]) {
 | 
			
		||||
			else
 | 
			
		||||
				badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp(*args,"-v1"))
 | 
			
		||||
			{
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				pbe_nid=OBJ_txt2nid(*args);
 | 
			
		||||
				if(pbe_nid == NID_undef) {
 | 
			
		||||
				if (pbe_nid == NID_undef)
 | 
			
		||||
					{
 | 
			
		||||
					BIO_printf(bio_err,
 | 
			
		||||
						 "Unknown PBE algorithm %s\n", *args);
 | 
			
		||||
					badarg = 1;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			} else badarg = 1;
 | 
			
		||||
		} else if (!strcmp(*args,"-inform")) {
 | 
			
		||||
			if (args[1]) {
 | 
			
		||||
			else
 | 
			
		||||
				badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp(*args,"-inform"))
 | 
			
		||||
			{
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				informat=str2fmt(*args);
 | 
			
		||||
			} else badarg = 1;
 | 
			
		||||
		} else if (!strcmp(*args,"-outform")) {
 | 
			
		||||
			if (args[1]) {
 | 
			
		||||
				}
 | 
			
		||||
			else badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp(*args,"-outform"))
 | 
			
		||||
			{
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				outformat=str2fmt(*args);
 | 
			
		||||
			} else badarg = 1;
 | 
			
		||||
		} else if (!strcmp (*args, "-topk8")) topk8 = 1;
 | 
			
		||||
		else if (!strcmp (*args, "-noiter")) iter = 1;
 | 
			
		||||
		else if (!strcmp (*args, "-nocrypt")) nocrypt = 1;
 | 
			
		||||
		else if (!strcmp (*args, "-nooct")) p8_broken = PKCS8_NO_OCTET;
 | 
			
		||||
		else if (!strcmp (*args, "-nsdb")) p8_broken = PKCS8_NS_DB;
 | 
			
		||||
		else if (!strcmp (*args, "-embed")) p8_broken = PKCS8_EMBEDDED_PARAM;
 | 
			
		||||
				}
 | 
			
		||||
			else badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp (*args, "-topk8"))
 | 
			
		||||
			topk8 = 1;
 | 
			
		||||
		else if (!strcmp (*args, "-noiter"))
 | 
			
		||||
			iter = 1;
 | 
			
		||||
		else if (!strcmp (*args, "-nocrypt"))
 | 
			
		||||
			nocrypt = 1;
 | 
			
		||||
		else if (!strcmp (*args, "-nooct"))
 | 
			
		||||
			p8_broken = PKCS8_NO_OCTET;
 | 
			
		||||
		else if (!strcmp (*args, "-nsdb"))
 | 
			
		||||
			p8_broken = PKCS8_NS_DB;
 | 
			
		||||
		else if (!strcmp (*args, "-embed"))
 | 
			
		||||
			p8_broken = PKCS8_EMBEDDED_PARAM;
 | 
			
		||||
		else if (!strcmp(*args,"-passin"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1]) goto bad;
 | 
			
		||||
@@ -154,21 +181,30 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			engine= *(++args);
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
		else if (!strcmp (*args, "-in")) {
 | 
			
		||||
			if (args[1]) {
 | 
			
		||||
		else if (!strcmp (*args, "-in"))
 | 
			
		||||
			{
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				infile = *args;
 | 
			
		||||
			} else badarg = 1;
 | 
			
		||||
		} else if (!strcmp (*args, "-out")) {
 | 
			
		||||
			if (args[1]) {
 | 
			
		||||
				}
 | 
			
		||||
			else badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp (*args, "-out"))
 | 
			
		||||
			{
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				outfile = *args;
 | 
			
		||||
			} else badarg = 1;
 | 
			
		||||
		} else badarg = 1;
 | 
			
		||||
				}
 | 
			
		||||
			else badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else badarg = 1;
 | 
			
		||||
		args++;
 | 
			
		||||
	}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (badarg) {
 | 
			
		||||
	if (badarg)
 | 
			
		||||
		{
 | 
			
		||||
		bad:
 | 
			
		||||
		BIO_printf(bio_err, "Usage pkcs8 [options]\n");
 | 
			
		||||
		BIO_printf(bio_err, "where options are\n");
 | 
			
		||||
@@ -189,147 +225,199 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
		BIO_printf(bio_err," -engine e       use engine e, possibly a hardware device.\n");
 | 
			
		||||
#endif
 | 
			
		||||
		return (1);
 | 
			
		||||
	}
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
        e = setup_engine(bio_err, engine, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
 | 
			
		||||
	if (!app_passwd(bio_err, passargin, passargout, &passin, &passout))
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err, "Error getting passwords\n");
 | 
			
		||||
		return (1);
 | 
			
		||||
	}
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if ((pbe_nid == -1) && !cipher) pbe_nid = NID_pbeWithMD5AndDES_CBC;
 | 
			
		||||
	if ((pbe_nid == -1) && !cipher)
 | 
			
		||||
		pbe_nid = NID_pbeWithMD5AndDES_CBC;
 | 
			
		||||
 | 
			
		||||
	if (infile) {
 | 
			
		||||
		if (!(in = BIO_new_file(infile, "rb"))) {
 | 
			
		||||
	if (infile)
 | 
			
		||||
		{
 | 
			
		||||
		if (!(in = BIO_new_file(infile, "rb")))
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,
 | 
			
		||||
				 "Can't open input file %s\n", infile);
 | 
			
		||||
			return (1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	} else in = BIO_new_fp (stdin, BIO_NOCLOSE);
 | 
			
		||||
	else
 | 
			
		||||
		in = BIO_new_fp (stdin, BIO_NOCLOSE);
 | 
			
		||||
 | 
			
		||||
	if (outfile) {
 | 
			
		||||
		if (!(out = BIO_new_file (outfile, "wb"))) {
 | 
			
		||||
	if (outfile)
 | 
			
		||||
		{
 | 
			
		||||
		if (!(out = BIO_new_file (outfile, "wb")))
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,
 | 
			
		||||
				 "Can't open output file %s\n", outfile);
 | 
			
		||||
			return (1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		out = BIO_new_fp (stdout, BIO_NOCLOSE);
 | 
			
		||||
#ifdef OPENSSL_SYS_VMS
 | 
			
		||||
		{
 | 
			
		||||
			{
 | 
			
		||||
			BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
			out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
		}
 | 
			
		||||
	if (topk8)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_free(in); /* Not needed in this section */
 | 
			
		||||
		pkey = load_key(bio_err, infile, informat, 1,
 | 
			
		||||
			passin, e, "key");
 | 
			
		||||
		if (!pkey) {
 | 
			
		||||
			return (1);
 | 
			
		||||
		}
 | 
			
		||||
		if (!(p8inf = EVP_PKEY2PKCS8_broken(pkey, p8_broken))) {
 | 
			
		||||
		if (!pkey)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_free_all(out);
 | 
			
		||||
			return 1;
 | 
			
		||||
			}
 | 
			
		||||
		if (!(p8inf = EVP_PKEY2PKCS8_broken(pkey, p8_broken)))
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "Error converting key\n");
 | 
			
		||||
			ERR_print_errors(bio_err);
 | 
			
		||||
			return (1);
 | 
			
		||||
		}
 | 
			
		||||
		if(nocrypt) {
 | 
			
		||||
			if(outformat == FORMAT_PEM) 
 | 
			
		||||
				PEM_write_bio_PKCS8_PRIV_KEY_INFO(out, p8inf);
 | 
			
		||||
			else if(outformat == FORMAT_ASN1)
 | 
			
		||||
				i2d_PKCS8_PRIV_KEY_INFO_bio(out, p8inf);
 | 
			
		||||
			else {
 | 
			
		||||
				BIO_printf(bio_err, "Bad format specified for key\n");
 | 
			
		||||
				return (1);
 | 
			
		||||
			EVP_PKEY_free(pkey);
 | 
			
		||||
			BIO_free_all(out);
 | 
			
		||||
			return 1;
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			if(passout) p8pass = passout;
 | 
			
		||||
			else {
 | 
			
		||||
		if (nocrypt)
 | 
			
		||||
			{
 | 
			
		||||
			if (outformat == FORMAT_PEM) 
 | 
			
		||||
				PEM_write_bio_PKCS8_PRIV_KEY_INFO(out, p8inf);
 | 
			
		||||
			else if (outformat == FORMAT_ASN1)
 | 
			
		||||
				i2d_PKCS8_PRIV_KEY_INFO_bio(out, p8inf);
 | 
			
		||||
			else
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_err, "Bad format specified for key\n");
 | 
			
		||||
				PKCS8_PRIV_KEY_INFO_free(p8inf);
 | 
			
		||||
				EVP_PKEY_free(pkey);
 | 
			
		||||
				BIO_free_all(out);
 | 
			
		||||
				return (1);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			if (passout)
 | 
			
		||||
				p8pass = passout;
 | 
			
		||||
			else
 | 
			
		||||
				{
 | 
			
		||||
				p8pass = pass;
 | 
			
		||||
				if (EVP_read_pw_string(pass, sizeof pass, "Enter Encryption Password:", 1))
 | 
			
		||||
					{
 | 
			
		||||
					PKCS8_PRIV_KEY_INFO_free(p8inf);
 | 
			
		||||
					EVP_PKEY_free(pkey);
 | 
			
		||||
					BIO_free_all(out);
 | 
			
		||||
					return (1);
 | 
			
		||||
			}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			app_RAND_load_file(NULL, bio_err, 0);
 | 
			
		||||
			if (!(p8 = PKCS8_encrypt(pbe_nid, cipher,
 | 
			
		||||
					p8pass, strlen(p8pass),
 | 
			
		||||
					NULL, 0, iter, p8inf))) {
 | 
			
		||||
					NULL, 0, iter, p8inf)))
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_err, "Error encrypting key\n");
 | 
			
		||||
				ERR_print_errors(bio_err);
 | 
			
		||||
				PKCS8_PRIV_KEY_INFO_free(p8inf);
 | 
			
		||||
				EVP_PKEY_free(pkey);
 | 
			
		||||
				BIO_free_all(out);
 | 
			
		||||
				return (1);
 | 
			
		||||
			}
 | 
			
		||||
				}
 | 
			
		||||
			app_RAND_write_file(NULL, bio_err);
 | 
			
		||||
			if(outformat == FORMAT_PEM) 
 | 
			
		||||
			if (outformat == FORMAT_PEM) 
 | 
			
		||||
				PEM_write_bio_PKCS8(out, p8);
 | 
			
		||||
			else if(outformat == FORMAT_ASN1)
 | 
			
		||||
			else if (outformat == FORMAT_ASN1)
 | 
			
		||||
				i2d_PKCS8_bio(out, p8);
 | 
			
		||||
			else {
 | 
			
		||||
			else
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_err, "Bad format specified for key\n");
 | 
			
		||||
				PKCS8_PRIV_KEY_INFO_free(p8inf);
 | 
			
		||||
				EVP_PKEY_free(pkey);
 | 
			
		||||
				BIO_free_all(out);
 | 
			
		||||
				return (1);
 | 
			
		||||
			}
 | 
			
		||||
				}
 | 
			
		||||
			X509_SIG_free(p8);
 | 
			
		||||
		}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		PKCS8_PRIV_KEY_INFO_free (p8inf);
 | 
			
		||||
		EVP_PKEY_free(pkey);
 | 
			
		||||
		BIO_free_all(out);
 | 
			
		||||
		if(passin) OPENSSL_free(passin);
 | 
			
		||||
		if(passout) OPENSSL_free(passout);
 | 
			
		||||
		if (passin)
 | 
			
		||||
			OPENSSL_free(passin);
 | 
			
		||||
		if (passout)
 | 
			
		||||
			OPENSSL_free(passout);
 | 
			
		||||
		return (0);
 | 
			
		||||
	}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if(nocrypt) {
 | 
			
		||||
		if(informat == FORMAT_PEM) 
 | 
			
		||||
	if (nocrypt)
 | 
			
		||||
		{
 | 
			
		||||
		if (informat == FORMAT_PEM) 
 | 
			
		||||
			p8inf = PEM_read_bio_PKCS8_PRIV_KEY_INFO(in,NULL,NULL, NULL);
 | 
			
		||||
		else if(informat == FORMAT_ASN1)
 | 
			
		||||
		else if (informat == FORMAT_ASN1)
 | 
			
		||||
			p8inf = d2i_PKCS8_PRIV_KEY_INFO_bio(in, NULL);
 | 
			
		||||
		else {
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "Bad format specified for key\n");
 | 
			
		||||
			return (1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		if(informat == FORMAT_PEM) 
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (informat == FORMAT_PEM) 
 | 
			
		||||
			p8 = PEM_read_bio_PKCS8(in, NULL, NULL, NULL);
 | 
			
		||||
		else if(informat == FORMAT_ASN1)
 | 
			
		||||
		else if (informat == FORMAT_ASN1)
 | 
			
		||||
			p8 = d2i_PKCS8_bio(in, NULL);
 | 
			
		||||
		else {
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "Bad format specified for key\n");
 | 
			
		||||
			return (1);
 | 
			
		||||
		}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if (!p8) {
 | 
			
		||||
		if (!p8)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf (bio_err, "Error reading key\n");
 | 
			
		||||
			ERR_print_errors(bio_err);
 | 
			
		||||
			return (1);
 | 
			
		||||
		}
 | 
			
		||||
		if(passin) p8pass = passin;
 | 
			
		||||
		else {
 | 
			
		||||
			}
 | 
			
		||||
		if (passin)
 | 
			
		||||
			p8pass = passin;
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			p8pass = pass;
 | 
			
		||||
			EVP_read_pw_string(pass, sizeof pass, "Enter Password:", 0);
 | 
			
		||||
		}
 | 
			
		||||
			}
 | 
			
		||||
		p8inf = PKCS8_decrypt(p8, p8pass, strlen(p8pass));
 | 
			
		||||
		X509_SIG_free(p8);
 | 
			
		||||
	}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (!p8inf) {
 | 
			
		||||
	if (!p8inf)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err, "Error decrypting key\n");
 | 
			
		||||
		ERR_print_errors(bio_err);
 | 
			
		||||
		return (1);
 | 
			
		||||
	}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (!(pkey = EVP_PKCS82PKEY(p8inf))) {
 | 
			
		||||
	if (!(pkey = EVP_PKCS82PKEY(p8inf)))
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err, "Error converting key\n");
 | 
			
		||||
		ERR_print_errors(bio_err);
 | 
			
		||||
		return (1);
 | 
			
		||||
	}
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
	if (p8inf->broken) {
 | 
			
		||||
	if (p8inf->broken)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err, "Warning: broken key encoding: ");
 | 
			
		||||
		switch (p8inf->broken) {
 | 
			
		||||
		switch (p8inf->broken)
 | 
			
		||||
			{
 | 
			
		||||
			case PKCS8_NO_OCTET:
 | 
			
		||||
			BIO_printf(bio_err, "No Octet String in PrivateKey\n");
 | 
			
		||||
			break;
 | 
			
		||||
@@ -349,21 +437,24 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	PKCS8_PRIV_KEY_INFO_free(p8inf);
 | 
			
		||||
	if(outformat == FORMAT_PEM) 
 | 
			
		||||
	if (outformat == FORMAT_PEM) 
 | 
			
		||||
		PEM_write_bio_PrivateKey(out, pkey, NULL, NULL, 0, NULL, passout);
 | 
			
		||||
	else if(outformat == FORMAT_ASN1)
 | 
			
		||||
	else if (outformat == FORMAT_ASN1)
 | 
			
		||||
		i2d_PrivateKey_bio(out, pkey);
 | 
			
		||||
	else {
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err, "Bad format specified for key\n");
 | 
			
		||||
			return (1);
 | 
			
		||||
	}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	end:
 | 
			
		||||
	EVP_PKEY_free(pkey);
 | 
			
		||||
	BIO_free_all(out);
 | 
			
		||||
	BIO_free(in);
 | 
			
		||||
	if(passin) OPENSSL_free(passin);
 | 
			
		||||
	if(passout) OPENSSL_free(passout);
 | 
			
		||||
	if (passin)
 | 
			
		||||
		OPENSSL_free(passin);
 | 
			
		||||
	if (passout)
 | 
			
		||||
		OPENSSL_free(passout);
 | 
			
		||||
 | 
			
		||||
	return (0);
 | 
			
		||||
}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										118
									
								
								apps/prime.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										118
									
								
								apps/prime.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,118 @@
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 2004 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 *
 | 
			
		||||
 * 1. Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer. 
 | 
			
		||||
 *
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in
 | 
			
		||||
 *    the documentation and/or other materials provided with the
 | 
			
		||||
 *    distribution.
 | 
			
		||||
 *
 | 
			
		||||
 * 3. All advertising materials mentioning features or use of this
 | 
			
		||||
 *    software must display the following acknowledgment:
 | 
			
		||||
 *    "This product includes software developed by the OpenSSL Project
 | 
			
		||||
 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
			
		||||
 *
 | 
			
		||||
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
			
		||||
 *    endorse or promote products derived from this software without
 | 
			
		||||
 *    prior written permission. For written permission, please contact
 | 
			
		||||
 *    openssl-core@openssl.org.
 | 
			
		||||
 *
 | 
			
		||||
 * 5. Products derived from this software may not be called "OpenSSL"
 | 
			
		||||
 *    nor may "OpenSSL" appear in their names without prior written
 | 
			
		||||
 *    permission of the OpenSSL Project.
 | 
			
		||||
 *
 | 
			
		||||
 * 6. Redistributions of any form whatsoever must retain the following
 | 
			
		||||
 *    acknowledgment:
 | 
			
		||||
 *    "This product includes software developed by the OpenSSL Project
 | 
			
		||||
 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
			
		||||
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
			
		||||
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
			
		||||
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
			
		||||
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
			
		||||
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
			
		||||
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
			
		||||
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
			
		||||
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
			
		||||
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
			
		||||
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
			
		||||
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
#include "apps.h"
 | 
			
		||||
#include <openssl/bn.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#undef PROG
 | 
			
		||||
#define PROG prime_main
 | 
			
		||||
 | 
			
		||||
int MAIN(int argc, char **argv)
 | 
			
		||||
    {
 | 
			
		||||
    int hex=0;
 | 
			
		||||
    int checks=20;
 | 
			
		||||
    BIGNUM *bn=NULL;
 | 
			
		||||
    BIO *bio_out=NULL;
 | 
			
		||||
 | 
			
		||||
    apps_startup();
 | 
			
		||||
 | 
			
		||||
    if (bio_err == NULL)
 | 
			
		||||
	if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
			
		||||
	    BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
			
		||||
 | 
			
		||||
    if (bio_out == NULL)
 | 
			
		||||
	if ((bio_out=BIO_new(BIO_s_file())) != NULL)
 | 
			
		||||
	    {
 | 
			
		||||
	    BIO_set_fp(bio_out,stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef OPENSSL_SYS_VMS
 | 
			
		||||
	    {
 | 
			
		||||
	    BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
	    bio_out = BIO_push(tmpbio, bio_out);
 | 
			
		||||
	    }
 | 
			
		||||
#endif
 | 
			
		||||
	    }
 | 
			
		||||
 | 
			
		||||
    --argc;
 | 
			
		||||
    ++argv;
 | 
			
		||||
    while (argc >= 1 && **argv == '-')
 | 
			
		||||
	{
 | 
			
		||||
	if(!strcmp(*argv,"-hex"))
 | 
			
		||||
	    hex=1;
 | 
			
		||||
	else if(!strcmp(*argv,"-checks"))
 | 
			
		||||
	    if(--argc < 1)
 | 
			
		||||
		goto bad;
 | 
			
		||||
	    else
 | 
			
		||||
		checks=atoi(*++argv);
 | 
			
		||||
	else
 | 
			
		||||
	    {
 | 
			
		||||
	    BIO_printf(bio_err,"Unknown option '%s'\n",*argv);
 | 
			
		||||
	bad:
 | 
			
		||||
	    BIO_printf(bio_err,"options are\n");
 | 
			
		||||
	    BIO_printf(bio_err,"%-14s hex\n","-hex");
 | 
			
		||||
	    BIO_printf(bio_err,"%-14s number of checks\n","-checks <n>");
 | 
			
		||||
	    exit(1);
 | 
			
		||||
	    }
 | 
			
		||||
	--argc;
 | 
			
		||||
	++argv;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    if(hex)
 | 
			
		||||
	BN_hex2bn(&bn,argv[0]);
 | 
			
		||||
    else
 | 
			
		||||
	BN_dec2bn(&bn,argv[0]);
 | 
			
		||||
 | 
			
		||||
    BN_print(bio_out,bn);
 | 
			
		||||
    BIO_printf(bio_out," is %sprime\n",
 | 
			
		||||
	       BN_is_prime(bn,checks,NULL,NULL,NULL) ? "" : "not ");
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
    }
 | 
			
		||||
@@ -35,6 +35,7 @@ extern int pkcs8_main(int argc,char *argv[]);
 | 
			
		||||
extern int spkac_main(int argc,char *argv[]);
 | 
			
		||||
extern int smime_main(int argc,char *argv[]);
 | 
			
		||||
extern int rand_main(int argc,char *argv[]);
 | 
			
		||||
extern int prime_main(int argc,char *argv[]);
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
extern int engine_main(int argc,char *argv[]);
 | 
			
		||||
#endif
 | 
			
		||||
@@ -115,6 +116,7 @@ FUNCTION functions[] = {
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"spkac",spkac_main},
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"smime",smime_main},
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"rand",rand_main},
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"prime",prime_main},
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"engine",engine_main},
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -831,7 +831,9 @@ loop:
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				{
 | 
			
		||||
				if (!ASN1_INTEGER_set(X509_get_serialNumber(x509ss),0L)) goto end;
 | 
			
		||||
				if (!rand_serial(NULL,
 | 
			
		||||
					X509_get_serialNumber(x509ss)))
 | 
			
		||||
						goto end;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
			if (!X509_set_issuer_name(x509ss, X509_REQ_get_subject_name(req))) goto end;
 | 
			
		||||
 
 | 
			
		||||
@@ -1395,6 +1395,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
					EVP_DecryptInit_ex(&ctx,evp_cipher,NULL,key16,iv);
 | 
			
		||||
				else
 | 
			
		||||
					EVP_EncryptInit_ex(&ctx,evp_cipher,NULL,key16,iv);
 | 
			
		||||
				EVP_CIPHER_CTX_set_padding(&ctx, 0);
 | 
			
		||||
 | 
			
		||||
				Time_F(START);
 | 
			
		||||
				if(decrypt)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										41
									
								
								apps/x509.c
									
									
									
									
									
								
							
							
						
						
									
										41
									
								
								apps/x509.c
									
									
									
									
									
								
							@@ -168,7 +168,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	char *CAkeyfile=NULL,*CAserial=NULL;
 | 
			
		||||
	char *alias=NULL;
 | 
			
		||||
	int text=0,serial=0,hash=0,subject=0,issuer=0,startdate=0,enddate=0;
 | 
			
		||||
	int ocspid=0;
 | 
			
		||||
	int next_serial=0,ocspid=0;
 | 
			
		||||
	int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0;
 | 
			
		||||
	int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0;
 | 
			
		||||
	int C=0;
 | 
			
		||||
@@ -371,6 +371,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			email= ++num;
 | 
			
		||||
		else if (strcmp(*argv,"-serial") == 0)
 | 
			
		||||
			serial= ++num;
 | 
			
		||||
		else if (strcmp(*argv,"-next_serial") == 0)
 | 
			
		||||
			next_serial= ++num;
 | 
			
		||||
		else if (strcmp(*argv,"-modulus") == 0)
 | 
			
		||||
			modulus= ++num;
 | 
			
		||||
		else if (strcmp(*argv,"-pubkey") == 0)
 | 
			
		||||
@@ -591,12 +593,16 @@ bad:
 | 
			
		||||
		if ((x=X509_new()) == NULL) goto end;
 | 
			
		||||
		ci=x->cert_info;
 | 
			
		||||
 | 
			
		||||
		if (sno)
 | 
			
		||||
		if (sno == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			if (!X509_set_serialNumber(x, sno))
 | 
			
		||||
			sno = ASN1_INTEGER_new();
 | 
			
		||||
			if (!sno || !rand_serial(NULL, sno))
 | 
			
		||||
				goto end;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!ASN1_INTEGER_set(X509_get_serialNumber(x),0)) goto end;
 | 
			
		||||
 | 
			
		||||
		if (!X509_set_serialNumber(x, sno)) 
 | 
			
		||||
			goto end;
 | 
			
		||||
 | 
			
		||||
		if (!X509_set_issuer_name(x,req->req_info->subject)) goto end;
 | 
			
		||||
		if (!X509_set_subject_name(x,req->req_info->subject)) goto end;
 | 
			
		||||
 | 
			
		||||
@@ -617,7 +623,7 @@ bad:
 | 
			
		||||
		if (xca == NULL) goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (!noout || text)
 | 
			
		||||
	if (!noout || text || next_serial)
 | 
			
		||||
		{
 | 
			
		||||
		OBJ_create("2.99999.3",
 | 
			
		||||
			"SET.ex3","SET x509v3 extension 3");
 | 
			
		||||
@@ -691,6 +697,24 @@ bad:
 | 
			
		||||
				i2a_ASN1_INTEGER(STDout,x->cert_info->serialNumber);
 | 
			
		||||
				BIO_printf(STDout,"\n");
 | 
			
		||||
				}
 | 
			
		||||
			else if (next_serial == i)
 | 
			
		||||
				{
 | 
			
		||||
				BIGNUM *bnser;
 | 
			
		||||
				ASN1_INTEGER *ser;
 | 
			
		||||
				ser = X509_get_serialNumber(x);
 | 
			
		||||
				bnser = ASN1_INTEGER_to_BN(ser, NULL);
 | 
			
		||||
				if (!bnser)
 | 
			
		||||
					goto end;
 | 
			
		||||
				if (!BN_add_word(bnser, 1))
 | 
			
		||||
					goto end;
 | 
			
		||||
				ser = BN_to_ASN1_INTEGER(bnser, NULL);
 | 
			
		||||
				if (!ser)
 | 
			
		||||
					goto end;
 | 
			
		||||
				BN_free(bnser);
 | 
			
		||||
				i2a_ASN1_INTEGER(out, ser);
 | 
			
		||||
				ASN1_INTEGER_free(ser);
 | 
			
		||||
				BIO_puts(out, "\n");
 | 
			
		||||
				}
 | 
			
		||||
			else if (email == i) 
 | 
			
		||||
				{
 | 
			
		||||
				int j;
 | 
			
		||||
@@ -1047,13 +1071,6 @@ static ASN1_INTEGER *x509_load_serial(char *CAfile, char *serialfile, int create
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		BUF_strlcpy(buf,serialfile,len);
 | 
			
		||||
	serial=BN_new();
 | 
			
		||||
	bs=ASN1_INTEGER_new();
 | 
			
		||||
	if ((serial == NULL) || (bs == NULL))
 | 
			
		||||
		{
 | 
			
		||||
		ERR_print_errors(bio_err);
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	serial = load_serial(buf, create, NULL);
 | 
			
		||||
	if (serial == NULL) goto end;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										23
									
								
								config
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								config
									
									
									
									
									
								
							@@ -23,6 +23,7 @@
 | 
			
		||||
PREFIX=""
 | 
			
		||||
SUFFIX=""
 | 
			
		||||
TEST="false"
 | 
			
		||||
EXE=""
 | 
			
		||||
 | 
			
		||||
# pick up any command line args to config
 | 
			
		||||
for i
 | 
			
		||||
@@ -288,6 +289,14 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
 | 
			
		||||
	echo "${MACHINE}-whatever-sysv4"; exit 0
 | 
			
		||||
	;;
 | 
			
		||||
 | 
			
		||||
    VOS:*:*:i786)
 | 
			
		||||
     echo "i386-stratus-vos"; exit 0
 | 
			
		||||
     ;;
 | 
			
		||||
 | 
			
		||||
    VOS:*:*:*)
 | 
			
		||||
     echo "hppa1.1-stratus-vos"; exit 0
 | 
			
		||||
     ;;
 | 
			
		||||
 | 
			
		||||
    *:4*:R4*:m88k)
 | 
			
		||||
	echo "${MACHINE}-whatever-sysv4"; exit 0
 | 
			
		||||
	;;
 | 
			
		||||
@@ -679,6 +688,10 @@ EOF
 | 
			
		||||
  *-*-UnixWare21*) OUT="unixware-2.1" ;;
 | 
			
		||||
  *-*-Unixware20*) OUT="unixware-2.0" ;;
 | 
			
		||||
  *-*-Unixware21*) OUT="unixware-2.1" ;;
 | 
			
		||||
  *-*-vos)
 | 
			
		||||
	options="$options no-threads no-shared no-asm no-dso"
 | 
			
		||||
	EXE=".pm"
 | 
			
		||||
	OUT="vos-$CC" ;;
 | 
			
		||||
  BS2000-siemens-sysv4) OUT="BS2000-OSD" ;;
 | 
			
		||||
  RM*-siemens-sysv4) OUT="ReliantUNIX" ;;
 | 
			
		||||
  *-siemens-sysv4) OUT="SINIX" ;;
 | 
			
		||||
@@ -806,8 +819,8 @@ fi
 | 
			
		||||
 | 
			
		||||
if [ ".$PERL" = . ] ; then
 | 
			
		||||
	for i in . `echo $PATH | sed 's/:/ /g'`; do
 | 
			
		||||
		if [ -f "$i/perl5" ] ; then
 | 
			
		||||
			PERL="$i/perl5"
 | 
			
		||||
		if [ -f "$i/perl5$EXE" ] ; then
 | 
			
		||||
			PERL="$i/perl5$EXE"
 | 
			
		||||
			break;
 | 
			
		||||
		fi;
 | 
			
		||||
	done
 | 
			
		||||
@@ -815,9 +828,9 @@ fi
 | 
			
		||||
 | 
			
		||||
if [ ".$PERL" = . ] ; then
 | 
			
		||||
	for i in . `echo $PATH | sed 's/:/ /g'`; do
 | 
			
		||||
		if [ -f "$i/perl" ] ; then
 | 
			
		||||
			if "$i/perl" -e 'exit($]<5.0)'; then
 | 
			
		||||
				PERL="$i/perl"
 | 
			
		||||
		if [ -f "$i/perl$EXE" ] ; then
 | 
			
		||||
			if "$i/perl$EXE" -e 'exit($]<5.0)'; then
 | 
			
		||||
				PERL="$i/perl$EXE"
 | 
			
		||||
				break;
 | 
			
		||||
			fi;
 | 
			
		||||
		fi;
 | 
			
		||||
 
 | 
			
		||||
@@ -11,10 +11,9 @@ CFLAG=		-g
 | 
			
		||||
INSTALL_PREFIX=
 | 
			
		||||
OPENSSLDIR=     /usr/local/ssl
 | 
			
		||||
INSTALLTOP=	/usr/local/ssl
 | 
			
		||||
MAKE=           make -f Makefile.ssl
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
MAKEFILE=       Makefile.ssl
 | 
			
		||||
MAKEFILE=       Makefile
 | 
			
		||||
RM=             rm -f
 | 
			
		||||
AR=		ar r
 | 
			
		||||
 | 
			
		||||
@@ -36,14 +35,14 @@ GENERAL=Makefile README crypto-lib.com install.com
 | 
			
		||||
 | 
			
		||||
LIB= $(TOP)/libcrypto.a
 | 
			
		||||
SHARED_LIB= libcrypto$(SHLIB_EXT)
 | 
			
		||||
LIBSRC=	cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c uid.c o_time.c
 | 
			
		||||
LIBOBJ= cryptlib.o mem.o mem_clr.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o uid.o o_time.o
 | 
			
		||||
LIBSRC=	cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c uid.c o_time.c o_str.c
 | 
			
		||||
LIBOBJ= cryptlib.o mem.o mem_clr.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o uid.o o_time.o o_str.o
 | 
			
		||||
 | 
			
		||||
SRC= $(LIBSRC)
 | 
			
		||||
 | 
			
		||||
EXHEADER= crypto.h tmdiff.h opensslv.h opensslconf.h ebcdic.h symhacks.h \
 | 
			
		||||
	ossl_typ.h
 | 
			
		||||
HEADER=	cryptlib.h buildinf.h md32_common.h o_time.h $(EXHEADER)
 | 
			
		||||
HEADER=	cryptlib.h buildinf.h md32_common.h o_time.h o_str.h $(EXHEADER)
 | 
			
		||||
 | 
			
		||||
ALL=    $(GENERAL) $(SRC) $(HEADER)
 | 
			
		||||
 | 
			
		||||
@@ -52,9 +51,9 @@ top:
 | 
			
		||||
 | 
			
		||||
all: shared
 | 
			
		||||
 | 
			
		||||
buildinf.h: ../Makefile.ssl
 | 
			
		||||
buildinf.h: ../Makefile
 | 
			
		||||
	( echo "#ifndef MK1MF_BUILD"; \
 | 
			
		||||
	echo '  /* auto-generated by crypto/Makefile.ssl for crypto/cversion.c */'; \
 | 
			
		||||
	echo '  /* auto-generated by crypto/Makefile for crypto/cversion.c */'; \
 | 
			
		||||
	echo '  #define CFLAGS "$(CC) $(CFLAG)"'; \
 | 
			
		||||
	echo '  #define PLATFORM "$(PLATFORM)"'; \
 | 
			
		||||
	echo "  #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \
 | 
			
		||||
@@ -73,7 +72,7 @@ subdirs:
 | 
			
		||||
	done;
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
	@for i in $(SDIRS) ;\
 | 
			
		||||
	do \
 | 
			
		||||
	(cd $$i && echo "making 'files' in crypto/$$i..." && \
 | 
			
		||||
@@ -81,11 +80,9 @@ files:
 | 
			
		||||
	done;
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../include/openssl $(EXHEADER)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../test $(TEST)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../apps $(APPS)
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@for i in $(SDIRS); do \
 | 
			
		||||
	(cd $$i && echo "making links in crypto/$$i..." && \
 | 
			
		||||
	$(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PERL='${PERL}' links ); \
 | 
			
		||||
@@ -203,6 +200,8 @@ mem_dbg.o: ../include/openssl/err.h ../include/openssl/lhash.h
 | 
			
		||||
mem_dbg.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
 | 
			
		||||
mem_dbg.o: ../include/openssl/safestack.h ../include/openssl/stack.h
 | 
			
		||||
mem_dbg.o: ../include/openssl/symhacks.h cryptlib.h mem_dbg.c
 | 
			
		||||
o_str.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h o_str.c
 | 
			
		||||
o_str.o: o_str.h
 | 
			
		||||
o_time.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h o_time.c
 | 
			
		||||
o_time.o: o_time.h
 | 
			
		||||
tmdiff.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
 | 
			
		||||
@@ -11,10 +11,9 @@ CFLAG=-g
 | 
			
		||||
INSTALL_PREFIX=
 | 
			
		||||
OPENSSLDIR=     /usr/local/ssl
 | 
			
		||||
INSTALLTOP=	/usr/local/ssl
 | 
			
		||||
MAKE=		make -f Makefile.ssl
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
MAKEFILE=	Makefile.ssl
 | 
			
		||||
MAKEFILE=	Makefile
 | 
			
		||||
AR=		ar r
 | 
			
		||||
 | 
			
		||||
# CFLAGS= -mpentiumpro $(INCLUDES) $(CFLAG) -O3 -fexpensive-optimizations -funroll-loops -fforce-addr
 | 
			
		||||
@@ -49,10 +48,9 @@ lib:	$(LIBOBJ)
 | 
			
		||||
$(LIBOBJ): $(LIBSRC)
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
 | 
			
		||||
@@ -91,7 +89,8 @@ aes_cbc.o: ../../include/openssl/opensslconf.h aes_cbc.c aes_locl.h
 | 
			
		||||
aes_cfb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
 | 
			
		||||
aes_cfb.o: ../../include/openssl/opensslconf.h aes_cfb.c aes_locl.h
 | 
			
		||||
aes_core.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
 | 
			
		||||
aes_core.o: ../../include/openssl/opensslconf.h aes_core.c aes_locl.h
 | 
			
		||||
aes_core.o: ../../include/openssl/fips.h ../../include/openssl/opensslconf.h
 | 
			
		||||
aes_core.o: aes_core.c aes_locl.h
 | 
			
		||||
aes_ctr.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
 | 
			
		||||
aes_ctr.o: ../../include/openssl/opensslconf.h aes_ctr.c aes_locl.h
 | 
			
		||||
aes_ecb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
 | 
			
		||||
@@ -52,6 +52,8 @@
 | 
			
		||||
#ifndef HEADER_AES_H
 | 
			
		||||
#define HEADER_AES_H
 | 
			
		||||
 | 
			
		||||
#include <openssl/e_os2.h>
 | 
			
		||||
 | 
			
		||||
#ifdef OPENSSL_NO_AES
 | 
			
		||||
#error AES is disabled.
 | 
			
		||||
#endif
 | 
			
		||||
@@ -64,6 +66,10 @@
 | 
			
		||||
#define AES_MAXNR 14
 | 
			
		||||
#define AES_BLOCK_SIZE 16
 | 
			
		||||
 | 
			
		||||
#if defined(OPENSSL_FIPS)
 | 
			
		||||
#define FIPS_AES_SIZE_T	int
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef  __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
@@ -95,6 +101,15 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
	const unsigned long length, const AES_KEY *key,
 | 
			
		||||
	unsigned char *ivec, int *num, const int enc);
 | 
			
		||||
void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
	const unsigned long length, const AES_KEY *key,
 | 
			
		||||
	unsigned char *ivec, int *num, const int enc);
 | 
			
		||||
void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
	const unsigned long length, const AES_KEY *key,
 | 
			
		||||
	unsigned char *ivec, int *num, const int enc);
 | 
			
		||||
void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out,
 | 
			
		||||
			    const int nbits,const AES_KEY *key,
 | 
			
		||||
			    unsigned char *ivec,const int enc);
 | 
			
		||||
void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
	const unsigned long length, const AES_KEY *key,
 | 
			
		||||
	unsigned char *ivec, int *num);
 | 
			
		||||
 
 | 
			
		||||
@@ -155,3 +155,96 @@ void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
	*num=n;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* This expects a single block of size nbits for both in and out. Note that
 | 
			
		||||
   it corrupts any extra bits in the last byte of out */
 | 
			
		||||
/* Untested, once it is working, it will be optimised */
 | 
			
		||||
void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out,
 | 
			
		||||
			    const int nbits,const AES_KEY *key,
 | 
			
		||||
			    unsigned char *ivec,const int enc)
 | 
			
		||||
    {
 | 
			
		||||
    int n;
 | 
			
		||||
    unsigned char ovec[AES_BLOCK_SIZE*2];
 | 
			
		||||
 | 
			
		||||
    assert(in && out && key && ivec);
 | 
			
		||||
    if(enc)
 | 
			
		||||
	{
 | 
			
		||||
	/* construct the new IV */
 | 
			
		||||
	AES_encrypt(ivec,ovec,key);
 | 
			
		||||
	/* encrypt the input */
 | 
			
		||||
	for(n=0 ; n < (nbits+7)/8 ; ++n)
 | 
			
		||||
	    out[n]=in[n]^ovec[n];
 | 
			
		||||
	/* fill in the first half of the new IV with the current IV */
 | 
			
		||||
	memcpy(ovec,ivec,AES_BLOCK_SIZE);
 | 
			
		||||
	/* and put the ciphertext in the second half */
 | 
			
		||||
	memcpy(ovec+AES_BLOCK_SIZE,out,(nbits+7)/8);
 | 
			
		||||
	/* shift ovec left most of the bits... */
 | 
			
		||||
	memmove(ovec,ovec+nbits/8,AES_BLOCK_SIZE+(nbits%8 ? 1 : 0));
 | 
			
		||||
	/* now the remaining bits */
 | 
			
		||||
	if(nbits%8 != 0)
 | 
			
		||||
	    for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
			
		||||
		{
 | 
			
		||||
		ovec[n]<<=nbits%8;
 | 
			
		||||
		ovec[n]|=ovec[n+1]>>(8-nbits%8);
 | 
			
		||||
		}
 | 
			
		||||
	/* finally, move it back into place */
 | 
			
		||||
	memcpy(ivec,ovec,AES_BLOCK_SIZE);
 | 
			
		||||
	}
 | 
			
		||||
    else
 | 
			
		||||
	{
 | 
			
		||||
	/* construct the new IV in the first half of ovec */
 | 
			
		||||
	AES_encrypt(ivec,ovec,key);
 | 
			
		||||
	/* decrypt the input */
 | 
			
		||||
	for(n=0 ; n < (nbits+7)/8 ; ++n)
 | 
			
		||||
	    out[n]=in[n]^ovec[n];
 | 
			
		||||
	/* fill in the first half of the new IV with the current IV */
 | 
			
		||||
	memcpy(ovec,ivec,AES_BLOCK_SIZE);
 | 
			
		||||
	/* append the ciphertext */
 | 
			
		||||
	memcpy(ovec+AES_BLOCK_SIZE,in,(nbits+7)/8);
 | 
			
		||||
	/* shift ovec left most of the bits... */
 | 
			
		||||
	memmove(ovec,ovec+nbits/8,AES_BLOCK_SIZE+(nbits%8 ? 1 : 0));
 | 
			
		||||
	/* now the remaining bits */
 | 
			
		||||
	if(nbits%8 != 0)
 | 
			
		||||
	    for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
			
		||||
		{
 | 
			
		||||
		ovec[n]<<=nbits%8;
 | 
			
		||||
		ovec[n]|=ovec[n+1]>>(8-nbits%8);
 | 
			
		||||
		}
 | 
			
		||||
	/* finally, move it back into place */
 | 
			
		||||
	memcpy(ivec,ovec,AES_BLOCK_SIZE);
 | 
			
		||||
	}
 | 
			
		||||
    /* it is not necessary to cleanse ovec, since the IV is not secret */
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
/* N.B. This expects the input to be packed, MS bit first */
 | 
			
		||||
void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
		      const unsigned long length, const AES_KEY *key,
 | 
			
		||||
		      unsigned char *ivec, int *num, const int enc)
 | 
			
		||||
    {
 | 
			
		||||
    unsigned int n;
 | 
			
		||||
    unsigned char c[1],d[1];
 | 
			
		||||
 | 
			
		||||
    assert(in && out && key && ivec && num);
 | 
			
		||||
    assert(*num == 0);
 | 
			
		||||
 | 
			
		||||
    memset(out,0,(length+7)/8);
 | 
			
		||||
    for(n=0 ; n < length ; ++n)
 | 
			
		||||
	{
 | 
			
		||||
	c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0;
 | 
			
		||||
	AES_cfbr_encrypt_block(c,d,1,key,ivec,enc);
 | 
			
		||||
	out[n/8]=(out[n/8]&~(1 << (7-n%8)))|((d[0]&0x80) >> (n%8));
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
		      const unsigned long length, const AES_KEY *key,
 | 
			
		||||
		      unsigned char *ivec, int *num, const int enc)
 | 
			
		||||
    {
 | 
			
		||||
    unsigned int n;
 | 
			
		||||
 | 
			
		||||
    assert(in && out && key && ivec && num);
 | 
			
		||||
    assert(*num == 0);
 | 
			
		||||
 | 
			
		||||
    for(n=0 ; n < length ; ++n)
 | 
			
		||||
	AES_cfbr_encrypt_block(&in[n],&out[n],8,key,ivec,enc);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -37,8 +37,11 @@
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <openssl/aes.h>
 | 
			
		||||
#include <openssl/fips.h>
 | 
			
		||||
#include "aes_locl.h"
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_FIPS
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
Te0[x] = S [x].[02, 01, 01, 03];
 | 
			
		||||
Te1[x] = S [x].[03, 02, 01, 01];
 | 
			
		||||
@@ -1255,3 +1258,4 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
	PUTU32(out + 12, s3);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif /* ndef OPENSSL_FIPS */
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@
 | 
			
		||||
#include <openssl/aes.h>
 | 
			
		||||
#include "aes_locl.h"
 | 
			
		||||
 | 
			
		||||
/* NOTE: CTR mode is big-endian.  The rest of the AES code
 | 
			
		||||
/* NOTE: the IV/counter CTR mode is big-endian.  The rest of the AES code
 | 
			
		||||
 * is endian-neutral. */
 | 
			
		||||
 | 
			
		||||
/* increment counter (128-bit int) by 1 */
 | 
			
		||||
@@ -67,61 +67,36 @@ static void AES_ctr128_inc(unsigned char *counter) {
 | 
			
		||||
	unsigned long c;
 | 
			
		||||
 | 
			
		||||
	/* Grab bottom dword of counter and increment */
 | 
			
		||||
#ifdef L_ENDIAN
 | 
			
		||||
	c = GETU32(counter +  0);
 | 
			
		||||
	c++;
 | 
			
		||||
	PUTU32(counter +  0, c);
 | 
			
		||||
#else
 | 
			
		||||
	c = GETU32(counter + 12);
 | 
			
		||||
	c++;
 | 
			
		||||
	c++;	c &= 0xFFFFFFFF;
 | 
			
		||||
	PUTU32(counter + 12, c);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	/* if no overflow, we're done */
 | 
			
		||||
	if (c)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	/* Grab 1st dword of counter and increment */
 | 
			
		||||
#ifdef L_ENDIAN
 | 
			
		||||
	c = GETU32(counter +  4);
 | 
			
		||||
	c++;
 | 
			
		||||
	PUTU32(counter +  4, c);
 | 
			
		||||
#else
 | 
			
		||||
	c = GETU32(counter +  8);
 | 
			
		||||
	c++;
 | 
			
		||||
	c++;	c &= 0xFFFFFFFF;
 | 
			
		||||
	PUTU32(counter +  8, c);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	/* if no overflow, we're done */
 | 
			
		||||
	if (c)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	/* Grab 2nd dword of counter and increment */
 | 
			
		||||
#ifdef L_ENDIAN
 | 
			
		||||
	c = GETU32(counter +  8);
 | 
			
		||||
	c++;
 | 
			
		||||
	PUTU32(counter +  8, c);
 | 
			
		||||
#else
 | 
			
		||||
	c = GETU32(counter +  4);
 | 
			
		||||
	c++;
 | 
			
		||||
	c++;	c &= 0xFFFFFFFF;
 | 
			
		||||
	PUTU32(counter +  4, c);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	/* if no overflow, we're done */
 | 
			
		||||
	if (c)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	/* Grab top dword of counter and increment */
 | 
			
		||||
#ifdef L_ENDIAN
 | 
			
		||||
	c = GETU32(counter + 12);
 | 
			
		||||
	c++;
 | 
			
		||||
	PUTU32(counter + 12, c);
 | 
			
		||||
#else
 | 
			
		||||
	c = GETU32(counter +  0);
 | 
			
		||||
	c++;
 | 
			
		||||
	c++;	c &= 0xFFFFFFFF;
 | 
			
		||||
	PUTU32(counter +  0, c);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* The input encrypted as though 128bit counter mode is being
 | 
			
		||||
 
 | 
			
		||||
@@ -62,7 +62,7 @@
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
#if defined(_MSC_VER) && !defined(OPENSSL_SYS_WINCE)
 | 
			
		||||
#if defined(_MSC_VER) && !defined(_M_IA64) && !defined(OPENSSL_SYS_WINCE)
 | 
			
		||||
# define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00)
 | 
			
		||||
# define GETU32(p) SWAP(*((u32 *)(p)))
 | 
			
		||||
# define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); }
 | 
			
		||||
 
 | 
			
		||||
@@ -10,10 +10,9 @@ CFLAG=-g
 | 
			
		||||
INSTALL_PREFIX=
 | 
			
		||||
OPENSSLDIR=     /usr/local/ssl
 | 
			
		||||
INSTALLTOP=/usr/local/ssl
 | 
			
		||||
MAKE=		make -f Makefile.ssl
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
MAKEFILE=	Makefile.ssl
 | 
			
		||||
MAKEFILE=	Makefile
 | 
			
		||||
AR=		ar r
 | 
			
		||||
 | 
			
		||||
CFLAGS= $(INCLUDES) $(CFLAG)
 | 
			
		||||
@@ -74,10 +73,9 @@ lib:	$(LIBOBJ)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
 | 
			
		||||
@@ -64,7 +64,26 @@ ASN1_INTEGER *ASN1_INTEGER_dup(ASN1_INTEGER *x)
 | 
			
		||||
{ return M_ASN1_INTEGER_dup(x);}
 | 
			
		||||
 | 
			
		||||
int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y)
 | 
			
		||||
{ return M_ASN1_INTEGER_cmp(x,y);}
 | 
			
		||||
	{ 
 | 
			
		||||
	int neg, ret;
 | 
			
		||||
	/* Compare signs */
 | 
			
		||||
	neg = x->type & V_ASN1_NEG;
 | 
			
		||||
	if (neg != (y->type & V_ASN1_NEG))
 | 
			
		||||
		{
 | 
			
		||||
		if (neg)
 | 
			
		||||
			return -1;
 | 
			
		||||
		else
 | 
			
		||||
			return 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	ret = ASN1_STRING_cmp(x, y);
 | 
			
		||||
 | 
			
		||||
	if (neg)
 | 
			
		||||
		return -ret;
 | 
			
		||||
	else
 | 
			
		||||
		return ret;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
/* 
 | 
			
		||||
 * This converts an ASN1 INTEGER into its content encoding.
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
 * project 2000.
 | 
			
		||||
 */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 2000 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 * Copyright (c) 2000-2004 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
@@ -553,7 +553,12 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in)
 | 
			
		||||
	if((type < 0) || (type > 30)) return -1;
 | 
			
		||||
	mbflag = tag2nbyte[type];
 | 
			
		||||
	if(mbflag == -1) return -1;
 | 
			
		||||
	mbflag |= MBSTRING_FLAG;
 | 
			
		||||
	if (mbflag == 0)
 | 
			
		||||
		mbflag = MBSTRING_UTF8;
 | 
			
		||||
	else if (mbflag == 4)
 | 
			
		||||
		mbflag = MBSTRING_UNIV;
 | 
			
		||||
	else		
 | 
			
		||||
		mbflag |= MBSTRING_FLAG;
 | 
			
		||||
	stmp.data = NULL;
 | 
			
		||||
	ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING);
 | 
			
		||||
	if(ret < 0) return ret;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/* p5_pbev2.c */
 | 
			
		||||
/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
 | 
			
		||||
 * project 1999.
 | 
			
		||||
 * project 1999-2004.
 | 
			
		||||
 */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
@@ -113,7 +113,8 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
 | 
			
		||||
	if(!(scheme->parameter = ASN1_TYPE_new())) goto merr;
 | 
			
		||||
 | 
			
		||||
	/* Create random IV */
 | 
			
		||||
	if (RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0)
 | 
			
		||||
	if (EVP_CIPHER_iv_length(cipher) &&
 | 
			
		||||
		RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0)
 | 
			
		||||
		goto err;
 | 
			
		||||
 | 
			
		||||
	EVP_CIPHER_CTX_init(&ctx);
 | 
			
		||||
@@ -123,6 +124,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
 | 
			
		||||
	if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) {
 | 
			
		||||
		ASN1err(ASN1_F_PKCS5_PBE2_SET,
 | 
			
		||||
					ASN1_R_ERROR_SETTING_CIPHER_PARAMS);
 | 
			
		||||
		EVP_CIPHER_CTX_cleanup(&ctx);
 | 
			
		||||
		goto err;
 | 
			
		||||
	}
 | 
			
		||||
	EVP_CIPHER_CTX_cleanup(&ctx);
 | 
			
		||||
 
 | 
			
		||||
@@ -63,8 +63,6 @@
 | 
			
		||||
 | 
			
		||||
static int X509_REVOKED_cmp(const X509_REVOKED * const *a,
 | 
			
		||||
				const X509_REVOKED * const *b);
 | 
			
		||||
static int X509_REVOKED_seq_cmp(const X509_REVOKED * const *a,
 | 
			
		||||
				const X509_REVOKED * const *b);
 | 
			
		||||
 | 
			
		||||
ASN1_SEQUENCE(X509_REVOKED) = {
 | 
			
		||||
	ASN1_SIMPLE(X509_REVOKED,serialNumber, ASN1_INTEGER),
 | 
			
		||||
@@ -72,43 +70,28 @@ ASN1_SEQUENCE(X509_REVOKED) = {
 | 
			
		||||
	ASN1_SEQUENCE_OF_OPT(X509_REVOKED,extensions, X509_EXTENSION)
 | 
			
		||||
} ASN1_SEQUENCE_END(X509_REVOKED)
 | 
			
		||||
 | 
			
		||||
/* The X509_CRL_INFO structure needs a bit of customisation. This is actually
 | 
			
		||||
 * mirroring the old behaviour: its purpose is to allow the use of
 | 
			
		||||
 * sk_X509_REVOKED_find to lookup revoked certificates. Unfortunately
 | 
			
		||||
 * this will zap the original order and the signature so we keep a copy
 | 
			
		||||
 * of the original positions and reorder appropriately before encoding.
 | 
			
		||||
 *
 | 
			
		||||
 * Might want to see if there's a better way of doing this later...
 | 
			
		||||
/* The X509_CRL_INFO structure needs a bit of customisation.
 | 
			
		||||
 * Since we cache the original encoding the signature wont be affected by
 | 
			
		||||
 * reordering of the revoked field.
 | 
			
		||||
 */
 | 
			
		||||
static int crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
 | 
			
		||||
{
 | 
			
		||||
	X509_CRL_INFO *a = (X509_CRL_INFO *)*pval;
 | 
			
		||||
	int i;
 | 
			
		||||
	int (*old_cmp)(const X509_REVOKED * const *,
 | 
			
		||||
			const X509_REVOKED * const *);
 | 
			
		||||
 | 
			
		||||
	if(!a || !a->revoked) return 1;
 | 
			
		||||
	switch(operation) {
 | 
			
		||||
 | 
			
		||||
		/* Save original order */
 | 
			
		||||
		/* Just set cmp function here. We don't sort because that
 | 
			
		||||
		 * would affect the output of X509_CRL_print().
 | 
			
		||||
		 */
 | 
			
		||||
		case ASN1_OP_D2I_POST:
 | 
			
		||||
		for (i=0; i<sk_X509_REVOKED_num(a->revoked); i++)
 | 
			
		||||
			sk_X509_REVOKED_value(a->revoked,i)->sequence=i;
 | 
			
		||||
		sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_cmp);
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
		/* Restore original order */
 | 
			
		||||
		case ASN1_OP_I2D_PRE:
 | 
			
		||||
		old_cmp=sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_seq_cmp);
 | 
			
		||||
		sk_X509_REVOKED_sort(a->revoked);
 | 
			
		||||
		sk_X509_REVOKED_set_cmp_func(a->revoked,old_cmp);
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ASN1_SEQUENCE_cb(X509_CRL_INFO, crl_inf_cb) = {
 | 
			
		||||
ASN1_SEQUENCE_enc(X509_CRL_INFO, enc, crl_inf_cb) = {
 | 
			
		||||
	ASN1_OPT(X509_CRL_INFO, version, ASN1_INTEGER),
 | 
			
		||||
	ASN1_SIMPLE(X509_CRL_INFO, sig_alg, X509_ALGOR),
 | 
			
		||||
	ASN1_SIMPLE(X509_CRL_INFO, issuer, X509_NAME),
 | 
			
		||||
@@ -116,7 +99,7 @@ ASN1_SEQUENCE_cb(X509_CRL_INFO, crl_inf_cb) = {
 | 
			
		||||
	ASN1_OPT(X509_CRL_INFO, nextUpdate, ASN1_TIME),
 | 
			
		||||
	ASN1_SEQUENCE_OF_OPT(X509_CRL_INFO, revoked, X509_REVOKED),
 | 
			
		||||
	ASN1_EXP_SEQUENCE_OF_OPT(X509_CRL_INFO, extensions, X509_EXTENSION, 0)
 | 
			
		||||
} ASN1_SEQUENCE_END_cb(X509_CRL_INFO, X509_CRL_INFO)
 | 
			
		||||
} ASN1_SEQUENCE_END_enc(X509_CRL_INFO, X509_CRL_INFO)
 | 
			
		||||
 | 
			
		||||
ASN1_SEQUENCE_ref(X509_CRL, 0, CRYPTO_LOCK_X509_CRL) = {
 | 
			
		||||
	ASN1_SIMPLE(X509_CRL, crl, X509_CRL_INFO),
 | 
			
		||||
@@ -137,12 +120,6 @@ static int X509_REVOKED_cmp(const X509_REVOKED * const *a,
 | 
			
		||||
		(ASN1_STRING *)(*b)->serialNumber));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int X509_REVOKED_seq_cmp(const X509_REVOKED * const *a,
 | 
			
		||||
				const X509_REVOKED * const *b)
 | 
			
		||||
	{
 | 
			
		||||
	return((*a)->sequence-(*b)->sequence);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev)
 | 
			
		||||
{
 | 
			
		||||
	X509_CRL_INFO *inf;
 | 
			
		||||
 
 | 
			
		||||
@@ -11,10 +11,9 @@ CFLAG=-g
 | 
			
		||||
INSTALL_PREFIX=
 | 
			
		||||
OPENSSLDIR=     /usr/local/ssl
 | 
			
		||||
INSTALLTOP=/usr/local/ssl
 | 
			
		||||
MAKE=		make -f Makefile.ssl
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
MAKEFILE=	Makefile.ssl
 | 
			
		||||
MAKEFILE=	Makefile
 | 
			
		||||
AR=		ar r
 | 
			
		||||
 | 
			
		||||
BF_ENC=		bf_enc.o
 | 
			
		||||
@@ -65,10 +64,9 @@ asm/bx86unix.cpp: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
 | 
			
		||||
	(cd asm; $(PERL) bf-586.pl cpp $(PROCESSOR) >bx86unix.cpp)
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
 | 
			
		||||
@@ -10,10 +10,9 @@ CFLAG=-g
 | 
			
		||||
INSTALL_PREFIX=
 | 
			
		||||
OPENSSLDIR=     /usr/local/ssl
 | 
			
		||||
INSTALLTOP=/usr/local/ssl
 | 
			
		||||
MAKE=		make -f Makefile.ssl
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
MAKEFILE=	Makefile.ssl
 | 
			
		||||
MAKEFILE=	Makefile
 | 
			
		||||
AR=		ar r
 | 
			
		||||
 | 
			
		||||
CFLAGS= $(INCLUDES) $(CFLAG)
 | 
			
		||||
@@ -54,10 +53,9 @@ lib:	$(LIBOBJ)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
 | 
			
		||||
@@ -347,6 +347,7 @@ typedef struct bio_f_buffer_ctx_struct
 | 
			
		||||
#define BIO_C_NWRITE0				145
 | 
			
		||||
#define BIO_C_NWRITE				146
 | 
			
		||||
#define BIO_C_RESET_READ_REQUEST		147
 | 
			
		||||
#define BIO_C_SET_MD_CTX			148
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define BIO_set_app_data(s,arg)		BIO_set_ex_data(s,0,arg)
 | 
			
		||||
 
 | 
			
		||||
@@ -11,10 +11,9 @@ CFLAG=-g
 | 
			
		||||
INSTALL_PREFIX=
 | 
			
		||||
OPENSSLDIR=     /usr/local/ssl
 | 
			
		||||
INSTALLTOP=/usr/local/ssl
 | 
			
		||||
MAKE=		make -f Makefile.ssl
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
MAKEFILE=	Makefile.ssl
 | 
			
		||||
MAKEFILE=	Makefile
 | 
			
		||||
AR=		ar r
 | 
			
		||||
 | 
			
		||||
BN_ASM=		bn_asm.o
 | 
			
		||||
@@ -124,10 +123,9 @@ asm/pa-risc2W.o: asm/pa-risc2W.s
 | 
			
		||||
	/usr/ccs/bin/as -o asm/pa-risc2W.o asm/pa-risc2W.s
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
.explicit
 | 
			
		||||
.text
 | 
			
		||||
.ident	"ia64.S, Version 2.0"
 | 
			
		||||
.ident	"ia64.S, Version 2.1"
 | 
			
		||||
.ident	"IA-64 ISA artwork by Andy Polyakov <appro@fy.chalmers.se>"
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
@@ -35,7 +35,7 @@
 | 
			
		||||
// What does it mean? You might ratiocinate that the original code
 | 
			
		||||
// should run just faster... Because sum of latencies is smaller...
 | 
			
		||||
// Wrong! Note that getf latency increased. This means that if a loop is
 | 
			
		||||
// scheduled for lower latency (and they are), then it will suffer from
 | 
			
		||||
// scheduled for lower latency (as they were), then it will suffer from
 | 
			
		||||
// stall condition and the code will therefore turn anti-scalable, e.g.
 | 
			
		||||
// original bn_mul_words spun at 5*n or 2.5 times slower than expected
 | 
			
		||||
// on Itanium2! What to do? Reschedule loops for Itanium2? But then
 | 
			
		||||
@@ -145,6 +145,12 @@
 | 
			
		||||
//	-Drum=nop.m in command line.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#if defined(_HPUX_SOURCE) && !defined(_LP64)
 | 
			
		||||
#define	ADDP	addp4
 | 
			
		||||
#else
 | 
			
		||||
#define	ADDP	add
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if 1
 | 
			
		||||
//
 | 
			
		||||
// bn_[add|sub]_words routines.
 | 
			
		||||
@@ -178,27 +184,12 @@ bn_add_words:
 | 
			
		||||
	brp.loop.imp	.L_bn_add_words_ctop,.L_bn_add_words_cend-16
 | 
			
		||||
					}
 | 
			
		||||
	.body
 | 
			
		||||
{ .mib;
 | 
			
		||||
#if defined(_HPUX_SOURCE) && defined(_ILP32)
 | 
			
		||||
	addp4		r14=0,r32		// rp
 | 
			
		||||
#else
 | 
			
		||||
	mov		r14=r32			// rp
 | 
			
		||||
#endif
 | 
			
		||||
{ .mib;	ADDP		r14=0,r32		// rp
 | 
			
		||||
	mov		r9=pr		};;
 | 
			
		||||
{ .mii;
 | 
			
		||||
#if defined(_HPUX_SOURCE) && defined(_ILP32)
 | 
			
		||||
	addp4		r15=0,r33		// ap
 | 
			
		||||
#else
 | 
			
		||||
	mov		r15=r33			// ap
 | 
			
		||||
#endif
 | 
			
		||||
{ .mii;	ADDP		r15=0,r33		// ap
 | 
			
		||||
	mov		ar.lc=r10
 | 
			
		||||
	mov		ar.ec=6		}
 | 
			
		||||
{ .mib;
 | 
			
		||||
#if defined(_HPUX_SOURCE) && defined(_ILP32)
 | 
			
		||||
	addp4		r16=0,r34		// bp
 | 
			
		||||
#else
 | 
			
		||||
	mov		r16=r34			// bp
 | 
			
		||||
#endif
 | 
			
		||||
{ .mib;	ADDP		r16=0,r34		// bp
 | 
			
		||||
	mov		pr.rot=1<<16	};;
 | 
			
		||||
 | 
			
		||||
.L_bn_add_words_ctop:
 | 
			
		||||
@@ -246,27 +237,12 @@ bn_sub_words:
 | 
			
		||||
	brp.loop.imp	.L_bn_sub_words_ctop,.L_bn_sub_words_cend-16
 | 
			
		||||
					}
 | 
			
		||||
	.body
 | 
			
		||||
{ .mib;
 | 
			
		||||
#if defined(_HPUX_SOURCE) && defined(_ILP32)
 | 
			
		||||
	addp4		r14=0,r32		// rp
 | 
			
		||||
#else
 | 
			
		||||
	mov		r14=r32			// rp
 | 
			
		||||
#endif
 | 
			
		||||
{ .mib;	ADDP		r14=0,r32		// rp
 | 
			
		||||
	mov		r9=pr		};;
 | 
			
		||||
{ .mii;
 | 
			
		||||
#if defined(_HPUX_SOURCE) && defined(_ILP32)
 | 
			
		||||
	addp4		r15=0,r33		// ap
 | 
			
		||||
#else
 | 
			
		||||
	mov		r15=r33			// ap
 | 
			
		||||
#endif
 | 
			
		||||
{ .mii;	ADDP		r15=0,r33		// ap
 | 
			
		||||
	mov		ar.lc=r10
 | 
			
		||||
	mov		ar.ec=6		}
 | 
			
		||||
{ .mib;
 | 
			
		||||
#if defined(_HPUX_SOURCE) && defined(_ILP32)
 | 
			
		||||
	addp4		r16=0,r34		// bp
 | 
			
		||||
#else
 | 
			
		||||
	mov		r16=r34			// bp
 | 
			
		||||
#endif
 | 
			
		||||
{ .mib;	ADDP		r16=0,r34		// bp
 | 
			
		||||
	mov		pr.rot=1<<16	};;
 | 
			
		||||
 | 
			
		||||
.L_bn_sub_words_ctop:
 | 
			
		||||
@@ -332,16 +308,10 @@ bn_mul_words:
 | 
			
		||||
 | 
			
		||||
#ifndef XMA_TEMPTATION
 | 
			
		||||
 | 
			
		||||
{ .mii;
 | 
			
		||||
#if defined(_HPUX_SOURCE) && defined(_ILP32)
 | 
			
		||||
	addp4		r14=0,r32	// rp
 | 
			
		||||
	addp4		r15=0,r33	// ap
 | 
			
		||||
#else
 | 
			
		||||
	mov		r14=r32		// rp
 | 
			
		||||
	mov		r15=r33		// ap
 | 
			
		||||
#endif
 | 
			
		||||
{ .mmi;	ADDP		r14=0,r32	// rp
 | 
			
		||||
	ADDP		r15=0,r33	// ap
 | 
			
		||||
	mov		ar.lc=r10	}
 | 
			
		||||
{ .mii;	mov		r40=0	// serves as r35 at first (p27)
 | 
			
		||||
{ .mmi;	mov		r40=0		// serves as r35 at first (p27)
 | 
			
		||||
	mov		ar.ec=13	};;
 | 
			
		||||
 | 
			
		||||
// This loop spins in 2*(n+12) ticks. It's scheduled for data in Itanium
 | 
			
		||||
@@ -424,89 +394,64 @@ bn_mul_words:
 | 
			
		||||
.global	bn_mul_add_words#
 | 
			
		||||
.proc	bn_mul_add_words#
 | 
			
		||||
.align	64
 | 
			
		||||
//.skip	0	// makes the loop split at 64-byte boundary
 | 
			
		||||
.skip	48	// makes the loop body aligned at 64-byte boundary
 | 
			
		||||
bn_mul_add_words:
 | 
			
		||||
	.prologue
 | 
			
		||||
	.fframe	0
 | 
			
		||||
	.save	ar.pfs,r2
 | 
			
		||||
{ .mii;	alloc		r2=ar.pfs,4,12,0,16
 | 
			
		||||
	cmp4.le		p6,p0=r34,r0	};;
 | 
			
		||||
{ .mfb;	mov		r8=r0			// return value
 | 
			
		||||
	.save	ar.lc,r3
 | 
			
		||||
	.save	pr,r9
 | 
			
		||||
{ .mmi;	alloc		r2=ar.pfs,4,4,0,8
 | 
			
		||||
	cmp4.le		p6,p0=r34,r0
 | 
			
		||||
	mov		r3=ar.lc	};;
 | 
			
		||||
{ .mib;	mov		r8=r0		// return value
 | 
			
		||||
	sub		r10=r34,r0,1
 | 
			
		||||
(p6)	br.ret.spnt.many	b0	};;
 | 
			
		||||
 | 
			
		||||
	.save	ar.lc,r3
 | 
			
		||||
{ .mii;	sub	r10=r34,r0,1
 | 
			
		||||
	mov	r3=ar.lc
 | 
			
		||||
	mov	r9=pr			};;
 | 
			
		||||
 | 
			
		||||
	.body
 | 
			
		||||
{ .mib;	setf.sig	f8=r35	// w
 | 
			
		||||
	mov		pr.rot=0x800001<<16
 | 
			
		||||
			// ------^----- serves as (p50) at first (p27)
 | 
			
		||||
{ .mib;	setf.sig	f8=r35		// w
 | 
			
		||||
	mov		r9=pr
 | 
			
		||||
	brp.loop.imp	.L_bn_mul_add_words_ctop,.L_bn_mul_add_words_cend-16
 | 
			
		||||
					}
 | 
			
		||||
{ .mii;
 | 
			
		||||
#if defined(_HPUX_SOURCE) && defined(_ILP32)
 | 
			
		||||
	addp4		r14=0,r32	// rp
 | 
			
		||||
	addp4		r15=0,r33	// ap
 | 
			
		||||
#else
 | 
			
		||||
	mov		r14=r32		// rp
 | 
			
		||||
	mov		r15=r33		// ap
 | 
			
		||||
#endif
 | 
			
		||||
{ .mmi;	ADDP		r14=0,r32	// rp
 | 
			
		||||
	ADDP		r15=0,r33	// ap
 | 
			
		||||
	mov		ar.lc=r10	}
 | 
			
		||||
{ .mii;	mov		r40=0	// serves as r35 at first (p27)
 | 
			
		||||
#if defined(_HPUX_SOURCE) && defined(_ILP32)
 | 
			
		||||
	addp4		r18=0,r32	// rp copy
 | 
			
		||||
#else
 | 
			
		||||
	mov		r18=r32		// rp copy
 | 
			
		||||
#endif
 | 
			
		||||
	mov		ar.ec=15	};;
 | 
			
		||||
{ .mii;	ADDP		r16=0,r32	// rp copy
 | 
			
		||||
	mov		pr.rot=0x2001<<16
 | 
			
		||||
			// ------^----- serves as (p40) at first (p27)
 | 
			
		||||
	mov		ar.ec=11	};;
 | 
			
		||||
 | 
			
		||||
// This loop spins in 3*(n+14) ticks on Itanium and should spin in
 | 
			
		||||
// 2*(n+14) on "wider" IA-64 implementations (to be verified with new
 | 
			
		||||
// <EFBFBD>-architecture manuals as they become available). As usual it's
 | 
			
		||||
// possible to compress the epilogue, down to 10 in this case, at the
 | 
			
		||||
// cost of scalability. Compressed (and therefore non-scalable) loop
 | 
			
		||||
// running at 3*(n+11) would buy you ~10% on Itanium but take ~35%
 | 
			
		||||
// from "wider" IA-64 so let it be scalable! Special attention was
 | 
			
		||||
// paid for having the loop body split at 64-byte boundary. ld8 is
 | 
			
		||||
// scheduled for L1 cache as the data is more than likely there.
 | 
			
		||||
// Indeed, bn_mul_words has put it there a moment ago:-)
 | 
			
		||||
// This loop spins in 3*(n+10) ticks on Itanium and in 2*(n+10) on
 | 
			
		||||
// Itanium 2. Yes, unlike previous versions it scales:-) Previous
 | 
			
		||||
// version was peforming *all* additions in IALU and was starving
 | 
			
		||||
// for those even on Itanium 2. In this version one addition is
 | 
			
		||||
// moved to FPU and is folded with multiplication. This is at cost
 | 
			
		||||
// of propogating the result from previous call to this subroutine
 | 
			
		||||
// to L2 cache... In other words negligible even for shorter keys.
 | 
			
		||||
// *Overall* performance improvement [over previous version] varies
 | 
			
		||||
// from 11 to 22 percent depending on key length.
 | 
			
		||||
.L_bn_mul_add_words_ctop:
 | 
			
		||||
{ .mfi;	(p25)	getf.sig	r36=f52			// low
 | 
			
		||||
	(p21)	xmpy.lu		f48=f37,f8
 | 
			
		||||
	(p28)	cmp.ltu		p54,p50=r41,r39	}
 | 
			
		||||
{ .mfi;	(p16)	ldf8		f32=[r15],8
 | 
			
		||||
	(p21)	xmpy.hu		f40=f37,f8
 | 
			
		||||
	(p28)	add		r45=r45,r41	};;
 | 
			
		||||
{ .mii;	(p25)	getf.sig	r32=f44			// high
 | 
			
		||||
	.pred.rel	"mutex",p50,p54
 | 
			
		||||
	(p50)	add		r40=r38,r35		// (p27)
 | 
			
		||||
	(p54)	add		r40=r38,r35,1	}	// (p27)
 | 
			
		||||
{ .mfb;	(p28)	cmp.ltu.unc	p60,p0=r45,r41
 | 
			
		||||
	(p0)	nop.f		0x0
 | 
			
		||||
	(p0)	nop.b		0x0		}
 | 
			
		||||
{ .mii;	(p27)	ld8		r44=[r18],8
 | 
			
		||||
	(p62)	cmp.eq.or	p61,p0=-1,r46
 | 
			
		||||
	(p62)	add		r46=1,r46	}
 | 
			
		||||
{ .mfb;	(p30)	st8		[r14]=r47,8
 | 
			
		||||
	(p0)	nop.f		0x0
 | 
			
		||||
.pred.rel	"mutex",p40,p42
 | 
			
		||||
{ .mfi;	(p23)	getf.sig	r36=f45			// low
 | 
			
		||||
	(p20)	xma.lu		f42=f36,f8,f50		// low
 | 
			
		||||
	(p40)	add		r39=r39,r35	}	// (p27)
 | 
			
		||||
{ .mfi;	(p16)	ldf8		f32=[r15],8		// *(ap++)
 | 
			
		||||
	(p20)	xma.hu		f36=f36,f8,f50		// high
 | 
			
		||||
	(p42)	add		r39=r39,r35,1	};;	// (p27)
 | 
			
		||||
{ .mmi;	(p24)	getf.sig	r32=f40			// high
 | 
			
		||||
	(p16)	ldf8		f46=[r16],8		// *(rp1++)
 | 
			
		||||
	(p40)	cmp.ltu		p41,p39=r39,r35	}	// (p27)
 | 
			
		||||
{ .mib;	(p26)	st8		[r14]=r39,8		// *(rp2++)
 | 
			
		||||
	(p42)	cmp.leu		p41,p39=r39,r35		// (p27)
 | 
			
		||||
	br.ctop.sptk	.L_bn_mul_add_words_ctop};;
 | 
			
		||||
.L_bn_mul_add_words_cend:
 | 
			
		||||
 | 
			
		||||
{ .mii;	nop.m		0x0
 | 
			
		||||
.pred.rel	"mutex",p53,p57
 | 
			
		||||
(p53)	add		r8=r38,r0
 | 
			
		||||
(p57)	add		r8=r38,r0,1	}
 | 
			
		||||
{ .mfb;	nop.m	0x0
 | 
			
		||||
	nop.f	0x0
 | 
			
		||||
	nop.b	0x0			};;
 | 
			
		||||
{ .mii;
 | 
			
		||||
(p63)	add		r8=1,r8
 | 
			
		||||
	mov		pr=r9,0x1ffff
 | 
			
		||||
	mov		ar.lc=r3	}
 | 
			
		||||
{ .mfb;	rum		1<<5		// clear um.mfh
 | 
			
		||||
	nop.f		0x0
 | 
			
		||||
{ .mmi;	.pred.rel	"mutex",p40,p42
 | 
			
		||||
(p40)	add		r8=r35,r0
 | 
			
		||||
(p42)	add		r8=r35,r0,1
 | 
			
		||||
	mov		pr=r9,0x1ffff	}
 | 
			
		||||
{ .mib;	rum		1<<5		// clear um.mfh
 | 
			
		||||
	mov		ar.lc=r3
 | 
			
		||||
	br.ret.sptk.many	b0	};;
 | 
			
		||||
.endp	bn_mul_add_words#
 | 
			
		||||
#endif
 | 
			
		||||
@@ -527,7 +472,8 @@ bn_sqr_words:
 | 
			
		||||
	sxt4		r34=r34		};;
 | 
			
		||||
{ .mii;	cmp.le		p6,p0=r34,r0
 | 
			
		||||
	mov		r8=r0		}	// return value
 | 
			
		||||
{ .mfb;	nop.f		0x0
 | 
			
		||||
{ .mfb;	ADDP		r32=0,r32
 | 
			
		||||
	nop.f		0x0
 | 
			
		||||
(p6)	br.ret.spnt.many	b0	};;
 | 
			
		||||
 | 
			
		||||
	.save	ar.lc,r3
 | 
			
		||||
@@ -536,11 +482,7 @@ bn_sqr_words:
 | 
			
		||||
	mov	r9=pr			};;
 | 
			
		||||
 | 
			
		||||
	.body
 | 
			
		||||
#if defined(_HPUX_SOURCE) && defined(_ILP32)
 | 
			
		||||
{ .mii; addp4		r32=0,r32
 | 
			
		||||
	addp4		r33=0,r33	};;
 | 
			
		||||
#endif
 | 
			
		||||
{ .mib;
 | 
			
		||||
{ .mib;	ADDP		r33=0,r33
 | 
			
		||||
	mov		pr.rot=1<<16
 | 
			
		||||
	brp.loop.imp	.L_bn_sqr_words_ctop,.L_bn_sqr_words_cend-16
 | 
			
		||||
					}
 | 
			
		||||
@@ -605,7 +547,7 @@ bn_sqr_comba8:
 | 
			
		||||
	.prologue
 | 
			
		||||
	.fframe	0
 | 
			
		||||
	.save	ar.pfs,r2
 | 
			
		||||
#if defined(_HPUX_SOURCE) && defined(_ILP32)
 | 
			
		||||
#if defined(_HPUX_SOURCE) && !defined(_LP64)
 | 
			
		||||
{ .mii;	alloc	r2=ar.pfs,2,1,0,0
 | 
			
		||||
	addp4	r33=0,r33
 | 
			
		||||
	addp4	r32=0,r32		};;
 | 
			
		||||
@@ -631,6 +573,10 @@ bn_sqr_comba8:
 | 
			
		||||
// clause in Itanium <EFBFBD>-architecture manual? Comments are welcomed and
 | 
			
		||||
// highly appreciated.
 | 
			
		||||
//
 | 
			
		||||
// On Itanium 2 it takes ~190 ticks. This is because of stalls on
 | 
			
		||||
// result from getf.sig. I do nothing about it at this point for
 | 
			
		||||
// reasons depicted below.
 | 
			
		||||
//
 | 
			
		||||
// However! It should be noted that even 160 ticks is darn good result
 | 
			
		||||
// as it's over 10 (yes, ten, spelled as t-e-n) times faster than the
 | 
			
		||||
// C version (compiled with gcc with inline assembler). I really
 | 
			
		||||
@@ -673,7 +619,7 @@ bn_mul_comba8:
 | 
			
		||||
	.prologue
 | 
			
		||||
	.fframe	0
 | 
			
		||||
	.save	ar.pfs,r2
 | 
			
		||||
#if defined(_HPUX_SOURCE) && defined(_ILP32)
 | 
			
		||||
#if defined(_HPUX_SOURCE) && !defined(_LP64)
 | 
			
		||||
{ .mii;	alloc	r2=ar.pfs,3,0,0,0
 | 
			
		||||
	addp4	r33=0,r33
 | 
			
		||||
	addp4	r34=0,r34		};;
 | 
			
		||||
@@ -1231,7 +1177,7 @@ bn_sqr_comba4:
 | 
			
		||||
	.prologue
 | 
			
		||||
	.fframe	0
 | 
			
		||||
	.save	ar.pfs,r2
 | 
			
		||||
#if defined(_HPUX_SOURCE) && defined(_ILP32)
 | 
			
		||||
#if defined(_HPUX_SOURCE) && !defined(_LP64)
 | 
			
		||||
{ .mii;	alloc   r2=ar.pfs,2,1,0,0
 | 
			
		||||
	addp4	r32=0,r32
 | 
			
		||||
	addp4	r33=0,r33		};;
 | 
			
		||||
@@ -1264,7 +1210,7 @@ bn_mul_comba4:
 | 
			
		||||
	.prologue
 | 
			
		||||
	.fframe	0
 | 
			
		||||
	.save	ar.pfs,r2
 | 
			
		||||
#if defined(_HPUX_SOURCE) && defined(_ILP32)
 | 
			
		||||
#if defined(_HPUX_SOURCE) && !defined(_LP64)
 | 
			
		||||
{ .mii;	alloc   r2=ar.pfs,3,0,0,0
 | 
			
		||||
	addp4	r33=0,r33
 | 
			
		||||
	addp4	r34=0,r34		};;
 | 
			
		||||
@@ -1448,8 +1394,8 @@ bn_mul_comba4:
 | 
			
		||||
#define	I	r21
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
// Some preprocessors (most notably HP-UX) apper to be allergic to
 | 
			
		||||
// macros enclosed to parenthesis as these three will be.
 | 
			
		||||
// Some preprocessors (most notably HP-UX) appear to be allergic to
 | 
			
		||||
// macros enclosed to parenthesis [as these three were].
 | 
			
		||||
#define	cont	p16
 | 
			
		||||
#define	break	p0	// p20
 | 
			
		||||
#define	equ	p24
 | 
			
		||||
@@ -1581,9 +1527,18 @@ bn_div_words:
 | 
			
		||||
// output:	f8 = (int)(a/b)
 | 
			
		||||
// clobbered:	f8,f9,f10,f11,pred
 | 
			
		||||
pred=p15
 | 
			
		||||
// This procedure is essentially Intel code and therefore is
 | 
			
		||||
// copyrighted to Intel Corporation (I suppose...). It's sligtly
 | 
			
		||||
// modified for specific needs.
 | 
			
		||||
// One can argue that this snippet is copyrighted to Intel
 | 
			
		||||
// Corporation, as it's essentially identical to one of those
 | 
			
		||||
// found in "Divide, Square Root and Remainder" section at
 | 
			
		||||
// http://www.intel.com/software/products/opensource/libraries/num.htm.
 | 
			
		||||
// Yes, I admit that the referred code was used as template,
 | 
			
		||||
// but after I realized that there hardly is any other instruction
 | 
			
		||||
// sequence which would perform this operation. I mean I figure that
 | 
			
		||||
// any independent attempt to implement high-performance division
 | 
			
		||||
// will result in code virtually identical to the Intel code. It
 | 
			
		||||
// should be noted though that below division kernel is 1 cycle
 | 
			
		||||
// faster than Intel one (note commented splits:-), not to mention
 | 
			
		||||
// original prologue (rather lack of one) and epilogue.
 | 
			
		||||
.align	32
 | 
			
		||||
.skip	16
 | 
			
		||||
.L_udiv64_32_b6:
 | 
			
		||||
 
 | 
			
		||||
@@ -232,7 +232,7 @@ int main(int argc, char *argv[])
 | 
			
		||||
	EXIT(0);
 | 
			
		||||
err:
 | 
			
		||||
	BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices
 | 
			
		||||
	                      * the failure, see test_bn in test/Makefile.ssl*/
 | 
			
		||||
	                      * the failure, see test_bn in test/Makefile */
 | 
			
		||||
	BIO_flush(out);
 | 
			
		||||
	ERR_load_crypto_strings();
 | 
			
		||||
	ERR_print_errors_fp(stderr);
 | 
			
		||||
 
 | 
			
		||||
@@ -10,10 +10,9 @@ CFLAG=-g
 | 
			
		||||
INSTALL_PREFIX=
 | 
			
		||||
OPENSSLDIR=     /usr/local/ssl
 | 
			
		||||
INSTALLTOP=/usr/local/ssl
 | 
			
		||||
MAKE=		make -f Makefile.ssl
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
MAKEFILE=	Makefile.ssl
 | 
			
		||||
MAKEFILE=	Makefile
 | 
			
		||||
AR=		ar r
 | 
			
		||||
 | 
			
		||||
CFLAGS= $(INCLUDES) $(CFLAG)
 | 
			
		||||
@@ -44,10 +43,9 @@ lib:	$(LIBOBJ)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
 | 
			
		||||
@@ -11,10 +11,9 @@ CFLAG=-g
 | 
			
		||||
INSTALL_PREFIX=
 | 
			
		||||
OPENSSLDIR=     /usr/local/ssl
 | 
			
		||||
INSTALLTOP=/usr/local/ssl
 | 
			
		||||
MAKE=		make -f Makefile.ssl
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
MAKEFILE=	Makefile.ssl
 | 
			
		||||
MAKEFILE=	Makefile
 | 
			
		||||
AR=		ar r
 | 
			
		||||
 | 
			
		||||
CAST_ENC=c_enc.o
 | 
			
		||||
@@ -68,10 +67,9 @@ asm/cx86unix.cpp: asm/cast-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
 | 
			
		||||
	(cd asm; $(PERL) cast-586.pl cpp $(PROCESSOR) >cx86unix.cpp)
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
 | 
			
		||||
@@ -1 +1,2 @@
 | 
			
		||||
cx86unix.cpp
 | 
			
		||||
cx86-elf.s
 | 
			
		||||
 
 | 
			
		||||
@@ -10,10 +10,9 @@ CFLAG=-g
 | 
			
		||||
INSTALL_PREFIX=
 | 
			
		||||
OPENSSLDIR=     /usr/local/ssl
 | 
			
		||||
INSTALLTOP=/usr/local/ssl
 | 
			
		||||
MAKE=		make -f Makefile.ssl
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
MAKEFILE=	Makefile.ssl
 | 
			
		||||
MAKEFILE=	Makefile
 | 
			
		||||
AR=		ar r
 | 
			
		||||
 | 
			
		||||
CFLAGS= $(INCLUDES) $(CFLAG)
 | 
			
		||||
@@ -47,10 +46,9 @@ lib:	$(LIBOBJ)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
 | 
			
		||||
@@ -189,7 +189,17 @@ COMP_METHOD *COMP_zlib(void)
 | 
			
		||||
	if (!zlib_loaded)
 | 
			
		||||
		{
 | 
			
		||||
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
 | 
			
		||||
		zlib_dso = DSO_load(NULL, "ZLIB", NULL, 0);
 | 
			
		||||
		zlib_dso = DSO_load(NULL, "ZLIB1", NULL, 0);
 | 
			
		||||
		if (!zlib_dso)
 | 
			
		||||
			{
 | 
			
		||||
			zlib_dso = DSO_load(NULL, "ZLIB", NULL, 0);
 | 
			
		||||
			if (zlib_dso)
 | 
			
		||||
				{
 | 
			
		||||
				/* Clear the errors from the first failed
 | 
			
		||||
				   DSO_load() */
 | 
			
		||||
				ERR_clear_error();
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
#else
 | 
			
		||||
		zlib_dso = DSO_load(NULL, "z", NULL, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -10,10 +10,9 @@ CFLAG=-g
 | 
			
		||||
INSTALL_PREFIX=
 | 
			
		||||
OPENSSLDIR=     /usr/local/ssl
 | 
			
		||||
INSTALLTOP=/usr/local/ssl
 | 
			
		||||
MAKE=		make -f Makefile.ssl
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
MAKEFILE=	Makefile.ssl
 | 
			
		||||
MAKEFILE=	Makefile
 | 
			
		||||
AR=		ar r
 | 
			
		||||
 | 
			
		||||
CFLAGS= $(INCLUDES) $(CFLAG)
 | 
			
		||||
@@ -47,10 +46,9 @@ lib:	$(LIBOBJ)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
 | 
			
		||||
@@ -632,6 +632,11 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
 | 
			
		||||
			BUF_MEM_grow_clean(buf,(strlen(p)+len-(e-from)));
 | 
			
		||||
			while (*p)
 | 
			
		||||
				buf->data[to++]= *(p++);
 | 
			
		||||
 | 
			
		||||
			/* Since we change the pointer 'from', we also have
 | 
			
		||||
			   to change the perceived length of the string it
 | 
			
		||||
			   points at.  /RL */
 | 
			
		||||
			len -= e-from;
 | 
			
		||||
			from=e;
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
 
 | 
			
		||||
@@ -105,7 +105,9 @@ static const char* lock_names[CRYPTO_NUM_LOCKS] =
 | 
			
		||||
	"engine",
 | 
			
		||||
	"ui",
 | 
			
		||||
	"hwcrhk",		/* This is a HACK which will disappear in 0.9.8 */
 | 
			
		||||
#if CRYPTO_NUM_LOCKS != 33
 | 
			
		||||
	"fips",
 | 
			
		||||
	"fips2",
 | 
			
		||||
#if CRYPTO_NUM_LOCKS != 35
 | 
			
		||||
# error "Inconsistency between crypto.h and cryptlib.c"
 | 
			
		||||
#endif
 | 
			
		||||
	};
 | 
			
		||||
@@ -512,3 +514,122 @@ void OpenSSLDie(const char *file,int line,const char *assertion)
 | 
			
		||||
		file,line,assertion);
 | 
			
		||||
	abort();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
static int fips_started = 0;
 | 
			
		||||
static int fips_mode = 0;
 | 
			
		||||
static void *fips_rand_check = 0;
 | 
			
		||||
static unsigned long fips_thread = 0;
 | 
			
		||||
 | 
			
		||||
void fips_set_started(void)
 | 
			
		||||
	{
 | 
			
		||||
	fips_started = 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int fips_is_started(void)
 | 
			
		||||
	{
 | 
			
		||||
	return fips_started;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int fips_is_owning_thread(void)
 | 
			
		||||
	{
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
 | 
			
		||||
	if (fips_is_started())
 | 
			
		||||
		{
 | 
			
		||||
		CRYPTO_r_lock(CRYPTO_LOCK_FIPS2);
 | 
			
		||||
		if (fips_thread != 0 && fips_thread == CRYPTO_thread_id())
 | 
			
		||||
			ret = 1;
 | 
			
		||||
		CRYPTO_r_unlock(CRYPTO_LOCK_FIPS2);
 | 
			
		||||
		}
 | 
			
		||||
	return ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int fips_set_owning_thread(void)
 | 
			
		||||
	{
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
 | 
			
		||||
	if (fips_is_started())
 | 
			
		||||
		{
 | 
			
		||||
		CRYPTO_w_lock(CRYPTO_LOCK_FIPS2);
 | 
			
		||||
		if (fips_thread == 0)
 | 
			
		||||
			{
 | 
			
		||||
			fips_thread = CRYPTO_thread_id();
 | 
			
		||||
			ret = 1;
 | 
			
		||||
			}
 | 
			
		||||
		CRYPTO_w_unlock(CRYPTO_LOCK_FIPS2);
 | 
			
		||||
		}
 | 
			
		||||
	return ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int fips_clear_owning_thread(void)
 | 
			
		||||
	{
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
 | 
			
		||||
	if (fips_is_started())
 | 
			
		||||
		{
 | 
			
		||||
		CRYPTO_w_lock(CRYPTO_LOCK_FIPS2);
 | 
			
		||||
		if (fips_thread == CRYPTO_thread_id())
 | 
			
		||||
			{
 | 
			
		||||
			fips_thread = 0;
 | 
			
		||||
			ret = 1;
 | 
			
		||||
			}
 | 
			
		||||
		CRYPTO_w_unlock(CRYPTO_LOCK_FIPS2);
 | 
			
		||||
		}
 | 
			
		||||
	return ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
void fips_set_mode(int onoff)
 | 
			
		||||
	{
 | 
			
		||||
	int owning_thread = fips_is_owning_thread();
 | 
			
		||||
 | 
			
		||||
	if (fips_is_started())
 | 
			
		||||
		{
 | 
			
		||||
		if (!owning_thread) CRYPTO_w_lock(CRYPTO_LOCK_FIPS);
 | 
			
		||||
		fips_mode = onoff;
 | 
			
		||||
		if (!owning_thread) CRYPTO_w_unlock(CRYPTO_LOCK_FIPS);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
void fips_set_rand_check(void *rand_check)
 | 
			
		||||
	{
 | 
			
		||||
	int owning_thread = fips_is_owning_thread();
 | 
			
		||||
 | 
			
		||||
	if (fips_is_started())
 | 
			
		||||
		{
 | 
			
		||||
		if (!owning_thread) CRYPTO_w_lock(CRYPTO_LOCK_FIPS);
 | 
			
		||||
		fips_rand_check = rand_check;
 | 
			
		||||
		if (!owning_thread) CRYPTO_w_unlock(CRYPTO_LOCK_FIPS);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int FIPS_mode(void)
 | 
			
		||||
	{
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
	int owning_thread = fips_is_owning_thread();
 | 
			
		||||
 | 
			
		||||
	if (fips_is_started())
 | 
			
		||||
		{
 | 
			
		||||
		if (!owning_thread) CRYPTO_r_lock(CRYPTO_LOCK_FIPS);
 | 
			
		||||
		ret = fips_mode;
 | 
			
		||||
		if (!owning_thread) CRYPTO_r_unlock(CRYPTO_LOCK_FIPS);
 | 
			
		||||
		}
 | 
			
		||||
	return ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
void *FIPS_rand_check(void)
 | 
			
		||||
	{
 | 
			
		||||
	void *ret = 0;
 | 
			
		||||
	int owning_thread = fips_is_owning_thread();
 | 
			
		||||
 | 
			
		||||
	if (fips_is_started())
 | 
			
		||||
		{
 | 
			
		||||
		if (!owning_thread) CRYPTO_r_lock(CRYPTO_LOCK_FIPS);
 | 
			
		||||
		ret = fips_rand_check;
 | 
			
		||||
		if (!owning_thread) CRYPTO_r_unlock(CRYPTO_LOCK_FIPS);
 | 
			
		||||
		}
 | 
			
		||||
	return ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#endif /* OPENSSL_FIPS */
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -158,7 +158,7 @@ $!
 | 
			
		||||
$ APPS_DES = "DES/DES,CBC3_ENC"
 | 
			
		||||
$ APPS_PKCS7 = "ENC/ENC;DEC/DEC;SIGN/SIGN;VERIFY/VERIFY,EXAMPLE"
 | 
			
		||||
$
 | 
			
		||||
$ LIB_ = "cryptlib,mem,mem_clr,mem_dbg,cversion,ex_data,tmdiff,cpt_err,ebcdic,uid,o_time"
 | 
			
		||||
$ LIB_ = "cryptlib,mem,mem_clr,mem_dbg,cversion,ex_data,tmdiff,cpt_err,ebcdic,uid,o_time,o_str"
 | 
			
		||||
$ LIB_MD2 = "md2_dgst,md2_one"
 | 
			
		||||
$ LIB_MD4 = "md4_dgst,md4_one"
 | 
			
		||||
$ LIB_MD5 = "md5_dgst,md5_one"
 | 
			
		||||
@@ -752,8 +752,8 @@ $     WRITE SYS$OUTPUT ""
 | 
			
		||||
$     WRITE SYS$OUTPUT "The Option ",P1," Is Invalid.  The Valid Options Are:"
 | 
			
		||||
$     WRITE SYS$OUTPUT ""
 | 
			
		||||
$     WRITE SYS$OUTPUT "    ALL      :  Just Build Everything."
 | 
			
		||||
$     WRITE SYS$OUTPUT "    LIBRARY  :  To Compile Just The [.xxx.EXE.SSL]LIBCRYPTO.OLB Library."
 | 
			
		||||
$     WRITE SYS$OUTPUT "    APPS     :  To Compile Just The [.xxx.EXE.SSL]*.EXE Programs."
 | 
			
		||||
$     WRITE SYS$OUTPUT "    LIBRARY  :  To Compile Just The [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library."
 | 
			
		||||
$     WRITE SYS$OUTPUT "    APPS     :  To Compile Just The [.xxx.EXE.CRYPTO]*.EXE Programs."
 | 
			
		||||
$     WRITE SYS$OUTPUT ""
 | 
			
		||||
$     WRITE SYS$OUTPUT " Where 'xxx' Stands For:"
 | 
			
		||||
$     WRITE SYS$OUTPUT ""
 | 
			
		||||
 
 | 
			
		||||
@@ -128,7 +128,9 @@ extern "C" {
 | 
			
		||||
#define CRYPTO_LOCK_ENGINE		30
 | 
			
		||||
#define CRYPTO_LOCK_UI			31
 | 
			
		||||
#define CRYPTO_LOCK_HWCRHK		32 /* This is a HACK which will disappear in 0.9.8 */
 | 
			
		||||
#define CRYPTO_NUM_LOCKS		33
 | 
			
		||||
#define CRYPTO_LOCK_FIPS		33
 | 
			
		||||
#define CRYPTO_LOCK_FIPS2		34
 | 
			
		||||
#define CRYPTO_NUM_LOCKS		35
 | 
			
		||||
 | 
			
		||||
#define CRYPTO_LOCK		1
 | 
			
		||||
#define CRYPTO_UNLOCK		2
 | 
			
		||||
@@ -434,6 +436,11 @@ void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
 | 
			
		||||
void OpenSSLDie(const char *file,int line,const char *assertion);
 | 
			
		||||
#define OPENSSL_assert(e)	((e) ? (void)0 : OpenSSLDie(__FILE__, __LINE__, #e))
 | 
			
		||||
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
int FIPS_mode(void);
 | 
			
		||||
void *FIPS_rand_check(void);
 | 
			
		||||
#endif /* def OPENSSL_FIPS */
 | 
			
		||||
 | 
			
		||||
/* BEGIN ERROR CODES */
 | 
			
		||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
 | 
			
		||||
 * made after this point may be overwritten when the script is next run.
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ README		- What this package is.
 | 
			
		||||
VERSION		- Which version this is and what was changed.
 | 
			
		||||
KERBEROS	- Kerberos version 4 notes.
 | 
			
		||||
Makefile.PL	- An old makefile to build with perl5, not current.
 | 
			
		||||
Makefile.ssl	- The SSLeay makefile
 | 
			
		||||
Makefile	- The SSLeay makefile
 | 
			
		||||
Makefile.uni	- The normal unix makefile.
 | 
			
		||||
GNUmakefile	- The makefile for use with glibc.
 | 
			
		||||
makefile.bc	- A Borland C makefile
 | 
			
		||||
 
 | 
			
		||||
@@ -11,10 +11,9 @@ CFLAG=-g
 | 
			
		||||
INSTALL_PREFIX=
 | 
			
		||||
OPENSSLDIR=     /usr/local/ssl
 | 
			
		||||
INSTALLTOP=/usr/local/ssl
 | 
			
		||||
MAKE=		make -f Makefile.ssl
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
MAKEFILE=	Makefile.ssl
 | 
			
		||||
MAKEFILE=	Makefile
 | 
			
		||||
AR=		ar r
 | 
			
		||||
RANLIB=		ranlib
 | 
			
		||||
DES_ENC=	des_enc.o fcrypt_b.o
 | 
			
		||||
@@ -94,10 +93,9 @@ asm/yx86unix.cpp: asm/crypt586.pl ../perlasm/x86asm.pl
 | 
			
		||||
	(cd asm; $(PERL) crypt586.pl cpp >yx86unix.cpp)
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
 | 
			
		||||
@@ -140,3 +140,114 @@ void DES_ede2_cfb64_encrypt(unsigned char *in, unsigned char *out, long length,
 | 
			
		||||
	DES_ede3_cfb64_encrypt(in,out,length,ks1,ks2,ks1,ivec,num,enc);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* This is compatible with the single key CFB-r for DES, even thought that's
 | 
			
		||||
 * not what EVP needs.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
void DES_ede3_cfb_encrypt(const unsigned char *in,unsigned char *out,
 | 
			
		||||
			  int numbits,long length,DES_key_schedule *ks1,
 | 
			
		||||
			  DES_key_schedule *ks2,DES_key_schedule *ks3,
 | 
			
		||||
			  DES_cblock *ivec,int enc)
 | 
			
		||||
	{
 | 
			
		||||
	register DES_LONG d0,d1,v0,v1;
 | 
			
		||||
	register long l=length;
 | 
			
		||||
	register int num=numbits,n=(numbits+7)/8,i;
 | 
			
		||||
	DES_LONG ti[2];
 | 
			
		||||
	unsigned char *iv;
 | 
			
		||||
	unsigned char ovec[16];
 | 
			
		||||
 | 
			
		||||
	if (num > 64) return;
 | 
			
		||||
	iv = &(*ivec)[0];
 | 
			
		||||
	c2l(iv,v0);
 | 
			
		||||
	c2l(iv,v1);
 | 
			
		||||
	if (enc)
 | 
			
		||||
		{
 | 
			
		||||
		while (l >= n)
 | 
			
		||||
			{
 | 
			
		||||
			l-=n;
 | 
			
		||||
			ti[0]=v0;
 | 
			
		||||
			ti[1]=v1;
 | 
			
		||||
			DES_encrypt3(ti,ks1,ks2,ks3);
 | 
			
		||||
			c2ln(in,d0,d1,n);
 | 
			
		||||
			in+=n;
 | 
			
		||||
			d0^=ti[0];
 | 
			
		||||
			d1^=ti[1];
 | 
			
		||||
			l2cn(d0,d1,out,n);
 | 
			
		||||
			out+=n;
 | 
			
		||||
			/* 30-08-94 - eay - changed because l>>32 and
 | 
			
		||||
			 * l<<32 are bad under gcc :-( */
 | 
			
		||||
			if (num == 32)
 | 
			
		||||
				{ v0=v1; v1=d0; }
 | 
			
		||||
			else if (num == 64)
 | 
			
		||||
				{ v0=d0; v1=d1; }
 | 
			
		||||
			else
 | 
			
		||||
				{
 | 
			
		||||
				iv=&ovec[0];
 | 
			
		||||
				l2c(v0,iv);
 | 
			
		||||
				l2c(v1,iv);
 | 
			
		||||
				l2c(d0,iv);
 | 
			
		||||
				l2c(d1,iv);
 | 
			
		||||
				/* shift ovec left most of the bits... */
 | 
			
		||||
				memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0));
 | 
			
		||||
				/* now the remaining bits */
 | 
			
		||||
				if(num%8 != 0)
 | 
			
		||||
					for(i=0 ; i < 8 ; ++i)
 | 
			
		||||
						{
 | 
			
		||||
						ovec[i]<<=num%8;
 | 
			
		||||
						ovec[i]|=ovec[i+1]>>(8-num%8);
 | 
			
		||||
						}
 | 
			
		||||
				iv=&ovec[0];
 | 
			
		||||
				c2l(iv,v0);
 | 
			
		||||
				c2l(iv,v1);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		while (l >= n)
 | 
			
		||||
			{
 | 
			
		||||
			l-=n;
 | 
			
		||||
			ti[0]=v0;
 | 
			
		||||
			ti[1]=v1;
 | 
			
		||||
			DES_encrypt3(ti,ks1,ks2,ks3);
 | 
			
		||||
			c2ln(in,d0,d1,n);
 | 
			
		||||
			in+=n;
 | 
			
		||||
			/* 30-08-94 - eay - changed because l>>32 and
 | 
			
		||||
			 * l<<32 are bad under gcc :-( */
 | 
			
		||||
			if (num == 32)
 | 
			
		||||
				{ v0=v1; v1=d0; }
 | 
			
		||||
			else if (num == 64)
 | 
			
		||||
				{ v0=d0; v1=d1; }
 | 
			
		||||
			else
 | 
			
		||||
				{
 | 
			
		||||
				iv=&ovec[0];
 | 
			
		||||
				l2c(v0,iv);
 | 
			
		||||
				l2c(v1,iv);
 | 
			
		||||
				l2c(d0,iv);
 | 
			
		||||
				l2c(d1,iv);
 | 
			
		||||
				/* shift ovec left most of the bits... */
 | 
			
		||||
				memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0));
 | 
			
		||||
				/* now the remaining bits */
 | 
			
		||||
				if(num%8 != 0)
 | 
			
		||||
					for(i=0 ; i < 8 ; ++i)
 | 
			
		||||
						{
 | 
			
		||||
						ovec[i]<<=num%8;
 | 
			
		||||
						ovec[i]|=ovec[i+1]>>(8-num%8);
 | 
			
		||||
						}
 | 
			
		||||
				iv=&ovec[0];
 | 
			
		||||
				c2l(iv,v0);
 | 
			
		||||
				c2l(iv,v1);
 | 
			
		||||
				}
 | 
			
		||||
			d0^=ti[0];
 | 
			
		||||
			d1^=ti[1];
 | 
			
		||||
			l2cn(d0,d1,out,n);
 | 
			
		||||
			out+=n;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	iv = &(*ivec)[0];
 | 
			
		||||
	l2c(v0,iv);
 | 
			
		||||
	l2c(v1,iv);
 | 
			
		||||
	v0=v1=d0=d1=ti[0]=ti[1]=0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -128,7 +128,7 @@ OPENSSL_DECLARE_GLOBAL(int,DES_rw_mode);	/* defaults to DES_PCBC_MODE */
 | 
			
		||||
#define DES_rw_mode OPENSSL_GLOBAL_REF(DES_rw_mode)
 | 
			
		||||
 | 
			
		||||
const char *DES_options(void);
 | 
			
		||||
void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,
 | 
			
		||||
void DES_ecb3_encrypt(const unsigned char *input, unsigned char *output,
 | 
			
		||||
		      DES_key_schedule *ks1,DES_key_schedule *ks2,
 | 
			
		||||
		      DES_key_schedule *ks3, int enc);
 | 
			
		||||
DES_LONG DES_cbc_cksum(const unsigned char *input,DES_cblock *output,
 | 
			
		||||
@@ -187,6 +187,10 @@ void DES_ede3_cfb64_encrypt(const unsigned char *in,unsigned char *out,
 | 
			
		||||
			    long length,DES_key_schedule *ks1,
 | 
			
		||||
			    DES_key_schedule *ks2,DES_key_schedule *ks3,
 | 
			
		||||
			    DES_cblock *ivec,int *num,int enc);
 | 
			
		||||
void DES_ede3_cfb_encrypt(const unsigned char *in,unsigned char *out,
 | 
			
		||||
			  int numbits,long length,DES_key_schedule *ks1,
 | 
			
		||||
			  DES_key_schedule *ks2,DES_key_schedule *ks3,
 | 
			
		||||
			  DES_cblock *ivec,int enc);
 | 
			
		||||
void DES_ede3_ofb64_encrypt(const unsigned char *in,unsigned char *out,
 | 
			
		||||
			    long length,DES_key_schedule *ks1,
 | 
			
		||||
			    DES_key_schedule *ks2,DES_key_schedule *ks3,
 | 
			
		||||
 
 | 
			
		||||
@@ -58,6 +58,8 @@
 | 
			
		||||
 | 
			
		||||
#include "des_locl.h"
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_FIPS
 | 
			
		||||
 | 
			
		||||
void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc)
 | 
			
		||||
	{
 | 
			
		||||
	register DES_LONG l,r,t,u;
 | 
			
		||||
@@ -287,8 +289,12 @@ void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1,
 | 
			
		||||
	data[1]=r;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#endif /* ndef OPENSSL_FIPS */
 | 
			
		||||
 | 
			
		||||
#ifndef DES_DEFAULT_OPTIONS
 | 
			
		||||
 | 
			
		||||
#if !defined(OPENSSL_FIPS) || !defined(I386_ONLY)
 | 
			
		||||
 | 
			
		||||
#undef CBC_ENC_C__DONT_UPDATE_IV
 | 
			
		||||
#include "ncbc_enc.c" /* DES_ncbc_encrypt */
 | 
			
		||||
 | 
			
		||||
@@ -404,4 +410,6 @@ void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output,
 | 
			
		||||
	tin[0]=tin[1]=0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#endif /* !defined(OPENSSL_FIPS) || !defined(I386_ONLY) */
 | 
			
		||||
 | 
			
		||||
#endif /* DES_DEFAULT_OPTIONS */
 | 
			
		||||
 
 | 
			
		||||
@@ -84,7 +84,7 @@ void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock
 | 
			
		||||
	des_key_schedule ks1,des_key_schedule ks2,
 | 
			
		||||
	des_key_schedule ks3, int enc)
 | 
			
		||||
	{
 | 
			
		||||
	DES_ecb3_encrypt((const_DES_cblock *)input, output,
 | 
			
		||||
	DES_ecb3_encrypt((const unsigned char *)input, (unsigned char *)output,
 | 
			
		||||
		(DES_key_schedule *)ks1, (DES_key_schedule *)ks2,
 | 
			
		||||
		(DES_key_schedule *)ks3, enc);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -439,8 +439,8 @@ int main(int argc, char *argv[])
 | 
			
		||||
		memcpy(in,plain_data[i],8);
 | 
			
		||||
		memset(out,0,8);
 | 
			
		||||
		memset(outin,0,8);
 | 
			
		||||
		des_ecb2_encrypt(&in,&out,ks,ks2,DES_ENCRYPT);
 | 
			
		||||
		des_ecb2_encrypt(&out,&outin,ks,ks2,DES_DECRYPT);
 | 
			
		||||
		des_ecb2_encrypt(in,out,ks,ks2,DES_ENCRYPT);
 | 
			
		||||
		des_ecb2_encrypt(out,outin,ks,ks2,DES_DECRYPT);
 | 
			
		||||
 | 
			
		||||
		if (memcmp(out,cipher_ecb2[i],8) != 0)
 | 
			
		||||
			{
 | 
			
		||||
 
 | 
			
		||||
@@ -58,15 +58,13 @@
 | 
			
		||||
 | 
			
		||||
#include "des_locl.h"
 | 
			
		||||
 | 
			
		||||
void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,
 | 
			
		||||
void DES_ecb3_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
		      DES_key_schedule *ks1, DES_key_schedule *ks2,
 | 
			
		||||
		      DES_key_schedule *ks3,
 | 
			
		||||
	     int enc)
 | 
			
		||||
	{
 | 
			
		||||
	register DES_LONG l0,l1;
 | 
			
		||||
	DES_LONG ll[2];
 | 
			
		||||
	const unsigned char *in = &(*input)[0];
 | 
			
		||||
	unsigned char *out = &(*output)[0];
 | 
			
		||||
 | 
			
		||||
	c2l(in,l0);
 | 
			
		||||
	c2l(in,l1);
 | 
			
		||||
 
 | 
			
		||||
@@ -65,6 +65,8 @@
 | 
			
		||||
 */
 | 
			
		||||
#include "des_locl.h"
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_FIPS
 | 
			
		||||
 | 
			
		||||
OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key);	/* defaults to false */
 | 
			
		||||
 | 
			
		||||
static const unsigned char odd_parity[256]={
 | 
			
		||||
@@ -405,3 +407,5 @@ void des_fixup_key_parity(des_cblock *key)
 | 
			
		||||
	des_set_odd_parity(key);
 | 
			
		||||
	}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#endif /* ndef OPENSSL_FIPS */
 | 
			
		||||
 
 | 
			
		||||
@@ -10,10 +10,9 @@ CFLAG=-g
 | 
			
		||||
INSTALL_PREFIX=
 | 
			
		||||
OPENSSLDIR=     /usr/local/ssl
 | 
			
		||||
INSTALLTOP=/usr/local/ssl
 | 
			
		||||
MAKE=		make -f Makefile.ssl
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
MAKEFILE=	Makefile.ssl
 | 
			
		||||
MAKEFILE=	Makefile
 | 
			
		||||
AR=		ar r
 | 
			
		||||
 | 
			
		||||
CFLAGS= $(INCLUDES) $(CFLAG)
 | 
			
		||||
@@ -44,10 +43,9 @@ lib:	$(LIBOBJ)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
 | 
			
		||||
@@ -70,6 +70,8 @@
 | 
			
		||||
 * should hold.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_FIPS
 | 
			
		||||
 | 
			
		||||
int DH_check(const DH *dh, int *ret)
 | 
			
		||||
	{
 | 
			
		||||
	int ok=0;
 | 
			
		||||
@@ -118,3 +120,5 @@ err:
 | 
			
		||||
	if (q != NULL) BN_free(q);
 | 
			
		||||
	return(ok);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/* crypto/dh/dh_err.c */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 1999-2002 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 * Copyright (c) 1999-2003 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 
 | 
			
		||||
@@ -86,6 +86,9 @@
 | 
			
		||||
 * It's just as OK (and in some sense better) to use a generator of the
 | 
			
		||||
 * order-q subgroup.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_FIPS
 | 
			
		||||
 | 
			
		||||
DH *DH_generate_parameters(int prime_len, int generator,
 | 
			
		||||
	     void (*callback)(int,int,void *), void *cb_arg)
 | 
			
		||||
	{
 | 
			
		||||
@@ -167,3 +170,5 @@ err:
 | 
			
		||||
		}
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -62,6 +62,8 @@
 | 
			
		||||
#include <openssl/rand.h>
 | 
			
		||||
#include <openssl/dh.h>
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_FIPS
 | 
			
		||||
 | 
			
		||||
static int generate_key(DH *dh);
 | 
			
		||||
static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh);
 | 
			
		||||
static int dh_bn_mod_exp(const DH *dh, BIGNUM *r,
 | 
			
		||||
@@ -220,3 +222,5 @@ static int dh_finish(DH *dh)
 | 
			
		||||
		BN_MONT_CTX_free((BN_MONT_CTX *)dh->method_mont_p);
 | 
			
		||||
	return(1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -10,10 +10,9 @@ CFLAG=-g
 | 
			
		||||
INSTALL_PREFIX=
 | 
			
		||||
OPENSSLDIR=     /usr/local/ssl
 | 
			
		||||
INSTALLTOP=/usr/local/ssl
 | 
			
		||||
MAKE=		make -f Makefile.ssl
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
MAKEFILE=	Makefile.ssl
 | 
			
		||||
MAKEFILE=	Makefile
 | 
			
		||||
AR=		ar r
 | 
			
		||||
 | 
			
		||||
CFLAGS= $(INCLUDES) $(CFLAG)
 | 
			
		||||
@@ -46,10 +45,9 @@ lib:	$(LIBOBJ)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
 | 
			
		||||
@@ -153,19 +151,23 @@ dsa_sign.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
dsa_sign.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
 | 
			
		||||
dsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
dsa_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
 | 
			
		||||
dsa_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
 | 
			
		||||
dsa_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
 | 
			
		||||
dsa_sign.o: ../../include/openssl/err.h ../../include/openssl/fips.h
 | 
			
		||||
dsa_sign.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
 | 
			
		||||
dsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
dsa_sign.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
 | 
			
		||||
dsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
dsa_sign.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
 | 
			
		||||
dsa_sign.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 | 
			
		||||
dsa_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
 | 
			
		||||
dsa_sign.o: ../cryptlib.h dsa_sign.c
 | 
			
		||||
dsa_vrf.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
dsa_vrf.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
 | 
			
		||||
dsa_vrf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 | 
			
		||||
dsa_vrf.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 | 
			
		||||
dsa_vrf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
 | 
			
		||||
dsa_vrf.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
 | 
			
		||||
dsa_vrf.o: ../../include/openssl/engine.h ../../include/openssl/err.h
 | 
			
		||||
dsa_vrf.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
dsa_vrf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
dsa_vrf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
 | 
			
		||||
dsa_vrf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 | 
			
		||||
dsa_vrf.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_vrf.c
 | 
			
		||||
dsa_vrf.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
 | 
			
		||||
dsa_vrf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
dsa_vrf.o: ../../include/openssl/ui.h ../cryptlib.h dsa_vrf.c
 | 
			
		||||
@@ -81,6 +81,10 @@
 | 
			
		||||
 | 
			
		||||
#define DSA_FLAG_CACHE_MONT_P	0x01
 | 
			
		||||
 | 
			
		||||
#if defined(OPENSSL_FIPS)
 | 
			
		||||
#define FIPS_DSA_SIZE_T	int
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef  __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -80,6 +80,7 @@
 | 
			
		||||
#include <openssl/rand.h>
 | 
			
		||||
#include <openssl/sha.h>
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_FIPS
 | 
			
		||||
DSA *DSA_generate_parameters(int bits,
 | 
			
		||||
		unsigned char *seed_in, int seed_len,
 | 
			
		||||
		int *counter_ret, unsigned long *h_ret,
 | 
			
		||||
@@ -293,4 +294,6 @@ err:
 | 
			
		||||
	if (mont != NULL) BN_MONT_CTX_free(mont);
 | 
			
		||||
	return(ok?ret:NULL);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
#endif /* ndef OPENSSL_FIPS */
 | 
			
		||||
#endif /* ndef OPENSSL_NO_SHA */
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -64,6 +64,7 @@
 | 
			
		||||
#include <openssl/dsa.h>
 | 
			
		||||
#include <openssl/rand.h>
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_FIPS
 | 
			
		||||
int DSA_generate_key(DSA *dsa)
 | 
			
		||||
	{
 | 
			
		||||
	int ok=0;
 | 
			
		||||
@@ -103,3 +104,4 @@ err:
 | 
			
		||||
	return(ok);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -65,6 +65,7 @@
 | 
			
		||||
#include <openssl/rand.h>
 | 
			
		||||
#include <openssl/asn1.h>
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_FIPS
 | 
			
		||||
static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa);
 | 
			
		||||
static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp);
 | 
			
		||||
static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig,
 | 
			
		||||
@@ -346,3 +347,4 @@ static int dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p,
 | 
			
		||||
{
 | 
			
		||||
	return BN_mod_exp_mont(r, a, p, m, ctx, m_ctx);
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -64,9 +64,17 @@
 | 
			
		||||
#include <openssl/dsa.h>
 | 
			
		||||
#include <openssl/rand.h>
 | 
			
		||||
#include <openssl/asn1.h>
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
#include <openssl/engine.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include <openssl/fips.h>
 | 
			
		||||
 | 
			
		||||
DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
 | 
			
		||||
	{
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
	if(FIPS_mode() && !FIPS_dsa_check(dsa))
 | 
			
		||||
		return NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	return dsa->meth->dsa_do_sign(dgst, dlen, dsa);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -87,6 +95,10 @@ int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig,
 | 
			
		||||
 | 
			
		||||
int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
 | 
			
		||||
	{
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
	if(FIPS_mode() && !FIPS_dsa_check(dsa))
 | 
			
		||||
		return 0;
 | 
			
		||||
#endif
 | 
			
		||||
	return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -65,10 +65,18 @@
 | 
			
		||||
#include <openssl/rand.h>
 | 
			
		||||
#include <openssl/asn1.h>
 | 
			
		||||
#include <openssl/asn1_mac.h>
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
#include <openssl/engine.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include <openssl/fips.h>
 | 
			
		||||
 | 
			
		||||
int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig,
 | 
			
		||||
		  DSA *dsa)
 | 
			
		||||
	{
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
	if(FIPS_mode() && !FIPS_dsa_check(dsa))
 | 
			
		||||
		return -1;
 | 
			
		||||
#endif
 | 
			
		||||
	return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -10,10 +10,9 @@ CFLAG=-g
 | 
			
		||||
INSTALL_PREFIX=
 | 
			
		||||
OPENSSLDIR=     /usr/local/ssl
 | 
			
		||||
INSTALLTOP=/usr/local/ssl
 | 
			
		||||
MAKE=		make -f Makefile.ssl
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
MAKEFILE=	Makefile.ssl
 | 
			
		||||
MAKEFILE=	Makefile
 | 
			
		||||
AR=		ar r
 | 
			
		||||
 | 
			
		||||
CFLAGS= $(INCLUDES) $(CFLAG)
 | 
			
		||||
@@ -46,10 +45,9 @@ lib:	$(LIBOBJ)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
 | 
			
		||||
@@ -10,10 +10,9 @@ CFLAG=-g
 | 
			
		||||
INSTALL_PREFIX=
 | 
			
		||||
OPENSSLDIR=     /usr/local/ssl
 | 
			
		||||
INSTALLTOP=/usr/local/ssl
 | 
			
		||||
MAKE=		make -f Makefile.ssl
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
MAKEFILE=	Makefile.ssl
 | 
			
		||||
MAKEFILE=	Makefile
 | 
			
		||||
AR=		ar r
 | 
			
		||||
 | 
			
		||||
CFLAGS= $(INCLUDES) $(CFLAG)
 | 
			
		||||
@@ -47,10 +46,9 @@ lib:	$(LIBOBJ)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
 | 
			
		||||
@@ -10,10 +10,9 @@ CFLAG=-g
 | 
			
		||||
INSTALL_PREFIX=
 | 
			
		||||
OPENSSLDIR=     /usr/local/ssl
 | 
			
		||||
INSTALLTOP=/usr/local/ssl
 | 
			
		||||
MAKE=		make -f Makefile.ssl
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
MAKEFILE=	Makefile.ssl
 | 
			
		||||
MAKEFILE=	Makefile
 | 
			
		||||
AR=		ar r
 | 
			
		||||
 | 
			
		||||
CFLAGS= $(INCLUDES) $(CFLAG)
 | 
			
		||||
@@ -54,10 +53,9 @@ lib:	$(LIBOBJ)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
 | 
			
		||||
@@ -77,7 +77,7 @@ static int cryptodev_max_iv(int cipher);
 | 
			
		||||
static int cryptodev_key_length_valid(int cipher, int len);
 | 
			
		||||
static int cipher_nid_to_cryptodev(int nid);
 | 
			
		||||
static int get_cryptodev_ciphers(const int **cnids);
 | 
			
		||||
static int get_cryptodev_digests(const int **cnids);
 | 
			
		||||
/*static int get_cryptodev_digests(const int **cnids);*/
 | 
			
		||||
static int cryptodev_usable_ciphers(const int **nids);
 | 
			
		||||
static int cryptodev_usable_digests(const int **nids);
 | 
			
		||||
static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
@@ -137,6 +137,7 @@ static struct {
 | 
			
		||||
	{ 0,				NID_undef,		0,	 0, },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#if 0 /* UNUSED */
 | 
			
		||||
static struct {
 | 
			
		||||
	int	id;
 | 
			
		||||
	int	nid;
 | 
			
		||||
@@ -149,6 +150,7 @@ static struct {
 | 
			
		||||
	{ CRYPTO_SHA1,			NID_undef,		},
 | 
			
		||||
	{ 0,				NID_undef,		},
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Return a fd if /dev/crypto seems usable, 0 otherwise.
 | 
			
		||||
@@ -258,7 +260,7 @@ get_cryptodev_ciphers(const int **cnids)
 | 
			
		||||
	int fd, i, count = 0;
 | 
			
		||||
 | 
			
		||||
	if ((fd = get_dev_crypto()) < 0) {
 | 
			
		||||
		*nids = NULL;
 | 
			
		||||
		*cnids = NULL;
 | 
			
		||||
		return (0);
 | 
			
		||||
	}
 | 
			
		||||
	memset(&sess, 0, sizeof(sess));
 | 
			
		||||
@@ -289,6 +291,7 @@ get_cryptodev_ciphers(const int **cnids)
 | 
			
		||||
 * returning them here is harmless, as long as we return NULL
 | 
			
		||||
 * when asked for a handler in the cryptodev_engine_digests routine
 | 
			
		||||
 */
 | 
			
		||||
#if 0 /* UNUSED */
 | 
			
		||||
static int
 | 
			
		||||
get_cryptodev_digests(const int **cnids)
 | 
			
		||||
{
 | 
			
		||||
@@ -297,7 +300,7 @@ get_cryptodev_digests(const int **cnids)
 | 
			
		||||
	int fd, i, count = 0;
 | 
			
		||||
 | 
			
		||||
	if ((fd = get_dev_crypto()) < 0) {
 | 
			
		||||
		*nids = NULL;
 | 
			
		||||
		*cnids = NULL;
 | 
			
		||||
		return (0);
 | 
			
		||||
	}
 | 
			
		||||
	memset(&sess, 0, sizeof(sess));
 | 
			
		||||
@@ -318,6 +321,7 @@ get_cryptodev_digests(const int **cnids)
 | 
			
		||||
		*cnids = NULL;
 | 
			
		||||
	return (count);
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Find the useable ciphers|digests from dev/crypto - this is the first
 | 
			
		||||
@@ -623,7 +627,7 @@ static int
 | 
			
		||||
bn2crparam(const BIGNUM *a, struct crparam *crp)
 | 
			
		||||
{
 | 
			
		||||
	int i, j, k;
 | 
			
		||||
	ssize_t words, bytes, bits;
 | 
			
		||||
	ssize_t bytes, bits;
 | 
			
		||||
	u_char *b;
 | 
			
		||||
 | 
			
		||||
	crp->crp_p = NULL;
 | 
			
		||||
 
 | 
			
		||||
@@ -10,10 +10,9 @@ CFLAG=-g
 | 
			
		||||
INSTALL_PREFIX=
 | 
			
		||||
OPENSSLDIR=     /usr/local/ssl
 | 
			
		||||
INSTALLTOP=/usr/local/ssl
 | 
			
		||||
MAKE=		make -f Makefile.ssl
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
MAKEFILE=	Makefile.ssl
 | 
			
		||||
MAKEFILE=	Makefile
 | 
			
		||||
AR=		ar r
 | 
			
		||||
 | 
			
		||||
CFLAGS= $(INCLUDES) $(CFLAG)
 | 
			
		||||
@@ -44,10 +43,9 @@ lib:	$(LIBOBJ)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
 | 
			
		||||
@@ -94,22 +92,23 @@ err_all.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
 | 
			
		||||
err_all.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
 | 
			
		||||
err_all.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
err_all.o: ../../include/openssl/engine.h ../../include/openssl/err.h
 | 
			
		||||
err_all.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
 | 
			
		||||
err_all.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
 | 
			
		||||
err_all.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
 | 
			
		||||
err_all.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
 | 
			
		||||
err_all.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
 | 
			
		||||
err_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
err_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem2.h
 | 
			
		||||
err_all.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
 | 
			
		||||
err_all.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
 | 
			
		||||
err_all.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
 | 
			
		||||
err_all.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
 | 
			
		||||
err_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
err_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
err_all.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
 | 
			
		||||
err_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
err_all.o: ../../include/openssl/x509v3.h err_all.c
 | 
			
		||||
err_all.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
 | 
			
		||||
err_all.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
 | 
			
		||||
err_all.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
 | 
			
		||||
err_all.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
 | 
			
		||||
err_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
err_all.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
 | 
			
		||||
err_all.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
err_all.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs12.h
 | 
			
		||||
err_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
 | 
			
		||||
err_all.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
 | 
			
		||||
err_all.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
 | 
			
		||||
err_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
 | 
			
		||||
err_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
err_all.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
 | 
			
		||||
err_all.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
 | 
			
		||||
err_all.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
 | 
			
		||||
err_all.o: err_all.c
 | 
			
		||||
err_prn.o: ../../e_os.h ../../include/openssl/bio.h
 | 
			
		||||
err_prn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
err_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
 | 
			
		||||
@@ -149,6 +149,7 @@ static ERR_STRING_DATA ERR_str_libraries[]=
 | 
			
		||||
{ERR_PACK(ERR_LIB_DSO,0,0)		,"DSO support routines"},
 | 
			
		||||
{ERR_PACK(ERR_LIB_ENGINE,0,0)		,"engine routines"},
 | 
			
		||||
{ERR_PACK(ERR_LIB_OCSP,0,0)		,"OCSP routines"},
 | 
			
		||||
{ERR_PACK(ERR_LIB_FIPS,0,0)		,"FIPS routines"},
 | 
			
		||||
{0,NULL},
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -131,6 +131,7 @@ typedef struct err_state_st
 | 
			
		||||
#define ERR_LIB_OCSP            39
 | 
			
		||||
#define ERR_LIB_UI              40
 | 
			
		||||
#define ERR_LIB_COMP            41
 | 
			
		||||
#define ERR_LIB_FIPS		42
 | 
			
		||||
 | 
			
		||||
#define ERR_LIB_USER		128
 | 
			
		||||
 | 
			
		||||
@@ -159,6 +160,7 @@ typedef struct err_state_st
 | 
			
		||||
#define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__)
 | 
			
		||||
#define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__)
 | 
			
		||||
#define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__)
 | 
			
		||||
#define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),__FILE__,__LINE__)
 | 
			
		||||
 | 
			
		||||
/* Borland C seems too stupid to be able to shift and do longs in
 | 
			
		||||
 * the pre-processor :-( */
 | 
			
		||||
 
 | 
			
		||||
@@ -87,6 +87,7 @@
 | 
			
		||||
#endif
 | 
			
		||||
#include <openssl/ocsp.h>
 | 
			
		||||
#include <openssl/err.h>
 | 
			
		||||
#include <openssl/fips.h>
 | 
			
		||||
 | 
			
		||||
void ERR_load_crypto_strings(void)
 | 
			
		||||
	{
 | 
			
		||||
@@ -129,5 +130,8 @@ void ERR_load_crypto_strings(void)
 | 
			
		||||
#endif
 | 
			
		||||
	ERR_load_OCSP_strings();
 | 
			
		||||
	ERR_load_UI_strings();
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
	ERR_load_FIPS_strings();
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -27,6 +27,7 @@ L DSO		crypto/dso/dso.h		crypto/dso/dso_err.c
 | 
			
		||||
L ENGINE	crypto/engine/engine.h		crypto/engine/eng_err.c
 | 
			
		||||
L OCSP		crypto/ocsp/ocsp.h		crypto/ocsp/ocsp_err.c
 | 
			
		||||
L UI		crypto/ui/ui.h			crypto/ui/ui_err.c
 | 
			
		||||
L FIPS		fips/fips.h			fips/fips_err.h
 | 
			
		||||
 | 
			
		||||
# additional header files to be scanned for function names
 | 
			
		||||
L NONE		crypto/x509/x509_vfy.h		NONE
 | 
			
		||||
 
 | 
			
		||||
@@ -10,10 +10,9 @@ CFLAG=-g
 | 
			
		||||
INSTALL_PREFIX=
 | 
			
		||||
OPENSSLDIR=     /usr/local/ssl
 | 
			
		||||
INSTALLTOP=/usr/local/ssl
 | 
			
		||||
MAKE=		make -f Makefile.ssl
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
MAKEFILE=	Makefile.ssl
 | 
			
		||||
MAKEFILE=	Makefile
 | 
			
		||||
AR=		ar r
 | 
			
		||||
 | 
			
		||||
CFLAGS= $(INCLUDES) $(CFLAG)
 | 
			
		||||
@@ -33,7 +32,8 @@ LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \
 | 
			
		||||
	p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c \
 | 
			
		||||
	bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c \
 | 
			
		||||
	c_all.c c_allc.c c_alld.c evp_lib.c bio_ok.c \
 | 
			
		||||
	evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c
 | 
			
		||||
	evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c \
 | 
			
		||||
	e_old.c
 | 
			
		||||
 | 
			
		||||
LIBOBJ=	encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \
 | 
			
		||||
	e_des.o e_bf.o e_idea.o e_des3.o \
 | 
			
		||||
@@ -44,7 +44,8 @@ LIBOBJ=	encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \
 | 
			
		||||
	p_open.o p_seal.o p_sign.o p_verify.o p_lib.o p_enc.o p_dec.o \
 | 
			
		||||
	bio_md.o bio_b64.o bio_enc.o evp_err.o e_null.o \
 | 
			
		||||
	c_all.o c_allc.o c_alld.o evp_lib.o bio_ok.o \
 | 
			
		||||
	evp_pkey.o evp_pbe.o p5_crpt.o p5_crpt2.o
 | 
			
		||||
	evp_pkey.o evp_pbe.o p5_crpt.o p5_crpt2.o \
 | 
			
		||||
	e_old.o
 | 
			
		||||
 | 
			
		||||
SRC= $(LIBSRC)
 | 
			
		||||
 | 
			
		||||
@@ -64,10 +65,9 @@ lib:	$(LIBOBJ)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
 | 
			
		||||
links:
 | 
			
		||||
	@sh $(TOP)/util/point.sh Makefile.ssl Makefile
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
 | 
			
		||||
	cp $(TESTDATA) ../../test
 | 
			
		||||
@@ -394,6 +394,23 @@ e_null.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
 | 
			
		||||
e_null.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
e_null.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
 | 
			
		||||
e_null.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_null.c
 | 
			
		||||
e_old.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
 | 
			
		||||
e_old.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
 | 
			
		||||
e_old.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
 | 
			
		||||
e_old.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
 | 
			
		||||
e_old.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
 | 
			
		||||
e_old.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
 | 
			
		||||
e_old.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
 | 
			
		||||
e_old.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
 | 
			
		||||
e_old.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
 | 
			
		||||
e_old.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
e_old.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
e_old.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h
 | 
			
		||||
e_old.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
 | 
			
		||||
e_old.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
 | 
			
		||||
e_old.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
e_old.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
e_old.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h e_old.c
 | 
			
		||||
e_rc2.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
 | 
			
		||||
e_rc2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
 | 
			
		||||
e_rc2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 | 
			
		||||
@@ -176,10 +176,11 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
		{
 | 
			
		||||
	case BIO_CTRL_RESET:
 | 
			
		||||
		if (b->init)
 | 
			
		||||
			EVP_DigestInit_ex(ctx,ctx->digest, NULL);
 | 
			
		||||
			ret = EVP_DigestInit_ex(ctx,ctx->digest, NULL);
 | 
			
		||||
		else
 | 
			
		||||
			ret=0;
 | 
			
		||||
		ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
 | 
			
		||||
		if (ret > 0)
 | 
			
		||||
			ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_C_GET_MD:
 | 
			
		||||
		if (b->init)
 | 
			
		||||
@@ -199,6 +200,12 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
		else
 | 
			
		||||
			ret=0;
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_C_SET_MD_CTX:
 | 
			
		||||
		if (b->init)
 | 
			
		||||
			b->ptr=ptr;
 | 
			
		||||
		else
 | 
			
		||||
			ret=0;
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_C_DO_STATE_MACHINE:
 | 
			
		||||
		BIO_clear_retry_flags(b);
 | 
			
		||||
		ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
 | 
			
		||||
@@ -207,8 +214,9 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
 | 
			
		||||
	case BIO_C_SET_MD:
 | 
			
		||||
		md=ptr;
 | 
			
		||||
		EVP_DigestInit_ex(ctx,md, NULL);
 | 
			
		||||
		b->init=1;
 | 
			
		||||
		ret = EVP_DigestInit_ex(ctx,md, NULL);
 | 
			
		||||
		if (ret > 0)
 | 
			
		||||
			b->init=1;
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_CTRL_DUP:
 | 
			
		||||
		dbio=ptr;
 | 
			
		||||
 
 | 
			
		||||
@@ -67,6 +67,8 @@ void OpenSSL_add_all_ciphers(void)
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_DES
 | 
			
		||||
	EVP_add_cipher(EVP_des_cfb());
 | 
			
		||||
	EVP_add_cipher(EVP_des_cfb1());
 | 
			
		||||
	EVP_add_cipher(EVP_des_cfb8());
 | 
			
		||||
	EVP_add_cipher(EVP_des_ede_cfb());
 | 
			
		||||
	EVP_add_cipher(EVP_des_ede3_cfb());
 | 
			
		||||
 | 
			
		||||
@@ -150,6 +152,8 @@ void OpenSSL_add_all_ciphers(void)
 | 
			
		||||
	EVP_add_cipher(EVP_aes_128_ecb());
 | 
			
		||||
	EVP_add_cipher(EVP_aes_128_cbc());
 | 
			
		||||
	EVP_add_cipher(EVP_aes_128_cfb());
 | 
			
		||||
	EVP_add_cipher(EVP_aes_128_cfb1());
 | 
			
		||||
	EVP_add_cipher(EVP_aes_128_cfb8());
 | 
			
		||||
	EVP_add_cipher(EVP_aes_128_ofb());
 | 
			
		||||
#if 0
 | 
			
		||||
	EVP_add_cipher(EVP_aes_128_ctr());
 | 
			
		||||
@@ -159,6 +163,8 @@ void OpenSSL_add_all_ciphers(void)
 | 
			
		||||
	EVP_add_cipher(EVP_aes_192_ecb());
 | 
			
		||||
	EVP_add_cipher(EVP_aes_192_cbc());
 | 
			
		||||
	EVP_add_cipher(EVP_aes_192_cfb());
 | 
			
		||||
	EVP_add_cipher(EVP_aes_192_cfb1());
 | 
			
		||||
	EVP_add_cipher(EVP_aes_192_cfb8());
 | 
			
		||||
	EVP_add_cipher(EVP_aes_192_ofb());
 | 
			
		||||
#if 0
 | 
			
		||||
	EVP_add_cipher(EVP_aes_192_ctr());
 | 
			
		||||
@@ -168,6 +174,8 @@ void OpenSSL_add_all_ciphers(void)
 | 
			
		||||
	EVP_add_cipher(EVP_aes_256_ecb());
 | 
			
		||||
	EVP_add_cipher(EVP_aes_256_cbc());
 | 
			
		||||
	EVP_add_cipher(EVP_aes_256_cfb());
 | 
			
		||||
	EVP_add_cipher(EVP_aes_256_cfb1());
 | 
			
		||||
	EVP_add_cipher(EVP_aes_256_cfb8());
 | 
			
		||||
	EVP_add_cipher(EVP_aes_256_ofb());
 | 
			
		||||
#if 0
 | 
			
		||||
	EVP_add_cipher(EVP_aes_256_ctr());
 | 
			
		||||
 
 | 
			
		||||
@@ -84,17 +84,35 @@ IMPLEMENT_BLOCK_CIPHER(aes_256, ks, AES, EVP_AES_KEY,
 | 
			
		||||
		       EVP_CIPHER_get_asn1_iv,
 | 
			
		||||
		       NULL)
 | 
			
		||||
 | 
			
		||||
#define IMPLEMENT_AES_CFBR(ksize,cbits)	IMPLEMENT_CFBR(aes,AES,EVP_AES_KEY,ks,ksize,cbits,16)
 | 
			
		||||
 | 
			
		||||
IMPLEMENT_AES_CFBR(128,1)
 | 
			
		||||
IMPLEMENT_AES_CFBR(192,1)
 | 
			
		||||
IMPLEMENT_AES_CFBR(256,1)
 | 
			
		||||
 | 
			
		||||
IMPLEMENT_AES_CFBR(128,8)
 | 
			
		||||
IMPLEMENT_AES_CFBR(192,8)
 | 
			
		||||
IMPLEMENT_AES_CFBR(256,8)
 | 
			
		||||
 | 
			
		||||
static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
 | 
			
		||||
		   const unsigned char *iv, int enc) {
 | 
			
		||||
		   const unsigned char *iv, int enc)
 | 
			
		||||
	{
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
	if ((ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_CFB_MODE
 | 
			
		||||
	    || (ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_OFB_MODE
 | 
			
		||||
	    || enc) 
 | 
			
		||||
		AES_set_encrypt_key(key, ctx->key_len * 8, ctx->cipher_data);
 | 
			
		||||
		ret=AES_set_encrypt_key(key, ctx->key_len * 8, ctx->cipher_data);
 | 
			
		||||
	else
 | 
			
		||||
		AES_set_decrypt_key(key, ctx->key_len * 8, ctx->cipher_data);
 | 
			
		||||
		ret=AES_set_decrypt_key(key, ctx->key_len * 8, ctx->cipher_data);
 | 
			
		||||
 | 
			
		||||
	if(ret < 0)
 | 
			
		||||
		{
 | 
			
		||||
		EVPerr(EVP_F_AES_INIT_KEY,EVP_R_AES_KEY_SETUP_FAILED);
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -56,9 +56,9 @@
 | 
			
		||||
 * [including the GNU Public Licence.]
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_DES
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "cryptlib.h"
 | 
			
		||||
#ifndef OPENSSL_NO_DES
 | 
			
		||||
#include <openssl/evp.h>
 | 
			
		||||
#include <openssl/objects.h>
 | 
			
		||||
#include "evp_locl.h"
 | 
			
		||||
@@ -92,20 +92,53 @@ static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
			  const unsigned char *in, unsigned int inl)
 | 
			
		||||
static int des_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
			    const unsigned char *in, unsigned int inl)
 | 
			
		||||
{
 | 
			
		||||
	DES_cfb64_encrypt(in, out, (long)inl, ctx->cipher_data,
 | 
			
		||||
			  (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt);
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Although we have a CFB-r implementation for DES, it doesn't pack the right
 | 
			
		||||
   way, so wrap it here */
 | 
			
		||||
static int des_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
			   const unsigned char *in, unsigned int inl)
 | 
			
		||||
    {
 | 
			
		||||
    unsigned int n;
 | 
			
		||||
    unsigned char c[1],d[1];
 | 
			
		||||
 | 
			
		||||
    for(n=0 ; n < inl ; ++n)
 | 
			
		||||
	{
 | 
			
		||||
	c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0;
 | 
			
		||||
	DES_cfb_encrypt(c,d,1,1,ctx->cipher_data,(DES_cblock *)ctx->iv,
 | 
			
		||||
			ctx->encrypt);
 | 
			
		||||
	out[n/8]=(out[n/8]&~(0x80 >> (n%8)))|((d[0]&0x80) >> (n%8));
 | 
			
		||||
	}
 | 
			
		||||
    return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
static int des_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
			   const unsigned char *in, unsigned int inl)
 | 
			
		||||
    {
 | 
			
		||||
    DES_cfb_encrypt(in,out,8,inl,ctx->cipher_data,(DES_cblock *)ctx->iv,
 | 
			
		||||
		    ctx->encrypt);
 | 
			
		||||
    return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
BLOCK_CIPHER_defs(des, DES_key_schedule, NID_des, 8, 8, 8, 64,
 | 
			
		||||
			0, des_init_key, NULL,
 | 
			
		||||
			EVP_CIPHER_set_asn1_iv,
 | 
			
		||||
			EVP_CIPHER_get_asn1_iv,
 | 
			
		||||
			NULL)
 | 
			
		||||
 | 
			
		||||
BLOCK_CIPHER_def_cfb(des,DES_key_schedule,NID_des,8,8,1,0,des_init_key,NULL,
 | 
			
		||||
		     EVP_CIPHER_set_asn1_iv,
 | 
			
		||||
		     EVP_CIPHER_get_asn1_iv,NULL)
 | 
			
		||||
 | 
			
		||||
BLOCK_CIPHER_def_cfb(des,DES_key_schedule,NID_des,8,8,8,0,des_init_key,NULL,
 | 
			
		||||
		     EVP_CIPHER_set_asn1_iv,
 | 
			
		||||
		     EVP_CIPHER_get_asn1_iv,NULL)
 | 
			
		||||
 | 
			
		||||
static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
 | 
			
		||||
			const unsigned char *iv, int enc)
 | 
			
		||||
 
 | 
			
		||||
@@ -56,9 +56,9 @@
 | 
			
		||||
 * [including the GNU Public Licence.]
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_DES
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "cryptlib.h"
 | 
			
		||||
#ifndef OPENSSL_NO_DES
 | 
			
		||||
#include <openssl/evp.h>
 | 
			
		||||
#include <openssl/objects.h>
 | 
			
		||||
#include "evp_locl.h"
 | 
			
		||||
@@ -85,7 +85,7 @@ static int des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
			      const unsigned char *in, unsigned int inl)
 | 
			
		||||
{
 | 
			
		||||
	BLOCK_CIPHER_ecb_loop()
 | 
			
		||||
		DES_ecb3_encrypt((DES_cblock *)(in + i), (DES_cblock *)(out + i), 
 | 
			
		||||
		DES_ecb3_encrypt(in + i,out + i, 
 | 
			
		||||
				 &data(ctx)->ks1, &data(ctx)->ks2,
 | 
			
		||||
				 &data(ctx)->ks3,
 | 
			
		||||
				 ctx->encrypt);
 | 
			
		||||
@@ -121,7 +121,7 @@ static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
static int des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
			      const unsigned char *in, unsigned int inl)
 | 
			
		||||
{
 | 
			
		||||
	DES_ede3_cfb64_encrypt(in, out, (long)inl, 
 | 
			
		||||
@@ -130,13 +130,42 @@ static int des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Although we have a CFB-r implementation for 3-DES, it doesn't pack the right
 | 
			
		||||
   way, so wrap it here */
 | 
			
		||||
static int des_ede3_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
				const unsigned char *in, unsigned int inl)
 | 
			
		||||
    {
 | 
			
		||||
    unsigned int n;
 | 
			
		||||
    unsigned char c[1],d[1];
 | 
			
		||||
 | 
			
		||||
    for(n=0 ; n < inl ; ++n)
 | 
			
		||||
	{
 | 
			
		||||
	c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0;
 | 
			
		||||
	DES_ede3_cfb_encrypt(c,d,1,1,
 | 
			
		||||
			     &data(ctx)->ks1,&data(ctx)->ks2,&data(ctx)->ks3,
 | 
			
		||||
			     (DES_cblock *)ctx->iv,ctx->encrypt);
 | 
			
		||||
	out[n/8]=(out[n/8]&~(0x80 >> (n%8)))|((d[0]&0x80) >> (n%8));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
static int des_ede3_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
				const unsigned char *in, unsigned int inl)
 | 
			
		||||
    {
 | 
			
		||||
    DES_ede3_cfb_encrypt(in,out,8,inl,
 | 
			
		||||
			 &data(ctx)->ks1,&data(ctx)->ks2,&data(ctx)->ks3,
 | 
			
		||||
			 (DES_cblock *)ctx->iv,ctx->encrypt);
 | 
			
		||||
    return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
BLOCK_CIPHER_defs(des_ede, DES_EDE_KEY, NID_des_ede, 8, 16, 8, 64,
 | 
			
		||||
			0, des_ede_init_key, NULL, 
 | 
			
		||||
			EVP_CIPHER_set_asn1_iv,
 | 
			
		||||
			EVP_CIPHER_get_asn1_iv,
 | 
			
		||||
			NULL)
 | 
			
		||||
 | 
			
		||||
#define des_ede3_cfb_cipher des_ede_cfb_cipher
 | 
			
		||||
#define des_ede3_cfb64_cipher des_ede_cfb64_cipher
 | 
			
		||||
#define des_ede3_ofb_cipher des_ede_ofb_cipher
 | 
			
		||||
#define des_ede3_cbc_cipher des_ede_cbc_cipher
 | 
			
		||||
#define des_ede3_ecb_cipher des_ede_ecb_cipher
 | 
			
		||||
@@ -147,6 +176,16 @@ BLOCK_CIPHER_defs(des_ede3, DES_EDE_KEY, NID_des_ede3, 8, 24, 8, 64,
 | 
			
		||||
			EVP_CIPHER_get_asn1_iv,
 | 
			
		||||
			NULL)
 | 
			
		||||
 | 
			
		||||
BLOCK_CIPHER_def_cfb(des_ede3,DES_EDE_KEY,NID_des_ede3,24,8,1,0,
 | 
			
		||||
		     des_ede3_init_key,NULL,
 | 
			
		||||
		     EVP_CIPHER_set_asn1_iv,
 | 
			
		||||
		     EVP_CIPHER_get_asn1_iv,NULL)
 | 
			
		||||
 | 
			
		||||
BLOCK_CIPHER_def_cfb(des_ede3,DES_EDE_KEY,NID_des_ede3,24,8,8,0,
 | 
			
		||||
		     des_ede3_init_key,NULL,
 | 
			
		||||
		     EVP_CIPHER_set_asn1_iv,
 | 
			
		||||
		     EVP_CIPHER_get_asn1_iv,NULL)
 | 
			
		||||
 | 
			
		||||
static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
 | 
			
		||||
			    const unsigned char *iv, int enc)
 | 
			
		||||
	{
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										108
									
								
								crypto/evp/e_old.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										108
									
								
								crypto/evp/e_old.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,108 @@
 | 
			
		||||
/* crypto/evp/e_old.c -*- mode:C; c-file-style: "eay" -*- */
 | 
			
		||||
/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
 | 
			
		||||
 * project 2004.
 | 
			
		||||
 */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 2004 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 *
 | 
			
		||||
 * 1. Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer. 
 | 
			
		||||
 *
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in
 | 
			
		||||
 *    the documentation and/or other materials provided with the
 | 
			
		||||
 *    distribution.
 | 
			
		||||
 *
 | 
			
		||||
 * 3. All advertising materials mentioning features or use of this
 | 
			
		||||
 *    software must display the following acknowledgment:
 | 
			
		||||
 *    "This product includes software developed by the OpenSSL Project
 | 
			
		||||
 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
			
		||||
 *
 | 
			
		||||
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
			
		||||
 *    endorse or promote products derived from this software without
 | 
			
		||||
 *    prior written permission. For written permission, please contact
 | 
			
		||||
 *    openssl-core@openssl.org.
 | 
			
		||||
 *
 | 
			
		||||
 * 5. Products derived from this software may not be called "OpenSSL"
 | 
			
		||||
 *    nor may "OpenSSL" appear in their names without prior written
 | 
			
		||||
 *    permission of the OpenSSL Project.
 | 
			
		||||
 *
 | 
			
		||||
 * 6. Redistributions of any form whatsoever must retain the following
 | 
			
		||||
 *    acknowledgment:
 | 
			
		||||
 *    "This product includes software developed by the OpenSSL Project
 | 
			
		||||
 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
			
		||||
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
			
		||||
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
			
		||||
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
			
		||||
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
			
		||||
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
			
		||||
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
			
		||||
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
			
		||||
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
			
		||||
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
			
		||||
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
			
		||||
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 * ====================================================================
 | 
			
		||||
 *
 | 
			
		||||
 * This product includes cryptographic software written by Eric Young
 | 
			
		||||
 * (eay@cryptsoft.com).  This product includes software written by Tim
 | 
			
		||||
 * Hudson (tjh@cryptsoft.com).
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <openssl/evp.h>
 | 
			
		||||
 | 
			
		||||
/* Define some deprecated functions, so older programs
 | 
			
		||||
   don't crash and burn too quickly.  On Windows and VMS,
 | 
			
		||||
   these will never be used, since functions and variables
 | 
			
		||||
   in shared libraries are selected by entry point location,
 | 
			
		||||
   not by name.  */
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_BF
 | 
			
		||||
#undef EVP_bf_cfb
 | 
			
		||||
const EVP_CIPHER *EVP_bf_cfb(void) { return EVP_bf_cfb64(); }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_DES
 | 
			
		||||
#undef EVP_des_cfb
 | 
			
		||||
const EVP_CIPHER *EVP_des_cfb(void) { return EVP_des_cfb64(); }
 | 
			
		||||
#undef EVP_des_ede3_cfb
 | 
			
		||||
const EVP_CIPHER *EVP_des_ede3_cfb(void) { return EVP_des_ede3_cfb64(); }
 | 
			
		||||
#undef EVP_des_ede_cfb
 | 
			
		||||
const EVP_CIPHER *EVP_des_ede_cfb(void) { return EVP_des_ede_cfb64(); }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_IDEA
 | 
			
		||||
#undef EVP_idea_cfb
 | 
			
		||||
const EVP_CIPHER *EVP_idea_cfb(void) { return EVP_idea_cfb64(); }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_RC2
 | 
			
		||||
#undef EVP_rc2_cfb
 | 
			
		||||
const EVP_CIPHER *EVP_rc2_cfb(void) { return EVP_rc2_cfb64(); }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_CAST5
 | 
			
		||||
#undef EVP_cast5_cfb
 | 
			
		||||
const EVP_CIPHER *EVP_cast5_cfb(void) { return EVP_cast5_cfb64(); }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_RC5
 | 
			
		||||
#undef EVP_rc5_32_12_16_cfb
 | 
			
		||||
const EVP_CIPHER *EVP_rc5_32_12_16_cfb(void) { return EVP_rc5_32_12_16_cfb64(); }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_AES
 | 
			
		||||
#undef EVP_aes_128_cfb
 | 
			
		||||
const EVP_CIPHER *EVP_aes_128_cfb(void) { return EVP_aes_128_cfb128(); }
 | 
			
		||||
#undef EVP_aes_192_cfb
 | 
			
		||||
const EVP_CIPHER *EVP_aes_192_cfb(void) { return EVP_aes_192_cfb128(); }
 | 
			
		||||
#undef EVP_aes_256_cfb
 | 
			
		||||
const EVP_CIPHER *EVP_aes_256_cfb(void) { return EVP_aes_256_cfb128(); }
 | 
			
		||||
#endif
 | 
			
		||||
@@ -499,6 +499,7 @@ void BIO_set_md(BIO *,const EVP_MD *md);
 | 
			
		||||
#endif
 | 
			
		||||
#define BIO_get_md(b,mdp)		BIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp)
 | 
			
		||||
#define BIO_get_md_ctx(b,mdcp)     BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(char *)mdcp)
 | 
			
		||||
#define BIO_set_md_ctx(b,mdcp)     BIO_ctrl(b,BIO_C_SET_MD_CTX,0,(char *)mdcp)
 | 
			
		||||
#define BIO_get_cipher_status(b)	BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL)
 | 
			
		||||
#define BIO_get_cipher_ctx(b,c_pp)	BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp)
 | 
			
		||||
 | 
			
		||||
@@ -640,9 +641,20 @@ const EVP_CIPHER *EVP_des_ede(void);
 | 
			
		||||
const EVP_CIPHER *EVP_des_ede3(void);
 | 
			
		||||
const EVP_CIPHER *EVP_des_ede_ecb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_des_ede3_ecb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_des_cfb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_des_ede_cfb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_des_ede3_cfb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_des_cfb64(void);
 | 
			
		||||
# define EVP_des_cfb EVP_des_cfb64
 | 
			
		||||
const EVP_CIPHER *EVP_des_cfb1(void);
 | 
			
		||||
const EVP_CIPHER *EVP_des_cfb8(void);
 | 
			
		||||
const EVP_CIPHER *EVP_des_ede_cfb64(void);
 | 
			
		||||
# define EVP_des_ede_cfb EVP_des_ede_cfb64
 | 
			
		||||
#if 0
 | 
			
		||||
const EVP_CIPHER *EVP_des_ede_cfb1(void);
 | 
			
		||||
const EVP_CIPHER *EVP_des_ede_cfb8(void);
 | 
			
		||||
#endif
 | 
			
		||||
const EVP_CIPHER *EVP_des_ede3_cfb64(void);
 | 
			
		||||
# define EVP_des_ede3_cfb EVP_des_ede3_cfb64
 | 
			
		||||
const EVP_CIPHER *EVP_des_ede3_cfb1(void);
 | 
			
		||||
const EVP_CIPHER *EVP_des_ede3_cfb8(void);
 | 
			
		||||
const EVP_CIPHER *EVP_des_ofb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_des_ede_ofb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_des_ede3_ofb(void);
 | 
			
		||||
@@ -666,7 +678,8 @@ const EVP_CIPHER *EVP_rc4_40(void);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_IDEA
 | 
			
		||||
const EVP_CIPHER *EVP_idea_ecb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_idea_cfb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_idea_cfb64(void);
 | 
			
		||||
# define EVP_idea_cfb EVP_idea_cfb64
 | 
			
		||||
const EVP_CIPHER *EVP_idea_ofb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_idea_cbc(void);
 | 
			
		||||
#endif
 | 
			
		||||
@@ -675,45 +688,58 @@ const EVP_CIPHER *EVP_rc2_ecb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_rc2_cbc(void);
 | 
			
		||||
const EVP_CIPHER *EVP_rc2_40_cbc(void);
 | 
			
		||||
const EVP_CIPHER *EVP_rc2_64_cbc(void);
 | 
			
		||||
const EVP_CIPHER *EVP_rc2_cfb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_rc2_cfb64(void);
 | 
			
		||||
# define EVP_rc2_cfb EVP_rc2_cfb64
 | 
			
		||||
const EVP_CIPHER *EVP_rc2_ofb(void);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_BF
 | 
			
		||||
const EVP_CIPHER *EVP_bf_ecb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_bf_cbc(void);
 | 
			
		||||
const EVP_CIPHER *EVP_bf_cfb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_bf_cfb64(void);
 | 
			
		||||
# define EVP_bf_cfb EVP_bf_cfb64
 | 
			
		||||
const EVP_CIPHER *EVP_bf_ofb(void);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_CAST
 | 
			
		||||
const EVP_CIPHER *EVP_cast5_ecb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_cast5_cbc(void);
 | 
			
		||||
const EVP_CIPHER *EVP_cast5_cfb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_cast5_cfb64(void);
 | 
			
		||||
# define EVP_cast5_cfb EVP_cast5_cfb64
 | 
			
		||||
const EVP_CIPHER *EVP_cast5_ofb(void);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_RC5
 | 
			
		||||
const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void);
 | 
			
		||||
const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_rc5_32_12_16_cfb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void);
 | 
			
		||||
# define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64
 | 
			
		||||
const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_AES
 | 
			
		||||
const EVP_CIPHER *EVP_aes_128_ecb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_128_cbc(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_128_cfb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_128_cfb1(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_128_cfb8(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_128_cfb128(void);
 | 
			
		||||
# define EVP_aes_128_cfb EVP_aes_128_cfb128
 | 
			
		||||
const EVP_CIPHER *EVP_aes_128_ofb(void);
 | 
			
		||||
#if 0
 | 
			
		||||
const EVP_CIPHER *EVP_aes_128_ctr(void);
 | 
			
		||||
#endif
 | 
			
		||||
const EVP_CIPHER *EVP_aes_192_ecb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_192_cbc(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_192_cfb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_192_cfb1(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_192_cfb8(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_192_cfb128(void);
 | 
			
		||||
# define EVP_aes_192_cfb EVP_aes_192_cfb128
 | 
			
		||||
const EVP_CIPHER *EVP_aes_192_ofb(void);
 | 
			
		||||
#if 0
 | 
			
		||||
const EVP_CIPHER *EVP_aes_192_ctr(void);
 | 
			
		||||
#endif
 | 
			
		||||
const EVP_CIPHER *EVP_aes_256_ecb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_256_cbc(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_256_cfb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_256_cfb1(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_256_cfb8(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_256_cfb128(void);
 | 
			
		||||
# define EVP_aes_256_cfb EVP_aes_256_cfb128
 | 
			
		||||
const EVP_CIPHER *EVP_aes_256_ofb(void);
 | 
			
		||||
#if 0
 | 
			
		||||
const EVP_CIPHER *EVP_aes_256_ctr(void);
 | 
			
		||||
@@ -825,6 +851,7 @@ void ERR_load_EVP_strings(void);
 | 
			
		||||
/* Error codes for the EVP functions. */
 | 
			
		||||
 | 
			
		||||
/* Function codes. */
 | 
			
		||||
#define EVP_F_AES_INIT_KEY				 129
 | 
			
		||||
#define EVP_F_D2I_PKEY					 100
 | 
			
		||||
#define EVP_F_EVP_CIPHERINIT				 123
 | 
			
		||||
#define EVP_F_EVP_CIPHER_CTX_CTRL			 124
 | 
			
		||||
@@ -855,6 +882,7 @@ void ERR_load_EVP_strings(void);
 | 
			
		||||
#define EVP_F_RC5_CTRL					 125
 | 
			
		||||
 | 
			
		||||
/* Reason codes. */
 | 
			
		||||
#define EVP_R_AES_KEY_SETUP_FAILED			 140
 | 
			
		||||
#define EVP_R_BAD_BLOCK_LENGTH				 136
 | 
			
		||||
#define EVP_R_BAD_DECRYPT				 100
 | 
			
		||||
#define EVP_R_BAD_KEY_LENGTH				 137
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/* crypto/evp/evp_err.c */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 * Copyright (c) 1999-2002 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
@@ -66,6 +66,7 @@
 | 
			
		||||
#ifndef OPENSSL_NO_ERR
 | 
			
		||||
static ERR_STRING_DATA EVP_str_functs[]=
 | 
			
		||||
	{
 | 
			
		||||
{ERR_PACK(0,EVP_F_AES_INIT_KEY,0),	"AES_INIT_KEY"},
 | 
			
		||||
{ERR_PACK(0,EVP_F_D2I_PKEY,0),	"D2I_PKEY"},
 | 
			
		||||
{ERR_PACK(0,EVP_F_EVP_CIPHERINIT,0),	"EVP_CipherInit"},
 | 
			
		||||
{ERR_PACK(0,EVP_F_EVP_CIPHER_CTX_CTRL,0),	"EVP_CIPHER_CTX_ctrl"},
 | 
			
		||||
@@ -99,6 +100,7 @@ static ERR_STRING_DATA EVP_str_functs[]=
 | 
			
		||||
 | 
			
		||||
static ERR_STRING_DATA EVP_str_reasons[]=
 | 
			
		||||
	{
 | 
			
		||||
{EVP_R_AES_KEY_SETUP_FAILED              ,"aes key setup failed"},
 | 
			
		||||
{EVP_R_BAD_BLOCK_LENGTH                  ,"bad block length"},
 | 
			
		||||
{EVP_R_BAD_DECRYPT                       ,"bad decrypt"},
 | 
			
		||||
{EVP_R_BAD_KEY_LENGTH                    ,"bad key length"},
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user