Compare commits
	
		
			110 Commits
		
	
	
		
			OpenSSL_1_
			...
			OpenSSL_1_
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					6545372c24 | ||
| 
						 | 
					17f8412983 | ||
| 
						 | 
					d48df9a91b | ||
| 
						 | 
					65448fd0d3 | ||
| 
						 | 
					a677c87b7b | ||
| 
						 | 
					f8a123b4a2 | ||
| 
						 | 
					c64beae686 | ||
| 
						 | 
					99ef8323e4 | ||
| 
						 | 
					2668c58969 | ||
| 
						 | 
					5ae3168a77 | ||
| 
						 | 
					559579659c | ||
| 
						 | 
					2dd74160cc | ||
| 
						 | 
					2adf63272c | ||
| 
						 | 
					fb5a0fb8f1 | ||
| 
						 | 
					c222de16ce | ||
| 
						 | 
					19091ac236 | ||
| 
						 | 
					2fcf251d3d | ||
| 
						 | 
					dab5848cd9 | ||
| 
						 | 
					a02f0f3d69 | ||
| 
						 | 
					e69d49364e | ||
| 
						 | 
					38921f0abf | ||
| 
						 | 
					d76ce84c92 | ||
| 
						 | 
					c3c7a0d26e | ||
| 
						 | 
					d06bc800f2 | ||
| 
						 | 
					a01dc637bd | ||
| 
						 | 
					3bbbe757ea | ||
| 
						 | 
					76474e519f | ||
| 
						 | 
					420f572d49 | ||
| 
						 | 
					6d65d44b95 | ||
| 
						 | 
					91e1ff77a0 | ||
| 
						 | 
					c8e60ec8fa | ||
| 
						 | 
					e840570207 | ||
| 
						 | 
					077527f19e | ||
| 
						 | 
					00daa2e6c6 | ||
| 
						 | 
					000f221d60 | ||
| 
						 | 
					579a605494 | ||
| 
						 | 
					fa29ebd7ed | ||
| 
						 | 
					3360999046 | ||
| 
						 | 
					0b965e59cb | ||
| 
						 | 
					1684846f54 | ||
| 
						 | 
					dde6d9520c | ||
| 
						 | 
					f9a772b743 | ||
| 
						 | 
					0d6f7dbb50 | ||
| 
						 | 
					994a1ea900 | ||
| 
						 | 
					e5d1fd38d1 | ||
| 
						 | 
					a330ed26be | ||
| 
						 | 
					ca0a86c89d | ||
| 
						 | 
					1cf7bbce48 | ||
| 
						 | 
					4cdde22432 | ||
| 
						 | 
					a28cee6efe | ||
| 
						 | 
					1977bafba4 | ||
| 
						 | 
					3c96907f2b | ||
| 
						 | 
					2d96a30dc7 | ||
| 
						 | 
					c09d1df7d3 | ||
| 
						 | 
					c20dd45477 | ||
| 
						 | 
					abb320463d | ||
| 
						 | 
					ada3f8b5d3 | ||
| 
						 | 
					6172561597 | ||
| 
						 | 
					368b64d6dd | ||
| 
						 | 
					4ed0ca2b3e | ||
| 
						 | 
					a92f98c630 | ||
| 
						 | 
					4385b556b4 | ||
| 
						 | 
					5e7c9519b8 | ||
| 
						 | 
					ef02492908 | ||
| 
						 | 
					86d5f9ba4f | ||
| 
						 | 
					febcec6254 | ||
| 
						 | 
					f07cb1ce8e | ||
| 
						 | 
					b3c17a4805 | ||
| 
						 | 
					7b83fe34c0 | ||
| 
						 | 
					e0b1c57ae0 | ||
| 
						 | 
					6806b06d21 | ||
| 
						 | 
					0af0e9d747 | ||
| 
						 | 
					2191b3ba44 | ||
| 
						 | 
					73020a945b | ||
| 
						 | 
					9c2d0cd11c | ||
| 
						 | 
					0ef9b9c7bf | ||
| 
						 | 
					c14c6e996d | ||
| 
						 | 
					51381cd4ed | ||
| 
						 | 
					8c9ab050e5 | ||
| 
						 | 
					b6996c7849 | ||
| 
						 | 
					2c23b0716e | ||
| 
						 | 
					f548a0e4d5 | ||
| 
						 | 
					a404f63f92 | ||
| 
						 | 
					b54f50d277 | ||
| 
						 | 
					10ba241909 | ||
| 
						 | 
					1f238b1c4a | ||
| 
						 | 
					ef85bf8c2b | ||
| 
						 | 
					cbfccdb729 | ||
| 
						 | 
					94111aa401 | ||
| 
						 | 
					eec48070a1 | ||
| 
						 | 
					eebe668174 | ||
| 
						 | 
					8a15a4a7b4 | ||
| 
						 | 
					19057003f1 | ||
| 
						 | 
					031648d4ce | ||
| 
						 | 
					02bee340a2 | ||
| 
						 | 
					f6f2f68a05 | ||
| 
						 | 
					982d68a0c0 | ||
| 
						 | 
					7585a86a76 | ||
| 
						 | 
					73190f1b46 | ||
| 
						 | 
					6673ac592a | ||
| 
						 | 
					59aa655b53 | ||
| 
						 | 
					c4c99b4961 | ||
| 
						 | 
					ccbbcddd5f | ||
| 
						 | 
					65d82478d8 | ||
| 
						 | 
					02a6518a02 | ||
| 
						 | 
					a79053511b | ||
| 
						 | 
					eb56eb2279 | ||
| 
						 | 
					d40f6d4a02 | ||
| 
						 | 
					943ae0951a | ||
| 
						 | 
					999eeaba14 | 
							
								
								
									
										25
									
								
								ACKNOWLEDGMENTS
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								ACKNOWLEDGMENTS
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
The OpenSSL project depends on volunteer efforts and financial support from
 | 
			
		||||
the end user community. That support comes in the form of donations and paid
 | 
			
		||||
sponsorships, software support contracts, paid consulting services
 | 
			
		||||
and commissioned software development.
 | 
			
		||||
 | 
			
		||||
Since all these activities support the continued development and improvement
 | 
			
		||||
of OpenSSL we consider all these clients and customers as sponsors of the
 | 
			
		||||
OpenSSL project.
 | 
			
		||||
 | 
			
		||||
We would like to identify and thank the following such sponsors for their past
 | 
			
		||||
or current significant support of the OpenSSL project:
 | 
			
		||||
 | 
			
		||||
Very significant support:
 | 
			
		||||
 | 
			
		||||
	OpenGear: www.opengear.com
 | 
			
		||||
 | 
			
		||||
Significant support:
 | 
			
		||||
 | 
			
		||||
	PSW Group: www.psw.net
 | 
			
		||||
 | 
			
		||||
Please note that we ask permission to identify sponsors and that some sponsors
 | 
			
		||||
we consider eligible for inclusion here have requested to remain anonymous.
 | 
			
		||||
 | 
			
		||||
Additional sponsorship or financial support is always welcome: for more
 | 
			
		||||
information please contact the OpenSSL Software Foundation.
 | 
			
		||||
							
								
								
									
										95
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										95
									
								
								CHANGES
									
									
									
									
									
								
							@@ -2,9 +2,38 @@
 | 
			
		||||
 OpenSSL CHANGES
 | 
			
		||||
 _______________
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.0a and 1.0.0b  [xx XXX xxxx]
 | 
			
		||||
 Changes between 1.0.0c and 1.0.0d [8 Feb 2011]
 | 
			
		||||
 | 
			
		||||
  *)
 | 
			
		||||
  *) Fix parsing of OCSP stapling ClientHello extension. CVE-2011-0014
 | 
			
		||||
     [Neel Mehta, Adam Langley, Bodo Moeller (Google)]
 | 
			
		||||
 | 
			
		||||
  *) Fix bug in string printing code: if *any* escaping is enabled we must
 | 
			
		||||
     escape the escape character (backslash) or the resulting string is
 | 
			
		||||
     ambiguous.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.0b and 1.0.0c  [2 Dec 2010]
 | 
			
		||||
 | 
			
		||||
  *) Disable code workaround for ancient and obsolete Netscape browsers
 | 
			
		||||
     and servers: an attacker can use it in a ciphersuite downgrade attack.
 | 
			
		||||
     Thanks to Martin Rex for discovering this bug. CVE-2010-4180
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Fixed J-PAKE implementation error, originally discovered by
 | 
			
		||||
     Sebastien Martini, further info and confirmation from Stefan
 | 
			
		||||
     Arentz and Feng Hao. Note that this fix is a security fix. CVE-2010-4252
 | 
			
		||||
     [Ben Laurie]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.0a and 1.0.0b  [16 Nov 2010]
 | 
			
		||||
 | 
			
		||||
  *) Fix extension code to avoid race conditions which can result in a buffer
 | 
			
		||||
     overrun vulnerability: resumed sessions must not be modified as they can
 | 
			
		||||
     be shared by multiple threads. CVE-2010-3864
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Fix WIN32 build system to correctly link an ENGINE directory into
 | 
			
		||||
     a DLL. 
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.0 and 1.0.0a  [01 Jun 2010]
 | 
			
		||||
 | 
			
		||||
@@ -853,7 +882,57 @@
 | 
			
		||||
  *) Change 'Configure' script to enable Camellia by default.
 | 
			
		||||
     [NTT]
 | 
			
		||||
  
 | 
			
		||||
 Changes between 0.9.8n and 0.9.8o [xx XXX xxxx]
 | 
			
		||||
 Changes between 0.9.8q and 0.9.8r [8 Feb 2011]
 | 
			
		||||
 | 
			
		||||
  *) Fix parsing of OCSP stapling ClientHello extension.  CVE-2011-0014
 | 
			
		||||
     [Neel Mehta, Adam Langley, Bodo Moeller (Google)]
 | 
			
		||||
 | 
			
		||||
  *) Fix bug in string printing code: if *any* escaping is enabled we must
 | 
			
		||||
     escape the escape character (backslash) or the resulting string is
 | 
			
		||||
     ambiguous.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8p and 0.9.8q [2 Dec 2010]
 | 
			
		||||
 | 
			
		||||
  *) Disable code workaround for ancient and obsolete Netscape browsers
 | 
			
		||||
     and servers: an attacker can use it in a ciphersuite downgrade attack.
 | 
			
		||||
     Thanks to Martin Rex for discovering this bug. CVE-2010-4180
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Fixed J-PAKE implementation error, originally discovered by
 | 
			
		||||
     Sebastien Martini, further info and confirmation from Stefan
 | 
			
		||||
     Arentz and Feng Hao. Note that this fix is a security fix. CVE-2010-4252
 | 
			
		||||
     [Ben Laurie]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8o and 0.9.8p [16 Nov 2010]
 | 
			
		||||
 | 
			
		||||
  *) Fix extension code to avoid race conditions which can result in a buffer
 | 
			
		||||
     overrun vulnerability: resumed sessions must not be modified as they can
 | 
			
		||||
     be shared by multiple threads. CVE-2010-3864
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Fix for double free bug in ssl/s3_clnt.c CVE-2010-2939
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Don't reencode certificate when calculating signature: cache and use
 | 
			
		||||
     the original encoding instead. This makes signature verification of
 | 
			
		||||
     some broken encodings work correctly.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) ec2_GF2m_simple_mul bugfix: compute correct result if the output EC_POINT
 | 
			
		||||
     is also one of the inputs.
 | 
			
		||||
     [Emilia K<>sper <emilia.kasper@esat.kuleuven.be> (Google)]
 | 
			
		||||
 | 
			
		||||
  *) Don't repeatedly append PBE algorithms to table if they already exist.
 | 
			
		||||
     Sort table on each new add. This effectively makes the table read only
 | 
			
		||||
     after all algorithms are added and subsequent calls to PKCS12_pbe_add
 | 
			
		||||
     etc are non-op.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8n and 0.9.8o [01 Jun 2010]
 | 
			
		||||
 | 
			
		||||
  [NB: OpenSSL 0.9.8o and later 0.9.8 patch levels were released after
 | 
			
		||||
  OpenSSL 1.0.0.]
 | 
			
		||||
 | 
			
		||||
  *) Correct a typo in the CMS ASN1 module which can result in invalid memory
 | 
			
		||||
     access or freeing data twice (CVE-2010-0742)
 | 
			
		||||
@@ -864,6 +943,12 @@
 | 
			
		||||
     SSL_library_init and not OpenSSL_add_all_algorithms() will fail.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) VMS fixes: 
 | 
			
		||||
     Reduce copying into .apps and .test in makevms.com
 | 
			
		||||
     Don't try to use blank CA certificate in CA.com
 | 
			
		||||
     Allow use of C files from original directories in maketests.com
 | 
			
		||||
     [Steven M. Schweda" <sms@antinode.info>]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8m and 0.9.8n [24 Mar 2010]
 | 
			
		||||
 | 
			
		||||
  *) When rejecting SSL/TLS records due to an incorrect version number, never
 | 
			
		||||
@@ -872,8 +957,8 @@
 | 
			
		||||
     - OpenSSL 0.9.8f if 'short' is longer than 16 bits,
 | 
			
		||||
     the previous behavior could result in a read attempt at NULL when
 | 
			
		||||
     receiving specific incorrect SSL/TLS records once record payload
 | 
			
		||||
     protection is active.  (CVE-2010-####)
 | 
			
		||||
     [Bodo Moeller, Adam Langley]
 | 
			
		||||
     protection is active.  (CVE-2010-0740)
 | 
			
		||||
     [Bodo Moeller, Adam Langley <agl@chromium.org>]
 | 
			
		||||
 | 
			
		||||
  *) Fix for CVE-2010-0433 where some kerberos enabled versions of OpenSSL 
 | 
			
		||||
     could be crashed if the relevant tables were not present (e.g. chrooted).
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								Configure
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								Configure
									
									
									
									
									
								
							@@ -492,6 +492,8 @@ my %table=(
 | 
			
		||||
# Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64
 | 
			
		||||
"VC-WIN64I","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:ia64cpuid.o:ia64.o::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o:::::::ias:win32",
 | 
			
		||||
"VC-WIN64A","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:x86_64cpuid.o:bn_asm.o x86_64-mont.o::aes-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o::rc4-x86_64.o:::wp-x86_64.o:cmll-x86_64.o cmll_misc.o:auto:win32",
 | 
			
		||||
"debug-VC-WIN64I","cl:-W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:ia64cpuid.o:ia64.o::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o:::::::ias:win32",
 | 
			
		||||
"debug-VC-WIN64A","cl:-W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:x86_64cpuid.o:bn_asm.o x86_64-mont.o::aes-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o::rc4-x86_64.o:::wp-x86_64.o:cmll-x86_64.o cmll_misc.o:auto:win32",
 | 
			
		||||
# x86 Win32 target defaults to ANSI API, if you want UNICODE, complement
 | 
			
		||||
# 'perl Configure VC-WIN32' with '-DUNICODE -D_UNICODE'
 | 
			
		||||
"VC-WIN32","cl:-W3 -WX -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32",
 | 
			
		||||
@@ -583,6 +585,7 @@ my %table=(
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
my @MK1MF_Builds=qw(VC-WIN64I VC-WIN64A
 | 
			
		||||
		    debug-VC-WIN64I debug-VC-WIN64A
 | 
			
		||||
		    VC-NT VC-CE VC-WIN32 debug-VC-WIN32
 | 
			
		||||
		    BC-32 
 | 
			
		||||
		    netware-clib netware-clib-bsdsock
 | 
			
		||||
@@ -1093,6 +1096,12 @@ my $ar = $ENV{'AR'} || "ar";
 | 
			
		||||
my $arflags = $fields[$idx_arflags];
 | 
			
		||||
my $multilib = $fields[$idx_multilib];
 | 
			
		||||
 | 
			
		||||
# if $prefix/lib$multilib is not an existing directory, then
 | 
			
		||||
# assume that it's not searched by linker automatically, in
 | 
			
		||||
# which case adding $multilib suffix causes more grief than
 | 
			
		||||
# we're ready to tolerate, so don't...
 | 
			
		||||
$multilib="" if !-d "$prefix/lib$multilib";
 | 
			
		||||
 | 
			
		||||
$libdir="lib$multilib" if $libdir eq "";
 | 
			
		||||
 | 
			
		||||
$cflags = "$cflags$exp_cflags";
 | 
			
		||||
@@ -1102,6 +1111,12 @@ my ($prelflags,$postlflags)=split('%',$lflags);
 | 
			
		||||
if (defined($postlflags))	{ $lflags=$postlflags;	}
 | 
			
		||||
else				{ $lflags=$prelflags; undef $prelflags;	}
 | 
			
		||||
 | 
			
		||||
if ($target =~ /^mingw/ && `$cc --target-help 2>&1` !~ m/\-mno\-cygwin/m)
 | 
			
		||||
	{
 | 
			
		||||
	$cflags =~ s/\-mno\-cygwin\s*//;
 | 
			
		||||
	$shared_ldflag =~ s/\-mno\-cygwin\s*//;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
my $no_shared_warn=0;
 | 
			
		||||
my $no_user_cflags=0;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										53
									
								
								FAQ
									
									
									
									
									
								
							
							
						
						
									
										53
									
								
								FAQ
									
									
									
									
									
								
							@@ -52,6 +52,9 @@ OpenSSL  -  Frequently Asked Questions
 | 
			
		||||
* Why does the OpenSSL test suite fail in sha512t on x86 CPU?
 | 
			
		||||
* Why does compiler fail to compile sha512.c?
 | 
			
		||||
* Test suite still fails, what to do?
 | 
			
		||||
* I think I've found a bug, what should I do?
 | 
			
		||||
* I'm SURE I've found a bug, how do I report it?
 | 
			
		||||
* I've found a security issue, how do I report it?
 | 
			
		||||
 | 
			
		||||
[PROG] Questions about programming with OpenSSL
 | 
			
		||||
 | 
			
		||||
@@ -79,7 +82,7 @@ OpenSSL  -  Frequently Asked Questions
 | 
			
		||||
* Which is the current version of OpenSSL?
 | 
			
		||||
 | 
			
		||||
The current version is available from <URL: http://www.openssl.org>.
 | 
			
		||||
OpenSSL 1.0.0a was released on Jun 1st, 2010.
 | 
			
		||||
OpenSSL 1.0.0d was released on Feb 8th, 2011.
 | 
			
		||||
 | 
			
		||||
In addition to the current stable release, you can also access daily
 | 
			
		||||
snapshots of the OpenSSL development version at <URL:
 | 
			
		||||
@@ -131,7 +134,7 @@ OpenSSL.  Information on the OpenSSL mailing lists is available from
 | 
			
		||||
* Where can I get a compiled version of OpenSSL?
 | 
			
		||||
 | 
			
		||||
You can finder pointers to binary distributions in
 | 
			
		||||
http://www.openssl.org/related/binaries.html .
 | 
			
		||||
<URL: http://www.openssl.org/related/binaries.html> .
 | 
			
		||||
 | 
			
		||||
Some applications that use OpenSSL are distributed in binary form.
 | 
			
		||||
When using such an application, you don't need to install OpenSSL
 | 
			
		||||
@@ -463,7 +466,7 @@ administrators.
 | 
			
		||||
Other projects do have other policies so you can for example extract the CA
 | 
			
		||||
bundle used by Mozilla and/or modssl as described in this article:
 | 
			
		||||
 | 
			
		||||
  http://www.mail-archive.com/modssl-users@modssl.org/msg16980.html
 | 
			
		||||
  <URL: http://www.mail-archive.com/modssl-users@modssl.org/msg16980.html>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
[BUILD] =======================================================================
 | 
			
		||||
@@ -505,7 +508,7 @@ when you run the test suite (using "make test").  The message returned is
 | 
			
		||||
"bc: 1 not implemented".
 | 
			
		||||
 | 
			
		||||
The best way to deal with this is to find another implementation of bc
 | 
			
		||||
and compile/install it.  GNU bc (see http://www.gnu.org/software/software.html
 | 
			
		||||
and compile/install it.  GNU bc (see <URL: http://www.gnu.org/software/software.html>
 | 
			
		||||
for download instructions) can be safely used, for example.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -516,7 +519,7 @@ that the OpenSSL bntest throws at it.  This gets triggered when you run the
 | 
			
		||||
test suite (using "make test").  The message returned is "bc: stack empty".
 | 
			
		||||
 | 
			
		||||
The best way to deal with this is to find another implementation of bc
 | 
			
		||||
and compile/install it.  GNU bc (see http://www.gnu.org/software/software.html
 | 
			
		||||
and compile/install it.  GNU bc (see <URL: http://www.gnu.org/software/software.html>
 | 
			
		||||
for download instructions) can be safely used, for example.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -709,6 +712,46 @@ never make sense, and tend to emerge when you least expect them. In order
 | 
			
		||||
to identify one, drop optimization level, e.g. by editing CFLAG line in
 | 
			
		||||
top-level Makefile, recompile and re-run the test.
 | 
			
		||||
 | 
			
		||||
* I think I've found a bug, what should I do?
 | 
			
		||||
 | 
			
		||||
If you are a new user then it is quite likely you haven't found a bug and
 | 
			
		||||
something is happening you aren't familiar with. Check this FAQ, the associated
 | 
			
		||||
documentation and the mailing lists for similar queries. If you are still
 | 
			
		||||
unsure whether it is a bug or not submit a query to the openssl-users mailing
 | 
			
		||||
list.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
* I'm SURE I've found a bug, how do I report it?
 | 
			
		||||
 | 
			
		||||
Bug reports with no security implications should be sent to the request
 | 
			
		||||
tracker. This can be done by mailing the report to <rt@openssl.org> (or its
 | 
			
		||||
alias <openssl-bugs@openssl.org>), please note that messages sent to the
 | 
			
		||||
request tracker also appear in the public openssl-dev mailing list.
 | 
			
		||||
 | 
			
		||||
The report should be in plain text. Any patches should be sent as
 | 
			
		||||
plain text attachments because some mailers corrupt patches sent inline.
 | 
			
		||||
If your issue affects multiple versions of OpenSSL check any patches apply
 | 
			
		||||
cleanly and, if possible include patches to each affected version.
 | 
			
		||||
 | 
			
		||||
The report should be given a meaningful subject line briefly summarising the
 | 
			
		||||
issue. Just "bug in OpenSSL" or "bug in OpenSSL 0.9.8n" is not very helpful.
 | 
			
		||||
 | 
			
		||||
By sending reports to the request tracker the bug can then be given a priority
 | 
			
		||||
and assigned to the appropriate maintainer. The history of discussions can be
 | 
			
		||||
accessed and if the issue has been addressed or a reason why not. If patches
 | 
			
		||||
are only sent to openssl-dev they can be mislaid if a team member has to
 | 
			
		||||
wade through months of old messages to review the discussion.
 | 
			
		||||
 | 
			
		||||
See also <URL: http://www.openssl.org/support/rt.html>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
* I've found a security issue, how do I report it?
 | 
			
		||||
 | 
			
		||||
If you think your bug has security implications then please send it to
 | 
			
		||||
openssl-security@openssl.org if you don't get a prompt reply at least 
 | 
			
		||||
acknowledging receipt then resend or mail it directly to one of the
 | 
			
		||||
more active team members (e.g. Steve).
 | 
			
		||||
 | 
			
		||||
[PROG] ========================================================================
 | 
			
		||||
 | 
			
		||||
* Is OpenSSL thread-safe?
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										22
									
								
								INSTALL.W32
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								INSTALL.W32
									
									
									
									
									
								
							@@ -185,6 +185,15 @@
 | 
			
		||||
   required. Run the installers and do whatever magic they say it takes
 | 
			
		||||
   to start MSYS bash shell with GNU tools on its PATH.
 | 
			
		||||
 | 
			
		||||
   N.B. Since source tar-ball can contain symbolic links, it's essential
 | 
			
		||||
   that you use accompanying MSYS tar to unpack the source. It will
 | 
			
		||||
   either handle them in one way or another or fail to extract them,
 | 
			
		||||
   which does the trick too. Latter means that you may safely ignore all
 | 
			
		||||
   "cannot create symlink" messages, as they will be "re-created" at
 | 
			
		||||
   configure stage by copying corresponding files. Alternative programs
 | 
			
		||||
   were observed to create empty files instead, which results in build
 | 
			
		||||
   failure.
 | 
			
		||||
 | 
			
		||||
 * Compile OpenSSL:
 | 
			
		||||
 | 
			
		||||
   $ ./config
 | 
			
		||||
@@ -297,7 +306,18 @@
 | 
			
		||||
 desktop, which is not available to service processes. The toolkit is
 | 
			
		||||
 designed to detect in which context it's currently executed, GUI,
 | 
			
		||||
 console app or service, and act accordingly, namely whether or not to
 | 
			
		||||
 actually make GUI calls.
 | 
			
		||||
 actually make GUI calls. Additionally those who wish to
 | 
			
		||||
 /DELAYLOAD:GDI32.DLL and /DELAYLOAD:USER32.DLL and actually keep them
 | 
			
		||||
 off service process should consider implementing and exporting from
 | 
			
		||||
 .exe image in question own _OPENSSL_isservice not relying on USER32.DLL.
 | 
			
		||||
 E.g., on Windows Vista and later you could:
 | 
			
		||||
 | 
			
		||||
	__declspec(dllexport) __cdecl BOOL _OPENSSL_isservice(void)
 | 
			
		||||
	{   DWORD sess;
 | 
			
		||||
	    if (ProcessIdToSessionId(GetCurrentProcessId(),&sess))
 | 
			
		||||
	        return sess==0;
 | 
			
		||||
	    return FALSE;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 If you link with OpenSSL .DLLs, then you're expected to include into
 | 
			
		||||
 your application code small "shim" snippet, which provides glue between
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							@@ -12,7 +12,7 @@
 | 
			
		||||
  ---------------
 | 
			
		||||
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 1998-2008 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 * Copyright (c) 1998-2011 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
 | 
			
		||||
 
 | 
			
		||||
@@ -135,7 +135,7 @@ LINK_SO_A_VIA_O=	\
 | 
			
		||||
  ALL=$$ALLSYMSFLAGS; ALLSYMSFLAGS=; NOALLSYMSFLAGS=; \
 | 
			
		||||
  ( $(SET_X); \
 | 
			
		||||
    ld $(LDFLAGS) -r -o lib$(LIBNAME).o $$ALL lib$(LIBNAME).a $(LIBEXTRAS) ); \
 | 
			
		||||
  $(LINK_SO) && rm -f $(LIBNAME).o
 | 
			
		||||
  $(LINK_SO) && rm -f lib$(LIBNAME).o
 | 
			
		||||
 | 
			
		||||
LINK_SO_A_UNPACKED=	\
 | 
			
		||||
  UNPACKDIR=link_tmp.$$$$; rm -rf $$UNPACKDIR; mkdir $$UNPACKDIR; \
 | 
			
		||||
@@ -207,17 +207,29 @@ link_app.bsd:
 | 
			
		||||
	fi; $(LINK_APP)
 | 
			
		||||
 | 
			
		||||
# For Darwin AKA Mac OS/X (dyld)
 | 
			
		||||
# link_o.darwin produces .so, because we let it use dso_dlfcn module,
 | 
			
		||||
# which has .so extension hard-coded. One can argue that one should
 | 
			
		||||
# develop special dso module for MacOS X. At least manual encourages
 | 
			
		||||
# to use native NSModule(3) API and refers to dlfcn as termporary hack.
 | 
			
		||||
# Originally link_o.darwin produced .so, because it was hard-coded
 | 
			
		||||
# in dso_dlfcn module. At later point dso_dlfcn switched to .dylib
 | 
			
		||||
# extension in order to allow for run-time linking with vendor-
 | 
			
		||||
# supplied shared libraries such as libz, so that link_o.darwin had
 | 
			
		||||
# to be harmonized with it. This caused minor controversy, because
 | 
			
		||||
# it was believed that dlopen can't be used to dynamically load
 | 
			
		||||
# .dylib-s, only so called bundle modules (ones linked with -bundle
 | 
			
		||||
# flag). The belief seems to be originating from pre-10.4 release,
 | 
			
		||||
# where dlfcn functionality was emulated by dlcompat add-on. In
 | 
			
		||||
# 10.4 dlopen was rewritten as native part of dyld and is documented
 | 
			
		||||
# to be capable of loading both dynamic libraries and bundles. In
 | 
			
		||||
# order to provide compatibility with pre-10.4 dlopen, modules are
 | 
			
		||||
# linked with -bundle flag, which makes .dylib extension misleading.
 | 
			
		||||
# It works, because dlopen is [and always was] extension-agnostic.
 | 
			
		||||
# Alternative to this heuristic approach is to develop specific
 | 
			
		||||
# MacOS X dso module relying on whichever "native" dyld interface.
 | 
			
		||||
link_o.darwin:
 | 
			
		||||
	@ $(CALC_VERSIONS); \
 | 
			
		||||
	SHLIB=lib$(LIBNAME); \
 | 
			
		||||
	SHLIB_SUFFIX=.so; \
 | 
			
		||||
	SHLIB_SUFFIX=.dylib; \
 | 
			
		||||
	ALLSYMSFLAGS='-all_load'; \
 | 
			
		||||
	NOALLSYMSFLAGS=''; \
 | 
			
		||||
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS)"; \
 | 
			
		||||
	SHAREDFLAGS="$(CFLAGS) `echo $(SHARED_LDFLAGS) | sed s/dynamiclib/bundle/`"; \
 | 
			
		||||
	if [ -n "$(LIBVERSION)" ]; then \
 | 
			
		||||
		SHAREDFLAGS="$$SHAREDFLAGS -current_version $(LIBVERSION)"; \
 | 
			
		||||
	fi; \
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										33
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								NEWS
									
									
									
									
									
								
							@@ -5,12 +5,30 @@
 | 
			
		||||
  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 1.0.0c and OpenSSL 1.0.0d:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2011-0014
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.0b and OpenSSL 1.0.0c:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2010-4180
 | 
			
		||||
      o Fix for CVE-2010-4252
 | 
			
		||||
      o Fix mishandling of absent EC point format extension.
 | 
			
		||||
      o Fix various platform compilation issues.
 | 
			
		||||
      o Corrected fix for security issue CVE-2010-3864.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.0a and OpenSSL 1.0.0b:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2010-3864.
 | 
			
		||||
      o Fix for CVE-2010-2939
 | 
			
		||||
      o Fix WIN32 build system for GOST ENGINE.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.0 and OpenSSL 1.0.0a:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2010-1633.
 | 
			
		||||
      o GOST MAC and CFB fixes.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8n and OpenSSL 1.0:
 | 
			
		||||
  Major changes between OpenSSL 0.9.8n and OpenSSL 1.0.0:
 | 
			
		||||
 | 
			
		||||
      o RFC3280 path validation: sufficient to process PKITS tests.
 | 
			
		||||
      o Integrated support for PVK files and keyblobs.
 | 
			
		||||
@@ -33,6 +51,19 @@
 | 
			
		||||
      o Opaque PRF Input TLS extension support.
 | 
			
		||||
      o Updated time routines to avoid OS limitations.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8q and OpenSSL 0.9.8r:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2011-0014
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8p and OpenSSL 0.9.8q:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2010-4180
 | 
			
		||||
      o Fix for CVE-2010-4252
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8o and OpenSSL 0.9.8p:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2010-3864.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8n and OpenSSL 0.9.8o:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2010-0742.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								PROBLEMS
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								PROBLEMS
									
									
									
									
									
								
							@@ -36,7 +36,9 @@ may differ on your machine.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
As long as Apple doesn't fix the problem with ld, this problem building
 | 
			
		||||
OpenSSL will remain as is.
 | 
			
		||||
OpenSSL will remain as is. Well, the problem was addressed in 0.9.8f by
 | 
			
		||||
passing -Wl,-search_paths_first, but it's unknown if the flag was
 | 
			
		||||
supported from the initial MacOS X release.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
* Parallell make leads to errors
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								README
									
									
									
									
									
								
							@@ -1,7 +1,7 @@
 | 
			
		||||
 | 
			
		||||
 OpenSSL 1.0.0b-dev
 | 
			
		||||
 OpenSSL 1.0.0d
 | 
			
		||||
 | 
			
		||||
 Copyright (c) 1998-2010 The OpenSSL Project
 | 
			
		||||
 Copyright (c) 1998-2011 The OpenSSL Project
 | 
			
		||||
 Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
 | 
			
		||||
 All rights reserved.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								STATUS
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								STATUS
									
									
									
									
									
								
							@@ -1,12 +1,20 @@
 | 
			
		||||
 | 
			
		||||
  OpenSSL STATUS                           Last modified at
 | 
			
		||||
  ______________                           $Date: 2010/06/01 13:31:36 $
 | 
			
		||||
  ______________                           $Date: 2011/02/08 17:10:52 $
 | 
			
		||||
 | 
			
		||||
  DEVELOPMENT STATE
 | 
			
		||||
 | 
			
		||||
    o  OpenSSL 1.1.0:  Under development...
 | 
			
		||||
    o  OpenSSL 1.0.1:  Under development...
 | 
			
		||||
    o  OpenSSL 1.0.0d: Released on February   8nd, 2011
 | 
			
		||||
    o  OpenSSL 1.0.0c: Released on December   2nd, 2010
 | 
			
		||||
    o  OpenSSL 1.0.0b: Released on November  16th, 2010
 | 
			
		||||
    o  OpenSSL 1.0.0a: Released on June      1st,  2010
 | 
			
		||||
    o  OpenSSL 1.0.0:  Released on March     29th, 2010
 | 
			
		||||
    o  OpenSSL 0.9.8r: Released on February   8nd, 2011
 | 
			
		||||
    o  OpenSSL 0.9.8q: Released on December   2nd, 2010
 | 
			
		||||
    o  OpenSSL 0.9.8p: Released on November  16th, 2010
 | 
			
		||||
    o  OpenSSL 0.9.8o: Released on June       1st, 2010
 | 
			
		||||
    o  OpenSSL 0.9.8n: Released on March     24th, 2010
 | 
			
		||||
    o  OpenSSL 0.9.8m: Released on February  25th, 2010
 | 
			
		||||
    o  OpenSSL 0.9.8l: Released on November   5th, 2009
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										62
									
								
								TABLE
									
									
									
									
									
								
							
							
						
						
									
										62
									
								
								TABLE
									
									
									
									
									
								
							@@ -1426,6 +1426,68 @@ $ranlib       =
 | 
			
		||||
$arflags      = 
 | 
			
		||||
$multilib     = 
 | 
			
		||||
 | 
			
		||||
*** debug-VC-WIN64A
 | 
			
		||||
$cc           = cl
 | 
			
		||||
$cflags       = -W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = 
 | 
			
		||||
$sys_id       = WIN64A
 | 
			
		||||
$lflags       = 
 | 
			
		||||
$bn_ops       = SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN
 | 
			
		||||
$cpuid_obj    = x86_64cpuid.o
 | 
			
		||||
$bn_obj       = bn_asm.o x86_64-mont.o
 | 
			
		||||
$des_obj      = 
 | 
			
		||||
$aes_obj      = aes-x86_64.o
 | 
			
		||||
$bf_obj       = 
 | 
			
		||||
$md5_obj      = md5-x86_64.o
 | 
			
		||||
$sha1_obj     = sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o
 | 
			
		||||
$cast_obj     = 
 | 
			
		||||
$rc4_obj      = rc4-x86_64.o
 | 
			
		||||
$rmd160_obj   = 
 | 
			
		||||
$rc5_obj      = 
 | 
			
		||||
$wp_obj       = wp-x86_64.o
 | 
			
		||||
$cmll_obj     = cmll-x86_64.o cmll_misc.o
 | 
			
		||||
$perlasm_scheme = auto
 | 
			
		||||
$dso_scheme   = win32
 | 
			
		||||
$shared_target= 
 | 
			
		||||
$shared_cflag = 
 | 
			
		||||
$shared_ldflag = 
 | 
			
		||||
$shared_extension = 
 | 
			
		||||
$ranlib       = 
 | 
			
		||||
$arflags      = 
 | 
			
		||||
$multilib     = 
 | 
			
		||||
 | 
			
		||||
*** debug-VC-WIN64I
 | 
			
		||||
$cc           = cl
 | 
			
		||||
$cflags       = -W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = 
 | 
			
		||||
$sys_id       = WIN64I
 | 
			
		||||
$lflags       = 
 | 
			
		||||
$bn_ops       = SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN
 | 
			
		||||
$cpuid_obj    = ia64cpuid.o
 | 
			
		||||
$bn_obj       = ia64.o
 | 
			
		||||
$des_obj      = 
 | 
			
		||||
$aes_obj      = aes_core.o aes_cbc.o aes-ia64.o
 | 
			
		||||
$bf_obj       = 
 | 
			
		||||
$md5_obj      = md5-ia64.o
 | 
			
		||||
$sha1_obj     = sha1-ia64.o sha256-ia64.o sha512-ia64.o
 | 
			
		||||
$cast_obj     = 
 | 
			
		||||
$rc4_obj      = 
 | 
			
		||||
$rmd160_obj   = 
 | 
			
		||||
$rc5_obj      = 
 | 
			
		||||
$wp_obj       = 
 | 
			
		||||
$cmll_obj     = 
 | 
			
		||||
$perlasm_scheme = ias
 | 
			
		||||
$dso_scheme   = win32
 | 
			
		||||
$shared_target= 
 | 
			
		||||
$shared_cflag = 
 | 
			
		||||
$shared_ldflag = 
 | 
			
		||||
$shared_extension = 
 | 
			
		||||
$ranlib       = 
 | 
			
		||||
$arflags      = 
 | 
			
		||||
$multilib     = 
 | 
			
		||||
 | 
			
		||||
*** debug-ben
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DDEBUG_UNUSED -O2 -pedantic -Wall -Wshadow -Werror -pipe
 | 
			
		||||
 
 | 
			
		||||
@@ -38,7 +38,7 @@ $   libopt = "''libdir'LIBCRYPTO.OPT"
 | 
			
		||||
$   libmap = "''libdir'LIBCRYPTO.MAP"
 | 
			
		||||
$   libgoal= "''libdir'LIBCRYPTO.EXE"
 | 
			
		||||
$   libref = ""
 | 
			
		||||
$   gosub create_nonvax_shr
 | 
			
		||||
$   if f$search(libdir+libolb) .nes. "" then gosub create_nonvax_shr
 | 
			
		||||
$   libid  = "SSL"
 | 
			
		||||
$   libnum = "[.UTIL]SSLEAY.NUM"
 | 
			
		||||
$   libdir = "[.''ARCH'.EXE.SSL]"
 | 
			
		||||
@@ -47,7 +47,26 @@ $   libopt = "''libdir'LIBSSL.OPT"
 | 
			
		||||
$   libmap = "''libdir'LIBSSL.MAP"
 | 
			
		||||
$   libgoal= "''libdir'LIBSSL.EXE"
 | 
			
		||||
$   libref = "[.''ARCH'.EXE.CRYPTO]LIBCRYPTO.EXE"
 | 
			
		||||
$   gosub create_nonvax_shr
 | 
			
		||||
$   if f$search(libdir+libolb) .nes. "" then gosub create_nonvax_shr
 | 
			
		||||
$   arch_vax = 0
 | 
			
		||||
$   libid  = "Crypto"
 | 
			
		||||
$   libnum = "[.UTIL]LIBEAY.NUM"
 | 
			
		||||
$   libdir = "[.''ARCH'.EXE.CRYPTO]"
 | 
			
		||||
$   libolb = "''libdir'LIBCRYPTO32.OLB"
 | 
			
		||||
$   libopt = "''libdir'LIBCRYPTO32.OPT"
 | 
			
		||||
$   libmap = "''libdir'LIBCRYPTO32.MAP"
 | 
			
		||||
$   libgoal= "''libdir'LIBCRYPTO32.EXE"
 | 
			
		||||
$   libref = ""
 | 
			
		||||
$   if f$search(libdir+libolb) .nes. "" then gosub create_nonvax_shr
 | 
			
		||||
$   libid  = "SSL"
 | 
			
		||||
$   libnum = "[.UTIL]SSLEAY.NUM"
 | 
			
		||||
$   libdir = "[.''ARCH'.EXE.SSL]"
 | 
			
		||||
$   libolb = "''libdir'LIBSSL32.OLB"
 | 
			
		||||
$   libopt = "''libdir'LIBSSL32.OPT"
 | 
			
		||||
$   libmap = "''libdir'LIBSSL32.MAP"
 | 
			
		||||
$   libgoal= "''libdir'LIBSSL32.EXE"
 | 
			
		||||
$   libref = "[.''ARCH'.EXE.CRYPTO]LIBCRYPTO32.EXE"
 | 
			
		||||
$   if f$search(libdir+libolb) .nes. "" then gosub create_nonvax_shr
 | 
			
		||||
$ else
 | 
			
		||||
$   arch_vax = 1
 | 
			
		||||
$   libtit = "CRYPTO_TRANSFER_VECTOR"
 | 
			
		||||
@@ -62,7 +81,7 @@ $   libmap = "''libdir'LIBCRYPTO.MAP"
 | 
			
		||||
$   libgoal= "''libdir'LIBCRYPTO.EXE"
 | 
			
		||||
$   libref = ""
 | 
			
		||||
$   libvec = "LIBCRYPTO"
 | 
			
		||||
$   gosub create_vax_shr
 | 
			
		||||
$   if f$search(libdir+libolb) .nes. "" then gosub create_vax_shr
 | 
			
		||||
$   libtit = "SSL_TRANSFER_VECTOR"
 | 
			
		||||
$   libid  = "SSL"
 | 
			
		||||
$   libnum = "[.UTIL]SSLEAY.NUM"
 | 
			
		||||
@@ -75,11 +94,11 @@ $   libmap = "''libdir'LIBSSL.MAP"
 | 
			
		||||
$   libgoal= "''libdir'LIBSSL.EXE"
 | 
			
		||||
$   libref = "[.''ARCH'.EXE.CRYPTO]LIBCRYPTO.EXE"
 | 
			
		||||
$   libvec = "LIBSSL"
 | 
			
		||||
$   gosub create_vax_shr
 | 
			
		||||
$   if f$search(libdir+libolb) .nes. "" then gosub create_vax_shr
 | 
			
		||||
$ endif
 | 
			
		||||
$ exit
 | 
			
		||||
$
 | 
			
		||||
$! ----- Soubroutines to build the shareable libraries
 | 
			
		||||
$! ----- Subroutines to build the shareable libraries
 | 
			
		||||
$! For each supported architecture, there's a main shareable library
 | 
			
		||||
$! creator, which is called from the main code above.
 | 
			
		||||
$! The creator will define a number of variables to tell the next levels of
 | 
			
		||||
 
 | 
			
		||||
@@ -257,6 +257,8 @@ int args_from_file(char *file, int *argc, char **argv[])
 | 
			
		||||
 | 
			
		||||
int str2fmt(char *s)
 | 
			
		||||
	{
 | 
			
		||||
	if (s == NULL)
 | 
			
		||||
		return FORMAT_UNDEF;
 | 
			
		||||
	if 	((*s == 'D') || (*s == 'd'))
 | 
			
		||||
		return(FORMAT_ASN1);
 | 
			
		||||
	else if ((*s == 'T') || (*s == 't'))
 | 
			
		||||
 
 | 
			
		||||
@@ -39,6 +39,13 @@ $!  P4, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up)
 | 
			
		||||
$!
 | 
			
		||||
$!  P5, if defined, sets a choice of programs to compile.
 | 
			
		||||
$!
 | 
			
		||||
$!  For 64 bit architectures (Alpha and IA64), specify the pointer size as P6.
 | 
			
		||||
$!  For 32 bit architectures (VAX), P6 is ignored.
 | 
			
		||||
$!  Currently supported values are:
 | 
			
		||||
$!
 | 
			
		||||
$!	32	To ge a library compiled with /POINTER_SIZE=32
 | 
			
		||||
$!	64	To ge a library compiled with /POINTER_SIZE=64
 | 
			
		||||
$!
 | 
			
		||||
$!
 | 
			
		||||
$! Define A TCP/IP Library That We Will Need To Link To.
 | 
			
		||||
$! (That Is, If We Need To Link To One.)
 | 
			
		||||
@@ -73,11 +80,11 @@ $ PROGRAMS := OPENSSL
 | 
			
		||||
$!
 | 
			
		||||
$! Define The CRYPTO Library.
 | 
			
		||||
$!
 | 
			
		||||
$ CRYPTO_LIB := SYS$DISK:[-.'ARCH'.EXE.CRYPTO]LIBCRYPTO.OLB
 | 
			
		||||
$ CRYPTO_LIB := SYS$DISK:[-.'ARCH'.EXE.CRYPTO]LIBCRYPTO'LIB32'.OLB
 | 
			
		||||
$!
 | 
			
		||||
$! Define The SSL Library.
 | 
			
		||||
$!
 | 
			
		||||
$ SSL_LIB := SYS$DISK:[-.'ARCH'.EXE.SSL]LIBSSL.OLB
 | 
			
		||||
$ SSL_LIB := SYS$DISK:[-.'ARCH'.EXE.SSL]LIBSSL'LIB32'.OLB
 | 
			
		||||
$!
 | 
			
		||||
$! Define The OBJ Directory.
 | 
			
		||||
$!
 | 
			
		||||
@@ -563,6 +570,58 @@ $! End The P1 Check.
 | 
			
		||||
$!
 | 
			
		||||
$ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! Check To See If P6 Is Blank.
 | 
			
		||||
$!
 | 
			
		||||
$ IF (P6.EQS."")
 | 
			
		||||
$ THEN
 | 
			
		||||
$   POINTER_SIZE = ""
 | 
			
		||||
$ ELSE
 | 
			
		||||
$!
 | 
			
		||||
$!  Check is P6 Is Valid
 | 
			
		||||
$!
 | 
			
		||||
$   IF (P6.EQS."32")
 | 
			
		||||
$   THEN
 | 
			
		||||
$     POINTER_SIZE = "/POINTER_SIZE=32"
 | 
			
		||||
$     IF ARCH .EQS. "VAX"
 | 
			
		||||
$     THEN
 | 
			
		||||
$       LIB32 = ""
 | 
			
		||||
$     ELSE
 | 
			
		||||
$       LIB32 = "32"
 | 
			
		||||
$     ENDIF
 | 
			
		||||
$   ELSE
 | 
			
		||||
$     IF (P6.EQS."64")
 | 
			
		||||
$     THEN
 | 
			
		||||
$       LIB32 = ""
 | 
			
		||||
$       IF ARCH .EQS. "VAX"
 | 
			
		||||
$       THEN
 | 
			
		||||
$         POINTER_SIZE = "/POINTER_SIZE=32"
 | 
			
		||||
$       ELSE
 | 
			
		||||
$         POINTER_SIZE = "/POINTER_SIZE=64"
 | 
			
		||||
$       ENDIF
 | 
			
		||||
$     ELSE
 | 
			
		||||
$!
 | 
			
		||||
$!      Tell The User Entered An Invalid Option..
 | 
			
		||||
$!
 | 
			
		||||
$       WRITE SYS$OUTPUT ""
 | 
			
		||||
$       WRITE SYS$OUTPUT "The Option ",P6," Is Invalid.  The Valid Options Are:"
 | 
			
		||||
$       WRITE SYS$OUTPUT ""
 | 
			
		||||
$       WRITE SYS$OUTPUT "    32  :  Compile with 32 bit pointer size"
 | 
			
		||||
$       WRITE SYS$OUTPUT "    64  :  Compile with 64 bit pointer size"
 | 
			
		||||
$       WRITE SYS$OUTPUT ""
 | 
			
		||||
$!
 | 
			
		||||
$!      Time To EXIT.
 | 
			
		||||
$!
 | 
			
		||||
$       GOTO TIDY
 | 
			
		||||
$!
 | 
			
		||||
$!      End The Valid Arguement Check.
 | 
			
		||||
$!
 | 
			
		||||
$     ENDIF
 | 
			
		||||
$   ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! End The P6 Check.
 | 
			
		||||
$!
 | 
			
		||||
$ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! Check To See If P2 Is Blank.
 | 
			
		||||
$!
 | 
			
		||||
$ IF (P2.EQS."")
 | 
			
		||||
@@ -690,7 +749,7 @@ $!
 | 
			
		||||
$     CC = "CC"
 | 
			
		||||
$     IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
 | 
			
		||||
	 THEN CC = "CC/DECC"
 | 
			
		||||
$     CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + -
 | 
			
		||||
$     CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89''POINTER_SIZE'" + -
 | 
			
		||||
           "/NOLIST/PREFIX=ALL" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS
 | 
			
		||||
$!
 | 
			
		||||
 
 | 
			
		||||
@@ -119,17 +119,17 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		if (!strcmp(*argv,"-in"))
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) badarg = 1;
 | 
			
		||||
                        infile= *(++argv);
 | 
			
		||||
                        else infile= *(++argv);
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp(*argv,"-out"))
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) badarg = 1;
 | 
			
		||||
			outfile= *(++argv);
 | 
			
		||||
			else outfile= *(++argv);
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp(*argv,"-sigfile"))
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) badarg = 1;
 | 
			
		||||
			sigfile= *(++argv);
 | 
			
		||||
			else sigfile= *(++argv);
 | 
			
		||||
			}
 | 
			
		||||
		else if(!strcmp(*argv, "-inkey"))
 | 
			
		||||
			{
 | 
			
		||||
@@ -159,17 +159,17 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		else if (!strcmp(*argv,"-passin"))
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) badarg = 1;
 | 
			
		||||
			passargin= *(++argv);
 | 
			
		||||
			else passargin= *(++argv);
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-peerform") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) badarg = 1;
 | 
			
		||||
			peerform=str2fmt(*(++argv));
 | 
			
		||||
			else peerform=str2fmt(*(++argv));
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-keyform") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) badarg = 1;
 | 
			
		||||
			keyform=str2fmt(*(++argv));
 | 
			
		||||
			else keyform=str2fmt(*(++argv));
 | 
			
		||||
			}
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
		else if(!strcmp(*argv, "-engine"))
 | 
			
		||||
 
 | 
			
		||||
@@ -406,6 +406,7 @@ redoit:
 | 
			
		||||
	if (ret == INVALID_SOCKET)
 | 
			
		||||
		{
 | 
			
		||||
#if defined(OPENSSL_SYS_WINDOWS) || (defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK))
 | 
			
		||||
		int i;
 | 
			
		||||
		i=WSAGetLastError();
 | 
			
		||||
		BIO_printf(bio_err,"accept error %d\n",i);
 | 
			
		||||
#else
 | 
			
		||||
 
 | 
			
		||||
@@ -1230,7 +1230,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		count*=2;
 | 
			
		||||
		Time_F(START);
 | 
			
		||||
		for (it=count; it; it--)
 | 
			
		||||
			DES_ecb_encrypt(buf_as_des_cblock,buf_as_des_cblock,
 | 
			
		||||
			DES_ecb_encrypt((DES_cblock *)buf,
 | 
			
		||||
				(DES_cblock *)buf,
 | 
			
		||||
				&sch,DES_ENCRYPT);
 | 
			
		||||
		d=Time_F(STOP);
 | 
			
		||||
		} while (d <3);
 | 
			
		||||
 
 | 
			
		||||
@@ -74,7 +74,9 @@ x86_64cpuid.s: x86_64cpuid.pl
 | 
			
		||||
	$(PERL) x86_64cpuid.pl $(PERLASM_SCHEME) > $@
 | 
			
		||||
ia64cpuid.s: ia64cpuid.S
 | 
			
		||||
	$(CC) $(CFLAGS) -E ia64cpuid.S > $@
 | 
			
		||||
ppccpuid.s:		ppccpuid.pl;	$(PERL) ppccpuid.pl $(PERLASM_SCHEME) $@
 | 
			
		||||
ppccpuid.s:	ppccpuid.pl;	$(PERL) ppccpuid.pl $(PERLASM_SCHEME) $@
 | 
			
		||||
alphacpuid.s:	alphacpuid.pl
 | 
			
		||||
	$(PERL) $< | $(CC) -E - | tee $@ > /dev/null
 | 
			
		||||
 | 
			
		||||
testapps:
 | 
			
		||||
	[ -z "$(THIS)" ] || (	if echo $(SDIRS) | fgrep ' des '; \
 | 
			
		||||
 
 | 
			
		||||
@@ -85,9 +85,9 @@ int AES_wrap_key(AES_KEY *key, const unsigned char *iv,
 | 
			
		||||
			A[7] ^= (unsigned char)(t & 0xff);
 | 
			
		||||
			if (t > 0xff)	
 | 
			
		||||
				{
 | 
			
		||||
				A[6] ^= (unsigned char)((t & 0xff) >> 8);
 | 
			
		||||
				A[5] ^= (unsigned char)((t & 0xff) >> 16);
 | 
			
		||||
				A[4] ^= (unsigned char)((t & 0xff) >> 24);
 | 
			
		||||
				A[6] ^= (unsigned char)((t >> 8) & 0xff);
 | 
			
		||||
				A[5] ^= (unsigned char)((t >> 16) & 0xff);
 | 
			
		||||
				A[4] ^= (unsigned char)((t >> 24) & 0xff);
 | 
			
		||||
				}
 | 
			
		||||
			memcpy(R, B + 8, 8);
 | 
			
		||||
			}
 | 
			
		||||
@@ -119,9 +119,9 @@ int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
 | 
			
		||||
			A[7] ^= (unsigned char)(t & 0xff);
 | 
			
		||||
			if (t > 0xff)	
 | 
			
		||||
				{
 | 
			
		||||
				A[6] ^= (unsigned char)((t & 0xff) >> 8);
 | 
			
		||||
				A[5] ^= (unsigned char)((t & 0xff) >> 16);
 | 
			
		||||
				A[4] ^= (unsigned char)((t & 0xff) >> 24);
 | 
			
		||||
				A[6] ^= (unsigned char)((t >> 8) & 0xff);
 | 
			
		||||
				A[5] ^= (unsigned char)((t >> 16) & 0xff);
 | 
			
		||||
				A[4] ^= (unsigned char)((t >> 24) & 0xff);
 | 
			
		||||
				}
 | 
			
		||||
			memcpy(B + 8, R, 8);
 | 
			
		||||
			AES_decrypt(B, B, key);
 | 
			
		||||
 
 | 
			
		||||
@@ -16,12 +16,20 @@
 | 
			
		||||
# allows to merge logical or arithmetic operation with shift or rotate
 | 
			
		||||
# in one instruction and emit combined result every cycle. The module
 | 
			
		||||
# is endian-neutral. The performance is ~42 cycles/byte for 128-bit
 | 
			
		||||
# key.
 | 
			
		||||
# key [on single-issue Xscale PXA250 core].
 | 
			
		||||
 | 
			
		||||
# May 2007.
 | 
			
		||||
#
 | 
			
		||||
# AES_set_[en|de]crypt_key is added.
 | 
			
		||||
 | 
			
		||||
# July 2010.
 | 
			
		||||
#
 | 
			
		||||
# Rescheduling for dual-issue pipeline resulted in 12% improvement on
 | 
			
		||||
# Cortex A8 core and ~25 cycles per byte processed with 128-bit key.
 | 
			
		||||
 | 
			
		||||
while (($output=shift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
 | 
			
		||||
open STDOUT,">$output";
 | 
			
		||||
 | 
			
		||||
$s0="r0";
 | 
			
		||||
$s1="r1";
 | 
			
		||||
$s2="r2";
 | 
			
		||||
@@ -164,24 +172,24 @@ AES_encrypt:
 | 
			
		||||
	ldrb	$t2,[$rounds,#1]
 | 
			
		||||
	ldrb	$t3,[$rounds,#0]
 | 
			
		||||
	orr	$s0,$s0,$t1,lsl#8
 | 
			
		||||
	orr	$s0,$s0,$t2,lsl#16
 | 
			
		||||
	orr	$s0,$s0,$t3,lsl#24
 | 
			
		||||
	ldrb	$s1,[$rounds,#7]
 | 
			
		||||
	orr	$s0,$s0,$t2,lsl#16
 | 
			
		||||
	ldrb	$t1,[$rounds,#6]
 | 
			
		||||
	orr	$s0,$s0,$t3,lsl#24
 | 
			
		||||
	ldrb	$t2,[$rounds,#5]
 | 
			
		||||
	ldrb	$t3,[$rounds,#4]
 | 
			
		||||
	orr	$s1,$s1,$t1,lsl#8
 | 
			
		||||
	orr	$s1,$s1,$t2,lsl#16
 | 
			
		||||
	orr	$s1,$s1,$t3,lsl#24
 | 
			
		||||
	ldrb	$s2,[$rounds,#11]
 | 
			
		||||
	orr	$s1,$s1,$t2,lsl#16
 | 
			
		||||
	ldrb	$t1,[$rounds,#10]
 | 
			
		||||
	orr	$s1,$s1,$t3,lsl#24
 | 
			
		||||
	ldrb	$t2,[$rounds,#9]
 | 
			
		||||
	ldrb	$t3,[$rounds,#8]
 | 
			
		||||
	orr	$s2,$s2,$t1,lsl#8
 | 
			
		||||
	orr	$s2,$s2,$t2,lsl#16
 | 
			
		||||
	orr	$s2,$s2,$t3,lsl#24
 | 
			
		||||
	ldrb	$s3,[$rounds,#15]
 | 
			
		||||
	orr	$s2,$s2,$t2,lsl#16
 | 
			
		||||
	ldrb	$t1,[$rounds,#14]
 | 
			
		||||
	orr	$s2,$s2,$t3,lsl#24
 | 
			
		||||
	ldrb	$t2,[$rounds,#13]
 | 
			
		||||
	ldrb	$t3,[$rounds,#12]
 | 
			
		||||
	orr	$s3,$s3,$t1,lsl#8
 | 
			
		||||
@@ -196,24 +204,24 @@ AES_encrypt:
 | 
			
		||||
	mov	$t3,$s0,lsr#8
 | 
			
		||||
	strb	$t1,[$rounds,#0]
 | 
			
		||||
	strb	$t2,[$rounds,#1]
 | 
			
		||||
	strb	$t3,[$rounds,#2]
 | 
			
		||||
	strb	$s0,[$rounds,#3]
 | 
			
		||||
	mov	$t1,$s1,lsr#24
 | 
			
		||||
	strb	$t3,[$rounds,#2]
 | 
			
		||||
	mov	$t2,$s1,lsr#16
 | 
			
		||||
	strb	$s0,[$rounds,#3]
 | 
			
		||||
	mov	$t3,$s1,lsr#8
 | 
			
		||||
	strb	$t1,[$rounds,#4]
 | 
			
		||||
	strb	$t2,[$rounds,#5]
 | 
			
		||||
	strb	$t3,[$rounds,#6]
 | 
			
		||||
	strb	$s1,[$rounds,#7]
 | 
			
		||||
	mov	$t1,$s2,lsr#24
 | 
			
		||||
	strb	$t3,[$rounds,#6]
 | 
			
		||||
	mov	$t2,$s2,lsr#16
 | 
			
		||||
	strb	$s1,[$rounds,#7]
 | 
			
		||||
	mov	$t3,$s2,lsr#8
 | 
			
		||||
	strb	$t1,[$rounds,#8]
 | 
			
		||||
	strb	$t2,[$rounds,#9]
 | 
			
		||||
	strb	$t3,[$rounds,#10]
 | 
			
		||||
	strb	$s2,[$rounds,#11]
 | 
			
		||||
	mov	$t1,$s3,lsr#24
 | 
			
		||||
	strb	$t3,[$rounds,#10]
 | 
			
		||||
	mov	$t2,$s3,lsr#16
 | 
			
		||||
	strb	$s2,[$rounds,#11]
 | 
			
		||||
	mov	$t3,$s3,lsr#8
 | 
			
		||||
	strb	$t1,[$rounds,#12]
 | 
			
		||||
	strb	$t2,[$rounds,#13]
 | 
			
		||||
@@ -230,141 +238,137 @@ AES_encrypt:
 | 
			
		||||
.align	2
 | 
			
		||||
_armv4_AES_encrypt:
 | 
			
		||||
	str	lr,[sp,#-4]!		@ push lr
 | 
			
		||||
	ldr	$t1,[$key],#16
 | 
			
		||||
	ldr	$t2,[$key,#-12]
 | 
			
		||||
	ldr	$t3,[$key,#-8]
 | 
			
		||||
	ldr	$i1,[$key,#-4]
 | 
			
		||||
	ldr	$rounds,[$key,#240-16]
 | 
			
		||||
	ldmia	$key!,{$t1-$i1}
 | 
			
		||||
	eor	$s0,$s0,$t1
 | 
			
		||||
	ldr	$rounds,[$key,#240-16]
 | 
			
		||||
	eor	$s1,$s1,$t2
 | 
			
		||||
	eor	$s2,$s2,$t3
 | 
			
		||||
	eor	$s3,$s3,$i1
 | 
			
		||||
	sub	$rounds,$rounds,#1
 | 
			
		||||
	mov	lr,#255
 | 
			
		||||
 | 
			
		||||
.Lenc_loop:
 | 
			
		||||
	and	$i1,lr,$s0
 | 
			
		||||
	and	$i2,lr,$s0,lsr#8
 | 
			
		||||
	and	$i3,lr,$s0,lsr#16
 | 
			
		||||
	and	$i1,lr,$s0
 | 
			
		||||
	mov	$s0,$s0,lsr#24
 | 
			
		||||
.Lenc_loop:
 | 
			
		||||
	ldr	$t1,[$tbl,$i1,lsl#2]	@ Te3[s0>>0]
 | 
			
		||||
	ldr	$s0,[$tbl,$s0,lsl#2]	@ Te0[s0>>24]
 | 
			
		||||
	ldr	$t2,[$tbl,$i2,lsl#2]	@ Te2[s0>>8]
 | 
			
		||||
	ldr	$t3,[$tbl,$i3,lsl#2]	@ Te1[s0>>16]
 | 
			
		||||
 | 
			
		||||
	and	$i1,lr,$s1,lsr#16	@ i0
 | 
			
		||||
	ldr	$t2,[$tbl,$i2,lsl#2]	@ Te2[s0>>8]
 | 
			
		||||
	and	$i2,lr,$s1
 | 
			
		||||
	ldr	$t3,[$tbl,$i3,lsl#2]	@ Te1[s0>>16]
 | 
			
		||||
	and	$i3,lr,$s1,lsr#8
 | 
			
		||||
	ldr	$s0,[$tbl,$s0,lsl#2]	@ Te0[s0>>24]
 | 
			
		||||
	mov	$s1,$s1,lsr#24
 | 
			
		||||
 | 
			
		||||
	ldr	$i1,[$tbl,$i1,lsl#2]	@ Te1[s1>>16]
 | 
			
		||||
	ldr	$s1,[$tbl,$s1,lsl#2]	@ Te0[s1>>24]
 | 
			
		||||
	ldr	$i2,[$tbl,$i2,lsl#2]	@ Te3[s1>>0]
 | 
			
		||||
	ldr	$i3,[$tbl,$i3,lsl#2]	@ Te2[s1>>8]
 | 
			
		||||
	eor	$s0,$s0,$i1,ror#8
 | 
			
		||||
	eor	$s1,$s1,$t1,ror#24
 | 
			
		||||
	eor	$t2,$t2,$i2,ror#8
 | 
			
		||||
	eor	$t3,$t3,$i3,ror#8
 | 
			
		||||
 | 
			
		||||
	ldr	$s1,[$tbl,$s1,lsl#2]	@ Te0[s1>>24]
 | 
			
		||||
	and	$i1,lr,$s2,lsr#8	@ i0
 | 
			
		||||
	eor	$t2,$t2,$i2,ror#8
 | 
			
		||||
	and	$i2,lr,$s2,lsr#16	@ i1
 | 
			
		||||
	eor	$t3,$t3,$i3,ror#8
 | 
			
		||||
	and	$i3,lr,$s2
 | 
			
		||||
	mov	$s2,$s2,lsr#24
 | 
			
		||||
	eor	$s1,$s1,$t1,ror#24
 | 
			
		||||
	ldr	$i1,[$tbl,$i1,lsl#2]	@ Te2[s2>>8]
 | 
			
		||||
	mov	$s2,$s2,lsr#24
 | 
			
		||||
 | 
			
		||||
	ldr	$i2,[$tbl,$i2,lsl#2]	@ Te1[s2>>16]
 | 
			
		||||
	ldr	$s2,[$tbl,$s2,lsl#2]	@ Te0[s2>>24]
 | 
			
		||||
	ldr	$i3,[$tbl,$i3,lsl#2]	@ Te3[s2>>0]
 | 
			
		||||
	eor	$s0,$s0,$i1,ror#16
 | 
			
		||||
	eor	$s1,$s1,$i2,ror#8
 | 
			
		||||
	eor	$s2,$s2,$t2,ror#16
 | 
			
		||||
	eor	$t3,$t3,$i3,ror#16
 | 
			
		||||
 | 
			
		||||
	ldr	$s2,[$tbl,$s2,lsl#2]	@ Te0[s2>>24]
 | 
			
		||||
	and	$i1,lr,$s3		@ i0
 | 
			
		||||
	eor	$s1,$s1,$i2,ror#8
 | 
			
		||||
	and	$i2,lr,$s3,lsr#8	@ i1
 | 
			
		||||
	eor	$t3,$t3,$i3,ror#16
 | 
			
		||||
	and	$i3,lr,$s3,lsr#16	@ i2
 | 
			
		||||
	mov	$s3,$s3,lsr#24
 | 
			
		||||
	eor	$s2,$s2,$t2,ror#16
 | 
			
		||||
	ldr	$i1,[$tbl,$i1,lsl#2]	@ Te3[s3>>0]
 | 
			
		||||
	mov	$s3,$s3,lsr#24
 | 
			
		||||
 | 
			
		||||
	ldr	$i2,[$tbl,$i2,lsl#2]	@ Te2[s3>>8]
 | 
			
		||||
	ldr	$i3,[$tbl,$i3,lsl#2]	@ Te1[s3>>16]
 | 
			
		||||
	ldr	$s3,[$tbl,$s3,lsl#2]	@ Te0[s3>>24]
 | 
			
		||||
	eor	$s0,$s0,$i1,ror#24
 | 
			
		||||
	ldr	$s3,[$tbl,$s3,lsl#2]	@ Te0[s3>>24]
 | 
			
		||||
	eor	$s1,$s1,$i2,ror#16
 | 
			
		||||
	ldr	$i1,[$key],#16
 | 
			
		||||
	eor	$s2,$s2,$i3,ror#8
 | 
			
		||||
	ldr	$t1,[$key,#-12]
 | 
			
		||||
	eor	$s3,$s3,$t3,ror#8
 | 
			
		||||
 | 
			
		||||
	ldr	$t1,[$key],#16
 | 
			
		||||
	ldr	$t2,[$key,#-12]
 | 
			
		||||
	ldr	$t3,[$key,#-8]
 | 
			
		||||
	ldr	$i1,[$key,#-4]
 | 
			
		||||
	eor	$s0,$s0,$t1
 | 
			
		||||
	eor	$s1,$s1,$t2
 | 
			
		||||
	eor	$s2,$s2,$t3
 | 
			
		||||
	eor	$s3,$s3,$i1
 | 
			
		||||
	ldr	$t2,[$key,#-8]
 | 
			
		||||
	eor	$s0,$s0,$i1
 | 
			
		||||
	ldr	$t3,[$key,#-4]
 | 
			
		||||
	and	$i1,lr,$s0
 | 
			
		||||
	eor	$s1,$s1,$t1
 | 
			
		||||
	and	$i2,lr,$s0,lsr#8
 | 
			
		||||
	eor	$s2,$s2,$t2
 | 
			
		||||
	and	$i3,lr,$s0,lsr#16
 | 
			
		||||
	eor	$s3,$s3,$t3
 | 
			
		||||
	mov	$s0,$s0,lsr#24
 | 
			
		||||
 | 
			
		||||
	subs	$rounds,$rounds,#1
 | 
			
		||||
	bne	.Lenc_loop
 | 
			
		||||
 | 
			
		||||
	add	$tbl,$tbl,#2
 | 
			
		||||
 | 
			
		||||
	and	$i1,lr,$s0
 | 
			
		||||
	and	$i2,lr,$s0,lsr#8
 | 
			
		||||
	and	$i3,lr,$s0,lsr#16
 | 
			
		||||
	mov	$s0,$s0,lsr#24
 | 
			
		||||
	ldrb	$t1,[$tbl,$i1,lsl#2]	@ Te4[s0>>0]
 | 
			
		||||
	ldrb	$s0,[$tbl,$s0,lsl#2]	@ Te4[s0>>24]
 | 
			
		||||
	ldrb	$t2,[$tbl,$i2,lsl#2]	@ Te4[s0>>8]
 | 
			
		||||
	ldrb	$t3,[$tbl,$i3,lsl#2]	@ Te4[s0>>16]
 | 
			
		||||
 | 
			
		||||
	and	$i1,lr,$s1,lsr#16	@ i0
 | 
			
		||||
	ldrb	$t2,[$tbl,$i2,lsl#2]	@ Te4[s0>>8]
 | 
			
		||||
	and	$i2,lr,$s1
 | 
			
		||||
	ldrb	$t3,[$tbl,$i3,lsl#2]	@ Te4[s0>>16]
 | 
			
		||||
	and	$i3,lr,$s1,lsr#8
 | 
			
		||||
	ldrb	$s0,[$tbl,$s0,lsl#2]	@ Te4[s0>>24]
 | 
			
		||||
	mov	$s1,$s1,lsr#24
 | 
			
		||||
 | 
			
		||||
	ldrb	$i1,[$tbl,$i1,lsl#2]	@ Te4[s1>>16]
 | 
			
		||||
	ldrb	$s1,[$tbl,$s1,lsl#2]	@ Te4[s1>>24]
 | 
			
		||||
	ldrb	$i2,[$tbl,$i2,lsl#2]	@ Te4[s1>>0]
 | 
			
		||||
	ldrb	$i3,[$tbl,$i3,lsl#2]	@ Te4[s1>>8]
 | 
			
		||||
	eor	$s0,$i1,$s0,lsl#8
 | 
			
		||||
	eor	$s1,$t1,$s1,lsl#24
 | 
			
		||||
	eor	$t2,$i2,$t2,lsl#8
 | 
			
		||||
	eor	$t3,$i3,$t3,lsl#8
 | 
			
		||||
 | 
			
		||||
	ldrb	$s1,[$tbl,$s1,lsl#2]	@ Te4[s1>>24]
 | 
			
		||||
	and	$i1,lr,$s2,lsr#8	@ i0
 | 
			
		||||
	eor	$t2,$i2,$t2,lsl#8
 | 
			
		||||
	and	$i2,lr,$s2,lsr#16	@ i1
 | 
			
		||||
	eor	$t3,$i3,$t3,lsl#8
 | 
			
		||||
	and	$i3,lr,$s2
 | 
			
		||||
	mov	$s2,$s2,lsr#24
 | 
			
		||||
	eor	$s1,$t1,$s1,lsl#24
 | 
			
		||||
	ldrb	$i1,[$tbl,$i1,lsl#2]	@ Te4[s2>>8]
 | 
			
		||||
	mov	$s2,$s2,lsr#24
 | 
			
		||||
 | 
			
		||||
	ldrb	$i2,[$tbl,$i2,lsl#2]	@ Te4[s2>>16]
 | 
			
		||||
	ldrb	$s2,[$tbl,$s2,lsl#2]	@ Te4[s2>>24]
 | 
			
		||||
	ldrb	$i3,[$tbl,$i3,lsl#2]	@ Te4[s2>>0]
 | 
			
		||||
	eor	$s0,$i1,$s0,lsl#8
 | 
			
		||||
	eor	$s1,$s1,$i2,lsl#16
 | 
			
		||||
	eor	$s2,$t2,$s2,lsl#24
 | 
			
		||||
	eor	$t3,$i3,$t3,lsl#8
 | 
			
		||||
 | 
			
		||||
	ldrb	$s2,[$tbl,$s2,lsl#2]	@ Te4[s2>>24]
 | 
			
		||||
	and	$i1,lr,$s3		@ i0
 | 
			
		||||
	eor	$s1,$s1,$i2,lsl#16
 | 
			
		||||
	and	$i2,lr,$s3,lsr#8	@ i1
 | 
			
		||||
	eor	$t3,$i3,$t3,lsl#8
 | 
			
		||||
	and	$i3,lr,$s3,lsr#16	@ i2
 | 
			
		||||
	mov	$s3,$s3,lsr#24
 | 
			
		||||
	eor	$s2,$t2,$s2,lsl#24
 | 
			
		||||
	ldrb	$i1,[$tbl,$i1,lsl#2]	@ Te4[s3>>0]
 | 
			
		||||
	mov	$s3,$s3,lsr#24
 | 
			
		||||
 | 
			
		||||
	ldrb	$i2,[$tbl,$i2,lsl#2]	@ Te4[s3>>8]
 | 
			
		||||
	ldrb	$i3,[$tbl,$i3,lsl#2]	@ Te4[s3>>16]
 | 
			
		||||
	ldrb	$s3,[$tbl,$s3,lsl#2]	@ Te4[s3>>24]
 | 
			
		||||
	eor	$s0,$i1,$s0,lsl#8
 | 
			
		||||
	ldrb	$s3,[$tbl,$s3,lsl#2]	@ Te4[s3>>24]
 | 
			
		||||
	ldr	$i1,[$key,#0]
 | 
			
		||||
	eor	$s1,$s1,$i2,lsl#8
 | 
			
		||||
	ldr	$t1,[$key,#4]
 | 
			
		||||
	eor	$s2,$s2,$i3,lsl#16
 | 
			
		||||
	ldr	$t2,[$key,#8]
 | 
			
		||||
	eor	$s3,$t3,$s3,lsl#24
 | 
			
		||||
	ldr	$t3,[$key,#12]
 | 
			
		||||
 | 
			
		||||
	ldr	lr,[sp],#4		@ pop lr
 | 
			
		||||
	ldr	$t1,[$key,#0]
 | 
			
		||||
	ldr	$t2,[$key,#4]
 | 
			
		||||
	ldr	$t3,[$key,#8]
 | 
			
		||||
	ldr	$i1,[$key,#12]
 | 
			
		||||
	eor	$s0,$s0,$t1
 | 
			
		||||
	eor	$s1,$s1,$t2
 | 
			
		||||
	eor	$s2,$s2,$t3
 | 
			
		||||
	eor	$s3,$s3,$i1
 | 
			
		||||
	eor	$s0,$s0,$i1
 | 
			
		||||
	eor	$s1,$s1,$t1
 | 
			
		||||
	eor	$s2,$s2,$t2
 | 
			
		||||
	eor	$s3,$s3,$t3
 | 
			
		||||
 | 
			
		||||
	sub	$tbl,$tbl,#2
 | 
			
		||||
	mov	pc,lr			@ return
 | 
			
		||||
	ldr	pc,[sp],#4		@ pop and return
 | 
			
		||||
.size	_armv4_AES_encrypt,.-_armv4_AES_encrypt
 | 
			
		||||
 | 
			
		||||
.global AES_set_encrypt_key
 | 
			
		||||
@@ -399,31 +403,31 @@ AES_set_encrypt_key:
 | 
			
		||||
	ldrb	$t2,[$rounds,#1]
 | 
			
		||||
	ldrb	$t3,[$rounds,#0]
 | 
			
		||||
	orr	$s0,$s0,$t1,lsl#8
 | 
			
		||||
	orr	$s0,$s0,$t2,lsl#16
 | 
			
		||||
	orr	$s0,$s0,$t3,lsl#24
 | 
			
		||||
	ldrb	$s1,[$rounds,#7]
 | 
			
		||||
	orr	$s0,$s0,$t2,lsl#16
 | 
			
		||||
	ldrb	$t1,[$rounds,#6]
 | 
			
		||||
	orr	$s0,$s0,$t3,lsl#24
 | 
			
		||||
	ldrb	$t2,[$rounds,#5]
 | 
			
		||||
	ldrb	$t3,[$rounds,#4]
 | 
			
		||||
	orr	$s1,$s1,$t1,lsl#8
 | 
			
		||||
	orr	$s1,$s1,$t2,lsl#16
 | 
			
		||||
	orr	$s1,$s1,$t3,lsl#24
 | 
			
		||||
	ldrb	$s2,[$rounds,#11]
 | 
			
		||||
	orr	$s1,$s1,$t2,lsl#16
 | 
			
		||||
	ldrb	$t1,[$rounds,#10]
 | 
			
		||||
	orr	$s1,$s1,$t3,lsl#24
 | 
			
		||||
	ldrb	$t2,[$rounds,#9]
 | 
			
		||||
	ldrb	$t3,[$rounds,#8]
 | 
			
		||||
	orr	$s2,$s2,$t1,lsl#8
 | 
			
		||||
	orr	$s2,$s2,$t2,lsl#16
 | 
			
		||||
	orr	$s2,$s2,$t3,lsl#24
 | 
			
		||||
	ldrb	$s3,[$rounds,#15]
 | 
			
		||||
	orr	$s2,$s2,$t2,lsl#16
 | 
			
		||||
	ldrb	$t1,[$rounds,#14]
 | 
			
		||||
	orr	$s2,$s2,$t3,lsl#24
 | 
			
		||||
	ldrb	$t2,[$rounds,#13]
 | 
			
		||||
	ldrb	$t3,[$rounds,#12]
 | 
			
		||||
	orr	$s3,$s3,$t1,lsl#8
 | 
			
		||||
	orr	$s3,$s3,$t2,lsl#16
 | 
			
		||||
	orr	$s3,$s3,$t3,lsl#24
 | 
			
		||||
	str	$s0,[$key],#16
 | 
			
		||||
	orr	$s3,$s3,$t2,lsl#16
 | 
			
		||||
	str	$s1,[$key,#-12]
 | 
			
		||||
	orr	$s3,$s3,$t3,lsl#24
 | 
			
		||||
	str	$s2,[$key,#-8]
 | 
			
		||||
	str	$s3,[$key,#-4]
 | 
			
		||||
 | 
			
		||||
@@ -437,27 +441,26 @@ AES_set_encrypt_key:
 | 
			
		||||
.L128_loop:
 | 
			
		||||
	and	$t2,lr,$s3,lsr#24
 | 
			
		||||
	and	$i1,lr,$s3,lsr#16
 | 
			
		||||
	and	$i2,lr,$s3,lsr#8
 | 
			
		||||
	and	$i3,lr,$s3
 | 
			
		||||
	ldrb	$t2,[$tbl,$t2]
 | 
			
		||||
	and	$i2,lr,$s3,lsr#8
 | 
			
		||||
	ldrb	$i1,[$tbl,$i1]
 | 
			
		||||
	and	$i3,lr,$s3
 | 
			
		||||
	ldrb	$i2,[$tbl,$i2]
 | 
			
		||||
	ldrb	$i3,[$tbl,$i3]
 | 
			
		||||
	ldr	$t1,[$t3],#4			@ rcon[i++]
 | 
			
		||||
	orr	$t2,$t2,$i1,lsl#24
 | 
			
		||||
	ldrb	$i3,[$tbl,$i3]
 | 
			
		||||
	orr	$t2,$t2,$i2,lsl#16
 | 
			
		||||
	ldr	$t1,[$t3],#4			@ rcon[i++]
 | 
			
		||||
	orr	$t2,$t2,$i3,lsl#8
 | 
			
		||||
	eor	$t2,$t2,$t1
 | 
			
		||||
	eor	$s0,$s0,$t2			@ rk[4]=rk[0]^...
 | 
			
		||||
	eor	$s1,$s1,$s0			@ rk[5]=rk[1]^rk[4]
 | 
			
		||||
	eor	$s2,$s2,$s1			@ rk[6]=rk[2]^rk[5]
 | 
			
		||||
	eor	$s3,$s3,$s2			@ rk[7]=rk[3]^rk[6]
 | 
			
		||||
	str	$s0,[$key],#16
 | 
			
		||||
	eor	$s2,$s2,$s1			@ rk[6]=rk[2]^rk[5]
 | 
			
		||||
	str	$s1,[$key,#-12]
 | 
			
		||||
	eor	$s3,$s3,$s2			@ rk[7]=rk[3]^rk[6]
 | 
			
		||||
	str	$s2,[$key,#-8]
 | 
			
		||||
	str	$s3,[$key,#-4]
 | 
			
		||||
 | 
			
		||||
	subs	$rounds,$rounds,#1
 | 
			
		||||
	str	$s3,[$key,#-4]
 | 
			
		||||
	bne	.L128_loop
 | 
			
		||||
	sub	r2,$key,#176
 | 
			
		||||
	b	.Ldone
 | 
			
		||||
@@ -468,16 +471,16 @@ AES_set_encrypt_key:
 | 
			
		||||
	ldrb	$t2,[$rounds,#17]
 | 
			
		||||
	ldrb	$t3,[$rounds,#16]
 | 
			
		||||
	orr	$i2,$i2,$t1,lsl#8
 | 
			
		||||
	orr	$i2,$i2,$t2,lsl#16
 | 
			
		||||
	orr	$i2,$i2,$t3,lsl#24
 | 
			
		||||
	ldrb	$i3,[$rounds,#23]
 | 
			
		||||
	orr	$i2,$i2,$t2,lsl#16
 | 
			
		||||
	ldrb	$t1,[$rounds,#22]
 | 
			
		||||
	orr	$i2,$i2,$t3,lsl#24
 | 
			
		||||
	ldrb	$t2,[$rounds,#21]
 | 
			
		||||
	ldrb	$t3,[$rounds,#20]
 | 
			
		||||
	orr	$i3,$i3,$t1,lsl#8
 | 
			
		||||
	orr	$i3,$i3,$t2,lsl#16
 | 
			
		||||
	orr	$i3,$i3,$t3,lsl#24
 | 
			
		||||
	str	$i2,[$key],#8
 | 
			
		||||
	orr	$i3,$i3,$t3,lsl#24
 | 
			
		||||
	str	$i3,[$key,#-4]
 | 
			
		||||
 | 
			
		||||
	teq	lr,#192
 | 
			
		||||
@@ -491,27 +494,26 @@ AES_set_encrypt_key:
 | 
			
		||||
.L192_loop:
 | 
			
		||||
	and	$t2,lr,$i3,lsr#24
 | 
			
		||||
	and	$i1,lr,$i3,lsr#16
 | 
			
		||||
	and	$i2,lr,$i3,lsr#8
 | 
			
		||||
	and	$i3,lr,$i3
 | 
			
		||||
	ldrb	$t2,[$tbl,$t2]
 | 
			
		||||
	and	$i2,lr,$i3,lsr#8
 | 
			
		||||
	ldrb	$i1,[$tbl,$i1]
 | 
			
		||||
	and	$i3,lr,$i3
 | 
			
		||||
	ldrb	$i2,[$tbl,$i2]
 | 
			
		||||
	ldrb	$i3,[$tbl,$i3]
 | 
			
		||||
	ldr	$t1,[$t3],#4			@ rcon[i++]
 | 
			
		||||
	orr	$t2,$t2,$i1,lsl#24
 | 
			
		||||
	ldrb	$i3,[$tbl,$i3]
 | 
			
		||||
	orr	$t2,$t2,$i2,lsl#16
 | 
			
		||||
	ldr	$t1,[$t3],#4			@ rcon[i++]
 | 
			
		||||
	orr	$t2,$t2,$i3,lsl#8
 | 
			
		||||
	eor	$i3,$t2,$t1
 | 
			
		||||
	eor	$s0,$s0,$i3			@ rk[6]=rk[0]^...
 | 
			
		||||
	eor	$s1,$s1,$s0			@ rk[7]=rk[1]^rk[6]
 | 
			
		||||
	eor	$s2,$s2,$s1			@ rk[8]=rk[2]^rk[7]
 | 
			
		||||
	eor	$s3,$s3,$s2			@ rk[9]=rk[3]^rk[8]
 | 
			
		||||
	str	$s0,[$key],#24
 | 
			
		||||
	eor	$s2,$s2,$s1			@ rk[8]=rk[2]^rk[7]
 | 
			
		||||
	str	$s1,[$key,#-20]
 | 
			
		||||
	eor	$s3,$s3,$s2			@ rk[9]=rk[3]^rk[8]
 | 
			
		||||
	str	$s2,[$key,#-16]
 | 
			
		||||
	str	$s3,[$key,#-12]
 | 
			
		||||
 | 
			
		||||
	subs	$rounds,$rounds,#1
 | 
			
		||||
	str	$s3,[$key,#-12]
 | 
			
		||||
	subeq	r2,$key,#216
 | 
			
		||||
	beq	.Ldone
 | 
			
		||||
 | 
			
		||||
@@ -529,16 +531,16 @@ AES_set_encrypt_key:
 | 
			
		||||
	ldrb	$t2,[$rounds,#25]
 | 
			
		||||
	ldrb	$t3,[$rounds,#24]
 | 
			
		||||
	orr	$i2,$i2,$t1,lsl#8
 | 
			
		||||
	orr	$i2,$i2,$t2,lsl#16
 | 
			
		||||
	orr	$i2,$i2,$t3,lsl#24
 | 
			
		||||
	ldrb	$i3,[$rounds,#31]
 | 
			
		||||
	orr	$i2,$i2,$t2,lsl#16
 | 
			
		||||
	ldrb	$t1,[$rounds,#30]
 | 
			
		||||
	orr	$i2,$i2,$t3,lsl#24
 | 
			
		||||
	ldrb	$t2,[$rounds,#29]
 | 
			
		||||
	ldrb	$t3,[$rounds,#28]
 | 
			
		||||
	orr	$i3,$i3,$t1,lsl#8
 | 
			
		||||
	orr	$i3,$i3,$t2,lsl#16
 | 
			
		||||
	orr	$i3,$i3,$t3,lsl#24
 | 
			
		||||
	str	$i2,[$key],#8
 | 
			
		||||
	orr	$i3,$i3,$t3,lsl#24
 | 
			
		||||
	str	$i3,[$key,#-4]
 | 
			
		||||
 | 
			
		||||
	mov	$rounds,#14
 | 
			
		||||
@@ -550,52 +552,51 @@ AES_set_encrypt_key:
 | 
			
		||||
.L256_loop:
 | 
			
		||||
	and	$t2,lr,$i3,lsr#24
 | 
			
		||||
	and	$i1,lr,$i3,lsr#16
 | 
			
		||||
	and	$i2,lr,$i3,lsr#8
 | 
			
		||||
	and	$i3,lr,$i3
 | 
			
		||||
	ldrb	$t2,[$tbl,$t2]
 | 
			
		||||
	and	$i2,lr,$i3,lsr#8
 | 
			
		||||
	ldrb	$i1,[$tbl,$i1]
 | 
			
		||||
	and	$i3,lr,$i3
 | 
			
		||||
	ldrb	$i2,[$tbl,$i2]
 | 
			
		||||
	ldrb	$i3,[$tbl,$i3]
 | 
			
		||||
	ldr	$t1,[$t3],#4			@ rcon[i++]
 | 
			
		||||
	orr	$t2,$t2,$i1,lsl#24
 | 
			
		||||
	ldrb	$i3,[$tbl,$i3]
 | 
			
		||||
	orr	$t2,$t2,$i2,lsl#16
 | 
			
		||||
	ldr	$t1,[$t3],#4			@ rcon[i++]
 | 
			
		||||
	orr	$t2,$t2,$i3,lsl#8
 | 
			
		||||
	eor	$i3,$t2,$t1
 | 
			
		||||
	eor	$s0,$s0,$i3			@ rk[8]=rk[0]^...
 | 
			
		||||
	eor	$s1,$s1,$s0			@ rk[9]=rk[1]^rk[8]
 | 
			
		||||
	eor	$s2,$s2,$s1			@ rk[10]=rk[2]^rk[9]
 | 
			
		||||
	eor	$s3,$s3,$s2			@ rk[11]=rk[3]^rk[10]
 | 
			
		||||
	str	$s0,[$key],#32
 | 
			
		||||
	eor	$s2,$s2,$s1			@ rk[10]=rk[2]^rk[9]
 | 
			
		||||
	str	$s1,[$key,#-28]
 | 
			
		||||
	eor	$s3,$s3,$s2			@ rk[11]=rk[3]^rk[10]
 | 
			
		||||
	str	$s2,[$key,#-24]
 | 
			
		||||
	str	$s3,[$key,#-20]
 | 
			
		||||
 | 
			
		||||
	subs	$rounds,$rounds,#1
 | 
			
		||||
	str	$s3,[$key,#-20]
 | 
			
		||||
	subeq	r2,$key,#256
 | 
			
		||||
	beq	.Ldone
 | 
			
		||||
 | 
			
		||||
	and	$t2,lr,$s3
 | 
			
		||||
	and	$i1,lr,$s3,lsr#8
 | 
			
		||||
	and	$i2,lr,$s3,lsr#16
 | 
			
		||||
	and	$i3,lr,$s3,lsr#24
 | 
			
		||||
	ldrb	$t2,[$tbl,$t2]
 | 
			
		||||
	and	$i2,lr,$s3,lsr#16
 | 
			
		||||
	ldrb	$i1,[$tbl,$i1]
 | 
			
		||||
	and	$i3,lr,$s3,lsr#24
 | 
			
		||||
	ldrb	$i2,[$tbl,$i2]
 | 
			
		||||
	ldrb	$i3,[$tbl,$i3]
 | 
			
		||||
	orr	$t2,$t2,$i1,lsl#8
 | 
			
		||||
	ldrb	$i3,[$tbl,$i3]
 | 
			
		||||
	orr	$t2,$t2,$i2,lsl#16
 | 
			
		||||
	ldr	$t1,[$key,#-48]
 | 
			
		||||
	orr	$t2,$t2,$i3,lsl#24
 | 
			
		||||
 | 
			
		||||
	ldr	$t1,[$key,#-48]
 | 
			
		||||
	ldr	$i1,[$key,#-44]
 | 
			
		||||
	ldr	$i2,[$key,#-40]
 | 
			
		||||
	ldr	$i3,[$key,#-36]
 | 
			
		||||
	eor	$t1,$t1,$t2			@ rk[12]=rk[4]^...
 | 
			
		||||
	ldr	$i3,[$key,#-36]
 | 
			
		||||
	eor	$i1,$i1,$t1			@ rk[13]=rk[5]^rk[12]
 | 
			
		||||
	eor	$i2,$i2,$i1			@ rk[14]=rk[6]^rk[13]
 | 
			
		||||
	eor	$i3,$i3,$i2			@ rk[15]=rk[7]^rk[14]
 | 
			
		||||
	str	$t1,[$key,#-16]
 | 
			
		||||
	eor	$i2,$i2,$i1			@ rk[14]=rk[6]^rk[13]
 | 
			
		||||
	str	$i1,[$key,#-12]
 | 
			
		||||
	eor	$i3,$i3,$i2			@ rk[15]=rk[7]^rk[14]
 | 
			
		||||
	str	$i2,[$key,#-8]
 | 
			
		||||
	str	$i3,[$key,#-4]
 | 
			
		||||
	b	.L256_loop
 | 
			
		||||
@@ -816,24 +817,24 @@ AES_decrypt:
 | 
			
		||||
	ldrb	$t2,[$rounds,#1]
 | 
			
		||||
	ldrb	$t3,[$rounds,#0]
 | 
			
		||||
	orr	$s0,$s0,$t1,lsl#8
 | 
			
		||||
	orr	$s0,$s0,$t2,lsl#16
 | 
			
		||||
	orr	$s0,$s0,$t3,lsl#24
 | 
			
		||||
	ldrb	$s1,[$rounds,#7]
 | 
			
		||||
	orr	$s0,$s0,$t2,lsl#16
 | 
			
		||||
	ldrb	$t1,[$rounds,#6]
 | 
			
		||||
	orr	$s0,$s0,$t3,lsl#24
 | 
			
		||||
	ldrb	$t2,[$rounds,#5]
 | 
			
		||||
	ldrb	$t3,[$rounds,#4]
 | 
			
		||||
	orr	$s1,$s1,$t1,lsl#8
 | 
			
		||||
	orr	$s1,$s1,$t2,lsl#16
 | 
			
		||||
	orr	$s1,$s1,$t3,lsl#24
 | 
			
		||||
	ldrb	$s2,[$rounds,#11]
 | 
			
		||||
	orr	$s1,$s1,$t2,lsl#16
 | 
			
		||||
	ldrb	$t1,[$rounds,#10]
 | 
			
		||||
	orr	$s1,$s1,$t3,lsl#24
 | 
			
		||||
	ldrb	$t2,[$rounds,#9]
 | 
			
		||||
	ldrb	$t3,[$rounds,#8]
 | 
			
		||||
	orr	$s2,$s2,$t1,lsl#8
 | 
			
		||||
	orr	$s2,$s2,$t2,lsl#16
 | 
			
		||||
	orr	$s2,$s2,$t3,lsl#24
 | 
			
		||||
	ldrb	$s3,[$rounds,#15]
 | 
			
		||||
	orr	$s2,$s2,$t2,lsl#16
 | 
			
		||||
	ldrb	$t1,[$rounds,#14]
 | 
			
		||||
	orr	$s2,$s2,$t3,lsl#24
 | 
			
		||||
	ldrb	$t2,[$rounds,#13]
 | 
			
		||||
	ldrb	$t3,[$rounds,#12]
 | 
			
		||||
	orr	$s3,$s3,$t1,lsl#8
 | 
			
		||||
@@ -848,24 +849,24 @@ AES_decrypt:
 | 
			
		||||
	mov	$t3,$s0,lsr#8
 | 
			
		||||
	strb	$t1,[$rounds,#0]
 | 
			
		||||
	strb	$t2,[$rounds,#1]
 | 
			
		||||
	strb	$t3,[$rounds,#2]
 | 
			
		||||
	strb	$s0,[$rounds,#3]
 | 
			
		||||
	mov	$t1,$s1,lsr#24
 | 
			
		||||
	strb	$t3,[$rounds,#2]
 | 
			
		||||
	mov	$t2,$s1,lsr#16
 | 
			
		||||
	strb	$s0,[$rounds,#3]
 | 
			
		||||
	mov	$t3,$s1,lsr#8
 | 
			
		||||
	strb	$t1,[$rounds,#4]
 | 
			
		||||
	strb	$t2,[$rounds,#5]
 | 
			
		||||
	strb	$t3,[$rounds,#6]
 | 
			
		||||
	strb	$s1,[$rounds,#7]
 | 
			
		||||
	mov	$t1,$s2,lsr#24
 | 
			
		||||
	strb	$t3,[$rounds,#6]
 | 
			
		||||
	mov	$t2,$s2,lsr#16
 | 
			
		||||
	strb	$s1,[$rounds,#7]
 | 
			
		||||
	mov	$t3,$s2,lsr#8
 | 
			
		||||
	strb	$t1,[$rounds,#8]
 | 
			
		||||
	strb	$t2,[$rounds,#9]
 | 
			
		||||
	strb	$t3,[$rounds,#10]
 | 
			
		||||
	strb	$s2,[$rounds,#11]
 | 
			
		||||
	mov	$t1,$s3,lsr#24
 | 
			
		||||
	strb	$t3,[$rounds,#10]
 | 
			
		||||
	mov	$t2,$s3,lsr#16
 | 
			
		||||
	strb	$s2,[$rounds,#11]
 | 
			
		||||
	mov	$t3,$s3,lsr#8
 | 
			
		||||
	strb	$t1,[$rounds,#12]
 | 
			
		||||
	strb	$t2,[$rounds,#13]
 | 
			
		||||
@@ -882,146 +883,143 @@ AES_decrypt:
 | 
			
		||||
.align	2
 | 
			
		||||
_armv4_AES_decrypt:
 | 
			
		||||
	str	lr,[sp,#-4]!		@ push lr
 | 
			
		||||
	ldr	$t1,[$key],#16
 | 
			
		||||
	ldr	$t2,[$key,#-12]
 | 
			
		||||
	ldr	$t3,[$key,#-8]
 | 
			
		||||
	ldr	$i1,[$key,#-4]
 | 
			
		||||
	ldr	$rounds,[$key,#240-16]
 | 
			
		||||
	ldmia	$key!,{$t1-$i1}
 | 
			
		||||
	eor	$s0,$s0,$t1
 | 
			
		||||
	ldr	$rounds,[$key,#240-16]
 | 
			
		||||
	eor	$s1,$s1,$t2
 | 
			
		||||
	eor	$s2,$s2,$t3
 | 
			
		||||
	eor	$s3,$s3,$i1
 | 
			
		||||
	sub	$rounds,$rounds,#1
 | 
			
		||||
	mov	lr,#255
 | 
			
		||||
 | 
			
		||||
.Ldec_loop:
 | 
			
		||||
	and	$i1,lr,$s0,lsr#16
 | 
			
		||||
	and	$i2,lr,$s0,lsr#8
 | 
			
		||||
	and	$i3,lr,$s0
 | 
			
		||||
	mov	$s0,$s0,lsr#24
 | 
			
		||||
.Ldec_loop:
 | 
			
		||||
	ldr	$t1,[$tbl,$i1,lsl#2]	@ Td1[s0>>16]
 | 
			
		||||
	ldr	$s0,[$tbl,$s0,lsl#2]	@ Td0[s0>>24]
 | 
			
		||||
	ldr	$t2,[$tbl,$i2,lsl#2]	@ Td2[s0>>8]
 | 
			
		||||
	ldr	$t3,[$tbl,$i3,lsl#2]	@ Td3[s0>>0]
 | 
			
		||||
 | 
			
		||||
	and	$i1,lr,$s1		@ i0
 | 
			
		||||
	ldr	$t2,[$tbl,$i2,lsl#2]	@ Td2[s0>>8]
 | 
			
		||||
	and	$i2,lr,$s1,lsr#16
 | 
			
		||||
	ldr	$t3,[$tbl,$i3,lsl#2]	@ Td3[s0>>0]
 | 
			
		||||
	and	$i3,lr,$s1,lsr#8
 | 
			
		||||
	ldr	$s0,[$tbl,$s0,lsl#2]	@ Td0[s0>>24]
 | 
			
		||||
	mov	$s1,$s1,lsr#24
 | 
			
		||||
 | 
			
		||||
	ldr	$i1,[$tbl,$i1,lsl#2]	@ Td3[s1>>0]
 | 
			
		||||
	ldr	$s1,[$tbl,$s1,lsl#2]	@ Td0[s1>>24]
 | 
			
		||||
	ldr	$i2,[$tbl,$i2,lsl#2]	@ Td1[s1>>16]
 | 
			
		||||
	ldr	$i3,[$tbl,$i3,lsl#2]	@ Td2[s1>>8]
 | 
			
		||||
	eor	$s0,$s0,$i1,ror#24
 | 
			
		||||
	eor	$s1,$s1,$t1,ror#8
 | 
			
		||||
	eor	$t2,$i2,$t2,ror#8
 | 
			
		||||
	eor	$t3,$i3,$t3,ror#8
 | 
			
		||||
 | 
			
		||||
	ldr	$s1,[$tbl,$s1,lsl#2]	@ Td0[s1>>24]
 | 
			
		||||
	and	$i1,lr,$s2,lsr#8	@ i0
 | 
			
		||||
	eor	$t2,$i2,$t2,ror#8
 | 
			
		||||
	and	$i2,lr,$s2		@ i1
 | 
			
		||||
	eor	$t3,$i3,$t3,ror#8
 | 
			
		||||
	and	$i3,lr,$s2,lsr#16
 | 
			
		||||
	mov	$s2,$s2,lsr#24
 | 
			
		||||
	eor	$s1,$s1,$t1,ror#8
 | 
			
		||||
	ldr	$i1,[$tbl,$i1,lsl#2]	@ Td2[s2>>8]
 | 
			
		||||
	mov	$s2,$s2,lsr#24
 | 
			
		||||
 | 
			
		||||
	ldr	$i2,[$tbl,$i2,lsl#2]	@ Td3[s2>>0]
 | 
			
		||||
	ldr	$s2,[$tbl,$s2,lsl#2]	@ Td0[s2>>24]
 | 
			
		||||
	ldr	$i3,[$tbl,$i3,lsl#2]	@ Td1[s2>>16]
 | 
			
		||||
	eor	$s0,$s0,$i1,ror#16
 | 
			
		||||
	eor	$s1,$s1,$i2,ror#24
 | 
			
		||||
	eor	$s2,$s2,$t2,ror#8
 | 
			
		||||
	eor	$t3,$i3,$t3,ror#8
 | 
			
		||||
 | 
			
		||||
	ldr	$s2,[$tbl,$s2,lsl#2]	@ Td0[s2>>24]
 | 
			
		||||
	and	$i1,lr,$s3,lsr#16	@ i0
 | 
			
		||||
	eor	$s1,$s1,$i2,ror#24
 | 
			
		||||
	and	$i2,lr,$s3,lsr#8	@ i1
 | 
			
		||||
	eor	$t3,$i3,$t3,ror#8
 | 
			
		||||
	and	$i3,lr,$s3		@ i2
 | 
			
		||||
	mov	$s3,$s3,lsr#24
 | 
			
		||||
	eor	$s2,$s2,$t2,ror#8
 | 
			
		||||
	ldr	$i1,[$tbl,$i1,lsl#2]	@ Td1[s3>>16]
 | 
			
		||||
	mov	$s3,$s3,lsr#24
 | 
			
		||||
 | 
			
		||||
	ldr	$i2,[$tbl,$i2,lsl#2]	@ Td2[s3>>8]
 | 
			
		||||
	ldr	$i3,[$tbl,$i3,lsl#2]	@ Td3[s3>>0]
 | 
			
		||||
	ldr	$s3,[$tbl,$s3,lsl#2]	@ Td0[s3>>24]
 | 
			
		||||
	eor	$s0,$s0,$i1,ror#8
 | 
			
		||||
	ldr	$s3,[$tbl,$s3,lsl#2]	@ Td0[s3>>24]
 | 
			
		||||
	eor	$s1,$s1,$i2,ror#16
 | 
			
		||||
	eor	$s2,$s2,$i3,ror#24
 | 
			
		||||
	ldr	$i1,[$key],#16
 | 
			
		||||
	eor	$s3,$s3,$t3,ror#8
 | 
			
		||||
 | 
			
		||||
	ldr	$t1,[$key],#16
 | 
			
		||||
	ldr	$t2,[$key,#-12]
 | 
			
		||||
	ldr	$t3,[$key,#-8]
 | 
			
		||||
	ldr	$i1,[$key,#-4]
 | 
			
		||||
	eor	$s0,$s0,$t1
 | 
			
		||||
	eor	$s1,$s1,$t2
 | 
			
		||||
	eor	$s2,$s2,$t3
 | 
			
		||||
	eor	$s3,$s3,$i1
 | 
			
		||||
	ldr	$t1,[$key,#-12]
 | 
			
		||||
	ldr	$t2,[$key,#-8]
 | 
			
		||||
	eor	$s0,$s0,$i1
 | 
			
		||||
	ldr	$t3,[$key,#-4]
 | 
			
		||||
	and	$i1,lr,$s0,lsr#16
 | 
			
		||||
	eor	$s1,$s1,$t1
 | 
			
		||||
	and	$i2,lr,$s0,lsr#8
 | 
			
		||||
	eor	$s2,$s2,$t2
 | 
			
		||||
	and	$i3,lr,$s0
 | 
			
		||||
	eor	$s3,$s3,$t3
 | 
			
		||||
	mov	$s0,$s0,lsr#24
 | 
			
		||||
 | 
			
		||||
	subs	$rounds,$rounds,#1
 | 
			
		||||
	bne	.Ldec_loop
 | 
			
		||||
 | 
			
		||||
	add	$tbl,$tbl,#1024
 | 
			
		||||
 | 
			
		||||
	ldr	$t1,[$tbl,#0]		@ prefetch Td4
 | 
			
		||||
	ldr	$t2,[$tbl,#32]
 | 
			
		||||
	ldr	$t3,[$tbl,#64]
 | 
			
		||||
	ldr	$i1,[$tbl,#96]
 | 
			
		||||
	ldr	$i2,[$tbl,#128]
 | 
			
		||||
	ldr	$i3,[$tbl,#160]
 | 
			
		||||
	ldr	$t1,[$tbl,#192]
 | 
			
		||||
	ldr	$t2,[$tbl,#224]
 | 
			
		||||
	ldr	$t2,[$tbl,#0]		@ prefetch Td4
 | 
			
		||||
	ldr	$t3,[$tbl,#32]
 | 
			
		||||
	ldr	$t1,[$tbl,#64]
 | 
			
		||||
	ldr	$t2,[$tbl,#96]
 | 
			
		||||
	ldr	$t3,[$tbl,#128]
 | 
			
		||||
	ldr	$t1,[$tbl,#160]
 | 
			
		||||
	ldr	$t2,[$tbl,#192]
 | 
			
		||||
	ldr	$t3,[$tbl,#224]
 | 
			
		||||
 | 
			
		||||
	and	$i1,lr,$s0,lsr#16
 | 
			
		||||
	and	$i2,lr,$s0,lsr#8
 | 
			
		||||
	and	$i3,lr,$s0
 | 
			
		||||
	ldrb	$s0,[$tbl,$s0,lsr#24]	@ Td4[s0>>24]
 | 
			
		||||
	ldrb	$s0,[$tbl,$s0]		@ Td4[s0>>24]
 | 
			
		||||
	ldrb	$t1,[$tbl,$i1]		@ Td4[s0>>16]
 | 
			
		||||
	ldrb	$t2,[$tbl,$i2]		@ Td4[s0>>8]
 | 
			
		||||
	ldrb	$t3,[$tbl,$i3]		@ Td4[s0>>0]
 | 
			
		||||
 | 
			
		||||
	and	$i1,lr,$s1		@ i0
 | 
			
		||||
	ldrb	$t2,[$tbl,$i2]		@ Td4[s0>>8]
 | 
			
		||||
	and	$i2,lr,$s1,lsr#16
 | 
			
		||||
	ldrb	$t3,[$tbl,$i3]		@ Td4[s0>>0]
 | 
			
		||||
	and	$i3,lr,$s1,lsr#8
 | 
			
		||||
 | 
			
		||||
	ldrb	$i1,[$tbl,$i1]		@ Td4[s1>>0]
 | 
			
		||||
	ldrb	$s1,[$tbl,$s1,lsr#24]	@ Td4[s1>>24]
 | 
			
		||||
	ldrb	$i2,[$tbl,$i2]		@ Td4[s1>>16]
 | 
			
		||||
	ldrb	$i3,[$tbl,$i3]		@ Td4[s1>>8]
 | 
			
		||||
	eor	$s0,$i1,$s0,lsl#24
 | 
			
		||||
	ldrb	$i3,[$tbl,$i3]		@ Td4[s1>>8]
 | 
			
		||||
	eor	$s1,$t1,$s1,lsl#8
 | 
			
		||||
	eor	$t2,$t2,$i2,lsl#8
 | 
			
		||||
	eor	$t3,$t3,$i3,lsl#8
 | 
			
		||||
 | 
			
		||||
	and	$i1,lr,$s2,lsr#8	@ i0
 | 
			
		||||
	eor	$t2,$t2,$i2,lsl#8
 | 
			
		||||
	and	$i2,lr,$s2		@ i1
 | 
			
		||||
	and	$i3,lr,$s2,lsr#16
 | 
			
		||||
	eor	$t3,$t3,$i3,lsl#8
 | 
			
		||||
	ldrb	$i1,[$tbl,$i1]		@ Td4[s2>>8]
 | 
			
		||||
	and	$i3,lr,$s2,lsr#16
 | 
			
		||||
 | 
			
		||||
	ldrb	$i2,[$tbl,$i2]		@ Td4[s2>>0]
 | 
			
		||||
	ldrb	$s2,[$tbl,$s2,lsr#24]	@ Td4[s2>>24]
 | 
			
		||||
	ldrb	$i3,[$tbl,$i3]		@ Td4[s2>>16]
 | 
			
		||||
	eor	$s0,$s0,$i1,lsl#8
 | 
			
		||||
	ldrb	$i3,[$tbl,$i3]		@ Td4[s2>>16]
 | 
			
		||||
	eor	$s1,$i2,$s1,lsl#16
 | 
			
		||||
	eor	$s2,$t2,$s2,lsl#16
 | 
			
		||||
	eor	$t3,$t3,$i3,lsl#16
 | 
			
		||||
 | 
			
		||||
	and	$i1,lr,$s3,lsr#16	@ i0
 | 
			
		||||
	eor	$s2,$t2,$s2,lsl#16
 | 
			
		||||
	and	$i2,lr,$s3,lsr#8	@ i1
 | 
			
		||||
	and	$i3,lr,$s3		@ i2
 | 
			
		||||
	eor	$t3,$t3,$i3,lsl#16
 | 
			
		||||
	ldrb	$i1,[$tbl,$i1]		@ Td4[s3>>16]
 | 
			
		||||
	and	$i3,lr,$s3		@ i2
 | 
			
		||||
 | 
			
		||||
	ldrb	$i2,[$tbl,$i2]		@ Td4[s3>>8]
 | 
			
		||||
	ldrb	$i3,[$tbl,$i3]		@ Td4[s3>>0]
 | 
			
		||||
	ldrb	$s3,[$tbl,$s3,lsr#24]	@ Td4[s3>>24]
 | 
			
		||||
	eor	$s0,$s0,$i1,lsl#16
 | 
			
		||||
	ldr	$i1,[$key,#0]
 | 
			
		||||
	eor	$s1,$s1,$i2,lsl#8
 | 
			
		||||
	ldr	$t1,[$key,#4]
 | 
			
		||||
	eor	$s2,$i3,$s2,lsl#8
 | 
			
		||||
	ldr	$t2,[$key,#8]
 | 
			
		||||
	eor	$s3,$t3,$s3,lsl#24
 | 
			
		||||
	ldr	$t3,[$key,#12]
 | 
			
		||||
 | 
			
		||||
	ldr	lr,[sp],#4		@ pop lr
 | 
			
		||||
	ldr	$t1,[$key,#0]
 | 
			
		||||
	ldr	$t2,[$key,#4]
 | 
			
		||||
	ldr	$t3,[$key,#8]
 | 
			
		||||
	ldr	$i1,[$key,#12]
 | 
			
		||||
	eor	$s0,$s0,$t1
 | 
			
		||||
	eor	$s1,$s1,$t2
 | 
			
		||||
	eor	$s2,$s2,$t3
 | 
			
		||||
	eor	$s3,$s3,$i1
 | 
			
		||||
	eor	$s0,$s0,$i1
 | 
			
		||||
	eor	$s1,$s1,$t1
 | 
			
		||||
	eor	$s2,$s2,$t2
 | 
			
		||||
	eor	$s3,$s3,$t3
 | 
			
		||||
 | 
			
		||||
	sub	$tbl,$tbl,#1024
 | 
			
		||||
	mov	pc,lr			@ return
 | 
			
		||||
	ldr	pc,[sp],#4		@ pop and return
 | 
			
		||||
.size	_armv4_AES_decrypt,.-_armv4_AES_decrypt
 | 
			
		||||
.asciz	"AES for ARMv4, CRYPTOGAMS by <appro\@openssl.org>"
 | 
			
		||||
.align	2
 | 
			
		||||
@@ -1029,3 +1027,4 @@ ___
 | 
			
		||||
 | 
			
		||||
$code =~ s/\bbx\s+lr\b/.word\t0xe12fff1e/gm;	# make it possible to compile with -march=armv4
 | 
			
		||||
print $code;
 | 
			
		||||
close STDOUT;	# enforce flush
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,5 @@
 | 
			
		||||
#!/usr/bin/env perl
 | 
			
		||||
print <<'___';
 | 
			
		||||
.text
 | 
			
		||||
 | 
			
		||||
.set	noat
 | 
			
		||||
@@ -68,9 +70,9 @@ OPENSSL_wipe_cpu:
 | 
			
		||||
OPENSSL_atomic_add:
 | 
			
		||||
	.frame	$30,0,$26
 | 
			
		||||
	.prologue 0
 | 
			
		||||
1:	ldl_l	$0,($16)
 | 
			
		||||
1:	ldl_l	$0,0($16)
 | 
			
		||||
	addl	$0,$17,$1
 | 
			
		||||
	stl_c	$1,($16)
 | 
			
		||||
	stl_c	$1,0($16)
 | 
			
		||||
	beq	$1,1b
 | 
			
		||||
	addl	$0,$17,$0
 | 
			
		||||
	ret	($26)
 | 
			
		||||
@@ -123,3 +125,4 @@ OPENSSL_cleanse:
 | 
			
		||||
	br	.Little
 | 
			
		||||
.Ldone: ret	($26)
 | 
			
		||||
.end	OPENSSL_cleanse
 | 
			
		||||
___
 | 
			
		||||
@@ -74,6 +74,11 @@
 | 
			
		||||
 | 
			
		||||
#define CHARTYPE_BS_ESC		(ASN1_STRFLGS_ESC_2253 | CHARTYPE_FIRST_ESC_2253 | CHARTYPE_LAST_ESC_2253)
 | 
			
		||||
 | 
			
		||||
#define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \
 | 
			
		||||
		  ASN1_STRFLGS_ESC_QUOTE | \
 | 
			
		||||
		  ASN1_STRFLGS_ESC_CTRL | \
 | 
			
		||||
		  ASN1_STRFLGS_ESC_MSB)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Three IO functions for sending data to memory, a BIO and
 | 
			
		||||
 * and a FILE pointer.
 | 
			
		||||
@@ -148,6 +153,13 @@ static int do_esc_char(unsigned long c, unsigned char flags, char *do_quotes, ch
 | 
			
		||||
		if(!io_ch(arg, tmphex, 3)) return -1;
 | 
			
		||||
		return 3;
 | 
			
		||||
	}
 | 
			
		||||
	/* If we get this far and do any escaping at all must escape 
 | 
			
		||||
	 * the escape character itself: backslash.
 | 
			
		||||
	 */
 | 
			
		||||
	if (chtmp == '\\' && flags & ESC_FLAGS) {
 | 
			
		||||
		if(!io_ch(arg, "\\\\", 2)) return -1;
 | 
			
		||||
		return 2;
 | 
			
		||||
	}
 | 
			
		||||
	if(!io_ch(arg, &chtmp, 1)) return -1;
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
@@ -292,11 +304,6 @@ static const signed char tag2nbyte[] = {
 | 
			
		||||
	4, -1, 2		/* 28-30 */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \
 | 
			
		||||
		  ASN1_STRFLGS_ESC_QUOTE | \
 | 
			
		||||
		  ASN1_STRFLGS_ESC_CTRL | \
 | 
			
		||||
		  ASN1_STRFLGS_ESC_MSB)
 | 
			
		||||
 | 
			
		||||
/* This is the main function, print out an
 | 
			
		||||
 * ASN1_STRING taking note of various escape
 | 
			
		||||
 * and display options. Returns number of
 | 
			
		||||
 
 | 
			
		||||
@@ -95,7 +95,7 @@ unsigned long ASN1_STRING_get_default_mask(void)
 | 
			
		||||
 * default:   the default value, Printable, T61, BMP.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
int ASN1_STRING_set_default_mask_asc(char *p)
 | 
			
		||||
int ASN1_STRING_set_default_mask_asc(const char *p)
 | 
			
		||||
{
 | 
			
		||||
	unsigned long mask;
 | 
			
		||||
	char *end;
 | 
			
		||||
 
 | 
			
		||||
@@ -172,7 +172,6 @@ static const EVP_PKEY_ASN1_METHOD *pkey_asn1_find(int type)
 | 
			
		||||
const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type)
 | 
			
		||||
	{
 | 
			
		||||
	const EVP_PKEY_ASN1_METHOD *t;
 | 
			
		||||
	ENGINE *e;
 | 
			
		||||
 | 
			
		||||
	for (;;)
 | 
			
		||||
		{
 | 
			
		||||
@@ -184,6 +183,7 @@ const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type)
 | 
			
		||||
	if (pe)
 | 
			
		||||
		{
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
		ENGINE *e;
 | 
			
		||||
		/* type will contain the final unaliased type */
 | 
			
		||||
		e = ENGINE_get_pkey_asn1_meth_engine(type);
 | 
			
		||||
		if (e)
 | 
			
		||||
 
 | 
			
		||||
@@ -1067,7 +1067,7 @@ ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
 | 
			
		||||
ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct);
 | 
			
		||||
 | 
			
		||||
void ASN1_STRING_set_default_mask(unsigned long mask);
 | 
			
		||||
int ASN1_STRING_set_default_mask_asc(char *p);
 | 
			
		||||
int ASN1_STRING_set_default_mask_asc(const char *p);
 | 
			
		||||
unsigned long ASN1_STRING_get_default_mask(void);
 | 
			
		||||
int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
 | 
			
		||||
					int inform, unsigned long mask);
 | 
			
		||||
 
 | 
			
		||||
@@ -63,7 +63,7 @@
 | 
			
		||||
#include <openssl/x509.h>
 | 
			
		||||
#include <openssl/x509v3.h>
 | 
			
		||||
 | 
			
		||||
ASN1_SEQUENCE(X509_CINF) = {
 | 
			
		||||
ASN1_SEQUENCE_enc(X509_CINF, enc, 0) = {
 | 
			
		||||
	ASN1_EXP_OPT(X509_CINF, version, ASN1_INTEGER, 0),
 | 
			
		||||
	ASN1_SIMPLE(X509_CINF, serialNumber, ASN1_INTEGER),
 | 
			
		||||
	ASN1_SIMPLE(X509_CINF, signature, X509_ALGOR),
 | 
			
		||||
@@ -74,7 +74,7 @@ ASN1_SEQUENCE(X509_CINF) = {
 | 
			
		||||
	ASN1_IMP_OPT(X509_CINF, issuerUID, ASN1_BIT_STRING, 1),
 | 
			
		||||
	ASN1_IMP_OPT(X509_CINF, subjectUID, ASN1_BIT_STRING, 2),
 | 
			
		||||
	ASN1_EXP_SEQUENCE_OF_OPT(X509_CINF, extensions, X509_EXTENSION, 3)
 | 
			
		||||
} ASN1_SEQUENCE_END(X509_CINF)
 | 
			
		||||
} ASN1_SEQUENCE_END_enc(X509_CINF, X509_CINF)
 | 
			
		||||
 | 
			
		||||
IMPLEMENT_ASN1_FUNCTIONS(X509_CINF)
 | 
			
		||||
/* X509 top level structure needs a bit of customisation */
 | 
			
		||||
 
 | 
			
		||||
@@ -340,7 +340,7 @@ static int dgram_write(BIO *b, const char *in, int inl)
 | 
			
		||||
 | 
			
		||||
		if (data->peer.sa.sa_family == AF_INET)
 | 
			
		||||
			peerlen = sizeof(data->peer.sa_in);
 | 
			
		||||
#if OPENSSL_USE_IVP6
 | 
			
		||||
#if OPENSSL_USE_IPV6
 | 
			
		||||
		else if (data->peer.sa.sa_family == AF_INET6)
 | 
			
		||||
			peerlen = sizeof(data->peer.sa_in6);
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -123,6 +123,7 @@ BIO *BIO_new_file(const char *filename, const char *mode)
 | 
			
		||||
 | 
			
		||||
#if defined(_WIN32) && defined(CP_UTF8)
 | 
			
		||||
	int sz, len_0 = (int)strlen(filename)+1;
 | 
			
		||||
	DWORD flags;
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Basically there are three cases to cover: a) filename is
 | 
			
		||||
@@ -136,17 +137,22 @@ BIO *BIO_new_file(const char *filename, const char *mode)
 | 
			
		||||
	 * ERROR_NO_UNICODE_TRANSLATION, in which case we fall
 | 
			
		||||
	 * back to fopen...
 | 
			
		||||
	 */
 | 
			
		||||
	if ((sz=MultiByteToWideChar(CP_UTF8,MB_ERR_INVALID_CHARS,
 | 
			
		||||
	if ((sz=MultiByteToWideChar(CP_UTF8,(flags=MB_ERR_INVALID_CHARS),
 | 
			
		||||
					filename,len_0,NULL,0))>0 ||
 | 
			
		||||
	    (GetLastError()==ERROR_INVALID_FLAGS &&
 | 
			
		||||
	     (sz=MultiByteToWideChar(CP_UTF8,(flags=0),
 | 
			
		||||
					filename,len_0,NULL,0))>0)
 | 
			
		||||
	   )
 | 
			
		||||
		{
 | 
			
		||||
		WCHAR  wmode[8];
 | 
			
		||||
		WCHAR *wfilename = _alloca(sz*sizeof(WCHAR));
 | 
			
		||||
 | 
			
		||||
		if (MultiByteToWideChar(CP_UTF8,MB_ERR_INVALID_CHARS,
 | 
			
		||||
		if (MultiByteToWideChar(CP_UTF8,flags,
 | 
			
		||||
					filename,len_0,wfilename,sz) &&
 | 
			
		||||
		    MultiByteToWideChar(CP_UTF8,0,mode,strlen(mode)+1,
 | 
			
		||||
			    		wmode,sizeof(wmode)/sizeof(wmode[0])) &&
 | 
			
		||||
		    (file=_wfopen(wfilename,wmode))==NULL && errno==ENOENT
 | 
			
		||||
		    (file=_wfopen(wfilename,wmode))==NULL &&
 | 
			
		||||
		    (errno==ENOENT || errno==EBADF)
 | 
			
		||||
		   )	/* UTF-8 decode succeeded, but no file, filename
 | 
			
		||||
			 * could still have been locale-ized... */
 | 
			
		||||
			file = fopen(filename,mode);
 | 
			
		||||
 
 | 
			
		||||
@@ -41,8 +41,12 @@ $j="s4";
 | 
			
		||||
$m1="s5";
 | 
			
		||||
 | 
			
		||||
$code=<<___;
 | 
			
		||||
#indef __linux__
 | 
			
		||||
#include <asm/regdef.h>
 | 
			
		||||
#else
 | 
			
		||||
#include <asm.h>
 | 
			
		||||
#include <regdef.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
.text
 | 
			
		||||
 | 
			
		||||
@@ -76,7 +80,7 @@ bn_mul_mont:
 | 
			
		||||
	ldq	$aj,8($ap)
 | 
			
		||||
	subq	sp,AT,sp
 | 
			
		||||
	ldq	$bi,0($bp)	# bp[0]
 | 
			
		||||
	mov	-4096,AT
 | 
			
		||||
	lda	AT,-4096(zero)	# mov	-4096,AT
 | 
			
		||||
	ldq	$n0,0($n0)
 | 
			
		||||
	and	sp,AT,sp
 | 
			
		||||
 | 
			
		||||
@@ -106,9 +110,9 @@ bn_mul_mont:
 | 
			
		||||
.align	4
 | 
			
		||||
.L1st:
 | 
			
		||||
	.set	noreorder
 | 
			
		||||
	ldq	$aj,($aj)
 | 
			
		||||
	ldq	$aj,0($aj)
 | 
			
		||||
	addl	$j,1,$j
 | 
			
		||||
	ldq	$nj,($nj)
 | 
			
		||||
	ldq	$nj,0($nj)
 | 
			
		||||
	lda	$tp,8($tp)
 | 
			
		||||
 | 
			
		||||
	addq	$alo,$hi0,$lo0
 | 
			
		||||
@@ -159,12 +163,12 @@ bn_mul_mont:
 | 
			
		||||
.align	4
 | 
			
		||||
.Louter:
 | 
			
		||||
	s8addq	$i,$bp,$bi
 | 
			
		||||
	ldq	$hi0,($ap)
 | 
			
		||||
	ldq	$hi0,0($ap)
 | 
			
		||||
	ldq	$aj,8($ap)
 | 
			
		||||
	ldq	$bi,($bi)
 | 
			
		||||
	ldq	$hi1,($np)
 | 
			
		||||
	ldq	$bi,0($bi)
 | 
			
		||||
	ldq	$hi1,0($np)
 | 
			
		||||
	ldq	$nj,8($np)
 | 
			
		||||
	ldq	$tj,(sp)
 | 
			
		||||
	ldq	$tj,0(sp)
 | 
			
		||||
 | 
			
		||||
	mulq	$hi0,$bi,$lo0
 | 
			
		||||
	umulh	$hi0,$bi,$hi0
 | 
			
		||||
@@ -195,10 +199,10 @@ bn_mul_mont:
 | 
			
		||||
	.set	noreorder
 | 
			
		||||
	ldq	$tj,8($tp)	#L0
 | 
			
		||||
	nop			#U1
 | 
			
		||||
	ldq	$aj,($aj)	#L1
 | 
			
		||||
	ldq	$aj,0($aj)	#L1
 | 
			
		||||
	s8addq	$j,$np,$nj	#U0
 | 
			
		||||
 | 
			
		||||
	ldq	$nj,($nj)	#L0
 | 
			
		||||
	ldq	$nj,0($nj)	#L0
 | 
			
		||||
	nop			#U1
 | 
			
		||||
	addq	$alo,$hi0,$lo0	#L1
 | 
			
		||||
	lda	$tp,8($tp)
 | 
			
		||||
@@ -247,7 +251,7 @@ bn_mul_mont:
 | 
			
		||||
	addq	$hi1,v0,$hi1
 | 
			
		||||
 | 
			
		||||
	addq	$hi1,$hi0,$lo1
 | 
			
		||||
	stq	$j,($tp)
 | 
			
		||||
	stq	$j,0($tp)
 | 
			
		||||
	cmpult	$lo1,$hi0,$hi1
 | 
			
		||||
	addq	$lo1,$tj,$lo1
 | 
			
		||||
	cmpult	$lo1,$tj,AT
 | 
			
		||||
@@ -265,8 +269,8 @@ bn_mul_mont:
 | 
			
		||||
	mov	0,$hi0		# clear borrow bit
 | 
			
		||||
 | 
			
		||||
.align	4
 | 
			
		||||
.Lsub:	ldq	$lo0,($tp)
 | 
			
		||||
	ldq	$lo1,($np)
 | 
			
		||||
.Lsub:	ldq	$lo0,0($tp)
 | 
			
		||||
	ldq	$lo1,0($np)
 | 
			
		||||
	lda	$tp,8($tp)
 | 
			
		||||
	lda	$np,8($np)
 | 
			
		||||
	subq	$lo0,$lo1,$lo1	# tp[i]-np[i]
 | 
			
		||||
@@ -274,7 +278,7 @@ bn_mul_mont:
 | 
			
		||||
	subq	$lo1,$hi0,$lo0
 | 
			
		||||
	cmpult	$lo1,$lo0,$hi0
 | 
			
		||||
	or	$hi0,AT,$hi0
 | 
			
		||||
	stq	$lo0,($rp)
 | 
			
		||||
	stq	$lo0,0($rp)
 | 
			
		||||
	cmpult	$tp,$tj,v0
 | 
			
		||||
	lda	$rp,8($rp)
 | 
			
		||||
	bne	v0,.Lsub
 | 
			
		||||
@@ -288,7 +292,7 @@ bn_mul_mont:
 | 
			
		||||
	bis	$bp,$ap,$ap	# ap=borrow?tp:rp
 | 
			
		||||
 | 
			
		||||
.align	4
 | 
			
		||||
.Lcopy:	ldq	$aj,($ap)	# copy or in-place refresh
 | 
			
		||||
.Lcopy:	ldq	$aj,0($ap)	# copy or in-place refresh
 | 
			
		||||
	lda	$tp,8($tp)
 | 
			
		||||
	lda	$rp,8($rp)
 | 
			
		||||
	lda	$ap,8($ap)
 | 
			
		||||
@@ -309,8 +313,8 @@ bn_mul_mont:
 | 
			
		||||
	lda	sp,48(sp)
 | 
			
		||||
	ret	(ra)
 | 
			
		||||
.end	bn_mul_mont
 | 
			
		||||
.rdata
 | 
			
		||||
.asciiz	"Montgomery Multiplication for Alpha, CRYPTOGAMS by <appro\@openssl.org>"
 | 
			
		||||
.ascii	"Montgomery Multiplication for Alpha, CRYPTOGAMS by <appro\@openssl.org>"
 | 
			
		||||
.align	2
 | 
			
		||||
___
 | 
			
		||||
 | 
			
		||||
print $code;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
.ident "s390x.S, version 1.0"
 | 
			
		||||
.ident "s390x.S, version 1.1"
 | 
			
		||||
// ====================================================================
 | 
			
		||||
// Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL
 | 
			
		||||
// project.
 | 
			
		||||
@@ -24,67 +24,67 @@ bn_mul_add_words:
 | 
			
		||||
	bler	%r14		// if (len<=0) return 0;
 | 
			
		||||
 | 
			
		||||
	stmg	%r6,%r10,48(%r15)
 | 
			
		||||
	lghi	%r10,3
 | 
			
		||||
	lghi	%r8,0		// carry = 0
 | 
			
		||||
	srag	%r10,%r4,2	// cnt=len/4
 | 
			
		||||
	jz	.Loop1_madd
 | 
			
		||||
	nr	%r10,%r4	// len%4
 | 
			
		||||
	sra	%r4,2		// cnt=len/4
 | 
			
		||||
	jz	.Loop1_madd	// carry is incidentally cleared if branch taken
 | 
			
		||||
	algr	zero,zero	// clear carry
 | 
			
		||||
 | 
			
		||||
.Loop4_madd:
 | 
			
		||||
	lg	%r7,0(%r2,%r3)	// ap[i]
 | 
			
		||||
	mlgr	%r6,%r5		// *=w
 | 
			
		||||
	algr	%r7,%r8		// +=carry
 | 
			
		||||
	alcgr	%r7,%r8		// +=carry
 | 
			
		||||
	alcgr	%r6,zero
 | 
			
		||||
	alg	%r7,0(%r2,%r1)	// +=rp[i]
 | 
			
		||||
	alcgr	%r6,zero
 | 
			
		||||
	stg	%r7,0(%r2,%r1)	// rp[i]=
 | 
			
		||||
 | 
			
		||||
	lg	%r9,8(%r2,%r3)
 | 
			
		||||
	mlgr	%r8,%r5
 | 
			
		||||
	algr	%r9,%r6
 | 
			
		||||
	alcgr	%r9,%r6
 | 
			
		||||
	alcgr	%r8,zero
 | 
			
		||||
	alg	%r9,8(%r2,%r1)
 | 
			
		||||
	alcgr	%r8,zero
 | 
			
		||||
	stg	%r9,8(%r2,%r1)
 | 
			
		||||
 | 
			
		||||
	lg	%r7,16(%r2,%r3)
 | 
			
		||||
	mlgr	%r6,%r5
 | 
			
		||||
	algr	%r7,%r8
 | 
			
		||||
	alcgr	%r7,%r8
 | 
			
		||||
	alcgr	%r6,zero
 | 
			
		||||
	alg	%r7,16(%r2,%r1)
 | 
			
		||||
	alcgr	%r6,zero
 | 
			
		||||
	stg	%r7,16(%r2,%r1)
 | 
			
		||||
 | 
			
		||||
	lg	%r9,24(%r2,%r3)
 | 
			
		||||
	mlgr	%r8,%r5
 | 
			
		||||
	algr	%r9,%r6
 | 
			
		||||
	alcgr	%r9,%r6
 | 
			
		||||
	alcgr	%r8,zero
 | 
			
		||||
	alg	%r9,24(%r2,%r1)
 | 
			
		||||
	alcgr	%r8,zero
 | 
			
		||||
	stg	%r9,24(%r2,%r1)
 | 
			
		||||
 | 
			
		||||
	la	%r2,32(%r2)	// i+=4
 | 
			
		||||
	brct	%r10,.Loop4_madd
 | 
			
		||||
	brct	%r4,.Loop4_madd
 | 
			
		||||
 | 
			
		||||
	lghi	%r10,3
 | 
			
		||||
	nr	%r4,%r10	// cnt=len%4
 | 
			
		||||
	jz	.Lend_madd
 | 
			
		||||
	la	%r10,1(%r10)		// see if len%4 is zero ...
 | 
			
		||||
	brct	%r10,.Loop1_madd	// without touching condition code:-)
 | 
			
		||||
 | 
			
		||||
.Lend_madd:
 | 
			
		||||
	alcgr	%r8,zero	// collect carry bit
 | 
			
		||||
	lgr	%r2,%r8
 | 
			
		||||
	lmg	%r6,%r10,48(%r15)
 | 
			
		||||
	br	%r14
 | 
			
		||||
 | 
			
		||||
.Loop1_madd:
 | 
			
		||||
	lg	%r7,0(%r2,%r3)	// ap[i]
 | 
			
		||||
	mlgr	%r6,%r5		// *=w
 | 
			
		||||
	algr	%r7,%r8		// +=carry
 | 
			
		||||
	alcgr	%r7,%r8		// +=carry
 | 
			
		||||
	alcgr	%r6,zero
 | 
			
		||||
	alg	%r7,0(%r2,%r1)	// +=rp[i]
 | 
			
		||||
	alcgr	%r6,zero
 | 
			
		||||
	stg	%r7,0(%r2,%r1)	// rp[i]=
 | 
			
		||||
 | 
			
		||||
	lgr	%r8,%r6
 | 
			
		||||
	la	%r2,8(%r2)	// i++
 | 
			
		||||
	brct	%r4,.Loop1_madd
 | 
			
		||||
	brct	%r10,.Loop1_madd
 | 
			
		||||
 | 
			
		||||
.Lend_madd:
 | 
			
		||||
	lgr	%r2,%r8
 | 
			
		||||
	lmg	%r6,%r10,48(%r15)
 | 
			
		||||
	br	%r14
 | 
			
		||||
	j	.Lend_madd
 | 
			
		||||
.size	bn_mul_add_words,.-bn_mul_add_words
 | 
			
		||||
 | 
			
		||||
// BN_ULONG bn_mul_words(BN_ULONG *r2,BN_ULONG *r3,int r4,BN_ULONG r5);
 | 
			
		||||
@@ -99,57 +99,57 @@ bn_mul_words:
 | 
			
		||||
	bler	%r14		// if (len<=0) return 0;
 | 
			
		||||
 | 
			
		||||
	stmg	%r6,%r10,48(%r15)
 | 
			
		||||
	lghi	%r10,3
 | 
			
		||||
	lghi	%r8,0		// carry = 0
 | 
			
		||||
	srag	%r10,%r4,2	// cnt=len/4
 | 
			
		||||
	jz	.Loop1_mul
 | 
			
		||||
	nr	%r10,%r4	// len%4
 | 
			
		||||
	sra	%r4,2		// cnt=len/4
 | 
			
		||||
	jz	.Loop1_mul	// carry is incidentally cleared if branch taken
 | 
			
		||||
	algr	zero,zero	// clear carry
 | 
			
		||||
 | 
			
		||||
.Loop4_mul:
 | 
			
		||||
	lg	%r7,0(%r2,%r3)	// ap[i]
 | 
			
		||||
	mlgr	%r6,%r5		// *=w
 | 
			
		||||
	algr	%r7,%r8		// +=carry
 | 
			
		||||
	alcgr	%r6,zero
 | 
			
		||||
	alcgr	%r7,%r8		// +=carry
 | 
			
		||||
	stg	%r7,0(%r2,%r1)	// rp[i]=
 | 
			
		||||
 | 
			
		||||
	lg	%r9,8(%r2,%r3)
 | 
			
		||||
	mlgr	%r8,%r5
 | 
			
		||||
	algr	%r9,%r6
 | 
			
		||||
	alcgr	%r8,zero
 | 
			
		||||
	alcgr	%r9,%r6
 | 
			
		||||
	stg	%r9,8(%r2,%r1)
 | 
			
		||||
 | 
			
		||||
	lg	%r7,16(%r2,%r3)
 | 
			
		||||
	mlgr	%r6,%r5
 | 
			
		||||
	algr	%r7,%r8
 | 
			
		||||
	alcgr	%r6,zero
 | 
			
		||||
	alcgr	%r7,%r8
 | 
			
		||||
	stg	%r7,16(%r2,%r1)
 | 
			
		||||
 | 
			
		||||
	lg	%r9,24(%r2,%r3)
 | 
			
		||||
	mlgr	%r8,%r5
 | 
			
		||||
	algr	%r9,%r6
 | 
			
		||||
	alcgr	%r8,zero
 | 
			
		||||
	alcgr	%r9,%r6
 | 
			
		||||
	stg	%r9,24(%r2,%r1)
 | 
			
		||||
 | 
			
		||||
	la	%r2,32(%r2)	// i+=4
 | 
			
		||||
	brct	%r10,.Loop4_mul
 | 
			
		||||
	brct	%r4,.Loop4_mul
 | 
			
		||||
 | 
			
		||||
	lghi	%r10,3
 | 
			
		||||
	nr	%r4,%r10	// cnt=len%4
 | 
			
		||||
	jz	.Lend_mul
 | 
			
		||||
	la	%r10,1(%r10)		// see if len%4 is zero ...
 | 
			
		||||
	brct	%r10,.Loop1_mul		// without touching condition code:-)
 | 
			
		||||
 | 
			
		||||
.Lend_mul:
 | 
			
		||||
	alcgr	%r8,zero	// collect carry bit
 | 
			
		||||
	lgr	%r2,%r8
 | 
			
		||||
	lmg	%r6,%r10,48(%r15)
 | 
			
		||||
	br	%r14
 | 
			
		||||
 | 
			
		||||
.Loop1_mul:
 | 
			
		||||
	lg	%r7,0(%r2,%r3)	// ap[i]
 | 
			
		||||
	mlgr	%r6,%r5		// *=w
 | 
			
		||||
	algr	%r7,%r8		// +=carry
 | 
			
		||||
	alcgr	%r6,zero
 | 
			
		||||
	alcgr	%r7,%r8		// +=carry
 | 
			
		||||
	stg	%r7,0(%r2,%r1)	// rp[i]=
 | 
			
		||||
 | 
			
		||||
	lgr	%r8,%r6
 | 
			
		||||
	la	%r2,8(%r2)	// i++
 | 
			
		||||
	brct	%r4,.Loop1_mul
 | 
			
		||||
	brct	%r10,.Loop1_mul
 | 
			
		||||
 | 
			
		||||
.Lend_mul:
 | 
			
		||||
	lgr	%r2,%r8
 | 
			
		||||
	lmg	%r6,%r10,48(%r15)
 | 
			
		||||
	br	%r14
 | 
			
		||||
	j	.Lend_mul
 | 
			
		||||
.size	bn_mul_words,.-bn_mul_words
 | 
			
		||||
 | 
			
		||||
// void bn_sqr_words(BN_ULONG *r2,BN_ULONG *r2,int r4)
 | 
			
		||||
 
 | 
			
		||||
@@ -301,7 +301,8 @@ int BN_mod_exp2_mont(BIGNUM *rr, const BIGNUM *a1, const BIGNUM *p1,
 | 
			
		||||
			r_is_one = 0;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	BN_from_montgomery(rr,r,mont,ctx);
 | 
			
		||||
	if (!BN_from_montgomery(rr,r,mont,ctx))
 | 
			
		||||
		goto err;
 | 
			
		||||
	ret=1;
 | 
			
		||||
err:
 | 
			
		||||
	if ((in_mont == NULL) && (mont != NULL)) BN_MONT_CTX_free(mont);
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@ static int rle_expand_block(COMP_CTX *ctx, unsigned char *out,
 | 
			
		||||
	{
 | 
			
		||||
	int i;
 | 
			
		||||
 | 
			
		||||
	if (olen < (ilen-1))
 | 
			
		||||
	if (ilen == 0 || olen < (ilen-1))
 | 
			
		||||
		{
 | 
			
		||||
		/* ZZZZZZZZZZZZZZZZZZZZZZ */
 | 
			
		||||
		return(-1);
 | 
			
		||||
@@ -59,4 +59,3 @@ static int rle_expand_block(COMP_CTX *ctx, unsigned char *out,
 | 
			
		||||
		}
 | 
			
		||||
	return(ilen-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -743,6 +743,16 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
 | 
			
		||||
#if defined(_WIN32) && !defined(__CYGWIN__)
 | 
			
		||||
#include <tchar.h>
 | 
			
		||||
#include <signal.h>
 | 
			
		||||
#ifdef __WATCOMC__
 | 
			
		||||
#if defined(_UNICODE) || defined(__UNICODE__)
 | 
			
		||||
#define _vsntprintf _vsnwprintf
 | 
			
		||||
#else
 | 
			
		||||
#define _vsntprintf _vsnprintf
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#define alloca _alloca
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333
 | 
			
		||||
int OPENSSL_isservice(void)
 | 
			
		||||
@@ -773,11 +783,7 @@ int OPENSSL_isservice(void)
 | 
			
		||||
 | 
			
		||||
    if (len>512) return -1;		/* paranoia */
 | 
			
		||||
    len++,len&=~1;			/* paranoia */
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
    name=(WCHAR *)_alloca(len+sizeof(WCHAR));
 | 
			
		||||
#else
 | 
			
		||||
    name=(WCHAR *)alloca(len+sizeof(WCHAR));
 | 
			
		||||
#endif
 | 
			
		||||
    if (!GetUserObjectInformationW (h,UOI_NAME,name,len,&len))
 | 
			
		||||
	return -1;
 | 
			
		||||
 | 
			
		||||
@@ -822,11 +828,7 @@ void OPENSSL_showfatal (const char *fmta,...)
 | 
			
		||||
      size_t len_0=strlen(fmta)+1,i;
 | 
			
		||||
      WCHAR *fmtw;
 | 
			
		||||
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
	fmtw = (WCHAR *)_alloca (len_0*sizeof(WCHAR));
 | 
			
		||||
#else
 | 
			
		||||
	fmtw = (WCHAR *)alloca (len_0*sizeof(WCHAR));
 | 
			
		||||
#endif
 | 
			
		||||
	fmtw = (WCHAR *)alloca(len_0*sizeof(WCHAR));
 | 
			
		||||
	if (fmtw == NULL) { fmt=(const TCHAR *)L"no stack?"; break; }
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_MULTIBYTE
 | 
			
		||||
 
 | 
			
		||||
@@ -47,6 +47,13 @@ $!  P6, if defined, sets a choice of crypto methods to compile.
 | 
			
		||||
$!  WARNING: this should only be done to recompile some part of an already
 | 
			
		||||
$!  fully compiled library.
 | 
			
		||||
$!
 | 
			
		||||
$!  For 64 bit architectures (Alpha and IA64), specify the pointer size as P7.
 | 
			
		||||
$!  For 32 bit architectures (VAX), P7 is ignored.
 | 
			
		||||
$!  Currently supported values are:
 | 
			
		||||
$!
 | 
			
		||||
$!	32	To ge a library compiled with /POINTER_SIZE=32
 | 
			
		||||
$!	64	To ge a library compiled with /POINTER_SIZE=64
 | 
			
		||||
$!
 | 
			
		||||
$!
 | 
			
		||||
$! Define A TCP/IP Library That We Will Need To Link To.
 | 
			
		||||
$! (That Is, If We Need To Link To One.)
 | 
			
		||||
@@ -140,11 +147,11 @@ $ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! Define The Library Name.
 | 
			
		||||
$!
 | 
			
		||||
$ LIB_NAME := 'EXE_DIR'LIBCRYPTO.OLB
 | 
			
		||||
$ LIB_NAME := 'EXE_DIR'LIBCRYPTO'LIB32'.OLB
 | 
			
		||||
$!
 | 
			
		||||
$! Define The CRYPTO-LIB We Are To Use.
 | 
			
		||||
$!
 | 
			
		||||
$ CRYPTO_LIB := 'EXE_DIR'LIBCRYPTO.OLB
 | 
			
		||||
$ CRYPTO_LIB := 'EXE_DIR'LIBCRYPTO'LIB32'.OLB
 | 
			
		||||
$!
 | 
			
		||||
$! Check To See If We Already Have A "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" Library...
 | 
			
		||||
$!
 | 
			
		||||
@@ -193,7 +200,7 @@ $ LIB_CAST = "c_skey,c_ecb,c_enc,c_cfb64,c_ofb64"
 | 
			
		||||
$ LIB_CAMELLIA = "camellia,cmll_misc,cmll_ecb,cmll_cbc,cmll_ofb,"+ -
 | 
			
		||||
	"cmll_cfb,cmll_ctr"
 | 
			
		||||
$ LIB_SEED = "seed,seed_ecb,seed_cbc,seed_cfb,seed_ofb"
 | 
			
		||||
$ LIB_MODES = "cbc128,ctr128,cfb128,ofb128"
 | 
			
		||||
$ LIB_MODES = "cbc128,ctr128,cfb128,ofb128,cts128"
 | 
			
		||||
$ LIB_BN_ASM = "[.asm]vms.mar,vms-helper"
 | 
			
		||||
$ IF F$TRNLNM("OPENSSL_NO_ASM") .OR. ARCH .NES. "VAX" THEN -
 | 
			
		||||
     LIB_BN_ASM = "bn_asm"
 | 
			
		||||
@@ -907,6 +914,58 @@ $! End The P5 Check.
 | 
			
		||||
$!
 | 
			
		||||
$ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! Check To See If P7 Is Blank.
 | 
			
		||||
$!
 | 
			
		||||
$ IF (P7.EQS."")
 | 
			
		||||
$ THEN
 | 
			
		||||
$   POINTER_SIZE = ""
 | 
			
		||||
$ ELSE
 | 
			
		||||
$!
 | 
			
		||||
$!  Check is P7 Is Valid
 | 
			
		||||
$!
 | 
			
		||||
$   IF (P7.EQS."32")
 | 
			
		||||
$   THEN
 | 
			
		||||
$     POINTER_SIZE = "/POINTER_SIZE=32"
 | 
			
		||||
$     IF ARCH .EQS. "VAX"
 | 
			
		||||
$     THEN
 | 
			
		||||
$       LIB32 = ""
 | 
			
		||||
$     ELSE
 | 
			
		||||
$       LIB32 = "32"
 | 
			
		||||
$     ENDIF
 | 
			
		||||
$   ELSE
 | 
			
		||||
$     IF (P7.EQS."64")
 | 
			
		||||
$     THEN
 | 
			
		||||
$       LIB32 = ""
 | 
			
		||||
$       IF ARCH .EQS. "VAX"
 | 
			
		||||
$       THEN
 | 
			
		||||
$         POINTER_SIZE = "/POINTER_SIZE=32"
 | 
			
		||||
$       ELSE
 | 
			
		||||
$         POINTER_SIZE = "/POINTER_SIZE=64"
 | 
			
		||||
$       ENDIF
 | 
			
		||||
$     ELSE
 | 
			
		||||
$!
 | 
			
		||||
$!      Tell The User Entered An Invalid Option..
 | 
			
		||||
$!
 | 
			
		||||
$       WRITE SYS$OUTPUT ""
 | 
			
		||||
$       WRITE SYS$OUTPUT "The Option ",P7," Is Invalid.  The Valid Options Are:"
 | 
			
		||||
$       WRITE SYS$OUTPUT ""
 | 
			
		||||
$       WRITE SYS$OUTPUT "    32  :  Compile with 32 bit pointer size"
 | 
			
		||||
$       WRITE SYS$OUTPUT "    64  :  Compile with 64 bit pointer size"
 | 
			
		||||
$       WRITE SYS$OUTPUT ""
 | 
			
		||||
$!
 | 
			
		||||
$!      Time To EXIT.
 | 
			
		||||
$!
 | 
			
		||||
$       GOTO TIDY
 | 
			
		||||
$!
 | 
			
		||||
$!      End The Valid Arguement Check.
 | 
			
		||||
$!
 | 
			
		||||
$     ENDIF
 | 
			
		||||
$   ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! End The P7 Check.
 | 
			
		||||
$!
 | 
			
		||||
$ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! Check To See If P3 Is Blank.
 | 
			
		||||
$!
 | 
			
		||||
$ IF (P3.EQS."")
 | 
			
		||||
@@ -1034,9 +1093,9 @@ $!
 | 
			
		||||
$     CC = "CC"
 | 
			
		||||
$     IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
 | 
			
		||||
	 THEN CC = "CC/DECC"
 | 
			
		||||
$     CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + -
 | 
			
		||||
$     CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89''POINTER_SIZE'" + -
 | 
			
		||||
           "/NOLIST/PREFIX=ALL" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[],SYS$DISK:[._''ARCH'],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS],SYS$DISK:[.EVP],SYS$DISK:[.ASN1])" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[._''ARCH'],SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS],SYS$DISK:[.EVP],SYS$DISK:[.ASN1])" + -
 | 
			
		||||
	   CCEXTRAFLAGS
 | 
			
		||||
$!
 | 
			
		||||
$!    Define The Linker Options File Name.
 | 
			
		||||
@@ -1070,7 +1129,7 @@ $	EXIT
 | 
			
		||||
$     ENDIF
 | 
			
		||||
$     IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC"
 | 
			
		||||
$     CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[],SYS$DISK:[._''ARCH'],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS],SYS$DISK:[.EVP],SYS$DISK:[.ASN1])" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[._''ARCH'],SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS],SYS$DISK:[.EVP],SYS$DISK:[.ASN1])" + -
 | 
			
		||||
	   CCEXTRAFLAGS
 | 
			
		||||
$     CCDEFS = """VAXC""," + CCDEFS
 | 
			
		||||
$!
 | 
			
		||||
@@ -1102,7 +1161,7 @@ $!
 | 
			
		||||
$!    Use GNU C...
 | 
			
		||||
$!
 | 
			
		||||
$     CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[],SYS$DISK:[._''ARCH'],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS],SYS$DISK:[.EVP],SYS$DISK:[.ASN1])" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[._''ARCH'],SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS],SYS$DISK:[.EVP],SYS$DISK:[.ASN1])" + -
 | 
			
		||||
	   CCEXTRAFLAGS
 | 
			
		||||
$!
 | 
			
		||||
$!    Define The Linker Options File Name.
 | 
			
		||||
 
 | 
			
		||||
@@ -148,15 +148,6 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
 | 
			
		||||
 | 
			
		||||
	s=BN_new();
 | 
			
		||||
	if (s == NULL) goto err;
 | 
			
		||||
 | 
			
		||||
	/* reject a excessive digest length (currently at most
 | 
			
		||||
	 * dsa-with-SHA256 is supported) */
 | 
			
		||||
	if (dlen > SHA256_DIGEST_LENGTH)
 | 
			
		||||
		{
 | 
			
		||||
		reason=DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE;
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	ctx=BN_CTX_new();
 | 
			
		||||
	if (ctx == NULL) goto err;
 | 
			
		||||
 | 
			
		||||
@@ -185,7 +176,7 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
 | 
			
		||||
	if (!BN_mod_mul(&xr,dsa->priv_key,r,dsa->q,ctx)) goto err;/* s = xr */
 | 
			
		||||
	if (!BN_add(s, &xr, &m)) goto err;		/* s = m + xr */
 | 
			
		||||
	if (BN_cmp(s,dsa->q) > 0)
 | 
			
		||||
		BN_sub(s,s,dsa->q);
 | 
			
		||||
		if (!BN_sub(s,s,dsa->q)) goto err;
 | 
			
		||||
	if (!BN_mod_mul(s,s,kinv,dsa->q,ctx)) goto err;
 | 
			
		||||
 | 
			
		||||
	ret=DSA_SIG_new();
 | 
			
		||||
@@ -325,15 +316,6 @@ static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig,
 | 
			
		||||
		DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_MODULUS_TOO_LARGE);
 | 
			
		||||
		return -1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	/* reject a excessive digest length (currently at most
 | 
			
		||||
	 * dsa-with-SHA256 is supported) */
 | 
			
		||||
	if (dgst_len > SHA256_DIGEST_LENGTH)
 | 
			
		||||
		{
 | 
			
		||||
		DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
 | 
			
		||||
		return -1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	BN_init(&u1);
 | 
			
		||||
	BN_init(&u2);
 | 
			
		||||
	BN_init(&t1);
 | 
			
		||||
 
 | 
			
		||||
@@ -319,6 +319,7 @@ int ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
	size_t i;
 | 
			
		||||
	EC_POINT *p=NULL;
 | 
			
		||||
	EC_POINT *acc = NULL;
 | 
			
		||||
 | 
			
		||||
	if (ctx == NULL)
 | 
			
		||||
		{
 | 
			
		||||
@@ -338,15 +339,16 @@ int ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if ((p = EC_POINT_new(group)) == NULL) goto err;
 | 
			
		||||
	if ((acc = EC_POINT_new(group)) == NULL) goto err;
 | 
			
		||||
 | 
			
		||||
	if (!EC_POINT_set_to_infinity(group, r)) goto err;
 | 
			
		||||
	if (!EC_POINT_set_to_infinity(group, acc)) goto err;
 | 
			
		||||
 | 
			
		||||
	if (scalar)
 | 
			
		||||
		{
 | 
			
		||||
		if (!ec_GF2m_montgomery_point_multiply(group, p, scalar, group->generator, ctx)) goto err;
 | 
			
		||||
		if (BN_is_negative(scalar)) 
 | 
			
		||||
		if (BN_is_negative(scalar))
 | 
			
		||||
			if (!group->meth->invert(group, p, ctx)) goto err;
 | 
			
		||||
		if (!group->meth->add(group, r, r, p, ctx)) goto err;
 | 
			
		||||
		if (!group->meth->add(group, acc, acc, p, ctx)) goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < num; i++)
 | 
			
		||||
@@ -354,13 +356,16 @@ int ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
 | 
			
		||||
		if (!ec_GF2m_montgomery_point_multiply(group, p, scalars[i], points[i], ctx)) goto err;
 | 
			
		||||
		if (BN_is_negative(scalars[i]))
 | 
			
		||||
			if (!group->meth->invert(group, p, ctx)) goto err;
 | 
			
		||||
		if (!group->meth->add(group, r, r, p, ctx)) goto err;
 | 
			
		||||
		if (!group->meth->add(group, acc, acc, p, ctx)) goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (!EC_POINT_copy(r, acc)) goto err;
 | 
			
		||||
 | 
			
		||||
	ret = 1;
 | 
			
		||||
 | 
			
		||||
  err:
 | 
			
		||||
	if (p) EC_POINT_free(p);
 | 
			
		||||
	if (acc) EC_POINT_free(acc);
 | 
			
		||||
	if (new_ctx != NULL)
 | 
			
		||||
		BN_CTX_free(new_ctx);
 | 
			
		||||
	return ret;
 | 
			
		||||
 
 | 
			
		||||
@@ -937,6 +937,9 @@ int ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT
 | 
			
		||||
		{
 | 
			
		||||
		return EC_POINT_is_at_infinity(group, b) ? 0 : 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (EC_POINT_is_at_infinity(group, b))
 | 
			
		||||
		return 1;
 | 
			
		||||
	
 | 
			
		||||
	if (a->Z_is_one && b->Z_is_one)
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -304,7 +304,13 @@ int EC_KEY_check_key(const EC_KEY *eckey)
 | 
			
		||||
		ECerr(EC_F_EC_KEY_CHECK_KEY, ERR_R_PASSED_NULL_PARAMETER);
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	if (EC_POINT_is_at_infinity(eckey->group, eckey->pub_key))
 | 
			
		||||
		{
 | 
			
		||||
		ECerr(EC_F_EC_KEY_CHECK_KEY, EC_R_POINT_AT_INFINITY);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if ((ctx = BN_CTX_new()) == NULL)
 | 
			
		||||
		goto err;
 | 
			
		||||
	if ((point = EC_POINT_new(eckey->group)) == NULL)
 | 
			
		||||
 
 | 
			
		||||
@@ -169,11 +169,13 @@ static void ec_pre_comp_clear_free(void *pre_)
 | 
			
		||||
		EC_POINT **p;
 | 
			
		||||
 | 
			
		||||
		for (p = pre->points; *p != NULL; p++)
 | 
			
		||||
			{
 | 
			
		||||
			EC_POINT_clear_free(*p);
 | 
			
		||||
		OPENSSL_cleanse(pre->points, sizeof pre->points);
 | 
			
		||||
			OPENSSL_cleanse(p, sizeof *p);
 | 
			
		||||
			}
 | 
			
		||||
		OPENSSL_free(pre->points);
 | 
			
		||||
		}
 | 
			
		||||
	OPENSSL_cleanse(pre, sizeof pre);
 | 
			
		||||
	OPENSSL_cleanse(pre, sizeof *pre);
 | 
			
		||||
	OPENSSL_free(pre);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1406,6 +1406,9 @@ int ec_GFp_simple_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *
 | 
			
		||||
		{
 | 
			
		||||
		return EC_POINT_is_at_infinity(group, b) ? 0 : 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (EC_POINT_is_at_infinity(group, b))
 | 
			
		||||
		return 1;
 | 
			
		||||
	
 | 
			
		||||
	if (a->Z_is_one && b->Z_is_one)
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -677,6 +677,7 @@ typedef struct st_dynamic_fns {
 | 
			
		||||
 * can be fully instantiated with IMPLEMENT_DYNAMIC_CHECK_FN(). */
 | 
			
		||||
typedef unsigned long (*dynamic_v_check_fn)(unsigned long ossl_version);
 | 
			
		||||
#define IMPLEMENT_DYNAMIC_CHECK_FN() \
 | 
			
		||||
	OPENSSL_EXPORT unsigned long v_check(unsigned long v); \
 | 
			
		||||
	OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \
 | 
			
		||||
		if(v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \
 | 
			
		||||
		return 0; }
 | 
			
		||||
@@ -699,6 +700,8 @@ typedef unsigned long (*dynamic_v_check_fn)(unsigned long ossl_version);
 | 
			
		||||
typedef int (*dynamic_bind_engine)(ENGINE *e, const char *id,
 | 
			
		||||
				const dynamic_fns *fns);
 | 
			
		||||
#define IMPLEMENT_DYNAMIC_BIND_FN(fn) \
 | 
			
		||||
	OPENSSL_EXPORT \
 | 
			
		||||
	int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \
 | 
			
		||||
	OPENSSL_EXPORT \
 | 
			
		||||
	int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \
 | 
			
		||||
		if(ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \
 | 
			
		||||
 
 | 
			
		||||
@@ -204,6 +204,7 @@ skip_to_init:
 | 
			
		||||
			case EVP_CIPH_OFB_MODE:
 | 
			
		||||
 | 
			
		||||
			ctx->num = 0;
 | 
			
		||||
			/* fall-through */
 | 
			
		||||
 | 
			
		||||
			case EVP_CIPH_CBC_MODE:
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -137,7 +137,7 @@ int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *siglen)
 | 
			
		||||
		sctx = 0;
 | 
			
		||||
	if (sigret)
 | 
			
		||||
		{
 | 
			
		||||
		MS_STATIC EVP_MD_CTX tmp_ctx;
 | 
			
		||||
		EVP_MD_CTX tmp_ctx;
 | 
			
		||||
		unsigned char md[EVP_MAX_MD_SIZE];
 | 
			
		||||
		unsigned int mdlen;
 | 
			
		||||
		EVP_MD_CTX_init(&tmp_ctx);
 | 
			
		||||
@@ -173,7 +173,7 @@ int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *siglen)
 | 
			
		||||
 | 
			
		||||
int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t siglen)
 | 
			
		||||
	{
 | 
			
		||||
	MS_STATIC EVP_MD_CTX tmp_ctx;
 | 
			
		||||
	EVP_MD_CTX tmp_ctx;
 | 
			
		||||
	unsigned char md[EVP_MAX_MD_SIZE];
 | 
			
		||||
	int r;
 | 
			
		||||
	unsigned int mdlen;
 | 
			
		||||
 
 | 
			
		||||
@@ -411,7 +411,10 @@ void EVP_PKEY_free(EVP_PKEY *x)
 | 
			
		||||
static void EVP_PKEY_free_it(EVP_PKEY *x)
 | 
			
		||||
	{
 | 
			
		||||
	if (x->ameth && x->ameth->pkey_free)
 | 
			
		||||
		{
 | 
			
		||||
		x->ameth->pkey_free(x);
 | 
			
		||||
		x->pkey.ptr = NULL;
 | 
			
		||||
		}
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	if (x->engine)
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -81,7 +81,7 @@ int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen,
 | 
			
		||||
	unsigned char m[EVP_MAX_MD_SIZE];
 | 
			
		||||
	unsigned int m_len;
 | 
			
		||||
	int i,ok=0,v;
 | 
			
		||||
	MS_STATIC EVP_MD_CTX tmp_ctx;
 | 
			
		||||
	EVP_MD_CTX tmp_ctx;
 | 
			
		||||
 | 
			
		||||
	*siglen=0;
 | 
			
		||||
	EVP_MD_CTX_init(&tmp_ctx);
 | 
			
		||||
 
 | 
			
		||||
@@ -68,7 +68,7 @@ int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
 | 
			
		||||
	unsigned char m[EVP_MAX_MD_SIZE];
 | 
			
		||||
	unsigned int m_len;
 | 
			
		||||
	int i,ok=0,v;
 | 
			
		||||
	MS_STATIC EVP_MD_CTX tmp_ctx;
 | 
			
		||||
	EVP_MD_CTX tmp_ctx;
 | 
			
		||||
 | 
			
		||||
	EVP_MD_CTX_init(&tmp_ctx);
 | 
			
		||||
	EVP_MD_CTX_copy_ex(&tmp_ctx,ctx);     
 | 
			
		||||
 
 | 
			
		||||
@@ -134,6 +134,8 @@ static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id)
 | 
			
		||||
		id = pkey->ameth->pkey_id;
 | 
			
		||||
		}
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	if (pkey && pkey->engine)
 | 
			
		||||
		e = pkey->engine;
 | 
			
		||||
	/* Try to find an ENGINE which implements this method */
 | 
			
		||||
	if (e)
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -106,7 +106,7 @@ $	EXHEADER_CMS := cms.h
 | 
			
		||||
$	EXHEADER_PQUEUE := pqueue.h
 | 
			
		||||
$	EXHEADER_TS := ts.h
 | 
			
		||||
$	EXHEADER_JPAKE := jpake.h
 | 
			
		||||
$	LIBS := LIBCRYPTO
 | 
			
		||||
$	LIBS := LIBCRYPTO,LIBCRYPTO32
 | 
			
		||||
$
 | 
			
		||||
$	EXE_DIR := [-.'ARCH'.EXE.CRYPTO]
 | 
			
		||||
$
 | 
			
		||||
@@ -120,12 +120,7 @@ $	IF D .EQS. ""
 | 
			
		||||
$	THEN
 | 
			
		||||
$	  COPY 'tmp' WRK_SSLINCLUDE: /LOG
 | 
			
		||||
$	ELSE
 | 
			
		||||
$	  IF D .EQS. "_''ARCH'"
 | 
			
		||||
$	  THEN
 | 
			
		||||
$	    COPY [-.'ARCH'.CRYPTO]'tmp' WRK_SSLINCLUDE: /LOG
 | 
			
		||||
$	  ELSE
 | 
			
		||||
$	    COPY [.'D']'tmp' WRK_SSLINCLUDE: /LOG
 | 
			
		||||
$	  ENDIF
 | 
			
		||||
$	  COPY [.'D']'tmp' WRK_SSLINCLUDE: /LOG
 | 
			
		||||
$	ENDIF
 | 
			
		||||
$	SET FILE/PROT=WORLD:RE WRK_SSLINCLUDE:'tmp'
 | 
			
		||||
$	GOTO LOOP_SDIRS
 | 
			
		||||
 
 | 
			
		||||
@@ -282,8 +282,37 @@ int JPAKE_STEP1_generate(JPAKE_STEP1 *send, JPAKE_CTX *ctx)
 | 
			
		||||
    return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
/* g^x is a legal value */
 | 
			
		||||
static int is_legal(const BIGNUM *gx, const JPAKE_CTX *ctx)
 | 
			
		||||
    {
 | 
			
		||||
    BIGNUM *t;
 | 
			
		||||
    int res;
 | 
			
		||||
    
 | 
			
		||||
    if(BN_is_negative(gx) || BN_is_zero(gx) || BN_cmp(gx, ctx->p.p) >= 0)
 | 
			
		||||
	return 0;
 | 
			
		||||
 | 
			
		||||
    t = BN_new();
 | 
			
		||||
    BN_mod_exp(t, gx, ctx->p.q, ctx->p.p, ctx->ctx);
 | 
			
		||||
    res = BN_is_one(t);
 | 
			
		||||
    BN_free(t);
 | 
			
		||||
 | 
			
		||||
    return res;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
int JPAKE_STEP1_process(JPAKE_CTX *ctx, const JPAKE_STEP1 *received)
 | 
			
		||||
    {
 | 
			
		||||
    if(!is_legal(received->p1.gx, ctx))
 | 
			
		||||
	{
 | 
			
		||||
	JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_G_TO_THE_X3_IS_NOT_LEGAL);
 | 
			
		||||
	return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    if(!is_legal(received->p2.gx, ctx))
 | 
			
		||||
	{
 | 
			
		||||
	JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_G_TO_THE_X4_IS_NOT_LEGAL);
 | 
			
		||||
	return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
   /* verify their ZKP(xc) */
 | 
			
		||||
    if(!verify_zkp(&received->p1, ctx->p.g, ctx))
 | 
			
		||||
	{
 | 
			
		||||
 
 | 
			
		||||
@@ -115,6 +115,8 @@ void ERR_load_JPAKE_strings(void);
 | 
			
		||||
#define JPAKE_F_VERIFY_ZKP				 100
 | 
			
		||||
 | 
			
		||||
/* Reason codes. */
 | 
			
		||||
#define JPAKE_R_G_TO_THE_X3_IS_NOT_LEGAL		 108
 | 
			
		||||
#define JPAKE_R_G_TO_THE_X4_IS_NOT_LEGAL		 109
 | 
			
		||||
#define JPAKE_R_G_TO_THE_X4_IS_ONE			 105
 | 
			
		||||
#define JPAKE_R_HASH_OF_HASH_OF_KEY_MISMATCH		 106
 | 
			
		||||
#define JPAKE_R_HASH_OF_KEY_MISMATCH			 107
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/* crypto/jpake/jpake_err.c */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 1999-2008 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 * Copyright (c) 1999-2010 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
 | 
			
		||||
@@ -80,6 +80,8 @@ static ERR_STRING_DATA JPAKE_str_functs[]=
 | 
			
		||||
 | 
			
		||||
static ERR_STRING_DATA JPAKE_str_reasons[]=
 | 
			
		||||
	{
 | 
			
		||||
{ERR_REASON(JPAKE_R_G_TO_THE_X3_IS_NOT_LEGAL),"g to the x3 is not legal"},
 | 
			
		||||
{ERR_REASON(JPAKE_R_G_TO_THE_X4_IS_NOT_LEGAL),"g to the x4 is not legal"},
 | 
			
		||||
{ERR_REASON(JPAKE_R_G_TO_THE_X4_IS_ONE)  ,"g to the x4 is one"},
 | 
			
		||||
{ERR_REASON(JPAKE_R_HASH_OF_HASH_OF_KEY_MISMATCH),"hash of hash of key mismatch"},
 | 
			
		||||
{ERR_REASON(JPAKE_R_HASH_OF_KEY_MISMATCH),"hash of key mismatch"},
 | 
			
		||||
 
 | 
			
		||||
@@ -165,7 +165,7 @@
 | 
			
		||||
				asm (			\
 | 
			
		||||
				"roll %1,%0"		\
 | 
			
		||||
				: "=r"(ret)		\
 | 
			
		||||
				: "I"(n), "0"(a)	\
 | 
			
		||||
				: "I"(n), "0"((unsigned int)(a))	\
 | 
			
		||||
				: "cc");		\
 | 
			
		||||
			   ret;				\
 | 
			
		||||
			})
 | 
			
		||||
@@ -383,6 +383,7 @@ int HASH_FINAL (unsigned char *md, HASH_CTX *c)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#ifndef MD32_REG_T
 | 
			
		||||
#if defined(__alpha) || defined(__sparcv9) || defined(__mips)
 | 
			
		||||
#define MD32_REG_T long
 | 
			
		||||
/*
 | 
			
		||||
 * This comment was originaly written for MD5, which is why it
 | 
			
		||||
@@ -400,9 +401,15 @@ int HASH_FINAL (unsigned char *md, HASH_CTX *c)
 | 
			
		||||
 * Well, to be honest it should say that this *prevents* 
 | 
			
		||||
 * performance degradation.
 | 
			
		||||
 *				<appro@fy.chalmers.se>
 | 
			
		||||
 * Apparently there're LP64 compilers that generate better
 | 
			
		||||
 * code if A-D are declared int. Most notably GCC-x86_64
 | 
			
		||||
 * generates better code.
 | 
			
		||||
 */
 | 
			
		||||
#else
 | 
			
		||||
/*
 | 
			
		||||
 * Above is not absolute and there are LP64 compilers that
 | 
			
		||||
 * generate better code if MD32_REG_T is defined int. The above
 | 
			
		||||
 * pre-processor condition reflects the circumstances under which
 | 
			
		||||
 * the conclusion was made and is subject to further extension.
 | 
			
		||||
 *				<appro@fy.chalmers.se>
 | 
			
		||||
 */
 | 
			
		||||
#define MD32_REG_T int
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -397,11 +397,12 @@ int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		case OHS_ASN1_HEADER:
 | 
			
		||||
		/* Now reading ASN1 header: can read at least 6 bytes which
 | 
			
		||||
		 * is more than enough for any valid ASN1 SEQUENCE header
 | 
			
		||||
		/* Now reading ASN1 header: can read at least 2 bytes which
 | 
			
		||||
		 * is enough for ASN1 SEQUENCE header and either length field
 | 
			
		||||
		 * or at least the length of the length field.
 | 
			
		||||
		 */
 | 
			
		||||
		n = BIO_get_mem_data(rctx->mem, &p);
 | 
			
		||||
		if (n < 6)
 | 
			
		||||
		if (n < 2)
 | 
			
		||||
			goto next_io;
 | 
			
		||||
 | 
			
		||||
		/* Check it is an ASN1 SEQUENCE */
 | 
			
		||||
@@ -414,6 +415,11 @@ int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx)
 | 
			
		||||
		/* Check out length field */
 | 
			
		||||
		if (*p & 0x80)
 | 
			
		||||
			{
 | 
			
		||||
			/* If MSB set on initial length octet we can now
 | 
			
		||||
			 * always read 6 octets: make sure we have them.
 | 
			
		||||
			 */
 | 
			
		||||
			if (n < 6)
 | 
			
		||||
				goto next_io;
 | 
			
		||||
			n = *p & 0x7F;
 | 
			
		||||
			/* Not NDEF or excessive length */
 | 
			
		||||
			if (!n || (n > 4))
 | 
			
		||||
 
 | 
			
		||||
@@ -25,11 +25,11 @@
 | 
			
		||||
 * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
 | 
			
		||||
 *  major minor fix final patch/beta)
 | 
			
		||||
 */
 | 
			
		||||
#define OPENSSL_VERSION_NUMBER	0x10000020
 | 
			
		||||
#define OPENSSL_VERSION_NUMBER	0x1000004fL
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
#define OPENSSL_VERSION_TEXT	"OpenSSL 1.0.0b-fips-dev xx XXX xxxx"
 | 
			
		||||
#define OPENSSL_VERSION_TEXT	"OpenSSL 1.0.0d-fips 8 Feb 2011"
 | 
			
		||||
#else
 | 
			
		||||
#define OPENSSL_VERSION_TEXT	"OpenSSL 1.0.0b-dev x XXX xxxx"
 | 
			
		||||
#define OPENSSL_VERSION_TEXT	"OpenSSL 1.0.0d 8 Feb 2011"
 | 
			
		||||
#endif
 | 
			
		||||
#define OPENSSL_VERSION_PTEXT	" part of " OPENSSL_VERSION_TEXT
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -167,7 +167,7 @@ my %globals;
 | 
			
		||||
	    } elsif ($self->{op} =~ /^(pop|push)f/) {
 | 
			
		||||
		$self->{op} .= $self->{sz};
 | 
			
		||||
	    } elsif ($self->{op} eq "call" && $current_segment eq ".CRT\$XCU") {
 | 
			
		||||
		$self->{op} = "ALIGN\t8\n\tDQ";
 | 
			
		||||
		$self->{op} = "\tDQ";
 | 
			
		||||
	    } 
 | 
			
		||||
	    $self->{op};
 | 
			
		||||
	}
 | 
			
		||||
@@ -545,6 +545,8 @@ my %globals;
 | 
			
		||||
					if ($line=~/\.([px])data/) {
 | 
			
		||||
					    $v.=" rdata align=";
 | 
			
		||||
					    $v.=$1 eq "p"? 4 : 8;
 | 
			
		||||
					} elsif ($line=~/\.CRT\$/i) {
 | 
			
		||||
					    $v.=" rdata align=8";
 | 
			
		||||
					}
 | 
			
		||||
				    } else {
 | 
			
		||||
					$v="$current_segment\tENDS\n" if ($current_segment);
 | 
			
		||||
@@ -552,6 +554,8 @@ my %globals;
 | 
			
		||||
					if ($line=~/\.([px])data/) {
 | 
			
		||||
					    $v.=" READONLY";
 | 
			
		||||
					    $v.=" ALIGN(".($1 eq "p" ? 4 : 8).")" if ($masm>=$masmref);
 | 
			
		||||
					} elsif ($line=~/\.CRT\$/i) {
 | 
			
		||||
					    $v.=" READONLY DWORD";
 | 
			
		||||
					}
 | 
			
		||||
				    }
 | 
			
		||||
				    $current_segment = $line;
 | 
			
		||||
 
 | 
			
		||||
@@ -107,6 +107,7 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
 | 
			
		||||
	unsigned char *B, *D, *I, *p, *Ai;
 | 
			
		||||
	int Slen, Plen, Ilen, Ijlen;
 | 
			
		||||
	int i, j, u, v;
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
	BIGNUM *Ij, *Bpl1;	/* These hold Ij and B + 1 */
 | 
			
		||||
	EVP_MD_CTX ctx;
 | 
			
		||||
#ifdef  DEBUG_KEYGEN
 | 
			
		||||
@@ -144,10 +145,8 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
 | 
			
		||||
	I = OPENSSL_malloc (Ilen);
 | 
			
		||||
	Ij = BN_new();
 | 
			
		||||
	Bpl1 = BN_new();
 | 
			
		||||
	if (!D || !Ai || !B || !I || !Ij || !Bpl1) {
 | 
			
		||||
		PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
	if (!D || !Ai || !B || !I || !Ij || !Bpl1)
 | 
			
		||||
		goto err;
 | 
			
		||||
	for (i = 0; i < v; i++) D[i] = id;
 | 
			
		||||
	p = I;
 | 
			
		||||
	for (i = 0; i < Slen; i++) *p++ = salt[i % saltlen];
 | 
			
		||||
@@ -164,28 +163,22 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
 | 
			
		||||
		}
 | 
			
		||||
		memcpy (out, Ai, min (n, u));
 | 
			
		||||
		if (u >= n) {
 | 
			
		||||
			OPENSSL_free (Ai);
 | 
			
		||||
			OPENSSL_free (B);
 | 
			
		||||
			OPENSSL_free (D);
 | 
			
		||||
			OPENSSL_free (I);
 | 
			
		||||
			BN_free (Ij);
 | 
			
		||||
			BN_free (Bpl1);
 | 
			
		||||
			EVP_MD_CTX_cleanup(&ctx);
 | 
			
		||||
#ifdef DEBUG_KEYGEN
 | 
			
		||||
			fprintf(stderr, "Output KEY (length %d)\n", tmpn);
 | 
			
		||||
			h__dump(tmpout, tmpn);
 | 
			
		||||
#endif
 | 
			
		||||
			return 1;	
 | 
			
		||||
			ret = 1;
 | 
			
		||||
			goto end;
 | 
			
		||||
		}
 | 
			
		||||
		n -= u;
 | 
			
		||||
		out += u;
 | 
			
		||||
		for (j = 0; j < v; j++) B[j] = Ai[j % u];
 | 
			
		||||
		/* Work out B + 1 first then can use B as tmp space */
 | 
			
		||||
		BN_bin2bn (B, v, Bpl1);
 | 
			
		||||
		BN_add_word (Bpl1, 1);
 | 
			
		||||
		if (!BN_bin2bn (B, v, Bpl1)) goto err;
 | 
			
		||||
		if (!BN_add_word (Bpl1, 1)) goto err;
 | 
			
		||||
		for (j = 0; j < Ilen ; j+=v) {
 | 
			
		||||
			BN_bin2bn (I + j, v, Ij);
 | 
			
		||||
			BN_add (Ij, Ij, Bpl1);
 | 
			
		||||
			if (!BN_bin2bn (I + j, v, Ij)) goto err;
 | 
			
		||||
			if (!BN_add (Ij, Ij, Bpl1)) goto err;
 | 
			
		||||
			BN_bn2bin (Ij, B);
 | 
			
		||||
			Ijlen = BN_num_bytes (Ij);
 | 
			
		||||
			/* If more than 2^(v*8) - 1 cut off MSB */
 | 
			
		||||
@@ -201,6 +194,19 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
 | 
			
		||||
			} else BN_bn2bin (Ij, I + j);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
err:
 | 
			
		||||
	PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
 | 
			
		||||
end:
 | 
			
		||||
	OPENSSL_free (Ai);
 | 
			
		||||
	OPENSSL_free (B);
 | 
			
		||||
	OPENSSL_free (D);
 | 
			
		||||
	OPENSSL_free (I);
 | 
			
		||||
	BN_free (Ij);
 | 
			
		||||
	BN_free (Bpl1);
 | 
			
		||||
	EVP_MD_CTX_cleanup(&ctx);
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
#ifdef DEBUG_KEYGEN
 | 
			
		||||
void h__dump (unsigned char *p, int len)
 | 
			
		||||
 
 | 
			
		||||
@@ -160,8 +160,8 @@ int RAND_poll(void)
 | 
			
		||||
         rdtsc
 | 
			
		||||
         mov tsc, eax        
 | 
			
		||||
      }
 | 
			
		||||
#else
 | 
			
		||||
      asm volatile("rdtsc":"=A" (tsc));
 | 
			
		||||
#elif defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
 | 
			
		||||
      asm volatile("rdtsc":"=a"(tsc)::"edx");
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
      RAND_add(&tsc, sizeof(tsc), 1);
 | 
			
		||||
 
 | 
			
		||||
@@ -310,7 +310,7 @@ const char *RAND_file_name(char *buf, size_t size)
 | 
			
		||||
	 * to something hopefully decent if that isn't available. 
 | 
			
		||||
	 */
 | 
			
		||||
 | 
			
		||||
	if (!ok)
 | 
			
		||||
	if (!buf[0])
 | 
			
		||||
		if (BUF_strlcpy(buf,"/dev/arandom",size) >= size) {
 | 
			
		||||
			return(NULL);
 | 
			
		||||
		}	
 | 
			
		||||
 
 | 
			
		||||
@@ -154,14 +154,14 @@
 | 
			
		||||
#  define ROTATE_l32(a,n)	({ register unsigned int ret;	\
 | 
			
		||||
					asm ("roll %%cl,%0"	\
 | 
			
		||||
						: "=r"(ret)	\
 | 
			
		||||
						: "c"(n),"0"(a)	\
 | 
			
		||||
						: "c"(n),"0"((unsigned int)(a))	\
 | 
			
		||||
						: "cc");	\
 | 
			
		||||
					ret;			\
 | 
			
		||||
				})
 | 
			
		||||
#  define ROTATE_r32(a,n)	({ register unsigned int ret;	\
 | 
			
		||||
					asm ("rorl %%cl,%0"	\
 | 
			
		||||
						: "=r"(ret)	\
 | 
			
		||||
						: "c"(n),"0"(a)	\
 | 
			
		||||
						: "c"(n),"0"((unsigned int)(a))	\
 | 
			
		||||
						: "cc");	\
 | 
			
		||||
					ret;			\
 | 
			
		||||
				})
 | 
			
		||||
 
 | 
			
		||||
@@ -675,7 +675,7 @@ static int RSA_eay_public_decrypt(int flen, const unsigned char *from,
 | 
			
		||||
		rsa->_method_mod_n)) goto err;
 | 
			
		||||
 | 
			
		||||
	if ((padding == RSA_X931_PADDING) && ((ret->d[0] & 0xf) != 12))
 | 
			
		||||
		BN_sub(ret, rsa->n, ret);
 | 
			
		||||
		if (!BN_sub(ret, rsa->n, ret)) goto err;
 | 
			
		||||
 | 
			
		||||
	p=buf;
 | 
			
		||||
	i=BN_bn2bin(ret,p);
 | 
			
		||||
 
 | 
			
		||||
@@ -37,9 +37,18 @@
 | 
			
		||||
#	modes are limited. As result it takes more instructions to do
 | 
			
		||||
#	the same job in Thumb, therefore the code is never twice as
 | 
			
		||||
#	small and always slower.
 | 
			
		||||
# [***]	which is also ~35% better than compiler generated code.
 | 
			
		||||
# [***]	which is also ~35% better than compiler generated code. Dual-
 | 
			
		||||
#	issue Cortex A8 core was measured to process input block in
 | 
			
		||||
#	~990 cycles.
 | 
			
		||||
 | 
			
		||||
$output=shift;
 | 
			
		||||
# August 2010.
 | 
			
		||||
#
 | 
			
		||||
# Rescheduling for dual-issue pipeline resulted in 13% improvement on
 | 
			
		||||
# Cortex A8 core and in absolute terms ~870 cycles per input block
 | 
			
		||||
# [or 13.6 cycles per byte].
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
while (($output=shift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
 | 
			
		||||
open STDOUT,">$output";
 | 
			
		||||
 | 
			
		||||
$ctx="r0";
 | 
			
		||||
@@ -58,43 +67,22 @@ $t3="r12";
 | 
			
		||||
$Xi="r14";
 | 
			
		||||
@V=($a,$b,$c,$d,$e);
 | 
			
		||||
 | 
			
		||||
# One can optimize this for aligned access on big-endian architecture,
 | 
			
		||||
# but code's endian neutrality makes it too pretty:-)
 | 
			
		||||
sub Xload {
 | 
			
		||||
my ($a,$b,$c,$d,$e)=@_;
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	ldrb	$t0,[$inp],#4
 | 
			
		||||
	ldrb	$t1,[$inp,#-3]
 | 
			
		||||
	ldrb	$t2,[$inp,#-2]
 | 
			
		||||
	ldrb	$t3,[$inp,#-1]
 | 
			
		||||
	add	$e,$K,$e,ror#2			@ E+=K_00_19
 | 
			
		||||
	orr	$t0,$t1,$t0,lsl#8
 | 
			
		||||
	add	$e,$e,$a,ror#27			@ E+=ROR(A,27)
 | 
			
		||||
	orr	$t0,$t2,$t0,lsl#8
 | 
			
		||||
	eor	$t1,$c,$d			@ F_xx_xx
 | 
			
		||||
	orr	$t0,$t3,$t0,lsl#8
 | 
			
		||||
	add	$e,$e,$t0			@ E+=X[i]
 | 
			
		||||
	str	$t0,[$Xi,#-4]!
 | 
			
		||||
___
 | 
			
		||||
}
 | 
			
		||||
sub Xupdate {
 | 
			
		||||
my ($a,$b,$c,$d,$e,$flag)=@_;
 | 
			
		||||
my ($a,$b,$c,$d,$e,$opt1,$opt2)=@_;
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	ldr	$t0,[$Xi,#15*4]
 | 
			
		||||
	ldr	$t1,[$Xi,#13*4]
 | 
			
		||||
	ldr	$t2,[$Xi,#7*4]
 | 
			
		||||
	ldr	$t3,[$Xi,#2*4]
 | 
			
		||||
	add	$e,$K,$e,ror#2			@ E+=K_xx_xx
 | 
			
		||||
	ldr	$t3,[$Xi,#2*4]
 | 
			
		||||
	eor	$t0,$t0,$t1
 | 
			
		||||
	eor	$t0,$t0,$t2
 | 
			
		||||
	eor	$t0,$t0,$t3
 | 
			
		||||
	add	$e,$e,$a,ror#27			@ E+=ROR(A,27)
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___ if (!defined($flag));
 | 
			
		||||
	eor	$t1,$c,$d			@ F_xx_xx, but not in 40_59
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	eor	$t2,$t2,$t3
 | 
			
		||||
	eor	$t1,$c,$d			@ F_xx_xx
 | 
			
		||||
	mov	$t0,$t0,ror#31
 | 
			
		||||
	add	$e,$e,$a,ror#27			@ E+=ROR(A,27)
 | 
			
		||||
	eor	$t0,$t0,$t2,ror#31
 | 
			
		||||
	$opt1					@ F_xx_xx
 | 
			
		||||
	$opt2					@ F_xx_xx
 | 
			
		||||
	add	$e,$e,$t0			@ E+=X[i]
 | 
			
		||||
	str	$t0,[$Xi,#-4]!
 | 
			
		||||
___
 | 
			
		||||
@@ -102,19 +90,29 @@ ___
 | 
			
		||||
 | 
			
		||||
sub BODY_00_15 {
 | 
			
		||||
my ($a,$b,$c,$d,$e)=@_;
 | 
			
		||||
	&Xload(@_);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	ldrb	$t0,[$inp],#4
 | 
			
		||||
	ldrb	$t1,[$inp,#-1]
 | 
			
		||||
	ldrb	$t2,[$inp,#-2]
 | 
			
		||||
	add	$e,$K,$e,ror#2			@ E+=K_00_19
 | 
			
		||||
	ldrb	$t3,[$inp,#-3]
 | 
			
		||||
	add	$e,$e,$a,ror#27			@ E+=ROR(A,27)
 | 
			
		||||
	orr	$t0,$t1,$t0,lsl#24
 | 
			
		||||
	eor	$t1,$c,$d			@ F_xx_xx
 | 
			
		||||
	orr	$t0,$t0,$t2,lsl#8
 | 
			
		||||
	orr	$t0,$t0,$t3,lsl#16
 | 
			
		||||
	and	$t1,$b,$t1,ror#2
 | 
			
		||||
	add	$e,$e,$t0			@ E+=X[i]
 | 
			
		||||
	eor	$t1,$t1,$d,ror#2		@ F_00_19(B,C,D)
 | 
			
		||||
	str	$t0,[$Xi,#-4]!
 | 
			
		||||
	add	$e,$e,$t1			@ E+=F_00_19(B,C,D)
 | 
			
		||||
___
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub BODY_16_19 {
 | 
			
		||||
my ($a,$b,$c,$d,$e)=@_;
 | 
			
		||||
	&Xupdate(@_);
 | 
			
		||||
	&Xupdate(@_,"and $t1,$b,$t1,ror#2");
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	and	$t1,$b,$t1,ror#2
 | 
			
		||||
	eor	$t1,$t1,$d,ror#2		@ F_00_19(B,C,D)
 | 
			
		||||
	add	$e,$e,$t1			@ E+=F_00_19(B,C,D)
 | 
			
		||||
___
 | 
			
		||||
@@ -122,22 +120,18 @@ ___
 | 
			
		||||
 | 
			
		||||
sub BODY_20_39 {
 | 
			
		||||
my ($a,$b,$c,$d,$e)=@_;
 | 
			
		||||
	&Xupdate(@_);
 | 
			
		||||
	&Xupdate(@_,"eor $t1,$b,$t1,ror#2");
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	eor	$t1,$b,$t1,ror#2		@ F_20_39(B,C,D)
 | 
			
		||||
	add	$e,$e,$t1			@ E+=F_20_39(B,C,D)
 | 
			
		||||
___
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub BODY_40_59 {
 | 
			
		||||
my ($a,$b,$c,$d,$e)=@_;
 | 
			
		||||
	&Xupdate(@_,1);
 | 
			
		||||
	&Xupdate(@_,"and $t1,$b,$t1,ror#2","and $t2,$c,$d");
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	and	$t1,$b,$c,ror#2
 | 
			
		||||
	orr	$t2,$b,$c,ror#2
 | 
			
		||||
	and	$t2,$t2,$d,ror#2
 | 
			
		||||
	orr	$t1,$t1,$t2			@ F_40_59(B,C,D)
 | 
			
		||||
	add	$e,$e,$t1			@ E+=F_40_59(B,C,D)
 | 
			
		||||
	add	$e,$e,$t2,ror#2
 | 
			
		||||
___
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -276,6 +276,7 @@ $code.=<<___;
 | 
			
		||||
.type	sha1_block_data_order,#function
 | 
			
		||||
.size	sha1_block_data_order,(.-sha1_block_data_order)
 | 
			
		||||
.asciz	"SHA1 block transform for SPARCv9, CRYPTOGAMS by <appro\@openssl.org>"
 | 
			
		||||
.align	4
 | 
			
		||||
___
 | 
			
		||||
 | 
			
		||||
$code =~ s/\`([^\`]*)\`/eval $1/gem;
 | 
			
		||||
 
 | 
			
		||||
@@ -539,6 +539,7 @@ $code.=<<___;
 | 
			
		||||
.type	sha1_block_data_order,#function
 | 
			
		||||
.size	sha1_block_data_order,(.-sha1_block_data_order)
 | 
			
		||||
.asciz	"SHA1 block transform for SPARCv9a, CRYPTOGAMS by <appro\@openssl.org>"
 | 
			
		||||
.align	4
 | 
			
		||||
___
 | 
			
		||||
 | 
			
		||||
# Purpose of these subroutines is to explicitly encode VIS instructions,
 | 
			
		||||
 
 | 
			
		||||
@@ -11,9 +11,14 @@
 | 
			
		||||
 | 
			
		||||
# Performance is ~2x better than gcc 3.4 generated code and in "abso-
 | 
			
		||||
# lute" terms is ~2250 cycles per 64-byte block or ~35 cycles per
 | 
			
		||||
# byte.
 | 
			
		||||
# byte [on single-issue Xscale PXA250 core].
 | 
			
		||||
 | 
			
		||||
$output=shift;
 | 
			
		||||
# July 2010.
 | 
			
		||||
#
 | 
			
		||||
# Rescheduling for dual-issue pipeline resulted in 22% improvement on
 | 
			
		||||
# Cortex A8 core and ~20 cycles per processed byte.
 | 
			
		||||
 | 
			
		||||
while (($output=shift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
 | 
			
		||||
open STDOUT,">$output";
 | 
			
		||||
 | 
			
		||||
$ctx="r0";	$t0="r0";
 | 
			
		||||
@@ -52,27 +57,27 @@ $code.=<<___ if ($i<16);
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	ldr	$t2,[$Ktbl],#4			@ *K256++
 | 
			
		||||
	str	$T1,[sp,#`$i%16`*4]
 | 
			
		||||
	mov	$t0,$e,ror#$Sigma1[0]
 | 
			
		||||
	str	$T1,[sp,#`$i%16`*4]
 | 
			
		||||
	eor	$t0,$t0,$e,ror#$Sigma1[1]
 | 
			
		||||
	eor	$t0,$t0,$e,ror#$Sigma1[2]	@ Sigma1(e)
 | 
			
		||||
	add	$T1,$T1,$t0
 | 
			
		||||
	eor	$t1,$f,$g
 | 
			
		||||
	eor	$t0,$t0,$e,ror#$Sigma1[2]	@ Sigma1(e)
 | 
			
		||||
	and	$t1,$t1,$e
 | 
			
		||||
	add	$T1,$T1,$t0
 | 
			
		||||
	eor	$t1,$t1,$g			@ Ch(e,f,g)
 | 
			
		||||
	add	$T1,$T1,$t1
 | 
			
		||||
	add	$T1,$T1,$h
 | 
			
		||||
	add	$T1,$T1,$t2
 | 
			
		||||
	mov	$h,$a,ror#$Sigma0[0]
 | 
			
		||||
	add	$T1,$T1,$t1
 | 
			
		||||
	eor	$h,$h,$a,ror#$Sigma0[1]
 | 
			
		||||
	add	$T1,$T1,$t2
 | 
			
		||||
	eor	$h,$h,$a,ror#$Sigma0[2]		@ Sigma0(a)
 | 
			
		||||
	orr	$t0,$a,$b
 | 
			
		||||
	and	$t0,$t0,$c
 | 
			
		||||
	and	$t1,$a,$b
 | 
			
		||||
	orr	$t0,$t0,$t1			@ Maj(a,b,c)
 | 
			
		||||
	add	$h,$h,$t0
 | 
			
		||||
	add	$d,$d,$T1
 | 
			
		||||
	and	$t0,$t0,$c
 | 
			
		||||
	add	$h,$h,$T1
 | 
			
		||||
	orr	$t0,$t0,$t1			@ Maj(a,b,c)
 | 
			
		||||
	add	$d,$d,$T1
 | 
			
		||||
	add	$h,$h,$t0
 | 
			
		||||
___
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -80,19 +85,19 @@ sub BODY_16_XX {
 | 
			
		||||
my ($i,$a,$b,$c,$d,$e,$f,$g,$h) = @_;
 | 
			
		||||
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	ldr	$t1,[sp,#`($i+1)%16`*4]	@ $i
 | 
			
		||||
	ldr	$t1,[sp,#`($i+1)%16`*4]		@ $i
 | 
			
		||||
	ldr	$t2,[sp,#`($i+14)%16`*4]
 | 
			
		||||
	ldr	$T1,[sp,#`($i+0)%16`*4]
 | 
			
		||||
	ldr	$inp,[sp,#`($i+9)%16`*4]
 | 
			
		||||
	mov	$t0,$t1,ror#$sigma0[0]
 | 
			
		||||
	ldr	$inp,[sp,#`($i+9)%16`*4]
 | 
			
		||||
	eor	$t0,$t0,$t1,ror#$sigma0[1]
 | 
			
		||||
	eor	$t0,$t0,$t1,lsr#$sigma0[2]	@ sigma0(X[i+1])
 | 
			
		||||
	mov	$t1,$t2,ror#$sigma1[0]
 | 
			
		||||
	eor	$t1,$t1,$t2,ror#$sigma1[1]
 | 
			
		||||
	eor	$t1,$t1,$t2,lsr#$sigma1[2]	@ sigma1(X[i+14])
 | 
			
		||||
	add	$T1,$T1,$t0
 | 
			
		||||
	add	$T1,$T1,$t1
 | 
			
		||||
	eor	$t1,$t1,$t2,ror#$sigma1[1]
 | 
			
		||||
	add	$T1,$T1,$inp
 | 
			
		||||
	eor	$t1,$t1,$t2,lsr#$sigma1[2]	@ sigma1(X[i+14])
 | 
			
		||||
	add	$T1,$T1,$t1
 | 
			
		||||
___
 | 
			
		||||
	&BODY_00_15(@_);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,13 @@
 | 
			
		||||
# SHA512 block procedure for ARMv4. September 2007.
 | 
			
		||||
 | 
			
		||||
# This code is ~4.5 (four and a half) times faster than code generated
 | 
			
		||||
# by gcc 3.4 and it spends ~72 clock cycles per byte. 
 | 
			
		||||
# by gcc 3.4 and it spends ~72 clock cycles per byte [on single-issue
 | 
			
		||||
# Xscale PXA250 core].
 | 
			
		||||
#
 | 
			
		||||
# July 2010.
 | 
			
		||||
#
 | 
			
		||||
# Rescheduling for dual-issue pipeline resulted in 6% improvement on
 | 
			
		||||
# Cortex A8 core and ~40 cycles per processed byte.
 | 
			
		||||
 | 
			
		||||
# Byte order [in]dependence. =========================================
 | 
			
		||||
#
 | 
			
		||||
@@ -22,7 +28,7 @@ $hi=0;
 | 
			
		||||
$lo=4;
 | 
			
		||||
# ====================================================================
 | 
			
		||||
 | 
			
		||||
$output=shift;
 | 
			
		||||
while (($output=shift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
 | 
			
		||||
open STDOUT,">$output";
 | 
			
		||||
 | 
			
		||||
$ctx="r0";
 | 
			
		||||
@@ -73,33 +79,31 @@ $code.=<<___;
 | 
			
		||||
	eor	$t0,$t0,$Elo,lsl#23
 | 
			
		||||
	eor	$t1,$t1,$Ehi,lsl#23	@ Sigma1(e)
 | 
			
		||||
	adds	$Tlo,$Tlo,$t0
 | 
			
		||||
	adc	$Thi,$Thi,$t1		@ T += Sigma1(e)
 | 
			
		||||
	adds	$Tlo,$Tlo,$t2
 | 
			
		||||
	adc	$Thi,$Thi,$t3		@ T += h
 | 
			
		||||
 | 
			
		||||
	ldr	$t0,[sp,#$Foff+0]	@ f.lo
 | 
			
		||||
	adc	$Thi,$Thi,$t1		@ T += Sigma1(e)
 | 
			
		||||
	ldr	$t1,[sp,#$Foff+4]	@ f.hi
 | 
			
		||||
	adds	$Tlo,$Tlo,$t2
 | 
			
		||||
	ldr	$t2,[sp,#$Goff+0]	@ g.lo
 | 
			
		||||
	adc	$Thi,$Thi,$t3		@ T += h
 | 
			
		||||
	ldr	$t3,[sp,#$Goff+4]	@ g.hi
 | 
			
		||||
 | 
			
		||||
	eor	$t0,$t0,$t2
 | 
			
		||||
	str	$Elo,[sp,#$Eoff+0]
 | 
			
		||||
	str	$Ehi,[sp,#$Eoff+4]
 | 
			
		||||
	str	$Alo,[sp,#$Aoff+0]
 | 
			
		||||
	str	$Ahi,[sp,#$Aoff+4]
 | 
			
		||||
 | 
			
		||||
	eor	$t0,$t0,$t2
 | 
			
		||||
	eor	$t1,$t1,$t3
 | 
			
		||||
	str	$Ehi,[sp,#$Eoff+4]
 | 
			
		||||
	and	$t0,$t0,$Elo
 | 
			
		||||
	str	$Alo,[sp,#$Aoff+0]
 | 
			
		||||
	and	$t1,$t1,$Ehi
 | 
			
		||||
	str	$Ahi,[sp,#$Aoff+4]
 | 
			
		||||
	eor	$t0,$t0,$t2
 | 
			
		||||
	eor	$t1,$t1,$t3		@ Ch(e,f,g)
 | 
			
		||||
 | 
			
		||||
	ldr	$t2,[$Ktbl,#4]		@ K[i].lo
 | 
			
		||||
	eor	$t1,$t1,$t3		@ Ch(e,f,g)
 | 
			
		||||
	ldr	$t3,[$Ktbl,#0]		@ K[i].hi
 | 
			
		||||
	ldr	$Elo,[sp,#$Doff+0]	@ d.lo
 | 
			
		||||
	ldr	$Ehi,[sp,#$Doff+4]	@ d.hi
 | 
			
		||||
 | 
			
		||||
	adds	$Tlo,$Tlo,$t0
 | 
			
		||||
	ldr	$Elo,[sp,#$Doff+0]	@ d.lo
 | 
			
		||||
	adc	$Thi,$Thi,$t1		@ T += Ch(e,f,g)
 | 
			
		||||
	ldr	$Ehi,[sp,#$Doff+4]	@ d.hi
 | 
			
		||||
	adds	$Tlo,$Tlo,$t2
 | 
			
		||||
	adc	$Thi,$Thi,$t3		@ T += K[i]
 | 
			
		||||
	adds	$Elo,$Elo,$Tlo
 | 
			
		||||
 
 | 
			
		||||
@@ -586,6 +586,7 @@ $code.=<<___;
 | 
			
		||||
.type	sha${label}_block_data_order,#function
 | 
			
		||||
.size	sha${label}_block_data_order,(.-sha${label}_block_data_order)
 | 
			
		||||
.asciz	"SHA${label} block transform for SPARCv9, CRYPTOGAMS by <appro\@openssl.org>"
 | 
			
		||||
.align	4
 | 
			
		||||
___
 | 
			
		||||
 | 
			
		||||
$code =~ s/\`([^\`]*)\`/eval $1/gem;
 | 
			
		||||
 
 | 
			
		||||
@@ -225,13 +225,95 @@ _sparcv9_rdtick:
 | 
			
		||||
	xor	%o0,%o0,%o0
 | 
			
		||||
	.word	0x91410000	!rd	%tick,%o0
 | 
			
		||||
	retl
 | 
			
		||||
	.word	0x93323020	!srlx	%o2,32,%o1
 | 
			
		||||
	.word	0x93323020	!srlx	%o0,32,%o1
 | 
			
		||||
.notick:
 | 
			
		||||
	retl
 | 
			
		||||
	xor	%o1,%o1,%o1
 | 
			
		||||
.type	_sparcv9_rdtick,#function
 | 
			
		||||
.size	_sparcv9_rdtick,.-_sparcv9_rdtick
 | 
			
		||||
 | 
			
		||||
.global	_sparcv9_vis1_probe
 | 
			
		||||
.align	8
 | 
			
		||||
_sparcv9_vis1_probe:
 | 
			
		||||
	.word	0x81b00d80	!fxor	%f0,%f0,%f0
 | 
			
		||||
	add	%sp,BIAS+2,%o1
 | 
			
		||||
	retl
 | 
			
		||||
	.word	0xc19a5a40	!ldda	[%o1]ASI_FP16_P,%f0
 | 
			
		||||
.type	_sparcv9_vis1_probe,#function
 | 
			
		||||
.size	_sparcv9_vis1_probe,.-_sparcv9_vis1_probe
 | 
			
		||||
 | 
			
		||||
! Probe and instrument VIS1 instruction. Output is number of cycles it
 | 
			
		||||
! takes to execute rdtick and pair of VIS1 instructions. US-Tx VIS unit
 | 
			
		||||
! is slow (documented to be 6 cycles on T2) and the core is in-order
 | 
			
		||||
! single-issue, it should be possible to distinguish Tx reliably...
 | 
			
		||||
! Observed return values are:
 | 
			
		||||
!
 | 
			
		||||
!	UltraSPARC IIe		7
 | 
			
		||||
!	UltraSPARC III		7
 | 
			
		||||
!	UltraSPARC T1		24
 | 
			
		||||
!
 | 
			
		||||
! Numbers for T2 and SPARC64 V-VII are more than welcomed.
 | 
			
		||||
!
 | 
			
		||||
! It would be possible to detect specifically US-T1 by instrumenting
 | 
			
		||||
! fmul8ulx16, which is emulated on T1 and as such accounts for quite
 | 
			
		||||
! a lot of %tick-s, couple of thousand on Linux...
 | 
			
		||||
.global	_sparcv9_vis1_instrument
 | 
			
		||||
.align	8
 | 
			
		||||
_sparcv9_vis1_instrument:
 | 
			
		||||
	.word	0x91410000	!rd	%tick,%o0
 | 
			
		||||
	.word	0x81b00d80	!fxor	%f0,%f0,%f0
 | 
			
		||||
	.word	0x85b08d82	!fxor	%f2,%f2,%f2
 | 
			
		||||
	.word	0x93410000	!rd	%tick,%o1
 | 
			
		||||
	.word	0x81b00d80	!fxor	%f0,%f0,%f0
 | 
			
		||||
	.word	0x85b08d82	!fxor	%f2,%f2,%f2
 | 
			
		||||
	.word	0x95410000	!rd	%tick,%o2
 | 
			
		||||
	.word	0x81b00d80	!fxor	%f0,%f0,%f0
 | 
			
		||||
	.word	0x85b08d82	!fxor	%f2,%f2,%f2
 | 
			
		||||
	.word	0x97410000	!rd	%tick,%o3
 | 
			
		||||
	.word	0x81b00d80	!fxor	%f0,%f0,%f0
 | 
			
		||||
	.word	0x85b08d82	!fxor	%f2,%f2,%f2
 | 
			
		||||
	.word	0x99410000	!rd	%tick,%o4
 | 
			
		||||
 | 
			
		||||
	! calculate intervals
 | 
			
		||||
	sub	%o1,%o0,%o0
 | 
			
		||||
	sub	%o2,%o1,%o1
 | 
			
		||||
	sub	%o3,%o2,%o2
 | 
			
		||||
	sub	%o4,%o3,%o3
 | 
			
		||||
 | 
			
		||||
	! find minumum value
 | 
			
		||||
	cmp	%o0,%o1
 | 
			
		||||
	.word	0x38680002	!bgu,a	%xcc,.+8
 | 
			
		||||
	mov	%o1,%o0
 | 
			
		||||
	cmp	%o0,%o2
 | 
			
		||||
	.word	0x38680002	!bgu,a	%xcc,.+8
 | 
			
		||||
	mov	%o2,%o0
 | 
			
		||||
	cmp	%o0,%o3
 | 
			
		||||
	.word	0x38680002	!bgu,a	%xcc,.+8
 | 
			
		||||
	mov	%o3,%o0
 | 
			
		||||
 | 
			
		||||
	retl
 | 
			
		||||
	nop
 | 
			
		||||
.type	_sparcv9_vis1_instrument,#function
 | 
			
		||||
.size	_sparcv9_vis1_instrument,.-_sparcv9_vis1_instrument
 | 
			
		||||
 | 
			
		||||
.global	_sparcv9_vis2_probe
 | 
			
		||||
.align	8
 | 
			
		||||
_sparcv9_vis2_probe:
 | 
			
		||||
	retl
 | 
			
		||||
	.word	0x81b00980	!bshuffle	%f0,%f0,%f0
 | 
			
		||||
.type	_sparcv9_vis2_probe,#function
 | 
			
		||||
.size	_sparcv9_vis2_probe,.-_sparcv9_vis2_probe
 | 
			
		||||
 | 
			
		||||
.global	_sparcv9_fmadd_probe
 | 
			
		||||
.align	8
 | 
			
		||||
_sparcv9_fmadd_probe:
 | 
			
		||||
	.word	0x81b00d80	!fxor	%f0,%f0,%f0
 | 
			
		||||
	.word	0x85b08d82	!fxor	%f2,%f2,%f2
 | 
			
		||||
	retl
 | 
			
		||||
	.word	0x81b80440	!fmaddd	%f0,%f0,%f2,%f0
 | 
			
		||||
.type	_sparcv9_fmadd_probe,#function
 | 
			
		||||
.size	_sparcv9_fmadd_probe,.-_sparcv9_fmadd_probe
 | 
			
		||||
 | 
			
		||||
.global	OPENSSL_cleanse
 | 
			
		||||
.align	32
 | 
			
		||||
OPENSSL_cleanse:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <setjmp.h>
 | 
			
		||||
#include <signal.h>
 | 
			
		||||
#include <sys/time.h>
 | 
			
		||||
#include <openssl/bn.h>
 | 
			
		||||
 | 
			
		||||
@@ -9,6 +11,7 @@
 | 
			
		||||
#define SPARCV9_VIS1		(1<<2)
 | 
			
		||||
#define SPARCV9_VIS2		(1<<3)	/* reserved */
 | 
			
		||||
#define SPARCV9_FMADD		(1<<4)	/* reserved for SPARC64 V */
 | 
			
		||||
 | 
			
		||||
static int OPENSSL_sparcv9cap_P=SPARCV9_TICK_PRIVILEGED;
 | 
			
		||||
 | 
			
		||||
int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0, int num)
 | 
			
		||||
@@ -23,10 +26,14 @@ int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_U
 | 
			
		||||
		return bn_mul_mont_int(rp,ap,bp,np,n0,num);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
unsigned long	_sparcv9_rdtick(void);
 | 
			
		||||
void		_sparcv9_vis1_probe(void);
 | 
			
		||||
unsigned long	_sparcv9_vis1_instrument(void);
 | 
			
		||||
void		_sparcv9_vis2_probe(void);
 | 
			
		||||
void		_sparcv9_fmadd_probe(void);
 | 
			
		||||
 | 
			
		||||
unsigned long OPENSSL_rdtsc(void)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned long _sparcv9_rdtick(void);
 | 
			
		||||
 | 
			
		||||
	if (OPENSSL_sparcv9cap_P&SPARCV9_TICK_PRIVILEGED)
 | 
			
		||||
#if defined(__sun) && defined(__SVR4)
 | 
			
		||||
		return gethrtime();
 | 
			
		||||
@@ -37,8 +44,11 @@ unsigned long OPENSSL_rdtsc(void)
 | 
			
		||||
		return _sparcv9_rdtick();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#if defined(__sun) && defined(__SVR4)
 | 
			
		||||
 | 
			
		||||
#if 0 && defined(__sun) && defined(__SVR4)
 | 
			
		||||
/* This code path is disabled, because of incompatibility of
 | 
			
		||||
 * libdevinfo.so.1 and libmalloc.so.1 (see below for details)
 | 
			
		||||
 */
 | 
			
		||||
#include <malloc.h>
 | 
			
		||||
#include <dlfcn.h>
 | 
			
		||||
#include <libdevinfo.h>
 | 
			
		||||
#include <sys/systeminfo.h>
 | 
			
		||||
@@ -110,7 +120,21 @@ void OPENSSL_cpuid_setup(void)
 | 
			
		||||
			return;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#ifdef M_KEEP
 | 
			
		||||
	/*
 | 
			
		||||
	 * Solaris libdevinfo.so.1 is effectively incomatible with
 | 
			
		||||
	 * libmalloc.so.1. Specifically, if application is linked with
 | 
			
		||||
	 * -lmalloc, it crashes upon startup with SIGSEGV in
 | 
			
		||||
	 * free(3LIBMALLOC) called by di_fini. Prior call to
 | 
			
		||||
	 * mallopt(M_KEEP,0) somehow helps... But not always...
 | 
			
		||||
	 */
 | 
			
		||||
	if ((h = dlopen(NULL,RTLD_LAZY)))
 | 
			
		||||
		{
 | 
			
		||||
		union { void *p; int (*f)(int,int); } sym;
 | 
			
		||||
		if ((sym.p = dlsym(h,"mallopt"))) (*sym.f)(M_KEEP,0);
 | 
			
		||||
		dlclose(h);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
	if ((h = dlopen("libdevinfo.so.1",RTLD_LAZY))) do
 | 
			
		||||
		{
 | 
			
		||||
		di_init_t	di_init;
 | 
			
		||||
@@ -137,9 +161,19 @@ void OPENSSL_cpuid_setup(void)
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
static sigjmp_buf common_jmp;
 | 
			
		||||
static void common_handler(int sig) { siglongjmp(common_jmp,sig); }
 | 
			
		||||
 | 
			
		||||
void OPENSSL_cpuid_setup(void)
 | 
			
		||||
	{
 | 
			
		||||
	char *e;
 | 
			
		||||
	struct sigaction	common_act,ill_oact,bus_oact;
 | 
			
		||||
	sigset_t		all_masked,oset;
 | 
			
		||||
	int			sig;
 | 
			
		||||
	static int trigger=0;
 | 
			
		||||
 | 
			
		||||
	if (trigger) return;
 | 
			
		||||
	trigger=1;
 | 
			
		||||
 
 | 
			
		||||
	if ((e=getenv("OPENSSL_sparcv9cap")))
 | 
			
		||||
		{
 | 
			
		||||
@@ -147,8 +181,57 @@ void OPENSSL_cpuid_setup(void)
 | 
			
		||||
		return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	/* For now we assume that the rest supports UltraSPARC-I* only */
 | 
			
		||||
	OPENSSL_sparcv9cap_P |= SPARCV9_PREFER_FPU|SPARCV9_VIS1;
 | 
			
		||||
	/* Initial value, fits UltraSPARC-I&II... */
 | 
			
		||||
	OPENSSL_sparcv9cap_P = SPARCV9_PREFER_FPU|SPARCV9_TICK_PRIVILEGED;
 | 
			
		||||
 | 
			
		||||
	sigfillset(&all_masked);
 | 
			
		||||
	sigdelset(&all_masked,SIGILL);
 | 
			
		||||
	sigdelset(&all_masked,SIGTRAP);
 | 
			
		||||
#ifdef SIGEMT
 | 
			
		||||
	sigdelset(&all_masked,SIGEMT);
 | 
			
		||||
#endif
 | 
			
		||||
	sigdelset(&all_masked,SIGFPE);
 | 
			
		||||
	sigdelset(&all_masked,SIGBUS);
 | 
			
		||||
	sigdelset(&all_masked,SIGSEGV);
 | 
			
		||||
	sigprocmask(SIG_SETMASK,&all_masked,&oset);
 | 
			
		||||
 | 
			
		||||
	memset(&common_act,0,sizeof(common_act));
 | 
			
		||||
	common_act.sa_handler = common_handler;
 | 
			
		||||
	common_act.sa_mask    = all_masked;
 | 
			
		||||
 | 
			
		||||
	sigaction(SIGILL,&common_act,&ill_oact);
 | 
			
		||||
	sigaction(SIGBUS,&common_act,&bus_oact);/* T1 fails 16-bit ldda [on Linux] */
 | 
			
		||||
 | 
			
		||||
	if (sigsetjmp(common_jmp,1) == 0)
 | 
			
		||||
		{
 | 
			
		||||
		_sparcv9_rdtick();
 | 
			
		||||
		OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (sigsetjmp(common_jmp,1) == 0)
 | 
			
		||||
		{
 | 
			
		||||
		_sparcv9_vis1_probe();
 | 
			
		||||
		OPENSSL_sparcv9cap_P |= SPARCV9_VIS1;
 | 
			
		||||
		/* detect UltraSPARC-Tx, see sparccpud.S for details... */
 | 
			
		||||
		if (_sparcv9_vis1_instrument() >= 12)
 | 
			
		||||
			OPENSSL_sparcv9cap_P &= ~(SPARCV9_VIS1|SPARCV9_PREFER_FPU);
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			_sparcv9_vis2_probe();
 | 
			
		||||
			OPENSSL_sparcv9cap_P |= SPARCV9_VIS2;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (sigsetjmp(common_jmp,1) == 0)
 | 
			
		||||
		{
 | 
			
		||||
		_sparcv9_fmadd_probe();
 | 
			
		||||
		OPENSSL_sparcv9cap_P |= SPARCV9_FMADD;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	sigaction(SIGBUS,&bus_oact,NULL);
 | 
			
		||||
	sigaction(SIGILL,&ill_oact,NULL);
 | 
			
		||||
 | 
			
		||||
	sigprocmask(SIG_SETMASK,&oset,NULL);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -179,7 +179,8 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
 | 
			
		||||
	sk_is_sorted(CHECKED_STACK_OF(type, st))
 | 
			
		||||
 | 
			
		||||
#define	SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
 | 
			
		||||
  (STACK_OF(type) *)d2i_ASN1_SET((STACK_OF(OPENSSL_BLOCK) **)CHECKED_STACK_OF(type, st), \
 | 
			
		||||
  (STACK_OF(type) *)d2i_ASN1_SET( \
 | 
			
		||||
				(STACK_OF(OPENSSL_BLOCK) **)CHECKED_PTR_OF(STACK_OF(type)*, st), \
 | 
			
		||||
				pp, length, \
 | 
			
		||||
				CHECKED_D2I_OF(type, d2i_func), \
 | 
			
		||||
				CHECKED_SK_FREE_FUNC(type, free_func), \
 | 
			
		||||
@@ -2030,81 +2031,81 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
 | 
			
		||||
#define sk_void_sort(st) SKM_sk_sort(void, (st))
 | 
			
		||||
#define sk_void_is_sorted(st) SKM_sk_is_sorted(void, (st))
 | 
			
		||||
 | 
			
		||||
#define sk_OPENSSL_STRING_new(cmp) ((STACK_OF(OPENSSL_STRING) *)sk_new(CHECKED_SK_CMP_FUNC(char, cmp)))
 | 
			
		||||
#define sk_OPENSSL_STRING_new_null() ((STACK_OF(OPENSSL_STRING) *)sk_new_null())
 | 
			
		||||
#define sk_OPENSSL_STRING_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val))
 | 
			
		||||
#define sk_OPENSSL_STRING_find(st, val) sk_find(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val))
 | 
			
		||||
#define sk_OPENSSL_STRING_value(st, i) ((OPENSSL_STRING)sk_value(CHECKED_STACK_OF(OPENSSL_STRING, st), i))
 | 
			
		||||
#define sk_OPENSSL_STRING_num(st) SKM_sk_num(OPENSSL_STRING, st)
 | 
			
		||||
#define sk_OPENSSL_STRING_pop_free(st, free_func) sk_pop_free(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_SK_FREE_FUNC2(OPENSSL_STRING, free_func))
 | 
			
		||||
#define sk_OPENSSL_STRING_insert(st, val, i) sk_insert(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val), i)
 | 
			
		||||
#define sk_OPENSSL_STRING_free(st) SKM_sk_free(OPENSSL_STRING, st)
 | 
			
		||||
#define sk_OPENSSL_STRING_set(st, i, val) sk_set(CHECKED_STACK_OF(OPENSSL_STRING, st), i, CHECKED_PTR_OF(char, val))
 | 
			
		||||
#define sk_OPENSSL_STRING_zero(st) SKM_sk_zero(OPENSSL_STRING, (st))
 | 
			
		||||
#define sk_OPENSSL_STRING_unshift(st, val) sk_unshift(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val))
 | 
			
		||||
#define sk_OPENSSL_STRING_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_CONST_PTR_OF(char, val))
 | 
			
		||||
#define sk_OPENSSL_STRING_delete(st, i) SKM_sk_delete(OPENSSL_STRING, (st), (i))
 | 
			
		||||
#define sk_OPENSSL_STRING_delete_ptr(st, ptr) (OPENSSL_STRING *)sk_delete_ptr(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, ptr))
 | 
			
		||||
#define sk_OPENSSL_STRING_set_cmp_func(st, cmp)  \
 | 
			
		||||
	((int (*)(const char * const *,const char * const *)) \
 | 
			
		||||
	sk_set_cmp_func(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_SK_CMP_FUNC(char, cmp)))
 | 
			
		||||
#define sk_OPENSSL_STRING_dup(st) SKM_sk_dup(OPENSSL_STRING, st)
 | 
			
		||||
#define sk_OPENSSL_STRING_shift(st) SKM_sk_shift(OPENSSL_STRING, (st))
 | 
			
		||||
#define sk_OPENSSL_STRING_pop(st) (char *)sk_pop(CHECKED_STACK_OF(OPENSSL_STRING, st))
 | 
			
		||||
#define sk_OPENSSL_STRING_sort(st) SKM_sk_sort(OPENSSL_STRING, (st))
 | 
			
		||||
#define sk_OPENSSL_STRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_STRING, (st))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define sk_OPENSSL_BLOCK_new(cmp) ((STACK_OF(OPENSSL_BLOCK) *)sk_new(CHECKED_SK_CMP_FUNC(void, cmp)))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_new_null() ((STACK_OF(OPENSSL_BLOCK) *)sk_new_null())
 | 
			
		||||
#define sk_OPENSSL_BLOCK_push(st, val) sk_push(CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_PTR_OF(void, val))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_find(st, val) sk_find(CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_PTR_OF(void, val))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_value(st, i) ((OPENSSL_BLOCK)sk_value(CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), i))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_find(st, val) sk_find(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_value(st, i) ((OPENSSL_BLOCK)sk_value(CHECKED_STACK_OF(OPENSSL_BLOCK, st), i))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_num(st) SKM_sk_num(OPENSSL_BLOCK, st)
 | 
			
		||||
#define sk_OPENSSL_BLOCK_pop_free(st, free_func) sk_pop_free(CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_SK_FREE_FUNC2(OPENSSL_BLOCK, free_func))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_insert(st, val, i) sk_insert(CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_PTR_OF(void, val), i)
 | 
			
		||||
#define sk_OPENSSL_BLOCK_pop_free(st, free_func) sk_pop_free(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_SK_FREE_FUNC2(OPENSSL_BLOCK, free_func))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_insert(st, val, i) sk_insert(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val), i)
 | 
			
		||||
#define sk_OPENSSL_BLOCK_free(st) SKM_sk_free(OPENSSL_BLOCK, st)
 | 
			
		||||
#define sk_OPENSSL_BLOCK_set(st, i, val) sk_set((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), i, CHECKED_PTR_OF(void, val))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_set(st, i, val) sk_set(CHECKED_STACK_OF(OPENSSL_BLOCK, st), i, CHECKED_PTR_OF(void, val))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_zero(st) SKM_sk_zero(OPENSSL_BLOCK, (st))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_unshift(st, val) sk_unshift((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_PTR_OF(void, val))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_unshift(st, val) sk_unshift(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_CONST_PTR_OF(void, val))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_delete(st, i) SKM_sk_delete(OPENSSL_BLOCK, (st), (i))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_delete_ptr(st, ptr) (OPENSSL_BLOCK *)sk_delete_ptr((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_PTR_OF(void, ptr))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_delete_ptr(st, ptr) (OPENSSL_BLOCK *)sk_delete_ptr(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, ptr))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_set_cmp_func(st, cmp)  \
 | 
			
		||||
	((int (*)(const void * const *,const void * const *)) \
 | 
			
		||||
	sk_set_cmp_func((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_SK_CMP_FUNC(void, cmp)))
 | 
			
		||||
	sk_set_cmp_func(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_SK_CMP_FUNC(void, cmp)))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_dup(st) SKM_sk_dup(OPENSSL_BLOCK, st)
 | 
			
		||||
#define sk_OPENSSL_BLOCK_shift(st) SKM_sk_shift(OPENSSL_BLOCK, (st))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_pop(st) (void *)sk_pop((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_pop(st) (void *)sk_pop(CHECKED_STACK_OF(OPENSSL_BLOCK, st))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_sort(st) SKM_sk_sort(OPENSSL_BLOCK, (st))
 | 
			
		||||
#define sk_OPENSSL_BLOCK_is_sorted(st) SKM_sk_is_sorted(OPENSSL_BLOCK, (st))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define sk_OPENSSL_PSTRING_new(cmp) ((STACK_OF(OPENSSL_PSTRING) *)sk_new(CHECKED_SK_CMP_FUNC(OPENSSL_STRING, cmp)))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_new_null() ((STACK_OF(OPENSSL_PSTRING) *)sk_new_null())
 | 
			
		||||
#define sk_OPENSSL_PSTRING_push(st, val) sk_push(CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_PTR_OF(OPENSSL_STRING, val))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_find(st, val) sk_find(CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_PTR_OF(OPENSSL_STRING, val))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_value(st, i) ((OPENSSL_PSTRING)sk_value(CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), i))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_find(st, val) sk_find(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_value(st, i) ((OPENSSL_PSTRING)sk_value(CHECKED_STACK_OF(OPENSSL_PSTRING, st), i))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_num(st) SKM_sk_num(OPENSSL_PSTRING, st)
 | 
			
		||||
#define sk_OPENSSL_PSTRING_pop_free(st, free_func) sk_pop_free(CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_SK_FREE_FUNC2(OPENSSL_PSTRING, free_func))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_insert(st, val, i) sk_insert(CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_PTR_OF(OPENSSL_STRING, val), i)
 | 
			
		||||
#define sk_OPENSSL_PSTRING_pop_free(st, free_func) sk_pop_free(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_SK_FREE_FUNC2(OPENSSL_PSTRING, free_func))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_insert(st, val, i) sk_insert(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val), i)
 | 
			
		||||
#define sk_OPENSSL_PSTRING_free(st) SKM_sk_free(OPENSSL_PSTRING, st)
 | 
			
		||||
#define sk_OPENSSL_PSTRING_set(st, i, val) sk_set((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), i, CHECKED_PTR_OF(OPENSSL_STRING, val))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_set(st, i, val) sk_set(CHECKED_STACK_OF(OPENSSL_PSTRING, st), i, CHECKED_PTR_OF(OPENSSL_STRING, val))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_zero(st) SKM_sk_zero(OPENSSL_PSTRING, (st))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_unshift(st, val) sk_unshift((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_PTR_OF(OPENSSL_STRING, val))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_unshift(st, val) sk_unshift(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_CONST_PTR_OF(OPENSSL_STRING, val))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_delete(st, i) SKM_sk_delete(OPENSSL_PSTRING, (st), (i))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_delete_ptr(st, ptr) (OPENSSL_PSTRING *)sk_delete_ptr((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_PTR_OF(OPENSSL_STRING, ptr))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_delete_ptr(st, ptr) (OPENSSL_PSTRING *)sk_delete_ptr(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, ptr))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_set_cmp_func(st, cmp)  \
 | 
			
		||||
	((int (*)(const OPENSSL_STRING * const *,const OPENSSL_STRING * const *)) \
 | 
			
		||||
	sk_set_cmp_func((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_SK_CMP_FUNC(OPENSSL_STRING, cmp)))
 | 
			
		||||
	sk_set_cmp_func(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_SK_CMP_FUNC(OPENSSL_STRING, cmp)))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_dup(st) SKM_sk_dup(OPENSSL_PSTRING, st)
 | 
			
		||||
#define sk_OPENSSL_PSTRING_shift(st) SKM_sk_shift(OPENSSL_PSTRING, (st))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_pop(st) (OPENSSL_STRING *)sk_pop((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_pop(st) (OPENSSL_STRING *)sk_pop(CHECKED_STACK_OF(OPENSSL_PSTRING, st))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_sort(st) SKM_sk_sort(OPENSSL_PSTRING, (st))
 | 
			
		||||
#define sk_OPENSSL_PSTRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_PSTRING, (st))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define sk_OPENSSL_STRING_new(cmp) ((STACK_OF(OPENSSL_STRING) *)sk_new(CHECKED_SK_CMP_FUNC(char, cmp)))
 | 
			
		||||
#define sk_OPENSSL_STRING_new_null() ((STACK_OF(OPENSSL_STRING) *)sk_new_null())
 | 
			
		||||
#define sk_OPENSSL_STRING_push(st, val) sk_push(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, val))
 | 
			
		||||
#define sk_OPENSSL_STRING_find(st, val) sk_find(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, val))
 | 
			
		||||
#define sk_OPENSSL_STRING_value(st, i) ((OPENSSL_STRING)sk_value(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), i))
 | 
			
		||||
#define sk_OPENSSL_STRING_num(st) SKM_sk_num(OPENSSL_STRING, st)
 | 
			
		||||
#define sk_OPENSSL_STRING_pop_free(st, free_func) sk_pop_free(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_SK_FREE_FUNC2(OPENSSL_STRING, free_func))
 | 
			
		||||
#define sk_OPENSSL_STRING_insert(st, val, i) sk_insert(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, val), i)
 | 
			
		||||
#define sk_OPENSSL_STRING_free(st) SKM_sk_free(OPENSSL_STRING, st)
 | 
			
		||||
#define sk_OPENSSL_STRING_set(st, i, val) sk_set((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), i, CHECKED_PTR_OF(char, val))
 | 
			
		||||
#define sk_OPENSSL_STRING_zero(st) SKM_sk_zero(OPENSSL_STRING, (st))
 | 
			
		||||
#define sk_OPENSSL_STRING_unshift(st, val) sk_unshift((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, val))
 | 
			
		||||
#define sk_OPENSSL_STRING_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_CONST_PTR_OF(char, val))
 | 
			
		||||
#define sk_OPENSSL_STRING_delete(st, i) SKM_sk_delete(OPENSSL_STRING, (st), (i))
 | 
			
		||||
#define sk_OPENSSL_STRING_delete_ptr(st, ptr) (OPENSSL_STRING *)sk_delete_ptr((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, ptr))
 | 
			
		||||
#define sk_OPENSSL_STRING_set_cmp_func(st, cmp)  \
 | 
			
		||||
	((int (*)(const char * const *,const char * const *)) \
 | 
			
		||||
	sk_set_cmp_func((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_SK_CMP_FUNC(char, cmp)))
 | 
			
		||||
#define sk_OPENSSL_STRING_dup(st) SKM_sk_dup(OPENSSL_STRING, st)
 | 
			
		||||
#define sk_OPENSSL_STRING_shift(st) SKM_sk_shift(OPENSSL_STRING, (st))
 | 
			
		||||
#define sk_OPENSSL_STRING_pop(st) (char *)sk_pop((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st))
 | 
			
		||||
#define sk_OPENSSL_STRING_sort(st) SKM_sk_sort(OPENSSL_STRING, (st))
 | 
			
		||||
#define sk_OPENSSL_STRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_STRING, (st))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
 | 
			
		||||
	SKM_ASN1_SET_OF_d2i(ACCESS_DESCRIPTION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
 | 
			
		||||
#define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, i2d_func, ex_tag, ex_class, is_set) \
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,6 @@
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
#include "cryptlib.h"
 | 
			
		||||
#include <openssl/objects.h>
 | 
			
		||||
#include <openssl/ts.h>
 | 
			
		||||
@@ -74,7 +73,7 @@ TS_VERIFY_CTX *TS_VERIFY_CTX_new(void)
 | 
			
		||||
 | 
			
		||||
void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx)
 | 
			
		||||
	{
 | 
			
		||||
	assert(ctx != NULL);
 | 
			
		||||
	OPENSSL_assert(ctx != NULL);
 | 
			
		||||
	memset(ctx, 0, sizeof(TS_VERIFY_CTX));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -116,7 +115,7 @@ TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx)
 | 
			
		||||
	ASN1_OCTET_STRING *msg;
 | 
			
		||||
	const ASN1_INTEGER *nonce;
 | 
			
		||||
 | 
			
		||||
	assert(req != NULL);
 | 
			
		||||
	OPENSSL_assert(req != NULL);
 | 
			
		||||
	if (ret)
 | 
			
		||||
		TS_VERIFY_CTX_cleanup(ret);
 | 
			
		||||
	else
 | 
			
		||||
 
 | 
			
		||||
@@ -258,6 +258,7 @@ typedef struct x509_cinf_st
 | 
			
		||||
	ASN1_BIT_STRING *issuerUID;		/* [ 1 ] optional in v2 */
 | 
			
		||||
	ASN1_BIT_STRING *subjectUID;		/* [ 2 ] optional in v2 */
 | 
			
		||||
	STACK_OF(X509_EXTENSION) *extensions;	/* [ 3 ] optional in v3 */
 | 
			
		||||
	ASN1_ENCODING enc;
 | 
			
		||||
	} X509_CINF;
 | 
			
		||||
 | 
			
		||||
/* This stuff is certificate "auxiliary info"
 | 
			
		||||
 
 | 
			
		||||
@@ -2034,7 +2034,7 @@ int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509,
 | 
			
		||||
	if (store)
 | 
			
		||||
		ret = X509_VERIFY_PARAM_inherit(ctx->param, store->param);
 | 
			
		||||
	else
 | 
			
		||||
		ctx->param->flags |= X509_VP_FLAG_DEFAULT|X509_VP_FLAG_ONCE;
 | 
			
		||||
		ctx->param->inh_flags |= X509_VP_FLAG_DEFAULT|X509_VP_FLAG_ONCE;
 | 
			
		||||
 | 
			
		||||
	if (store)
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -90,6 +90,7 @@ int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r)
 | 
			
		||||
 | 
			
		||||
int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md)
 | 
			
		||||
	{
 | 
			
		||||
	x->cert_info->enc.modified = 1;
 | 
			
		||||
	return(ASN1_item_sign(ASN1_ITEM_rptr(X509_CINF), x->cert_info->signature,
 | 
			
		||||
		x->sig_alg, x->signature, x->cert_info,pkey,md));
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -177,12 +177,18 @@ static int i2r_address(BIO *out,
 | 
			
		||||
  unsigned char addr[ADDR_RAW_BUF_LEN];
 | 
			
		||||
  int i, n;
 | 
			
		||||
 | 
			
		||||
  if (bs->length < 0)
 | 
			
		||||
    return 0;
 | 
			
		||||
  switch (afi) {
 | 
			
		||||
  case IANA_AFI_IPV4:
 | 
			
		||||
    if (bs->length > 4)
 | 
			
		||||
      return 0;
 | 
			
		||||
    addr_expand(addr, bs, 4, fill);
 | 
			
		||||
    BIO_printf(out, "%d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]);
 | 
			
		||||
    break;
 | 
			
		||||
  case IANA_AFI_IPV6:
 | 
			
		||||
    if (bs->length > 16)
 | 
			
		||||
      return 0;
 | 
			
		||||
    addr_expand(addr, bs, 16, fill);
 | 
			
		||||
    for (n = 16; n > 1 && addr[n-1] == 0x00 && addr[n-2] == 0x00; n -= 2)
 | 
			
		||||
      ;
 | 
			
		||||
 
 | 
			
		||||
@@ -61,7 +61,6 @@
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
#include "cryptlib.h"
 | 
			
		||||
#include <openssl/conf.h>
 | 
			
		||||
#include <openssl/asn1.h>
 | 
			
		||||
@@ -172,11 +171,11 @@ static int ASIdOrRange_cmp(const ASIdOrRange * const *a_,
 | 
			
		||||
{
 | 
			
		||||
  const ASIdOrRange *a = *a_, *b = *b_;
 | 
			
		||||
 | 
			
		||||
  assert((a->type == ASIdOrRange_id && a->u.id != NULL) ||
 | 
			
		||||
  OPENSSL_assert((a->type == ASIdOrRange_id && a->u.id != NULL) ||
 | 
			
		||||
	 (a->type == ASIdOrRange_range && a->u.range != NULL &&
 | 
			
		||||
	  a->u.range->min != NULL && a->u.range->max != NULL));
 | 
			
		||||
 | 
			
		||||
  assert((b->type == ASIdOrRange_id && b->u.id != NULL) ||
 | 
			
		||||
  OPENSSL_assert((b->type == ASIdOrRange_id && b->u.id != NULL) ||
 | 
			
		||||
	 (b->type == ASIdOrRange_range && b->u.range != NULL &&
 | 
			
		||||
	  b->u.range->min != NULL && b->u.range->max != NULL));
 | 
			
		||||
 | 
			
		||||
@@ -215,7 +214,7 @@ int v3_asid_add_inherit(ASIdentifiers *asid, int which)
 | 
			
		||||
  if (*choice == NULL) {
 | 
			
		||||
    if ((*choice = ASIdentifierChoice_new()) == NULL)
 | 
			
		||||
      return 0;
 | 
			
		||||
    assert((*choice)->u.inherit == NULL);
 | 
			
		||||
    OPENSSL_assert((*choice)->u.inherit == NULL);
 | 
			
		||||
    if (((*choice)->u.inherit = ASN1_NULL_new()) == NULL)
 | 
			
		||||
      return 0;
 | 
			
		||||
    (*choice)->type = ASIdentifierChoice_inherit;
 | 
			
		||||
@@ -250,7 +249,7 @@ int v3_asid_add_id_or_range(ASIdentifiers *asid,
 | 
			
		||||
  if (*choice == NULL) {
 | 
			
		||||
    if ((*choice = ASIdentifierChoice_new()) == NULL)
 | 
			
		||||
      return 0;
 | 
			
		||||
    assert((*choice)->u.asIdsOrRanges == NULL);
 | 
			
		||||
    OPENSSL_assert((*choice)->u.asIdsOrRanges == NULL);
 | 
			
		||||
    (*choice)->u.asIdsOrRanges = sk_ASIdOrRange_new(ASIdOrRange_cmp);
 | 
			
		||||
    if ((*choice)->u.asIdsOrRanges == NULL)
 | 
			
		||||
      return 0;
 | 
			
		||||
@@ -286,7 +285,7 @@ static void extract_min_max(ASIdOrRange *aor,
 | 
			
		||||
			    ASN1_INTEGER **min,
 | 
			
		||||
			    ASN1_INTEGER **max)
 | 
			
		||||
{
 | 
			
		||||
  assert(aor != NULL && min != NULL && max != NULL);
 | 
			
		||||
  OPENSSL_assert(aor != NULL && min != NULL && max != NULL);
 | 
			
		||||
  switch (aor->type) {
 | 
			
		||||
  case ASIdOrRange_id:
 | 
			
		||||
    *min = aor->u.id;
 | 
			
		||||
@@ -373,7 +372,7 @@ static int ASIdentifierChoice_is_canonical(ASIdentifierChoice *choice)
 | 
			
		||||
int v3_asid_is_canonical(ASIdentifiers *asid)
 | 
			
		||||
{
 | 
			
		||||
  return (asid == NULL ||
 | 
			
		||||
	  (ASIdentifierChoice_is_canonical(asid->asnum) ||
 | 
			
		||||
	  (ASIdentifierChoice_is_canonical(asid->asnum) &&
 | 
			
		||||
	   ASIdentifierChoice_is_canonical(asid->rdi)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -395,7 +394,7 @@ static int ASIdentifierChoice_canonize(ASIdentifierChoice *choice)
 | 
			
		||||
  /*
 | 
			
		||||
   * We have a list.  Sort it.
 | 
			
		||||
   */
 | 
			
		||||
  assert(choice->type == ASIdentifierChoice_asIdsOrRanges);
 | 
			
		||||
  OPENSSL_assert(choice->type == ASIdentifierChoice_asIdsOrRanges);
 | 
			
		||||
  sk_ASIdOrRange_sort(choice->u.asIdsOrRanges);
 | 
			
		||||
 | 
			
		||||
  /*
 | 
			
		||||
@@ -413,7 +412,7 @@ static int ASIdentifierChoice_canonize(ASIdentifierChoice *choice)
 | 
			
		||||
    /*
 | 
			
		||||
     * Make sure we're properly sorted (paranoia).
 | 
			
		||||
     */
 | 
			
		||||
    assert(ASN1_INTEGER_cmp(a_min, b_min) <= 0);
 | 
			
		||||
    OPENSSL_assert(ASN1_INTEGER_cmp(a_min, b_min) <= 0);
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * Check for overlaps.
 | 
			
		||||
@@ -472,7 +471,7 @@ static int ASIdentifierChoice_canonize(ASIdentifierChoice *choice)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  assert(ASIdentifierChoice_is_canonical(choice)); /* Paranoia */
 | 
			
		||||
  OPENSSL_assert(ASIdentifierChoice_is_canonical(choice)); /* Paranoia */
 | 
			
		||||
 | 
			
		||||
  ret = 1;
 | 
			
		||||
 | 
			
		||||
@@ -709,9 +708,9 @@ static int v3_asid_validate_path_internal(X509_STORE_CTX *ctx,
 | 
			
		||||
  int i, ret = 1, inherit_as = 0, inherit_rdi = 0;
 | 
			
		||||
  X509 *x;
 | 
			
		||||
 | 
			
		||||
  assert(chain != NULL && sk_X509_num(chain) > 0);
 | 
			
		||||
  assert(ctx != NULL || ext != NULL);
 | 
			
		||||
  assert(ctx == NULL || ctx->verify_cb != NULL);
 | 
			
		||||
  OPENSSL_assert(chain != NULL && sk_X509_num(chain) > 0);
 | 
			
		||||
  OPENSSL_assert(ctx != NULL || ext != NULL);
 | 
			
		||||
  OPENSSL_assert(ctx == NULL || ctx->verify_cb != NULL);
 | 
			
		||||
 | 
			
		||||
  /*
 | 
			
		||||
   * Figure out where to start.  If we don't have an extension to
 | 
			
		||||
@@ -724,7 +723,7 @@ static int v3_asid_validate_path_internal(X509_STORE_CTX *ctx,
 | 
			
		||||
  } else {
 | 
			
		||||
    i = 0;
 | 
			
		||||
    x = sk_X509_value(chain, i);
 | 
			
		||||
    assert(x != NULL);
 | 
			
		||||
    OPENSSL_assert(x != NULL);
 | 
			
		||||
    if ((ext = x->rfc3779_asid) == NULL)
 | 
			
		||||
      goto done;
 | 
			
		||||
  }
 | 
			
		||||
@@ -757,7 +756,7 @@ static int v3_asid_validate_path_internal(X509_STORE_CTX *ctx,
 | 
			
		||||
   */
 | 
			
		||||
  for (i++; i < sk_X509_num(chain); i++) {
 | 
			
		||||
    x = sk_X509_value(chain, i);
 | 
			
		||||
    assert(x != NULL);
 | 
			
		||||
    OPENSSL_assert(x != NULL);
 | 
			
		||||
    if (x->rfc3779_asid == NULL) {
 | 
			
		||||
      if (child_as != NULL || child_rdi != NULL)
 | 
			
		||||
	validation_err(X509_V_ERR_UNNESTED_RESOURCE);
 | 
			
		||||
@@ -800,7 +799,7 @@ static int v3_asid_validate_path_internal(X509_STORE_CTX *ctx,
 | 
			
		||||
  /*
 | 
			
		||||
   * Trust anchor can't inherit.
 | 
			
		||||
   */
 | 
			
		||||
  assert(x != NULL);
 | 
			
		||||
  OPENSSL_assert(x != NULL);
 | 
			
		||||
  if (x->rfc3779_asid != NULL) {
 | 
			
		||||
    if (x->rfc3779_asid->asnum != NULL &&
 | 
			
		||||
	x->rfc3779_asid->asnum->type == ASIdentifierChoice_inherit)
 | 
			
		||||
 
 | 
			
		||||
@@ -189,7 +189,6 @@ static int do_i2r_name_constraints(const X509V3_EXT_METHOD *method,
 | 
			
		||||
			print_nc_ipadd(bp, tree->base->d.ip);
 | 
			
		||||
		else
 | 
			
		||||
			GENERAL_NAME_print(bp, tree->base);
 | 
			
		||||
		tree = sk_GENERAL_SUBTREE_value(trees, i);
 | 
			
		||||
		BIO_puts(bp, "\n");
 | 
			
		||||
		}
 | 
			
		||||
	return 1;
 | 
			
		||||
 
 | 
			
		||||
@@ -343,7 +343,7 @@ Create a cleartext signed message:
 | 
			
		||||
 openssl smime -sign -in message.txt -text -out mail.msg \
 | 
			
		||||
	-signer mycert.pem
 | 
			
		||||
 | 
			
		||||
Create an opaque signed message
 | 
			
		||||
Create an opaque signed message:
 | 
			
		||||
 | 
			
		||||
 openssl smime -sign -in message.txt -text -out mail.msg -nodetach \
 | 
			
		||||
	-signer mycert.pem
 | 
			
		||||
@@ -397,11 +397,11 @@ it with:
 | 
			
		||||
 -----BEGIN PKCS7-----
 | 
			
		||||
 -----END PKCS7-----
 | 
			
		||||
 | 
			
		||||
and using the command, 
 | 
			
		||||
and using the command: 
 | 
			
		||||
 | 
			
		||||
 openssl smime -verify -inform PEM -in signature.pem -content content.txt
 | 
			
		||||
 | 
			
		||||
alternatively you can base64 decode the signature and use
 | 
			
		||||
Alternatively you can base64 decode the signature and use:
 | 
			
		||||
 | 
			
		||||
 openssl smime -verify -inform DER -in signature.der -content content.txt
 | 
			
		||||
 | 
			
		||||
@@ -427,7 +427,7 @@ Ideally a database should be maintained of a certificates for each email
 | 
			
		||||
address.
 | 
			
		||||
 | 
			
		||||
The code doesn't currently take note of the permitted symmetric encryption
 | 
			
		||||
algorithms as supplied in the SMIMECapabilities signed attribute. this means the
 | 
			
		||||
algorithms as supplied in the SMIMECapabilities signed attribute. This means the
 | 
			
		||||
user has to manually include the correct encryption algorithm. It should store
 | 
			
		||||
the list of permitted ciphers in a database and only use those.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -69,7 +69,7 @@ Verify signature using PKCS#1 and SHA256 digest:
 | 
			
		||||
	/* Error */
 | 
			
		||||
 | 
			
		||||
 /* Perform operation */
 | 
			
		||||
 ret = EVP_PKEY_verify(ctx, md, mdlen, sig, siglen);
 | 
			
		||||
 ret = EVP_PKEY_verify(ctx, sig, siglen, md, mdlen);
 | 
			
		||||
 | 
			
		||||
 /* ret == 1 indicates success, 0 verify failure and < 0 for some
 | 
			
		||||
  * other error.
 | 
			
		||||
 
 | 
			
		||||
@@ -74,7 +74,7 @@ Recover digest originally signed using PKCS#1 and SHA256 digest:
 | 
			
		||||
	/* Error */
 | 
			
		||||
 | 
			
		||||
 /* Determine buffer length */
 | 
			
		||||
 if (EVP_PKEY_verifyrecover(ctx, rout, &routlen, sig, siglen) <= 0)
 | 
			
		||||
 if (EVP_PKEY_verifyrecover(ctx, NULL, &routlen, sig, siglen) <= 0)
 | 
			
		||||
	/* Error */
 | 
			
		||||
 | 
			
		||||
 rout = OPENSSL_malloc(routlen);
 | 
			
		||||
 
 | 
			
		||||
@@ -78,18 +78,7 @@ this breaks this server so 16 bytes is the way to go.
 | 
			
		||||
 | 
			
		||||
=item SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG
 | 
			
		||||
 | 
			
		||||
ssl3.netscape.com:443, first a connection is established with RC4-MD5.
 | 
			
		||||
If it is then resumed, we end up using DES-CBC3-SHA.  It should be
 | 
			
		||||
RC4-MD5 according to 7.6.1.3, 'cipher_suite'.
 | 
			
		||||
 | 
			
		||||
Netscape-Enterprise/2.01 (https://merchant.netscape.com) has this bug.
 | 
			
		||||
It only really shows up when connecting via SSLv2/v3 then reconnecting
 | 
			
		||||
via SSLv3. The cipher list changes....
 | 
			
		||||
 | 
			
		||||
NEW INFORMATION.  Try connecting with a cipher list of just
 | 
			
		||||
DES-CBC-SHA:RC4-MD5.  For some weird reason, each new connection uses
 | 
			
		||||
RC4-MD5, but a re-connect tries to use DES-CBC-SHA.  So netscape, when
 | 
			
		||||
doing a re-connect, always takes the first cipher in the cipher list.
 | 
			
		||||
As of OpenSSL 0.9.8q and 1.0.0c, this option has no effect.
 | 
			
		||||
 | 
			
		||||
=item SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -114,7 +114,7 @@ install:
 | 
			
		||||
			  if [ "$(PLATFORM)" != "Cygwin" ]; then \
 | 
			
		||||
				case "$(CFLAGS)" in \
 | 
			
		||||
				*DSO_BEOS*)	sfx=".so";;	\
 | 
			
		||||
				*DSO_DLFCN*)	sfx=".so";;	\
 | 
			
		||||
				*DSO_DLFCN*)	sfx=`expr "$(SHLIB_EXT)" : '.*\(\.[a-z][a-z]*\)' \| ".so"`;;	\
 | 
			
		||||
				*DSO_DL*)	sfx=".sl";;	\
 | 
			
		||||
				*DSO_WIN32*)	sfx="eay32.dll"; pfx=;;	\
 | 
			
		||||
				*)		sfx=".bad";;	\
 | 
			
		||||
 
 | 
			
		||||
@@ -48,7 +48,7 @@ install:
 | 
			
		||||
		if [ "$(PLATFORM)" != "Cygwin" ]; then \
 | 
			
		||||
			case "$(CFLAGS)" in \
 | 
			
		||||
			*DSO_BEOS*) sfx=".so";; \
 | 
			
		||||
			*DSO_DLFCN*) sfx=".so";; \
 | 
			
		||||
			*DSO_DLFCN*) sfx=`expr "$(SHLIB_EXT)" : '.*\(\.[a-z][a-z]*\)' \| ".so"`;; \
 | 
			
		||||
			*DSO_DL*) sfx=".sl";; \
 | 
			
		||||
			*DSO_WIN32*) sfx="eay32.dll"; pfx=;; \
 | 
			
		||||
			*) sfx=".bad";; \
 | 
			
		||||
 
 | 
			
		||||
@@ -68,6 +68,8 @@ typedef int pid_t;
 | 
			
		||||
#if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB)
 | 
			
		||||
#define getpid GetThreadID
 | 
			
		||||
extern int GetThreadID(void);
 | 
			
		||||
#elif defined(_WIN32) && !defined(__WATCOMC__)
 | 
			
		||||
#define getpid _getpid
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <openssl/crypto.h>
 | 
			
		||||
@@ -867,13 +869,7 @@ static AEP_RV aep_get_connection(AEP_CONNECTION_HNDL_PTR phConnection)
 | 
			
		||||
 | 
			
		||||
	CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
 | 
			
		||||
 | 
			
		||||
#ifdef NETWARE_CLIB
 | 
			
		||||
	curr_pid = GetThreadID();
 | 
			
		||||
#elif defined(_WIN32)
 | 
			
		||||
	curr_pid = _getpid();
 | 
			
		||||
#else
 | 
			
		||||
	curr_pid = getpid();
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	/*Check if this is the first time this is being called from the current
 | 
			
		||||
	  process*/
 | 
			
		||||
 
 | 
			
		||||
@@ -76,10 +76,16 @@
 | 
			
		||||
 * CertGetCertificateContextProperty. CERT_KEY_PROV_INFO_PROP_ID is
 | 
			
		||||
 * one of possible values you can pass to function in question. By
 | 
			
		||||
 * checking if it's defined we can see if wincrypt.h and accompanying
 | 
			
		||||
 * crypt32.lib are in shape. Yes, it's rather "weak" test and if
 | 
			
		||||
 * compilation fails, then re-configure with -DOPENSSL_NO_CAPIENG.
 | 
			
		||||
 * crypt32.lib are in shape. The native MingW32 headers up to and
 | 
			
		||||
 * including __W32API_VERSION 3.14 lack of struct DSSPUBKEY and the
 | 
			
		||||
 * defines CERT_STORE_PROV_SYSTEM_A and CERT_STORE_READONLY_FLAG,
 | 
			
		||||
 * so we check for these too and avoid compiling.
 | 
			
		||||
 * Yes, it's rather "weak" test and if compilation fails,
 | 
			
		||||
 * then re-configure with -DOPENSSL_NO_CAPIENG.
 | 
			
		||||
 */
 | 
			
		||||
#ifdef CERT_KEY_PROV_INFO_PROP_ID
 | 
			
		||||
#if defined(CERT_KEY_PROV_INFO_PROP_ID) && \
 | 
			
		||||
    defined(CERT_STORE_PROV_SYSTEM_A) && \
 | 
			
		||||
    defined(CERT_STORE_READONLY_FLAG)
 | 
			
		||||
# define __COMPILE_CAPIENG
 | 
			
		||||
#endif /* CERT_KEY_PROV_INFO_PROP_ID */
 | 
			
		||||
#endif /* OPENSSL_NO_CAPIENG */
 | 
			
		||||
@@ -1808,6 +1814,8 @@ static int cert_select_dialog(ENGINE *e, SSL *ssl, STACK_OF(X509) *certs)
 | 
			
		||||
#include <openssl/engine.h>
 | 
			
		||||
#ifndef OPENSSL_NO_DYNAMIC_ENGINE
 | 
			
		||||
OPENSSL_EXPORT
 | 
			
		||||
int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns);
 | 
			
		||||
OPENSSL_EXPORT
 | 
			
		||||
int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { return 0; }
 | 
			
		||||
IMPLEMENT_DYNAMIC_CHECK_FN()
 | 
			
		||||
#else
 | 
			
		||||
 
 | 
			
		||||
@@ -471,6 +471,8 @@ static int bind_fn(ENGINE *e, const char *id)
 | 
			
		||||
IMPLEMENT_DYNAMIC_BIND_FN(bind_fn)
 | 
			
		||||
#else
 | 
			
		||||
OPENSSL_EXPORT
 | 
			
		||||
int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns);
 | 
			
		||||
OPENSSL_EXPORT
 | 
			
		||||
int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { return 0; }
 | 
			
		||||
#endif
 | 
			
		||||
#endif /* !OPENSSL_NO_DYNAMIC_ENGINE */
 | 
			
		||||
 
 | 
			
		||||
@@ -108,6 +108,8 @@ static ENGINE *ENGINE_padlock (void);
 | 
			
		||||
# endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef OPENSSL_NO_DYNAMIC_ENGINE
 | 
			
		||||
 | 
			
		||||
void ENGINE_load_padlock (void)
 | 
			
		||||
{
 | 
			
		||||
/* On non-x86 CPUs it just returns. */
 | 
			
		||||
@@ -120,6 +122,8 @@ void ENGINE_load_padlock (void)
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef COMPILE_HW_PADLOCK
 | 
			
		||||
/* We do these includes here to avoid header problems on platforms that
 | 
			
		||||
   do not have the VIA padlock anyway... */
 | 
			
		||||
@@ -1218,6 +1222,8 @@ static RAND_METHOD padlock_rand = {
 | 
			
		||||
#else  /* !COMPILE_HW_PADLOCK */
 | 
			
		||||
#ifndef OPENSSL_NO_DYNAMIC_ENGINE
 | 
			
		||||
OPENSSL_EXPORT
 | 
			
		||||
int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns);
 | 
			
		||||
OPENSSL_EXPORT
 | 
			
		||||
int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { return 0; }
 | 
			
		||||
IMPLEMENT_DYNAMIC_CHECK_FN()
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -28,6 +28,13 @@ $!
 | 
			
		||||
$!  P6	if defined, denotes which engines to build.  If not defined,
 | 
			
		||||
$!	all available engines are built.
 | 
			
		||||
$!
 | 
			
		||||
$!  For 64 bit architectures (Alpha and IA64), specify the pointer size as P7.
 | 
			
		||||
$!  For 32 bit architectures (VAX), P7 is ignored.
 | 
			
		||||
$!  Currently supported values are:
 | 
			
		||||
$!
 | 
			
		||||
$!	32	To ge a library compiled with /POINTER_SIZE=32
 | 
			
		||||
$!	64	To ge a library compiled with /POINTER_SIZE=64
 | 
			
		||||
$!
 | 
			
		||||
$!-----------------------------------------------------------------------------
 | 
			
		||||
$!
 | 
			
		||||
$! Set the default TCP/IP library to link against if needed
 | 
			
		||||
@@ -81,7 +88,7 @@ $ IF F$PARSE(EXE_DIR) .EQS. "" THEN CREATE/DIRECTORY 'EXE_DIR'
 | 
			
		||||
$!
 | 
			
		||||
$! Set the goal files, and create them if necessary
 | 
			
		||||
$!
 | 
			
		||||
$ CRYPTO_LIB :=SYS$DISK:[-.'ARCH'.EXE.CRYPTO]LIBCRYPTO.OLB
 | 
			
		||||
$ CRYPTO_LIB :=SYS$DISK:[-.'ARCH'.EXE.CRYPTO]LIBCRYPTO'LIB32'.OLB
 | 
			
		||||
$ IF F$SEARCH(CRYPTO_LIB) .EQS. "" THEN LIBRARY/CREATE/OBJECT 'CRYPTO_LIB'
 | 
			
		||||
$!
 | 
			
		||||
$! OK, time to check options and initialise
 | 
			
		||||
@@ -92,6 +99,7 @@ $ OPT_DEBUG = P2
 | 
			
		||||
$ OPT_COMPILER = P3
 | 
			
		||||
$ OPT_TCPIP_LIB = P4
 | 
			
		||||
$ OPT_SPECIAL_THREADS = P5
 | 
			
		||||
$ OPT_POINTER_SIZE = P7
 | 
			
		||||
$
 | 
			
		||||
$ GOSUB CHECK_OPTIONS
 | 
			
		||||
$ GOSUB INITIALISE
 | 
			
		||||
@@ -557,6 +565,58 @@ $! End The OPT_SPECIAL_THREADS Check.
 | 
			
		||||
$!
 | 
			
		||||
$ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! Check To See If OPT_POINTER_SIZE Is Blank.
 | 
			
		||||
$!
 | 
			
		||||
$ IF (OPT_POINTER_SIZE.EQS."")
 | 
			
		||||
$ THEN
 | 
			
		||||
$   POINTER_SIZE = ""
 | 
			
		||||
$ ELSE
 | 
			
		||||
$!
 | 
			
		||||
$!  Check is OPT_POINTER_SIZE Is Valid
 | 
			
		||||
$!
 | 
			
		||||
$   IF (OPT_POINTER_SIZE.EQS."32")
 | 
			
		||||
$   THEN
 | 
			
		||||
$     POINTER_SIZE = "/POINTER_SIZE=32"
 | 
			
		||||
$     IF ARCH .EQS. "VAX"
 | 
			
		||||
$     THEN
 | 
			
		||||
$       LIB32 = ""
 | 
			
		||||
$     ELSE
 | 
			
		||||
$       LIB32 = "32"
 | 
			
		||||
$     ENDIF
 | 
			
		||||
$   ELSE
 | 
			
		||||
$     IF (OPT_POINTER_SIZE.EQS."64")
 | 
			
		||||
$     THEN
 | 
			
		||||
$       LIB32 = ""
 | 
			
		||||
$       IF ARCH .EQS. "VAX"
 | 
			
		||||
$       THEN
 | 
			
		||||
$         POINTER_SIZE = "/POINTER_SIZE=32"
 | 
			
		||||
$       ELSE
 | 
			
		||||
$         POINTER_SIZE = "/POINTER_SIZE=64"
 | 
			
		||||
$       ENDIF
 | 
			
		||||
$     ELSE
 | 
			
		||||
$!
 | 
			
		||||
$!      Tell The User Entered An Invalid Option..
 | 
			
		||||
$!
 | 
			
		||||
$       WRITE SYS$OUTPUT ""
 | 
			
		||||
$       WRITE SYS$OUTPUT "The Option ",OPT_POINTER_SIZE," Is Invalid.  The Valid Options Are:"
 | 
			
		||||
$       WRITE SYS$OUTPUT ""
 | 
			
		||||
$       WRITE SYS$OUTPUT "    32  :  Compile with 32 bit pointer size"
 | 
			
		||||
$       WRITE SYS$OUTPUT "    64  :  Compile with 64 bit pointer size"
 | 
			
		||||
$       WRITE SYS$OUTPUT ""
 | 
			
		||||
$!
 | 
			
		||||
$!      Time To EXIT.
 | 
			
		||||
$!
 | 
			
		||||
$       GOTO TIDY
 | 
			
		||||
$!
 | 
			
		||||
$!      End The Valid Arguement Check.
 | 
			
		||||
$!
 | 
			
		||||
$     ENDIF
 | 
			
		||||
$   ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! End The OPT_POINTER_SIZE Check.
 | 
			
		||||
$!
 | 
			
		||||
$ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! Check To See If OPT_COMPILER Is Blank.
 | 
			
		||||
$!
 | 
			
		||||
$ IF (OPT_COMPILER.EQS."")
 | 
			
		||||
@@ -684,7 +744,7 @@ $!
 | 
			
		||||
$     CC = "CC"
 | 
			
		||||
$     IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
 | 
			
		||||
	 THEN CC = "CC/DECC"
 | 
			
		||||
$     CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + -
 | 
			
		||||
$     CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89''POINTER_SIZE'" + -
 | 
			
		||||
           "/NOLIST/PREFIX=ALL" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[],SYS$DISK:[.VENDOR_DEFNS])" + -
 | 
			
		||||
	   CCEXTRAFLAGS
 | 
			
		||||
@@ -720,7 +780,7 @@ $	EXIT
 | 
			
		||||
$     ENDIF
 | 
			
		||||
$     IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC"
 | 
			
		||||
$     CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS])" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.VENDOR_DEFNS])" + -
 | 
			
		||||
	   CCEXTRAFLAGS
 | 
			
		||||
$     CCDEFS = """VAXC""," + CCDEFS
 | 
			
		||||
$!
 | 
			
		||||
@@ -752,7 +812,7 @@ $!
 | 
			
		||||
$!    Use GNU C...
 | 
			
		||||
$!
 | 
			
		||||
$     CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS])" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.VENDOR_DEFNS])" + -
 | 
			
		||||
	   CCEXTRAFLAGS
 | 
			
		||||
$!
 | 
			
		||||
$!    Define The Linker Options File Name.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										94
									
								
								makevms.com
									
									
									
									
									
								
							
							
						
						
									
										94
									
								
								makevms.com
									
									
									
									
									
								
							@@ -32,8 +32,13 @@ $!      APPS      Just build the "[.xxx.EXE.APPS]" application programs for Open
 | 
			
		||||
$!      ENGINES   Just build the "[.xxx.EXE.ENGINES]" application programs for OpenSSL.
 | 
			
		||||
$!
 | 
			
		||||
$!
 | 
			
		||||
$! P2 is ignored (it was used to denote if RSAref should be used or not,
 | 
			
		||||
$! and is simply kept so surrounding scripts don't get confused)
 | 
			
		||||
$! For 64 bit architectures (Alpha and IA64), specify the pointer size as P2.
 | 
			
		||||
$! For 32 bit architectures (VAX), P2 is ignored.
 | 
			
		||||
$! Currently supported values are:
 | 
			
		||||
$!
 | 
			
		||||
$!	32	To ge a library compiled with /POINTER_SIZE=32
 | 
			
		||||
$!	64	To ge a library compiled with /POINTER_SIZE=64
 | 
			
		||||
$!
 | 
			
		||||
$!
 | 
			
		||||
$! Specify DEBUG or NODEBUG as P3 to compile with or without debugging
 | 
			
		||||
$! information.
 | 
			
		||||
@@ -581,7 +586,7 @@ $ TIME = F$TIME()
 | 
			
		||||
$!
 | 
			
		||||
$! Write The [.CRYPTO._xxx]BUILDINF.H File.
 | 
			
		||||
$!
 | 
			
		||||
$ WRITE H_FILE "#define CFLAGS """" /* Not filled in for now */"
 | 
			
		||||
$ WRITE H_FILE "#define CFLAGS ""/POINTER_SIZE=''POINTER_SIZE'"""
 | 
			
		||||
$ WRITE H_FILE "#define PLATFORM ""VMS ''ARCH' ''VMS_VERSION'"""
 | 
			
		||||
$ WRITE H_FILE "#define DATE ""''TIME'"" "
 | 
			
		||||
$!
 | 
			
		||||
@@ -593,6 +598,11 @@ $! Purge The [.CRYPTO._xxx]BUILDINF.H File.
 | 
			
		||||
$!
 | 
			
		||||
$ PURGE SYS$DISK:[.CRYPTO._'ARCH']BUILDINF.H
 | 
			
		||||
$!
 | 
			
		||||
$! Delete [.CRYPTO]BUILDINF.H File, as there might be some residue from Unix.
 | 
			
		||||
$!
 | 
			
		||||
$ IF F$SEARCH("[.CRYPTO]BUILDINF.H") .NES. "" THEN -
 | 
			
		||||
     DELETE SYS$DISK:[.CRYPTO]BUILDINF.H;*
 | 
			
		||||
$!
 | 
			
		||||
$! That's All, Time To RETURN.
 | 
			
		||||
$!
 | 
			
		||||
$ RETURN
 | 
			
		||||
@@ -721,14 +731,14 @@ $! That's All, Time To RETURN.
 | 
			
		||||
$!
 | 
			
		||||
$ RETURN
 | 
			
		||||
$!
 | 
			
		||||
$! Build The "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" Library.
 | 
			
		||||
$! Build The "[.xxx.EXE.CRYPTO]LIBCRYPTO''LIB32'.OLB" Library.
 | 
			
		||||
$!
 | 
			
		||||
$ CRYPTO:
 | 
			
		||||
$!
 | 
			
		||||
$! Tell The User What We Are Doing.
 | 
			
		||||
$!
 | 
			
		||||
$ WRITE SYS$OUTPUT ""
 | 
			
		||||
$ WRITE SYS$OUTPUT "Building The [.",ARCH,".EXE.CRYPTO]LIBCRYPTO.OLB Library."
 | 
			
		||||
$ WRITE SYS$OUTPUT "Building The [.",ARCH,".EXE.CRYPTO]LIBCRYPTO''LIB32'.OLB Library."
 | 
			
		||||
$!
 | 
			
		||||
$! Go To The [.CRYPTO] Directory.
 | 
			
		||||
$!
 | 
			
		||||
@@ -736,11 +746,11 @@ $ SET DEFAULT SYS$DISK:[.CRYPTO]
 | 
			
		||||
$!
 | 
			
		||||
$! Build The [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library.
 | 
			
		||||
$!  
 | 
			
		||||
$ @CRYPTO-LIB LIBRARY 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" "''ISSEVEN'" "''BUILDPART'"
 | 
			
		||||
$ @CRYPTO-LIB LIBRARY 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" "''ISSEVEN'" "''BUILDPART'" "''POINTER_SIZE'"
 | 
			
		||||
$!
 | 
			
		||||
$! Build The [.xxx.EXE.CRYPTO]*.EXE Test Applications.
 | 
			
		||||
$!  
 | 
			
		||||
$ @CRYPTO-LIB APPS 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" 'ISSEVEN' "''BUILDPART'"
 | 
			
		||||
$ @CRYPTO-LIB APPS 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" "''ISSEVEN'" "''BUILDPART'" "''POINTER_SIZE'"
 | 
			
		||||
$!
 | 
			
		||||
$! Go Back To The Main Directory.
 | 
			
		||||
$!
 | 
			
		||||
@@ -750,14 +760,14 @@ $! Time To RETURN.
 | 
			
		||||
$!
 | 
			
		||||
$ RETURN
 | 
			
		||||
$!
 | 
			
		||||
$! Build The "[.xxx.EXE.SSL]LIBSSL.OLB" Library.
 | 
			
		||||
$! Build The "[.xxx.EXE.SSL]LIBSSL''LIB32'.OLB" Library.
 | 
			
		||||
$!
 | 
			
		||||
$ SSL:
 | 
			
		||||
$!
 | 
			
		||||
$! Tell The User What We Are Doing.
 | 
			
		||||
$!
 | 
			
		||||
$ WRITE SYS$OUTPUT ""
 | 
			
		||||
$ WRITE SYS$OUTPUT "Building The [.",ARCH,".EXE.SSL]LIBSSL.OLB Library."
 | 
			
		||||
$ WRITE SYS$OUTPUT "Building The [.",ARCH,".EXE.SSL]LIBSSL''LIB32'.OLB Library."
 | 
			
		||||
$!
 | 
			
		||||
$! Go To The [.SSL] Directory.
 | 
			
		||||
$!
 | 
			
		||||
@@ -765,7 +775,7 @@ $ SET DEFAULT SYS$DISK:[.SSL]
 | 
			
		||||
$!
 | 
			
		||||
$! Build The [.xxx.EXE.SSL]LIBSSL.OLB Library.
 | 
			
		||||
$!
 | 
			
		||||
$ @SSL-LIB LIBRARY 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" 'ISSEVEN'
 | 
			
		||||
$ @SSL-LIB LIBRARY 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" "''ISSEVEN'" "''POINTER_SIZE'"
 | 
			
		||||
$!
 | 
			
		||||
$! Go Back To The Main Directory.
 | 
			
		||||
$!
 | 
			
		||||
@@ -790,7 +800,7 @@ $ SET DEFAULT SYS$DISK:[.SSL]
 | 
			
		||||
$!
 | 
			
		||||
$! Build The [.xxx.EXE.SSL]SSL_TASK.EXE
 | 
			
		||||
$!
 | 
			
		||||
$ @SSL-LIB SSL_TASK 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" 'ISSEVEN'
 | 
			
		||||
$ @SSL-LIB SSL_TASK 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" "''ISSEVEN'" "''POINTER_SIZE'"
 | 
			
		||||
$!
 | 
			
		||||
$! Go Back To The Main Directory.
 | 
			
		||||
$!
 | 
			
		||||
@@ -815,7 +825,7 @@ $ SET DEFAULT SYS$DISK:[.TEST]
 | 
			
		||||
$!
 | 
			
		||||
$! Build The Test Programs.
 | 
			
		||||
$!
 | 
			
		||||
$ @MAKETESTS 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" 'ISSEVEN'
 | 
			
		||||
$ @MAKETESTS 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" "''ISSEVEN'" "''POINTER_SIZE'"
 | 
			
		||||
$!
 | 
			
		||||
$! Go Back To The Main Directory.
 | 
			
		||||
$!
 | 
			
		||||
@@ -840,7 +850,7 @@ $ SET DEFAULT SYS$DISK:[.APPS]
 | 
			
		||||
$!
 | 
			
		||||
$! Build The Application Programs.
 | 
			
		||||
$!
 | 
			
		||||
$ @MAKEAPPS 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" 'ISSEVEN'
 | 
			
		||||
$ @MAKEAPPS 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" "''ISSEVEN'" "" "''POINTER_SIZE'"
 | 
			
		||||
$!
 | 
			
		||||
$! Go Back To The Main Directory.
 | 
			
		||||
$!
 | 
			
		||||
@@ -865,7 +875,7 @@ $ SET DEFAULT SYS$DISK:[.ENGINES]
 | 
			
		||||
$!
 | 
			
		||||
$! Build The Application Programs.
 | 
			
		||||
$!
 | 
			
		||||
$ @MAKEENGINES ENGINES 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" 'ISSEVEN' "''BUILDPART'"
 | 
			
		||||
$ @MAKEENGINES ENGINES 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" "''ISSEVEN'" "''BUILDPART'" "''POINTER_SIZE'"
 | 
			
		||||
$!
 | 
			
		||||
$! Go Back To The Main Directory.
 | 
			
		||||
$!
 | 
			
		||||
@@ -922,9 +932,9 @@ $!
 | 
			
		||||
$!    Tell The User We Don't Know What They Want.
 | 
			
		||||
$!
 | 
			
		||||
$     WRITE SYS$OUTPUT ""
 | 
			
		||||
$     WRITE SYS$OUTPUT "USAGE:   @MAKEVMS.COM [Target] [not-used option] [Debug option] <Compiler>"
 | 
			
		||||
$     WRITE SYS$OUTPUT "USAGE:   @MAKEVMS.COM [Target] [Pointer size] [Debug option] <Compiler>"
 | 
			
		||||
$     WRITE SYS$OUTPUT ""
 | 
			
		||||
$     WRITE SYS$OUTPUT "Example: @MAKEVMS.COM ALL NORSAREF NODEBUG "
 | 
			
		||||
$     WRITE SYS$OUTPUT "Example: @MAKEVMS.COM ALL """" NODEBUG "
 | 
			
		||||
$     WRITE SYS$OUTPUT ""
 | 
			
		||||
$     WRITE SYS$OUTPUT "The Target ",P1," Is Invalid.  The Valid Target Options Are:"
 | 
			
		||||
$     WRITE SYS$OUTPUT ""
 | 
			
		||||
@@ -961,6 +971,58 @@ $! End The P1 Check.
 | 
			
		||||
$!
 | 
			
		||||
$ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! Check To See If P2 Is Blank.
 | 
			
		||||
$!
 | 
			
		||||
$ IF (P2.EQS."")
 | 
			
		||||
$ THEN
 | 
			
		||||
$   POINTER_SIZE = ""
 | 
			
		||||
$ ELSE
 | 
			
		||||
$!
 | 
			
		||||
$!  Check is P2 Is Valid
 | 
			
		||||
$!
 | 
			
		||||
$   IF (P2.EQS."32")
 | 
			
		||||
$   THEN
 | 
			
		||||
$     POINTER_SIZE = "32"
 | 
			
		||||
$     IF ARCH .EQS. "VAX"
 | 
			
		||||
$     THEN
 | 
			
		||||
$       LIB32 = ""
 | 
			
		||||
$     ELSE
 | 
			
		||||
$       LIB32 = "32"
 | 
			
		||||
$     ENDIF
 | 
			
		||||
$   ELSE
 | 
			
		||||
$     IF (P2.EQS."64")
 | 
			
		||||
$     THEN
 | 
			
		||||
$       LIB32 = ""
 | 
			
		||||
$       IF ARCH .EQS. "VAX"
 | 
			
		||||
$       THEN
 | 
			
		||||
$         POINTER_SIZE = "32"
 | 
			
		||||
$       ELSE
 | 
			
		||||
$         POINTER_SIZE = "64"
 | 
			
		||||
$       ENDIF
 | 
			
		||||
$     ELSE
 | 
			
		||||
$!
 | 
			
		||||
$!      Tell The User Entered An Invalid Option..
 | 
			
		||||
$!
 | 
			
		||||
$       WRITE SYS$OUTPUT ""
 | 
			
		||||
$       WRITE SYS$OUTPUT "The Option ",P2," Is Invalid.  The Valid Options Are:"
 | 
			
		||||
$       WRITE SYS$OUTPUT ""
 | 
			
		||||
$       WRITE SYS$OUTPUT "    32  :  Compile with 32 bit pointer size"
 | 
			
		||||
$       WRITE SYS$OUTPUT "    64  :  Compile with 64 bit pointer size"
 | 
			
		||||
$       WRITE SYS$OUTPUT ""
 | 
			
		||||
$!
 | 
			
		||||
$!      Time To EXIT.
 | 
			
		||||
$!
 | 
			
		||||
$       GOTO TIDY
 | 
			
		||||
$!
 | 
			
		||||
$!      End The Valid Arguement Check.
 | 
			
		||||
$!
 | 
			
		||||
$     ENDIF
 | 
			
		||||
$   ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! End The P2 Check.
 | 
			
		||||
$!
 | 
			
		||||
$ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! Check To See If P3 Is Blank.
 | 
			
		||||
$!
 | 
			
		||||
$ IF (P3.EQS."NODEBUG")
 | 
			
		||||
 
 | 
			
		||||
@@ -2,15 +2,15 @@
 | 
			
		||||
%define libmaj 1
 | 
			
		||||
%define libmin 0
 | 
			
		||||
%define librel 0
 | 
			
		||||
%define librev b
 | 
			
		||||
%define librev d
 | 
			
		||||
Release: 1
 | 
			
		||||
 | 
			
		||||
%define openssldir /var/ssl
 | 
			
		||||
 | 
			
		||||
Summary: Secure Sockets Layer and cryptography libraries and tools
 | 
			
		||||
Name: openssl
 | 
			
		||||
Version: %{libmaj}.%{libmin}.%{librel}
 | 
			
		||||
#Version: %{libmaj}.%{libmin}.%{librel}%{librev}
 | 
			
		||||
#Version: %{libmaj}.%{libmin}.%{librel}
 | 
			
		||||
Version: %{libmaj}.%{libmin}.%{librel}%{librev}
 | 
			
		||||
Source0: ftp://ftp.openssl.org/source/%{name}-%{version}.tar.gz
 | 
			
		||||
Copyright: Freely distributable
 | 
			
		||||
Group: System Environment/Libraries
 | 
			
		||||
 
 | 
			
		||||
@@ -231,11 +231,7 @@ int dtls1_enc(SSL *s, int send)
 | 
			
		||||
		if (!send)
 | 
			
		||||
			{
 | 
			
		||||
			if (l == 0 || l%bs != 0)
 | 
			
		||||
				{
 | 
			
		||||
				SSLerr(SSL_F_DTLS1_ENC,SSL_R_BLOCK_CIPHER_PAD_IS_WRONG);
 | 
			
		||||
				ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_DECRYPTION_FAILED);
 | 
			
		||||
				return 0;
 | 
			
		||||
				}
 | 
			
		||||
				return -1;
 | 
			
		||||
			}
 | 
			
		||||
		
 | 
			
		||||
		EVP_Cipher(ds,rec->data,rec->input,l);
 | 
			
		||||
 
 | 
			
		||||
@@ -414,7 +414,8 @@ dtls1_process_record(SSL *s)
 | 
			
		||||
			goto err;
 | 
			
		||||
 | 
			
		||||
		/* otherwise enc_err == -1 */
 | 
			
		||||
		goto err;
 | 
			
		||||
		al=SSL_AD_BAD_RECORD_MAC;
 | 
			
		||||
		goto f_err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#ifdef TLS_DEBUG
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,7 @@ $	IF F$PARSE("WRK_SSLXEXE:") .EQS. "" THEN -
 | 
			
		||||
$
 | 
			
		||||
$	EXHEADER := ssl.h,ssl2.h,ssl3.h,ssl23.h,tls1.h,dtls1.h,kssl.h
 | 
			
		||||
$	E_EXE := ssl_task
 | 
			
		||||
$	LIBS := LIBSSL
 | 
			
		||||
$	LIBS := LIBSSL,LIBSSL32
 | 
			
		||||
$
 | 
			
		||||
$	XEXE_DIR := [-.'ARCH'.EXE.SSL]
 | 
			
		||||
$
 | 
			
		||||
 
 | 
			
		||||
@@ -403,13 +403,14 @@ static int get_client_master_key(SSL *s)
 | 
			
		||||
		p+=3;
 | 
			
		||||
		n2s(p,i); s->s2->tmp.clear=i;
 | 
			
		||||
		n2s(p,i); s->s2->tmp.enc=i;
 | 
			
		||||
		n2s(p,i); s->session->key_arg_length=i;
 | 
			
		||||
		if(s->session->key_arg_length > SSL_MAX_KEY_ARG_LENGTH)
 | 
			
		||||
		n2s(p,i);
 | 
			
		||||
		if(i > SSL_MAX_KEY_ARG_LENGTH)
 | 
			
		||||
			{
 | 
			
		||||
			ssl2_return_error(s,SSL2_PE_UNDEFINED_ERROR);
 | 
			
		||||
			SSLerr(SSL_F_GET_CLIENT_MASTER_KEY, SSL_R_KEY_ARG_TOO_LONG);
 | 
			
		||||
			return -1;
 | 
			
		||||
			}
 | 
			
		||||
		s->session->key_arg_length=i;
 | 
			
		||||
		s->state=SSL2_ST_GET_CLIENT_MASTER_KEY_B;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -866,8 +866,11 @@ int ssl3_get_server_hello(SSL *s)
 | 
			
		||||
		s->session->cipher_id = s->session->cipher->id;
 | 
			
		||||
	if (s->hit && (s->session->cipher_id != c->id))
 | 
			
		||||
		{
 | 
			
		||||
/* Workaround is now obsolete */
 | 
			
		||||
#if 0
 | 
			
		||||
		if (!(s->options &
 | 
			
		||||
			SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG))
 | 
			
		||||
#endif
 | 
			
		||||
			{
 | 
			
		||||
			al=SSL_AD_ILLEGAL_PARAMETER;
 | 
			
		||||
			SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED);
 | 
			
		||||
@@ -1508,6 +1511,7 @@ int ssl3_get_key_exchange(SSL *s)
 | 
			
		||||
		s->session->sess_cert->peer_ecdh_tmp=ecdh;
 | 
			
		||||
		ecdh=NULL;
 | 
			
		||||
		BN_CTX_free(bn_ctx);
 | 
			
		||||
		bn_ctx = NULL;
 | 
			
		||||
		EC_POINT_free(srvr_ecpoint);
 | 
			
		||||
		srvr_ecpoint = NULL;
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -985,6 +985,10 @@ int ssl3_get_client_hello(SSL *s)
 | 
			
		||||
				break;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
/* Disabled because it can be used in a ciphersuite downgrade
 | 
			
		||||
 * attack: CVE-2010-4180.
 | 
			
		||||
 */
 | 
			
		||||
#if 0
 | 
			
		||||
		if (j == 0 && (s->options & SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG) && (sk_SSL_CIPHER_num(ciphers) == 1))
 | 
			
		||||
			{
 | 
			
		||||
			/* Special case as client bug workaround: the previously used cipher may
 | 
			
		||||
@@ -999,6 +1003,7 @@ int ssl3_get_client_hello(SSL *s)
 | 
			
		||||
				j = 1;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
		if (j == 0)
 | 
			
		||||
			{
 | 
			
		||||
			/* we need to have the cipher in the cipher
 | 
			
		||||
@@ -2579,12 +2584,19 @@ int ssl3_get_client_key_exchange(SSL *s)
 | 
			
		||||
			{
 | 
			
		||||
			int ret = 0;
 | 
			
		||||
			EVP_PKEY_CTX *pkey_ctx;
 | 
			
		||||
			EVP_PKEY *client_pub_pkey = NULL;
 | 
			
		||||
			EVP_PKEY *client_pub_pkey = NULL, *pk = NULL;
 | 
			
		||||
			unsigned char premaster_secret[32], *start;
 | 
			
		||||
			size_t outlen=32, inlen;			
 | 
			
		||||
			size_t outlen=32, inlen;
 | 
			
		||||
			unsigned long alg_a;
 | 
			
		||||
 | 
			
		||||
			/* Get our certificate private key*/
 | 
			
		||||
			pkey_ctx = EVP_PKEY_CTX_new(s->cert->key->privatekey,NULL);	
 | 
			
		||||
			alg_a = s->s3->tmp.new_cipher->algorithm_auth;
 | 
			
		||||
			if (alg_a & SSL_aGOST94)
 | 
			
		||||
				pk = s->cert->pkeys[SSL_PKEY_GOST94].privatekey;
 | 
			
		||||
			else if (alg_a & SSL_aGOST01)
 | 
			
		||||
				pk = s->cert->pkeys[SSL_PKEY_GOST01].privatekey;
 | 
			
		||||
 | 
			
		||||
			pkey_ctx = EVP_PKEY_CTX_new(pk,NULL);
 | 
			
		||||
			EVP_PKEY_decrypt_init(pkey_ctx);
 | 
			
		||||
			/* If client certificate is present and is of the same type, maybe
 | 
			
		||||
			 * use it for key exchange.  Don't mind errors from
 | 
			
		||||
 
 | 
			
		||||
@@ -42,6 +42,13 @@ $!	SOCKETSHR	for SOCKETSHR+NETLIB
 | 
			
		||||
$!
 | 
			
		||||
$!  P5, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up)
 | 
			
		||||
$!
 | 
			
		||||
$!  For 64 bit architectures (Alpha and IA64), specify the pointer size as P6.
 | 
			
		||||
$!  For 32 bit architectures (VAX), P6 is ignored.
 | 
			
		||||
$!  Currently supported values are:
 | 
			
		||||
$!
 | 
			
		||||
$!	32	To ge a library compiled with /POINTER_SIZE=32
 | 
			
		||||
$!	64	To ge a library compiled with /POINTER_SIZE=64
 | 
			
		||||
$!
 | 
			
		||||
$!
 | 
			
		||||
$! Define A TCP/IP Library That We Will Need To Link To.
 | 
			
		||||
$! (That Is, If We Need To Link To One.)
 | 
			
		||||
@@ -118,11 +125,11 @@ $ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! Define The Library Name.
 | 
			
		||||
$!
 | 
			
		||||
$ SSL_LIB := 'EXE_DIR'LIBSSL.OLB
 | 
			
		||||
$ SSL_LIB := 'EXE_DIR'LIBSSL'LIB32'.OLB
 | 
			
		||||
$!
 | 
			
		||||
$! Define The CRYPTO-LIB We Are To Use.
 | 
			
		||||
$!
 | 
			
		||||
$ CRYPTO_LIB := SYS$DISK:[-.'ARCH'.EXE.CRYPTO]LIBCRYPTO.OLB
 | 
			
		||||
$ CRYPTO_LIB := SYS$DISK:[-.'ARCH'.EXE.CRYPTO]LIBCRYPTO'LIB32'.OLB
 | 
			
		||||
$!
 | 
			
		||||
$! Check To See What We Are To Do.
 | 
			
		||||
$!
 | 
			
		||||
@@ -156,7 +163,7 @@ $! Compile The Library.
 | 
			
		||||
$!
 | 
			
		||||
$ LIBRARY:
 | 
			
		||||
$!
 | 
			
		||||
$! Check To See If We Already Have A "[.xxx.EXE.SSL]LIBSSL.OLB" Library...
 | 
			
		||||
$! Check To See If We Already Have A "[.xxx.EXE.SSL]LIBSSL''LIB32'.OLB" Library...
 | 
			
		||||
$!
 | 
			
		||||
$ IF (F$SEARCH(SSL_LIB).EQS."")
 | 
			
		||||
$ THEN
 | 
			
		||||
@@ -653,6 +660,58 @@ $! End The P5 Check.
 | 
			
		||||
$!
 | 
			
		||||
$ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! Check To See If P6 Is Blank.
 | 
			
		||||
$!
 | 
			
		||||
$ IF (P6.EQS."")
 | 
			
		||||
$ THEN
 | 
			
		||||
$   POINTER_SIZE = ""
 | 
			
		||||
$ ELSE
 | 
			
		||||
$!
 | 
			
		||||
$!  Check is P6 Is Valid
 | 
			
		||||
$!
 | 
			
		||||
$   IF (P6.EQS."32")
 | 
			
		||||
$   THEN
 | 
			
		||||
$     POINTER_SIZE = "/POINTER_SIZE=32"
 | 
			
		||||
$     IF ARCH .EQS. "VAX"
 | 
			
		||||
$     THEN
 | 
			
		||||
$       LIB32 = ""
 | 
			
		||||
$     ELSE
 | 
			
		||||
$       LIB32 = "32"
 | 
			
		||||
$     ENDIF
 | 
			
		||||
$   ELSE
 | 
			
		||||
$     IF (P6.EQS."64")
 | 
			
		||||
$     THEN
 | 
			
		||||
$       LIB32 = ""
 | 
			
		||||
$       IF ARCH .EQS. "VAX"
 | 
			
		||||
$       THEN
 | 
			
		||||
$         POINTER_SIZE = "/POINTER_SIZE=32"
 | 
			
		||||
$       ELSE
 | 
			
		||||
$         POINTER_SIZE = "/POINTER_SIZE=64"
 | 
			
		||||
$       ENDIF
 | 
			
		||||
$     ELSE
 | 
			
		||||
$!
 | 
			
		||||
$!      Tell The User Entered An Invalid Option..
 | 
			
		||||
$!
 | 
			
		||||
$       WRITE SYS$OUTPUT ""
 | 
			
		||||
$       WRITE SYS$OUTPUT "The Option ",P6," Is Invalid.  The Valid Options Are:"
 | 
			
		||||
$       WRITE SYS$OUTPUT ""
 | 
			
		||||
$       WRITE SYS$OUTPUT "    32  :  Compile with 32 bit pointer size"
 | 
			
		||||
$       WRITE SYS$OUTPUT "    64  :  Compile with 64 bit pointer size"
 | 
			
		||||
$       WRITE SYS$OUTPUT ""
 | 
			
		||||
$!
 | 
			
		||||
$!      Time To EXIT.
 | 
			
		||||
$!
 | 
			
		||||
$       GOTO TIDY
 | 
			
		||||
$!
 | 
			
		||||
$!      End The Valid Arguement Check.
 | 
			
		||||
$!
 | 
			
		||||
$     ENDIF
 | 
			
		||||
$   ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! End The P6 Check.
 | 
			
		||||
$!
 | 
			
		||||
$ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! Check To See If P3 Is Blank.
 | 
			
		||||
$!
 | 
			
		||||
$ IF (P3.EQS."")
 | 
			
		||||
@@ -780,7 +839,7 @@ $!
 | 
			
		||||
$     CC = "CC"
 | 
			
		||||
$     IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
 | 
			
		||||
	 THEN CC = "CC/DECC"
 | 
			
		||||
$     CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + -
 | 
			
		||||
$     CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89''POINTER_SIZE'" + -
 | 
			
		||||
           "/NOLIST/PREFIX=ALL" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[-.CRYPTO],SYS$DISK:[-])" + CCEXTRAFLAGS
 | 
			
		||||
$!
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										79
									
								
								ssl/t1_lib.c
									
									
									
									
									
								
							
							
						
						
									
										79
									
								
								ssl/t1_lib.c
									
									
									
									
									
								
							@@ -714,14 +714,23 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in
 | 
			
		||||
				switch (servname_type)
 | 
			
		||||
					{
 | 
			
		||||
				case TLSEXT_NAMETYPE_host_name:
 | 
			
		||||
					if (s->session->tlsext_hostname == NULL)
 | 
			
		||||
					if (!s->hit)
 | 
			
		||||
						{
 | 
			
		||||
						if (len > TLSEXT_MAXLEN_host_name || 
 | 
			
		||||
							((s->session->tlsext_hostname = OPENSSL_malloc(len+1)) == NULL))
 | 
			
		||||
						if(s->session->tlsext_hostname)
 | 
			
		||||
							{
 | 
			
		||||
							*al = SSL_AD_DECODE_ERROR;
 | 
			
		||||
							return 0;
 | 
			
		||||
							}
 | 
			
		||||
						if (len > TLSEXT_MAXLEN_host_name)
 | 
			
		||||
							{
 | 
			
		||||
							*al = TLS1_AD_UNRECOGNIZED_NAME;
 | 
			
		||||
							return 0;
 | 
			
		||||
							}
 | 
			
		||||
						if ((s->session->tlsext_hostname = OPENSSL_malloc(len+1)) == NULL)
 | 
			
		||||
							{
 | 
			
		||||
							*al = TLS1_AD_INTERNAL_ERROR;
 | 
			
		||||
							return 0;
 | 
			
		||||
							}
 | 
			
		||||
						memcpy(s->session->tlsext_hostname, sdata, len);
 | 
			
		||||
						s->session->tlsext_hostname[len]='\0';
 | 
			
		||||
						if (strlen(s->session->tlsext_hostname) != len) {
 | 
			
		||||
@@ -734,7 +743,8 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in
 | 
			
		||||
 | 
			
		||||
						}
 | 
			
		||||
					else 
 | 
			
		||||
						s->servername_done = strlen(s->session->tlsext_hostname) == len 
 | 
			
		||||
						s->servername_done = s->session->tlsext_hostname
 | 
			
		||||
							&& strlen(s->session->tlsext_hostname) == len 
 | 
			
		||||
							&& strncmp(s->session->tlsext_hostname, (char *)sdata, len) == 0;
 | 
			
		||||
					
 | 
			
		||||
					break;
 | 
			
		||||
@@ -765,15 +775,22 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in
 | 
			
		||||
				*al = TLS1_AD_DECODE_ERROR;
 | 
			
		||||
				return 0;
 | 
			
		||||
				}
 | 
			
		||||
			s->session->tlsext_ecpointformatlist_length = 0;
 | 
			
		||||
			if (s->session->tlsext_ecpointformatlist != NULL) OPENSSL_free(s->session->tlsext_ecpointformatlist);
 | 
			
		||||
			if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL)
 | 
			
		||||
			if (!s->hit)
 | 
			
		||||
				{
 | 
			
		||||
				*al = TLS1_AD_INTERNAL_ERROR;
 | 
			
		||||
				return 0;
 | 
			
		||||
				if(s->session->tlsext_ecpointformatlist)
 | 
			
		||||
					{
 | 
			
		||||
					OPENSSL_free(s->session->tlsext_ecpointformatlist);
 | 
			
		||||
					s->session->tlsext_ecpointformatlist = NULL;
 | 
			
		||||
					}
 | 
			
		||||
				s->session->tlsext_ecpointformatlist_length = 0;
 | 
			
		||||
				if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL)
 | 
			
		||||
					{
 | 
			
		||||
					*al = TLS1_AD_INTERNAL_ERROR;
 | 
			
		||||
					return 0;
 | 
			
		||||
					}
 | 
			
		||||
				s->session->tlsext_ecpointformatlist_length = ecpointformatlist_length;
 | 
			
		||||
				memcpy(s->session->tlsext_ecpointformatlist, sdata, ecpointformatlist_length);
 | 
			
		||||
				}
 | 
			
		||||
			s->session->tlsext_ecpointformatlist_length = ecpointformatlist_length;
 | 
			
		||||
			memcpy(s->session->tlsext_ecpointformatlist, sdata, ecpointformatlist_length);
 | 
			
		||||
#if 0
 | 
			
		||||
			fprintf(stderr,"ssl_parse_clienthello_tlsext s->session->tlsext_ecpointformatlist (length=%i) ", s->session->tlsext_ecpointformatlist_length);
 | 
			
		||||
			sdata = s->session->tlsext_ecpointformatlist;
 | 
			
		||||
@@ -794,15 +811,22 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in
 | 
			
		||||
				*al = TLS1_AD_DECODE_ERROR;
 | 
			
		||||
				return 0;
 | 
			
		||||
				}
 | 
			
		||||
			s->session->tlsext_ellipticcurvelist_length = 0;
 | 
			
		||||
			if (s->session->tlsext_ellipticcurvelist != NULL) OPENSSL_free(s->session->tlsext_ellipticcurvelist);
 | 
			
		||||
			if ((s->session->tlsext_ellipticcurvelist = OPENSSL_malloc(ellipticcurvelist_length)) == NULL)
 | 
			
		||||
			if (!s->hit)
 | 
			
		||||
				{
 | 
			
		||||
				*al = TLS1_AD_INTERNAL_ERROR;
 | 
			
		||||
				return 0;
 | 
			
		||||
				if(s->session->tlsext_ellipticcurvelist)
 | 
			
		||||
					{
 | 
			
		||||
					*al = TLS1_AD_DECODE_ERROR;
 | 
			
		||||
					return 0;
 | 
			
		||||
					}
 | 
			
		||||
				s->session->tlsext_ellipticcurvelist_length = 0;
 | 
			
		||||
				if ((s->session->tlsext_ellipticcurvelist = OPENSSL_malloc(ellipticcurvelist_length)) == NULL)
 | 
			
		||||
					{
 | 
			
		||||
					*al = TLS1_AD_INTERNAL_ERROR;
 | 
			
		||||
					return 0;
 | 
			
		||||
					}
 | 
			
		||||
				s->session->tlsext_ellipticcurvelist_length = ellipticcurvelist_length;
 | 
			
		||||
				memcpy(s->session->tlsext_ellipticcurvelist, sdata, ellipticcurvelist_length);
 | 
			
		||||
				}
 | 
			
		||||
			s->session->tlsext_ellipticcurvelist_length = ellipticcurvelist_length;
 | 
			
		||||
			memcpy(s->session->tlsext_ellipticcurvelist, sdata, ellipticcurvelist_length);
 | 
			
		||||
#if 0
 | 
			
		||||
			fprintf(stderr,"ssl_parse_clienthello_tlsext s->session->tlsext_ellipticcurvelist (length=%i) ", s->session->tlsext_ellipticcurvelist_length);
 | 
			
		||||
			sdata = s->session->tlsext_ellipticcurvelist;
 | 
			
		||||
@@ -893,6 +917,7 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in
 | 
			
		||||
						}
 | 
			
		||||
					n2s(data, idsize);
 | 
			
		||||
					dsize -= 2 + idsize;
 | 
			
		||||
					size -= 2 + idsize;
 | 
			
		||||
					if (dsize < 0)
 | 
			
		||||
						{
 | 
			
		||||
						*al = SSL_AD_DECODE_ERROR;
 | 
			
		||||
@@ -931,9 +956,14 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
				/* Read in request_extensions */
 | 
			
		||||
				if (size < 2)
 | 
			
		||||
					{
 | 
			
		||||
					*al = SSL_AD_DECODE_ERROR;
 | 
			
		||||
					return 0;
 | 
			
		||||
					}
 | 
			
		||||
				n2s(data,dsize);
 | 
			
		||||
				size -= 2;
 | 
			
		||||
				if (dsize > size) 
 | 
			
		||||
				if (dsize != size)
 | 
			
		||||
					{
 | 
			
		||||
					*al = SSL_AD_DECODE_ERROR;
 | 
			
		||||
					return 0;
 | 
			
		||||
@@ -1428,23 +1458,20 @@ int ssl_check_serverhello_tlsext(SSL *s)
 | 
			
		||||
	int al = SSL_AD_UNRECOGNIZED_NAME;
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_EC
 | 
			
		||||
	/* If we are client and using an elliptic curve cryptography cipher suite, then server
 | 
			
		||||
	 * must return a an EC point formats lists containing uncompressed.
 | 
			
		||||
	/* If we are client and using an elliptic curve cryptography cipher
 | 
			
		||||
	 * suite, then if server returns an EC point formats lists extension
 | 
			
		||||
	 * it must contain uncompressed.
 | 
			
		||||
	 */
 | 
			
		||||
	unsigned long alg_k = s->s3->tmp.new_cipher->algorithm_mkey;
 | 
			
		||||
	unsigned long alg_a = s->s3->tmp.new_cipher->algorithm_auth;
 | 
			
		||||
	if ((s->tlsext_ecpointformatlist != NULL) && (s->tlsext_ecpointformatlist_length > 0) && 
 | 
			
		||||
	    (s->session->tlsext_ecpointformatlist != NULL) && (s->session->tlsext_ecpointformatlist_length > 0) && 
 | 
			
		||||
	    ((alg_k & (SSL_kEECDH|SSL_kECDHr|SSL_kECDHe)) || (alg_a & SSL_aECDSA)))
 | 
			
		||||
		{
 | 
			
		||||
		/* we are using an ECC cipher */
 | 
			
		||||
		size_t i;
 | 
			
		||||
		unsigned char *list;
 | 
			
		||||
		int found_uncompressed = 0;
 | 
			
		||||
		if ((s->session->tlsext_ecpointformatlist == NULL) || (s->session->tlsext_ecpointformatlist_length == 0))
 | 
			
		||||
			{
 | 
			
		||||
			SSLerr(SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT,SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST);
 | 
			
		||||
			return -1;
 | 
			
		||||
			}
 | 
			
		||||
		list = s->session->tlsext_ecpointformatlist;
 | 
			
		||||
		for (i = 0; i < s->session->tlsext_ecpointformatlist_length; i++)
 | 
			
		||||
			{
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										152
									
								
								test/bctest.com
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										152
									
								
								test/bctest.com
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,152 @@
 | 
			
		||||
$!
 | 
			
		||||
$! Check operation of "bc".
 | 
			
		||||
$!
 | 
			
		||||
$! 2010-04-05 SMS.  New.  Based (loosely) on "bctest".
 | 
			
		||||
$!
 | 
			
		||||
$!
 | 
			
		||||
$ tmp_file_name = "tmp.bctest"
 | 
			
		||||
$ failure = ""
 | 
			
		||||
$!
 | 
			
		||||
$! Basic command test.
 | 
			
		||||
$!
 | 
			
		||||
$ on warning then goto bc_fail
 | 
			
		||||
$ bc
 | 
			
		||||
$ on error then exit
 | 
			
		||||
$!
 | 
			
		||||
$! Test for SunOS 5.[78] bc bug.
 | 
			
		||||
$!
 | 
			
		||||
$ if (failure .eqs. "")
 | 
			
		||||
$ then
 | 
			
		||||
$!
 | 
			
		||||
$     define /user_mode sys$output 'tmp_file_name'
 | 
			
		||||
$     bc
 | 
			
		||||
obase=16
 | 
			
		||||
ibase=16
 | 
			
		||||
a=AD88C418F31B3FC712D0425001D522B3AE9134FF3A98C13C1FCC1682211195406C1A6C66C6A\
 | 
			
		||||
CEEC1A0EC16950233F77F1C2F2363D56DD71A36C57E0B2511FC4BA8F22D261FE2E9356D99AF57\
 | 
			
		||||
10F3817C0E05BF79C423C3F66FDF321BE8D3F18F625D91B670931C1EF25F28E489BDA1C5422D1\
 | 
			
		||||
C3F6F7A1AD21585746ECC4F10A14A778AF56F08898E965E9909E965E0CB6F85B514150C644759\
 | 
			
		||||
3BE731877B16EA07B552088FF2EA728AC5E0FF3A23EB939304519AB8B60F2C33D6BA0945B66F0\
 | 
			
		||||
4FC3CADF855448B24A9D7640BCF473E
 | 
			
		||||
b=DCE91E7D120B983EA9A104B5A96D634DD644C37657B1C7860B45E6838999B3DCE5A555583C6\
 | 
			
		||||
9209E41F413422954175A06E67FFEF6746DD652F0F48AEFECC3D8CAC13523BDAAD3F5AF4212BD\
 | 
			
		||||
8B3CD64126E1A82E190228020C05B91C8B141F1110086FC2A4C6ED631EBA129D04BB9A19FC53D\
 | 
			
		||||
3ED0E2017D60A68775B75481449
 | 
			
		||||
(a/b)*b + (a%b) - a
 | 
			
		||||
$     status = $status
 | 
			
		||||
$     output_expected = "0"
 | 
			
		||||
$     gosub check_output
 | 
			
		||||
$     if (output .ne. 1)
 | 
			
		||||
$     then
 | 
			
		||||
$         failure = "SunOStest"
 | 
			
		||||
$     else
 | 
			
		||||
$         delete 'f$parse( tmp_file_name)'
 | 
			
		||||
$     endif
 | 
			
		||||
$ endif
 | 
			
		||||
$!
 | 
			
		||||
$! Test for SCO bc bug.
 | 
			
		||||
$!
 | 
			
		||||
$ if (failure .eqs. "")
 | 
			
		||||
$ then
 | 
			
		||||
$!
 | 
			
		||||
$     define /user_mode sys$output 'tmp_file_name'
 | 
			
		||||
$     bc
 | 
			
		||||
obase=16
 | 
			
		||||
ibase=16
 | 
			
		||||
-FFDD63BA1A4648F0D804F8A1C66C53F0D2110590E8A3907EC73B4AEC6F15AC177F176F2274D2\
 | 
			
		||||
9DC8022EA0D7DD3ABE9746D2D46DD3EA5B5F6F69DF12877E0AC5E7F5ADFACEE54573F5D256A06\
 | 
			
		||||
11B5D2BC24947724E22AE4EC3FB0C39D9B4694A01AFE5E43B4D99FB9812A0E4A5773D8B254117\
 | 
			
		||||
1239157EC6E3D8D50199 * -FFDD63BA1A4648F0D804F8A1C66C53F0D2110590E8A3907EC73B4\
 | 
			
		||||
AEC6F15AC177F176F2274D29DC8022EA0D7DD3ABE9746D2D46DD3EA5B5F6F69DF12877E0AC5E7\
 | 
			
		||||
F5ADFACEE54573F5D256A0611B5D2BC24947724E22AE4EC3FB0C39D9B4694A01AFE5E43B4D99F\
 | 
			
		||||
B9812A0E4A5773D8B2541171239157EC6E3D8D50199 - FFBACC221682DA464B6D7F123482522\
 | 
			
		||||
02EDAEDCA38C3B69E9B7BBCD6165A9CD8716C4903417F23C09A85B851961F92C217258CEEB866\
 | 
			
		||||
85EFCC5DD131853A02C07A873B8E2AF2E40C6D5ED598CD0E8F35AD49F3C3A17FDB7653E4E2DC4\
 | 
			
		||||
A8D23CC34686EE4AD01F7407A7CD74429AC6D36DBF0CB6A3E302D0E5BDFCD048A3B90C1BE5AA8\
 | 
			
		||||
E16C3D5884F9136B43FF7BB443764153D4AEC176C681B078F4CC53D6EB6AB76285537DDEE7C18\
 | 
			
		||||
8C72441B52EDBDDBC77E02D34E513F2AABF92F44109CAFE8242BD0ECBAC5604A94B02EA44D43C\
 | 
			
		||||
04E9476E6FBC48043916BFA1485C6093603600273C9C33F13114D78064AE42F3DC466C7DA543D\
 | 
			
		||||
89C8D71
 | 
			
		||||
AD534AFBED2FA39EE9F40E20FCF9E2C861024DB98DDCBA1CD118C49CA55EEBC20D6BA51B2271C\
 | 
			
		||||
928B693D6A73F67FEB1B4571448588B46194617D25D910C6A9A130CC963155CF34079CB218A44\
 | 
			
		||||
8A1F57E276D92A33386DDCA3D241DB78C8974ABD71DD05B0FA555709C9910D745185E6FE108E3\
 | 
			
		||||
37F1907D0C56F8BFBF52B9704 % -E557905B56B13441574CAFCE2BD257A750B1A8B2C88D0E36\
 | 
			
		||||
E18EF7C38DAC80D3948E17ED63AFF3B3467866E3B89D09A81B3D16B52F6A3C7134D3C6F5123E9\
 | 
			
		||||
F617E3145BBFBE9AFD0D6E437EA4FF6F04BC67C4F1458B4F0F47B64 - 1C2BBBB19B74E86FD32\
 | 
			
		||||
9E8DB6A8C3B1B9986D57ED5419C2E855F7D5469E35E76334BB42F4C43E3F3A31B9697C171DAC4\
 | 
			
		||||
D97935A7E1A14AD209D6CF811F55C6DB83AA9E6DFECFCD6669DED7171EE22A40C6181615CAF3F\
 | 
			
		||||
5296964
 | 
			
		||||
$     status = $status
 | 
			
		||||
$     output_expected = "0\0"
 | 
			
		||||
$     gosub check_output
 | 
			
		||||
$     if (output .ne. 1)
 | 
			
		||||
$     then
 | 
			
		||||
$         failure = "SCOtest"
 | 
			
		||||
$     else
 | 
			
		||||
$         delete 'f$parse( tmp_file_name)'
 | 
			
		||||
$     endif
 | 
			
		||||
$ endif
 | 
			
		||||
$!
 | 
			
		||||
$! Test for working 'print' command.
 | 
			
		||||
$!
 | 
			
		||||
$ if (failure .eqs. "")
 | 
			
		||||
$ then
 | 
			
		||||
$!
 | 
			
		||||
$     define /user_mode sys$output 'tmp_file_name'
 | 
			
		||||
$     bc
 | 
			
		||||
print "OK"
 | 
			
		||||
$     status = $status
 | 
			
		||||
$     output_expected = "OK"
 | 
			
		||||
$     gosub check_output
 | 
			
		||||
$     if (output .ne. 1)
 | 
			
		||||
$     then
 | 
			
		||||
$         failure = "printtest"
 | 
			
		||||
$     else
 | 
			
		||||
$         delete 'f$parse( tmp_file_name)'
 | 
			
		||||
$     endif
 | 
			
		||||
$ endif
 | 
			
		||||
$!
 | 
			
		||||
$ if (failure .nes. "")
 | 
			
		||||
$ then
 | 
			
		||||
$     write sys$output -
 | 
			
		||||
       "No working bc found.  Consider installing GNU bc."
 | 
			
		||||
$     exit %X00030000 ! %DCL-W-NORMAL
 | 
			
		||||
$ endif
 | 
			
		||||
$!
 | 
			
		||||
$ exit
 | 
			
		||||
$!
 | 
			
		||||
$!
 | 
			
		||||
$! Complete "bc" command failure.
 | 
			
		||||
$!
 | 
			
		||||
$ bc_fail:
 | 
			
		||||
$ write sys$output -
 | 
			
		||||
   "No ""bc"" program/symbol found.  Consider installing GNU bc."
 | 
			
		||||
$ exit %X00030000 ! %DCL-W-NORMAL
 | 
			
		||||
$!
 | 
			
		||||
$!
 | 
			
		||||
$! Output check subroutine.
 | 
			
		||||
$!
 | 
			
		||||
$ check_output:
 | 
			
		||||
$     eof = 0
 | 
			
		||||
$     line_nr = 0
 | 
			
		||||
$     open /read tmp_file 'tmp_file_name'
 | 
			
		||||
$     c_o_loop:
 | 
			
		||||
$         read /error = error_read tmp_file line
 | 
			
		||||
$         goto ok_read
 | 
			
		||||
$         error_read:
 | 
			
		||||
$         eof = 1
 | 
			
		||||
$         ok_read:
 | 
			
		||||
$         line_expected = f$element( line_nr, "\", output_expected)
 | 
			
		||||
$         line_nr = line_nr+ 1
 | 
			
		||||
$     if ((line_expected .nes. "\") .and. (.not. eof) .and. -
 | 
			
		||||
       (line_expected .eqs. line)) then goto c_o_loop
 | 
			
		||||
$!
 | 
			
		||||
$     if ((line_expected .eqs. "\") .and. eof)
 | 
			
		||||
$     then
 | 
			
		||||
$         output = 1
 | 
			
		||||
$     else
 | 
			
		||||
$         output = 0
 | 
			
		||||
$     endif
 | 
			
		||||
$     close tmp_file
 | 
			
		||||
$ return
 | 
			
		||||
$!
 | 
			
		||||
							
								
								
									
										69
									
								
								test/bntest.com
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								test/bntest.com
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,69 @@
 | 
			
		||||
$!
 | 
			
		||||
$! Analyze bntest output file.
 | 
			
		||||
$!
 | 
			
		||||
$! Exit status = 1 (success) if all tests passed,
 | 
			
		||||
$!               0 (warning) if any test failed.
 | 
			
		||||
$!
 | 
			
		||||
$! 2010-04-05 SMS.  New.  Based (loosely) on perl code in bntest-vms.sh.
 | 
			
		||||
$!
 | 
			
		||||
$!                  Expect data like:
 | 
			
		||||
$!                        test test_name1
 | 
			
		||||
$!                        0
 | 
			
		||||
$!                        [...]
 | 
			
		||||
$!                        test test_name2
 | 
			
		||||
$!                        0
 | 
			
		||||
$!                        [...]
 | 
			
		||||
$!                        [...]
 | 
			
		||||
$!
 | 
			
		||||
$!                  Some tests have no following "0" lines.
 | 
			
		||||
$!
 | 
			
		||||
$ result_file_name = f$edit( p1, "TRIM")
 | 
			
		||||
$ if (result_file_name .eqs. "")
 | 
			
		||||
$ then
 | 
			
		||||
$     result_file_name = "bntest-vms.out"
 | 
			
		||||
$ endif
 | 
			
		||||
$!
 | 
			
		||||
$ fail = 0
 | 
			
		||||
$ passed = 0
 | 
			
		||||
$ tests = 0
 | 
			
		||||
$!
 | 
			
		||||
$ on control_c then goto tidy
 | 
			
		||||
$ on error then goto tidy
 | 
			
		||||
$!
 | 
			
		||||
$ open /read result_file 'result_file_name'
 | 
			
		||||
$!
 | 
			
		||||
$ read_loop:
 | 
			
		||||
$     read /end = read_loop_end /error = tidy result_file line
 | 
			
		||||
$     t1 = f$element( 0, " ", line)
 | 
			
		||||
$     if (t1 .eqs. "test")
 | 
			
		||||
$     then
 | 
			
		||||
$         passed = passed+ 1
 | 
			
		||||
$         tests = tests+ 1
 | 
			
		||||
$         fail = 1
 | 
			
		||||
$         t2 = f$extract( 5, 1000, line)
 | 
			
		||||
$         write sys$output "verify ''t2'"
 | 
			
		||||
$     else
 | 
			
		||||
$         if (t1 .nes. "0")
 | 
			
		||||
$         then
 | 
			
		||||
$             write sys$output "Failed! bc: ''line'"
 | 
			
		||||
$             passed = passed- fail
 | 
			
		||||
$             fail = 0
 | 
			
		||||
$         endif
 | 
			
		||||
$     endif
 | 
			
		||||
$ goto read_loop
 | 
			
		||||
$ read_loop_end:
 | 
			
		||||
$ write sys$output "''passed'/''tests' tests passed"
 | 
			
		||||
$!
 | 
			
		||||
$ tidy:
 | 
			
		||||
$ if f$trnlnm( "result_file", "LNM$PROCESS_TABLE", , "SUPERVISOR", , "CONFINE")
 | 
			
		||||
$ then
 | 
			
		||||
$     close result_file
 | 
			
		||||
$ endif
 | 
			
		||||
$!
 | 
			
		||||
$ if ((tests .gt. 0) .and. (tests .eq. passed))
 | 
			
		||||
$ then
 | 
			
		||||
$    exit 1
 | 
			
		||||
$ else
 | 
			
		||||
$    exit 0
 | 
			
		||||
$ endif
 | 
			
		||||
$!
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user