Compare commits
	
		
			173 Commits
		
	
	
		
			OpenSSL_1_
			...
			OpenSSL_1_
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					0ee5fcde06 | ||
| 
						 | 
					d4c1763858 | ||
| 
						 | 
					fe64245aa1 | ||
| 
						 | 
					1030f89f5e | ||
| 
						 | 
					b6ed991731 | ||
| 
						 | 
					7b560c174d | ||
| 
						 | 
					c26bfada81 | ||
| 
						 | 
					40b8eb792d | ||
| 
						 | 
					ab17f6b746 | ||
| 
						 | 
					7bc2aee4f1 | ||
| 
						 | 
					9bc3665ac9 | ||
| 
						 | 
					aa5ab40860 | ||
| 
						 | 
					8aa556e1c3 | ||
| 
						 | 
					5ef5b9ffa9 | ||
| 
						 | 
					d44f89c990 | ||
| 
						 | 
					c35e138a58 | ||
| 
						 | 
					57e477b9ec | ||
| 
						 | 
					39a298a1c0 | ||
| 
						 | 
					1fdf36f511 | ||
| 
						 | 
					9dcab127e1 | ||
| 
						 | 
					3e8f9dc1a0 | ||
| 
						 | 
					7cb79c7afb | ||
| 
						 | 
					d272599277 | ||
| 
						 | 
					b3c02473f7 | ||
| 
						 | 
					23cd01ef61 | ||
| 
						 | 
					dcad51bc13 | ||
| 
						 | 
					80d586d97f | ||
| 
						 | 
					cbfec68a79 | ||
| 
						 | 
					31909e7968 | ||
| 
						 | 
					34cdff92e9 | ||
| 
						 | 
					05627d57e5 | ||
| 
						 | 
					ac32a77cd6 | ||
| 
						 | 
					f877da9ced | ||
| 
						 | 
					ba9d44b28d | ||
| 
						 | 
					da5fab7325 | ||
| 
						 | 
					efd89aa9cc | ||
| 
						 | 
					4e3dbe37ca | ||
| 
						 | 
					3610719931 | ||
| 
						 | 
					af3aa2b5ef | ||
| 
						 | 
					adba3b3bf1 | ||
| 
						 | 
					ad0fb7f498 | ||
| 
						 | 
					b1d5b8a4a4 | ||
| 
						 | 
					fb22f74064 | ||
| 
						 | 
					858de8718f | ||
| 
						 | 
					bd5b5b4c4b | ||
| 
						 | 
					188f3f9767 | ||
| 
						 | 
					27c76b9b80 | ||
| 
						 | 
					8744ba5e42 | ||
| 
						 | 
					4d9dc0c269 | ||
| 
						 | 
					7e365298ea | ||
| 
						 | 
					b6f33dce3b | ||
| 
						 | 
					cdc47dcf19 | ||
| 
						 | 
					9cab86ee0a | ||
| 
						 | 
					e40d7c1f3a | ||
| 
						 | 
					3ae6186564 | ||
| 
						 | 
					aa1e42215b | ||
| 
						 | 
					bec1093cce | ||
| 
						 | 
					78ac7fa18d | ||
| 
						 | 
					11414f17d9 | ||
| 
						 | 
					0a59e2dc30 | ||
| 
						 | 
					0945bfcb22 | ||
| 
						 | 
					f5d840a079 | ||
| 
						 | 
					886ef2b650 | ||
| 
						 | 
					8b89cb3307 | ||
| 
						 | 
					bf42354620 | ||
| 
						 | 
					e4731f76e2 | ||
| 
						 | 
					595487ea19 | ||
| 
						 | 
					c6eb1cbd1e | ||
| 
						 | 
					1a9499cf23 | ||
| 
						 | 
					254c01ed54 | ||
| 
						 | 
					2d8e705b2a | ||
| 
						 | 
					f4d1fb7769 | ||
| 
						 | 
					10a70da729 | ||
| 
						 | 
					dcbc03ede7 | ||
| 
						 | 
					b32aa8e63e | ||
| 
						 | 
					82697bc2b9 | ||
| 
						 | 
					17b753f23a | ||
| 
						 | 
					cdcb94eea7 | ||
| 
						 | 
					051b41df41 | ||
| 
						 | 
					c59bd61b2e | ||
| 
						 | 
					f34b095fab | ||
| 
						 | 
					d3bb25e30a | ||
| 
						 | 
					eba8bf485a | ||
| 
						 | 
					464774d75f | ||
| 
						 | 
					833518cf0e | ||
| 
						 | 
					8a73e3a0e8 | ||
| 
						 | 
					edc2a76ade | ||
| 
						 | 
					8dfe1e4dd2 | ||
| 
						 | 
					feb96e914a | ||
| 
						 | 
					67fb63e9b7 | ||
| 
						 | 
					eecc697b65 | ||
| 
						 | 
					e4f77bf183 | ||
| 
						 | 
					cd5f206c2f | ||
| 
						 | 
					3cf40601b7 | ||
| 
						 | 
					82e586a90b | ||
| 
						 | 
					a659386639 | ||
| 
						 | 
					5b38d54753 | ||
| 
						 | 
					6b3a315003 | ||
| 
						 | 
					f296e411ef | ||
| 
						 | 
					5bea7975a6 | ||
| 
						 | 
					9c5efc9c65 | ||
| 
						 | 
					75862f7741 | ||
| 
						 | 
					99ceb2d40c | ||
| 
						 | 
					abc7a266a3 | ||
| 
						 | 
					33c99f2c81 | ||
| 
						 | 
					1a3701f4fe | ||
| 
						 | 
					4ce06271aa | ||
| 
						 | 
					c5f8cd7bc6 | ||
| 
						 | 
					937a766982 | ||
| 
						 | 
					07977739f0 | ||
| 
						 | 
					c7e78b6bed | ||
| 
						 | 
					df6c736fbd | ||
| 
						 | 
					c30a1b3b33 | ||
| 
						 | 
					9ed55313a7 | ||
| 
						 | 
					7238a82c8a | ||
| 
						 | 
					6e5d130765 | ||
| 
						 | 
					8f0f9ffda3 | ||
| 
						 | 
					5c4fd8b515 | ||
| 
						 | 
					496c79f60c | ||
| 
						 | 
					186578be45 | ||
| 
						 | 
					f4c5cd3085 | ||
| 
						 | 
					0ddf91c5f3 | ||
| 
						 | 
					73824ba8fe | ||
| 
						 | 
					e95e22af50 | ||
| 
						 | 
					47daa155a3 | ||
| 
						 | 
					be856c0391 | ||
| 
						 | 
					017a06c7d1 | ||
| 
						 | 
					dfd3322d72 | ||
| 
						 | 
					6281abc796 | ||
| 
						 | 
					3661bb4e79 | ||
| 
						 | 
					e697a4c3d7 | ||
| 
						 | 
					5613feaacc | ||
| 
						 | 
					3b38646d13 | ||
| 
						 | 
					bf5b8ff17d | ||
| 
						 | 
					a696708ae6 | ||
| 
						 | 
					5101c35c91 | ||
| 
						 | 
					35bac91676 | ||
| 
						 | 
					ea9de25f2f | ||
| 
						 | 
					f6cddcccc8 | ||
| 
						 | 
					6df777ed50 | ||
| 
						 | 
					07395b7a6d | ||
| 
						 | 
					784f155e0d | ||
| 
						 | 
					42802a94be | ||
| 
						 | 
					9e63eeaf76 | ||
| 
						 | 
					700c0eb8d9 | ||
| 
						 | 
					a4ba716333 | ||
| 
						 | 
					d21cbd7d5e | ||
| 
						 | 
					ae50d82700 | ||
| 
						 | 
					ff864ffef3 | ||
| 
						 | 
					0a1f31f7ba | ||
| 
						 | 
					5a27a20be3 | ||
| 
						 | 
					3d5bb773ec | ||
| 
						 | 
					c8ece537e3 | ||
| 
						 | 
					8338cf0bdb | ||
| 
						 | 
					ddbf312fb4 | ||
| 
						 | 
					e7c2ad508d | ||
| 
						 | 
					929b0d70c1 | ||
| 
						 | 
					b7279ed55c | ||
| 
						 | 
					8f8e4e4f52 | ||
| 
						 | 
					a20718fa2c | ||
| 
						 | 
					4285b85163 | ||
| 
						 | 
					fe82be2b33 | ||
| 
						 | 
					8509128179 | ||
| 
						 | 
					d3a9eaccc1 | ||
| 
						 | 
					4ba9a4265b | ||
| 
						 | 
					bc0eb82b85 | ||
| 
						 | 
					bd891f098b | ||
| 
						 | 
					c45dfdc68a | ||
| 
						 | 
					b5dc90121c | ||
| 
						 | 
					b0b7232877 | ||
| 
						 | 
					ece8574ae6 | ||
| 
						 | 
					3edf1b98e0 | ||
| 
						 | 
					0d6d10d97d | 
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -100,8 +100,12 @@ tags
 | 
			
		||||
TAGS
 | 
			
		||||
 | 
			
		||||
# Windows
 | 
			
		||||
/tmp32
 | 
			
		||||
/tmp32.dbg
 | 
			
		||||
/tmp32dll
 | 
			
		||||
/tmp32dll.dbg
 | 
			
		||||
/out32
 | 
			
		||||
/out32.dbg
 | 
			
		||||
/out32dll
 | 
			
		||||
/out32dll.dbg
 | 
			
		||||
/inc32
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										90
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										90
									
								
								CHANGES
									
									
									
									
									
								
							@@ -2,6 +2,96 @@
 | 
			
		||||
 OpenSSL CHANGES
 | 
			
		||||
 _______________
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.2b and 1.0.2c [12 Jun 2015]
 | 
			
		||||
 | 
			
		||||
  *) Fix HMAC ABI incompatibility. The previous version introduced an ABI
 | 
			
		||||
     incompatibility in the handling of HMAC. The previous ABI has now been
 | 
			
		||||
     restored.
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.2a and 1.0.2b [11 Jun 2015]
 | 
			
		||||
 | 
			
		||||
  *) Malformed ECParameters causes infinite loop
 | 
			
		||||
 | 
			
		||||
     When processing an ECParameters structure OpenSSL enters an infinite loop
 | 
			
		||||
     if the curve specified is over a specially malformed binary polynomial
 | 
			
		||||
     field.
 | 
			
		||||
 | 
			
		||||
     This can be used to perform denial of service against any
 | 
			
		||||
     system which processes public keys, certificate requests or
 | 
			
		||||
     certificates.  This includes TLS clients and TLS servers with
 | 
			
		||||
     client authentication enabled.
 | 
			
		||||
 | 
			
		||||
     This issue was reported to OpenSSL by Joseph Barr-Pixton.
 | 
			
		||||
     (CVE-2015-1788)
 | 
			
		||||
     [Andy Polyakov]
 | 
			
		||||
 | 
			
		||||
  *) Exploitable out-of-bounds read in X509_cmp_time
 | 
			
		||||
 | 
			
		||||
     X509_cmp_time does not properly check the length of the ASN1_TIME
 | 
			
		||||
     string and can read a few bytes out of bounds. In addition,
 | 
			
		||||
     X509_cmp_time accepts an arbitrary number of fractional seconds in the
 | 
			
		||||
     time string.
 | 
			
		||||
 | 
			
		||||
     An attacker can use this to craft malformed certificates and CRLs of
 | 
			
		||||
     various sizes and potentially cause a segmentation fault, resulting in
 | 
			
		||||
     a DoS on applications that verify certificates or CRLs. TLS clients
 | 
			
		||||
     that verify CRLs are affected. TLS clients and servers with client
 | 
			
		||||
     authentication enabled may be affected if they use custom verification
 | 
			
		||||
     callbacks.
 | 
			
		||||
 | 
			
		||||
     This issue was reported to OpenSSL by Robert Swiecki (Google), and
 | 
			
		||||
     independently by Hanno B<>ck.
 | 
			
		||||
     (CVE-2015-1789)
 | 
			
		||||
     [Emilia K<>sper]
 | 
			
		||||
 | 
			
		||||
  *) PKCS7 crash with missing EnvelopedContent
 | 
			
		||||
 | 
			
		||||
     The PKCS#7 parsing code does not handle missing inner EncryptedContent
 | 
			
		||||
     correctly. An attacker can craft malformed ASN.1-encoded PKCS#7 blobs
 | 
			
		||||
     with missing content and trigger a NULL pointer dereference on parsing.
 | 
			
		||||
 | 
			
		||||
     Applications that decrypt PKCS#7 data or otherwise parse PKCS#7
 | 
			
		||||
     structures from untrusted sources are affected. OpenSSL clients and
 | 
			
		||||
     servers are not affected.
 | 
			
		||||
 | 
			
		||||
     This issue was reported to OpenSSL by Michal Zalewski (Google).
 | 
			
		||||
     (CVE-2015-1790)
 | 
			
		||||
     [Emilia K<>sper]
 | 
			
		||||
 | 
			
		||||
  *) CMS verify infinite loop with unknown hash function
 | 
			
		||||
 | 
			
		||||
     When verifying a signedData message the CMS code can enter an infinite loop
 | 
			
		||||
     if presented with an unknown hash function OID. This can be used to perform
 | 
			
		||||
     denial of service against any system which verifies signedData messages using
 | 
			
		||||
     the CMS code.
 | 
			
		||||
     This issue was reported to OpenSSL by Johannes Bauer.
 | 
			
		||||
     (CVE-2015-1792)
 | 
			
		||||
     [Stephen Henson]
 | 
			
		||||
 | 
			
		||||
  *) Race condition handling NewSessionTicket
 | 
			
		||||
 | 
			
		||||
     If a NewSessionTicket is received by a multi-threaded client when attempting to
 | 
			
		||||
     reuse a previous ticket then a race condition can occur potentially leading to
 | 
			
		||||
     a double free of the ticket data.
 | 
			
		||||
     (CVE-2015-1791)
 | 
			
		||||
     [Matt Caswell]
 | 
			
		||||
 | 
			
		||||
  *) Removed support for the two export grade static DH ciphersuites
 | 
			
		||||
     EXP-DH-RSA-DES-CBC-SHA and EXP-DH-DSS-DES-CBC-SHA. These two ciphersuites
 | 
			
		||||
     were newly added (along with a number of other static DH ciphersuites) to
 | 
			
		||||
     1.0.2. However the two export ones have *never* worked since they were
 | 
			
		||||
     introduced. It seems strange in any case to be adding new export
 | 
			
		||||
     ciphersuites, and given "logjam" it also does not seem correct to fix them.
 | 
			
		||||
     [Matt Caswell]
 | 
			
		||||
 | 
			
		||||
  *) Only support 256-bit or stronger elliptic curves with the
 | 
			
		||||
     'ecdh_auto' setting (server) or by default (client). Of supported
 | 
			
		||||
     curves, prefer P-256 (both).
 | 
			
		||||
     [Emilia Kasper]
 | 
			
		||||
 | 
			
		||||
  *) Reject DH handshakes with parameters shorter than 768 bits.
 | 
			
		||||
     [Kurt Roeckx and Emilia Kasper]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.2 and 1.0.2a [19 Mar 2015]
 | 
			
		||||
 | 
			
		||||
  *) ClientHello sigalgs DoS fix
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										45
									
								
								Configure
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								Configure
									
									
									
									
									
								
							@@ -105,7 +105,24 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimenta
 | 
			
		||||
 | 
			
		||||
my $gcc_devteam_warn = "-Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED";
 | 
			
		||||
 | 
			
		||||
my $clang_disabled_warnings = "-Wno-language-extension-token -Wno-extended-offsetof -Wno-padded -Wno-shorten-64-to-32 -Wno-format-nonliteral -Wno-missing-noreturn -Wno-unused-parameter -Wno-sign-conversion -Wno-unreachable-code -Wno-conversion -Wno-documentation -Wno-missing-variable-declarations -Wno-cast-align -Wno-incompatible-pointer-types-discards-qualifiers -Wno-missing-variable-declarations -Wno-missing-field-initializers -Wno-unused-macros -Wno-disabled-macro-expansion -Wno-conditional-uninitialized -Wno-switch-enum";
 | 
			
		||||
# TODO(openssl-team): fix problems and investigate if (at least) the following
 | 
			
		||||
# warnings can also be enabled:
 | 
			
		||||
# -Wconditional-uninitialized, -Wswitch-enum, -Wunused-macros,
 | 
			
		||||
# -Wmissing-field-initializers, -Wmissing-variable-declarations,
 | 
			
		||||
# -Wincompatible-pointer-types-discards-qualifiers, -Wcast-align,
 | 
			
		||||
# -Wunreachable-code -Wunused-parameter -Wlanguage-extension-token
 | 
			
		||||
# -Wextended-offsetof
 | 
			
		||||
my $clang_disabled_warnings = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token  -Wno-extended-offsetof";
 | 
			
		||||
 | 
			
		||||
# These are used in addition to $gcc_devteam_warn when the compiler is clang.
 | 
			
		||||
# TODO(openssl-team): fix problems and investigate if (at least) the
 | 
			
		||||
# following warnings can also be enabled: -Wconditional-uninitialized,
 | 
			
		||||
# -Wswitch-enum, -Wunused-macros, -Wmissing-field-initializers,
 | 
			
		||||
# -Wmissing-variable-declarations,
 | 
			
		||||
# -Wincompatible-pointer-types-discards-qualifiers, -Wcast-align,
 | 
			
		||||
# -Wunreachable-code -Wunused-parameter -Wlanguage-extension-token
 | 
			
		||||
# -Wextended-offsetof
 | 
			
		||||
my $clang_devteam_warn = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token -Wno-extended-offsetof -Qunused-arguments";
 | 
			
		||||
 | 
			
		||||
my $strict_warnings = 0;
 | 
			
		||||
 | 
			
		||||
@@ -233,12 +250,12 @@ my %table=(
 | 
			
		||||
 | 
			
		||||
#### SPARC Solaris with GNU C setups
 | 
			
		||||
"solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"solaris-sparcv8-gcc","gcc:-mcpu=v8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
# -m32 should be safe to add as long as driver recognizes -mcpu=ultrasparc
 | 
			
		||||
"solaris-sparcv9-gcc","gcc:-m32 -mcpu=ultrasparc -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"solaris64-sparcv9-gcc","gcc:-m64 -mcpu=ultrasparc -O3 -Wall -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-m64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64",
 | 
			
		||||
####
 | 
			
		||||
"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mcpu=v8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-solaris-sparcv9-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -DPEDANTIC -O -g -mcpu=ultrasparc -pedantic -ansi -Wall -Wshadow -Wno-long-long -D__EXTENSIONS__ -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
 | 
			
		||||
#### SPARC Solaris with Sun C setups
 | 
			
		||||
@@ -255,7 +272,7 @@ my %table=(
 | 
			
		||||
 | 
			
		||||
#### SunOS configs, assuming sparc for the gcc one.
 | 
			
		||||
#"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown):SUNOS::DES_UNROLL:${no_asm}::",
 | 
			
		||||
"sunos-gcc","gcc:-O3 -mv8 -Dssize_t=int::(unknown):SUNOS::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1:${no_asm}::",
 | 
			
		||||
"sunos-gcc","gcc:-O3 -mcpu=v8 -Dssize_t=int::(unknown):SUNOS::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1:${no_asm}::",
 | 
			
		||||
 | 
			
		||||
#### IRIX 5.x configs
 | 
			
		||||
# -mips2 flag is added by ./config when appropriate.
 | 
			
		||||
@@ -398,7 +415,7 @@ my %table=(
 | 
			
		||||
"linux-ia64",	"gcc:-DL_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-ia64-icc","icc:-DL_ENDIAN -O2 -Wall::-D_REENTRANT::-ldl -no_cpprt:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-x86_64",	"gcc:-m64 -DL_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
 | 
			
		||||
"linux-x86_64-clang",	"clang: -m64 -DL_ENDIAN -O3 -Weverything $clang_disabled_warnings -Qunused-arguments::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
 | 
			
		||||
"linux-x86_64-clang",	"clang: -m64 -DL_ENDIAN -O3 -Wall -Wextra $clang_disabled_warnings -Qunused-arguments::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
 | 
			
		||||
"linux-x86_64-icc", "icc:-DL_ENDIAN -O2::-D_REENTRANT::-ldl -no_cpprt:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
 | 
			
		||||
"linux-x32",	"gcc:-mx32 -DL_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-mx32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::x32",
 | 
			
		||||
"linux64-s390x",	"gcc:-m64 -DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:${s390x_asm}:64:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
 | 
			
		||||
@@ -419,7 +436,7 @@ my %table=(
 | 
			
		||||
#### SPARC Linux setups
 | 
			
		||||
# Ray Miller <ray.miller@computing-services.oxford.ac.uk> has patiently
 | 
			
		||||
# assisted with debugging of following two configs.
 | 
			
		||||
"linux-sparcv8","gcc:-mv8 -DB_ENDIAN -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-sparcv8","gcc:-mcpu=v8 -DB_ENDIAN -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
# it's a real mess with -mcpu=ultrasparc option under Linux, but
 | 
			
		||||
# -Wa,-Av8plus should do the trick no matter what.
 | 
			
		||||
"linux-sparcv9","gcc:-m32 -mcpu=ultrasparc -DB_ENDIAN -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
@@ -454,7 +471,7 @@ my %table=(
 | 
			
		||||
"BSD-x86",	"gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"BSD-x86-elf",	"gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-BSD-x86-elf",	"gcc:-DL_ENDIAN -O3 -Wall -g::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"BSD-sparcv8",	"gcc:-DB_ENDIAN -O3 -mv8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${sparcv8_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"BSD-sparcv8",	"gcc:-DB_ENDIAN -O3 -mcpu=v8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${sparcv8_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
 | 
			
		||||
"BSD-generic64","gcc:-O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
# -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
 | 
			
		||||
@@ -462,7 +479,7 @@ my %table=(
 | 
			
		||||
# triggered by RIPEMD160 code.
 | 
			
		||||
"BSD-sparc64",	"gcc:-DB_ENDIAN -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:${sparcv9_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"BSD-ia64",	"gcc:-DL_ENDIAN -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"BSD-x86_64",	"gcc:-DL_ENDIAN -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"BSD-x86_64",	"cc:-DL_ENDIAN -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
 | 
			
		||||
"bsdi-elf-gcc",     "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
 | 
			
		||||
@@ -1195,6 +1212,7 @@ my $cc = $fields[$idx_cc];
 | 
			
		||||
if($ENV{CC}) {
 | 
			
		||||
    $cc = $ENV{CC};
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
my $cflags = $fields[$idx_cflags];
 | 
			
		||||
my $unistd = $fields[$idx_unistd];
 | 
			
		||||
my $thread_cflag = $fields[$idx_thread_cflag];
 | 
			
		||||
@@ -1630,12 +1648,21 @@ if ($shlib_version_number =~ /(^[0-9]*)\.([0-9\.]*)/)
 | 
			
		||||
 | 
			
		||||
if ($strict_warnings)
 | 
			
		||||
	{
 | 
			
		||||
	my $ecc = $cc;
 | 
			
		||||
	$ecc = "clang" if `$cc --version 2>&1` =~ /clang/;
 | 
			
		||||
	my $wopt;
 | 
			
		||||
	die "ERROR --strict-warnings requires gcc or clang" unless ($cc =~ /gcc$/ or $cc =~ /clang$/);
 | 
			
		||||
	die "ERROR --strict-warnings requires gcc or clang" unless ($ecc =~ /gcc$/ or $ecc =~ /clang$/);
 | 
			
		||||
	foreach $wopt (split /\s+/, $gcc_devteam_warn)
 | 
			
		||||
		{
 | 
			
		||||
		$cflags .= " $wopt" unless ($cflags =~ /$wopt/)
 | 
			
		||||
		}
 | 
			
		||||
	if ($ecc eq "clang")
 | 
			
		||||
		{
 | 
			
		||||
		foreach $wopt (split /\s+/, $clang_devteam_warn)
 | 
			
		||||
			{
 | 
			
		||||
			$cflags .= " $wopt" unless ($cflags =~ /$wopt/)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
open(IN,'<Makefile.org') || die "unable to read Makefile.org:$!\n";
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										26
									
								
								Makefile.org
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								Makefile.org
									
									
									
									
									
								
							@@ -185,7 +185,7 @@ WTARFILE=       $(NAME)-win.tar
 | 
			
		||||
EXHEADER=       e_os2.h
 | 
			
		||||
HEADER=         e_os.h
 | 
			
		||||
 | 
			
		||||
all: Makefile build_all openssl.pc libssl.pc libcrypto.pc
 | 
			
		||||
all: Makefile build_all
 | 
			
		||||
 | 
			
		||||
# as we stick to -e, CLEARENV ensures that local variables in lower
 | 
			
		||||
# Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn
 | 
			
		||||
@@ -271,7 +271,10 @@ reflect:
 | 
			
		||||
sub_all: build_all
 | 
			
		||||
build_all: build_libs build_apps build_tests build_tools
 | 
			
		||||
 | 
			
		||||
build_libs: build_crypto build_ssl build_engines
 | 
			
		||||
build_libs: build_libcrypto build_libssl openssl.pc
 | 
			
		||||
 | 
			
		||||
build_libcrypto: build_crypto build_engines libcrypto.pc
 | 
			
		||||
build_libssl: build_ssl libssl.pc
 | 
			
		||||
 | 
			
		||||
build_crypto:
 | 
			
		||||
	@dir=crypto; target=all; $(BUILD_ONE_CMD)
 | 
			
		||||
@@ -457,6 +460,9 @@ tests: rehash
 | 
			
		||||
report:
 | 
			
		||||
	@$(PERL) util/selftest.pl
 | 
			
		||||
 | 
			
		||||
update: errors stacks util/libeay.num util/ssleay.num TABLE
 | 
			
		||||
	@set -e; target=update; $(RECURSIVE_BUILD_CMD)
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@set -e; target=depend; $(RECURSIVE_BUILD_CMD)
 | 
			
		||||
 | 
			
		||||
@@ -481,26 +487,10 @@ util/libeay.num::
 | 
			
		||||
util/ssleay.num::
 | 
			
		||||
	$(PERL) util/mkdef.pl ssl update
 | 
			
		||||
 | 
			
		||||
crypto/objects/obj_dat.h: crypto/objects/obj_dat.pl crypto/objects/obj_mac.h
 | 
			
		||||
	$(PERL) crypto/objects/obj_dat.pl crypto/objects/obj_mac.h crypto/objects/obj_dat.h
 | 
			
		||||
crypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num
 | 
			
		||||
	$(PERL) crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num crypto/objects/obj_mac.h
 | 
			
		||||
crypto/objects/obj_xref.h: crypto/objects/objxref.pl crypto/objects/obj_xref.txt crypto/objects/obj_mac.num
 | 
			
		||||
	$(PERL) crypto/objects/objxref.pl crypto/objects/obj_mac.num crypto/objects/obj_xref.txt >crypto/objects/obj_xref.h
 | 
			
		||||
 | 
			
		||||
apps/openssl-vms.cnf: apps/openssl.cnf
 | 
			
		||||
	$(PERL) VMS/VMSify-conf.pl < apps/openssl.cnf > apps/openssl-vms.cnf
 | 
			
		||||
 | 
			
		||||
crypto/bn/bn_prime.h: crypto/bn/bn_prime.pl
 | 
			
		||||
	$(PERL) crypto/bn/bn_prime.pl >crypto/bn/bn_prime.h
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TABLE: Configure
 | 
			
		||||
	(echo 'Output of `Configure TABLE'"':"; \
 | 
			
		||||
	$(PERL) Configure TABLE) > TABLE
 | 
			
		||||
 | 
			
		||||
update: errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h crypto/objects/obj_xref.h apps/openssl-vms.cnf crypto/bn/bn_prime.h TABLE depend
 | 
			
		||||
 | 
			
		||||
# Build distribution tar-file. As the list of files returned by "find" is
 | 
			
		||||
# pretty long, on several platforms a "too many arguments" error or similar
 | 
			
		||||
# would occur. Therefore the list of files is temporarily stored into a file
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								NEWS
									
									
									
									
									
								
							@@ -5,6 +5,18 @@
 | 
			
		||||
  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.2b and OpenSSL 1.0.2c [12 Jun 2015]
 | 
			
		||||
 | 
			
		||||
      o Fix HMAC ABI incompatibility
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.2a and OpenSSL 1.0.2b [11 Jun 2015]
 | 
			
		||||
 | 
			
		||||
      o Malformed ECParameters causes infinite loop (CVE-2015-1788)
 | 
			
		||||
      o Exploitable out-of-bounds read in X509_cmp_time (CVE-2015-1789)
 | 
			
		||||
      o PKCS7 crash with missing EnvelopedContent (CVE-2015-1790)
 | 
			
		||||
      o CMS verify infinite loop with unknown hash function (CVE-2015-1792)
 | 
			
		||||
      o Race condition handling NewSessionTicket (CVE-2015-1791)
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.2 and OpenSSL 1.0.2a [19 Mar 2015]
 | 
			
		||||
 | 
			
		||||
      o OpenSSL 1.0.2 ClientHello sigalgs DoS fix (CVE-2015-0291)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								README
									
									
									
									
									
								
							@@ -1,5 +1,5 @@
 | 
			
		||||
 | 
			
		||||
 OpenSSL 1.0.2a 19 Mar 2015
 | 
			
		||||
 OpenSSL 1.0.2c 12 Jun 2015
 | 
			
		||||
 | 
			
		||||
 Copyright (c) 1998-2011 The OpenSSL Project
 | 
			
		||||
 Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										118
									
								
								TABLE
									
									
									
									
									
								
							
							
						
						
									
										118
									
								
								TABLE
									
									
									
									
									
								
							@@ -36,7 +36,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** BS2000-OSD
 | 
			
		||||
$cc           = c89
 | 
			
		||||
$cflags       = -O -XLLML -XLLMK -XL -DB_ENDIAN -DTERMIOS -DCHARSET_EBCDIC
 | 
			
		||||
$cflags       = -O -XLLML -XLLMK -XL -DB_ENDIAN -DCHARSET_EBCDIC
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = (unknown)
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -70,7 +70,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** BSD-generic32
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DTERMIOS -O3 -fomit-frame-pointer -Wall
 | 
			
		||||
$cflags       = -O3 -fomit-frame-pointer -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -pthread -D_THREAD_SAFE -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -104,7 +104,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** BSD-generic64
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DTERMIOS -O3 -Wall
 | 
			
		||||
$cflags       = -O3 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -pthread -D_THREAD_SAFE -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -138,7 +138,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** BSD-ia64
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DL_ENDIAN -DTERMIOS -O3 -Wall
 | 
			
		||||
$cflags       = -DL_ENDIAN -O3 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -pthread -D_THREAD_SAFE -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -172,7 +172,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** BSD-sparc64
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DB_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall
 | 
			
		||||
$cflags       = -DB_ENDIAN -O3 -DMD32_REG_T=int -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -pthread -D_THREAD_SAFE -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -206,7 +206,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** BSD-sparcv8
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DB_ENDIAN -DTERMIOS -O3 -mv8 -Wall
 | 
			
		||||
$cflags       = -DB_ENDIAN -O3 -mcpu=v8 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -pthread -D_THREAD_SAFE -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -240,7 +240,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** BSD-x86
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall
 | 
			
		||||
$cflags       = -DL_ENDIAN -O3 -fomit-frame-pointer -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -pthread -D_THREAD_SAFE -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -274,7 +274,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** BSD-x86-elf
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall
 | 
			
		||||
$cflags       = -DL_ENDIAN -O3 -fomit-frame-pointer -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -pthread -D_THREAD_SAFE -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -308,7 +308,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** BSD-x86_64
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DL_ENDIAN -DTERMIOS -O3 -Wall
 | 
			
		||||
$cflags       = -DL_ENDIAN -O3 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -pthread -D_THREAD_SAFE -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -410,7 +410,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** DJGPP
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall
 | 
			
		||||
$cflags       = -I/dev/env/WATT_ROOT/inc -DTERMIO -DL_ENDIAN -fomit-frame-pointer -O2 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = 
 | 
			
		||||
$sys_id       = MSDOS
 | 
			
		||||
@@ -546,7 +546,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** QNX6
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DTERMIOS
 | 
			
		||||
$cflags       = 
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = 
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -580,7 +580,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** QNX6-i386
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DL_ENDIAN -DTERMIOS -O2 -Wall
 | 
			
		||||
$cflags       = -DL_ENDIAN -O2 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = 
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -1600,7 +1600,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** debug-BSD-x86-elf
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DL_ENDIAN -DTERMIOS -O3 -Wall -g
 | 
			
		||||
$cflags       = -DL_ENDIAN -O3 -Wall -g
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -pthread -D_THREAD_SAFE -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -2348,7 +2348,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** debug-levitte-linux-elf-extreme
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe
 | 
			
		||||
$cflags       = -DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -2416,7 +2416,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** debug-levitte-linux-noasm-extreme
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe
 | 
			
		||||
$cflags       = -DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -2450,7 +2450,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** debug-linux-elf
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -march=i486 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -2484,7 +2484,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** debug-linux-elf-noefence
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -march=i486 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -2518,7 +2518,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** debug-linux-generic32
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DTERMIO -g -Wall
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -g -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -2586,7 +2586,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** debug-linux-ia32-aes
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DAES_EXPERIMENTAL -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall
 | 
			
		||||
$cflags       = -DAES_EXPERIMENTAL -DL_ENDIAN -O3 -fomit-frame-pointer -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -2620,7 +2620,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** debug-linux-pentium
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentium -Wall
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -mcpu=pentium -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -2654,7 +2654,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** debug-linux-ppro
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentiumpro -Wall
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -g -mcpu=pentiumpro -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -2688,7 +2688,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** debug-linux-x86_64
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -m64 -DL_ENDIAN -DTERMIO -g -Wall
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -m64 -DL_ENDIAN -g -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -2790,7 +2790,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** debug-solaris-sparcv8-gcc
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN
 | 
			
		||||
$cflags       = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mcpu=v8 -Wall -DB_ENDIAN
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -3708,7 +3708,7 @@ $multilib     = /pa20_64
 | 
			
		||||
 | 
			
		||||
*** hurd-x86
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -march=i486 -Wall
 | 
			
		||||
$cflags       = -DL_ENDIAN -O3 -fomit-frame-pointer -march=i486 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -3776,7 +3776,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** irix-cc
 | 
			
		||||
$cc           = cc
 | 
			
		||||
$cflags       = -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN
 | 
			
		||||
$cflags       = -O2 -use_readonly_const -DB_ENDIAN
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = (unknown)
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -3810,7 +3810,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** irix-gcc
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -O3 -DTERMIOS -DB_ENDIAN
 | 
			
		||||
$cflags       = -O3 -DB_ENDIAN
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = (unknown)
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -3844,7 +3844,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** irix-mips3-cc
 | 
			
		||||
$cc           = cc
 | 
			
		||||
$cflags       = -n32 -mips3 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W
 | 
			
		||||
$cflags       = -n32 -mips3 -O2 -use_readonly_const -G0 -rdata_shared -DB_ENDIAN -DBN_DIV3W
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_SGI_MP_SOURCE
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -3878,7 +3878,7 @@ $multilib     = 32
 | 
			
		||||
 | 
			
		||||
*** irix-mips3-gcc
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -mabi=n32 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W
 | 
			
		||||
$cflags       = -mabi=n32 -O3 -DB_ENDIAN -DBN_DIV3W
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_SGI_MP_SOURCE
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -3912,7 +3912,7 @@ $multilib     = 32
 | 
			
		||||
 | 
			
		||||
*** irix64-mips4-cc
 | 
			
		||||
$cc           = cc
 | 
			
		||||
$cflags       = -64 -mips4 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W
 | 
			
		||||
$cflags       = -64 -mips4 -O2 -use_readonly_const -G0 -rdata_shared -DB_ENDIAN -DBN_DIV3W
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_SGI_MP_SOURCE
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -3946,7 +3946,7 @@ $multilib     = 64
 | 
			
		||||
 | 
			
		||||
*** irix64-mips4-gcc
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -mabi=64 -mips4 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W
 | 
			
		||||
$cflags       = -mabi=64 -mips4 -O3 -DB_ENDIAN -DBN_DIV3W
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_SGI_MP_SOURCE
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -3980,7 +3980,7 @@ $multilib     = 64
 | 
			
		||||
 | 
			
		||||
*** linux-aarch64
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DTERMIO -O3 -Wall
 | 
			
		||||
$cflags       = -O3 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4014,7 +4014,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** linux-alpha+bwx-ccc
 | 
			
		||||
$cc           = ccc
 | 
			
		||||
$cflags       = -fast -readonly_strings -DL_ENDIAN -DTERMIO
 | 
			
		||||
$cflags       = -fast -readonly_strings -DL_ENDIAN
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4048,7 +4048,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** linux-alpha+bwx-gcc
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -O3 -DL_ENDIAN -DTERMIO
 | 
			
		||||
$cflags       = -O3 -DL_ENDIAN
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4082,7 +4082,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** linux-alpha-ccc
 | 
			
		||||
$cc           = ccc
 | 
			
		||||
$cflags       = -fast -readonly_strings -DL_ENDIAN -DTERMIO
 | 
			
		||||
$cflags       = -fast -readonly_strings -DL_ENDIAN
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4116,7 +4116,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** linux-alpha-gcc
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -O3 -DL_ENDIAN -DTERMIO
 | 
			
		||||
$cflags       = -O3 -DL_ENDIAN
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4150,7 +4150,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** linux-aout
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -march=i486 -Wall
 | 
			
		||||
$cflags       = -DL_ENDIAN -O3 -fomit-frame-pointer -march=i486 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = (unknown)
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4184,7 +4184,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** linux-armv4
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DTERMIO -O3 -Wall
 | 
			
		||||
$cflags       = -O3 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4218,7 +4218,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** linux-elf
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall
 | 
			
		||||
$cflags       = -DL_ENDIAN -O3 -fomit-frame-pointer -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4252,7 +4252,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** linux-generic32
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DTERMIO -O3 -fomit-frame-pointer -Wall
 | 
			
		||||
$cflags       = -O3 -fomit-frame-pointer -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4286,7 +4286,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** linux-generic64
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DTERMIO -O3 -Wall
 | 
			
		||||
$cflags       = -O3 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4320,7 +4320,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** linux-ia32-icc
 | 
			
		||||
$cc           = icc
 | 
			
		||||
$cflags       = -DL_ENDIAN -DTERMIO -O2
 | 
			
		||||
$cflags       = -DL_ENDIAN -O2
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4388,7 +4388,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** linux-ia64-icc
 | 
			
		||||
$cc           = icc
 | 
			
		||||
$cflags       = -DL_ENDIAN -DTERMIO -O2 -Wall
 | 
			
		||||
$cflags       = -DL_ENDIAN -O2 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4422,7 +4422,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** linux-mips32
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -mabi=32 -DTERMIO -O3 -Wall -DBN_DIV3W
 | 
			
		||||
$cflags       = -mabi=32 -O3 -Wall -DBN_DIV3W
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4456,7 +4456,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** linux-mips64
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -mabi=n32 -DTERMIO -O3 -Wall -DBN_DIV3W
 | 
			
		||||
$cflags       = -mabi=n32 -O3 -Wall -DBN_DIV3W
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4490,7 +4490,7 @@ $multilib     = 32
 | 
			
		||||
 | 
			
		||||
*** linux-ppc
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DB_ENDIAN -DTERMIO -O3 -Wall
 | 
			
		||||
$cflags       = -DB_ENDIAN -O3 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4524,7 +4524,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** linux-ppc64
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -m64 -DB_ENDIAN -DTERMIO -O3 -Wall
 | 
			
		||||
$cflags       = -m64 -DB_ENDIAN -O3 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4558,7 +4558,7 @@ $multilib     = 64
 | 
			
		||||
 | 
			
		||||
*** linux-ppc64le
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -m64 -DL_ENDIAN -DTERMIO -O3 -Wall
 | 
			
		||||
$cflags       = -m64 -DL_ENDIAN -O3 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4592,7 +4592,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** linux-sparcv8
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -mv8 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W
 | 
			
		||||
$cflags       = -mcpu=v8 -DB_ENDIAN -O3 -fomit-frame-pointer -Wall -DBN_DIV2W
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4626,7 +4626,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** linux-sparcv9
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -m32 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W
 | 
			
		||||
$cflags       = -m32 -mcpu=ultrasparc -DB_ENDIAN -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = ULTRASPARC
 | 
			
		||||
@@ -4660,7 +4660,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** linux-x32
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -mx32 -DL_ENDIAN -DTERMIO -O3 -Wall
 | 
			
		||||
$cflags       = -mx32 -DL_ENDIAN -O3 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4694,7 +4694,7 @@ $multilib     = x32
 | 
			
		||||
 | 
			
		||||
*** linux-x86_64
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -m64 -DL_ENDIAN -DTERMIO -O3 -Wall
 | 
			
		||||
$cflags       = -m64 -DL_ENDIAN -O3 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4728,7 +4728,7 @@ $multilib     = 64
 | 
			
		||||
 | 
			
		||||
*** linux-x86_64-clang
 | 
			
		||||
$cc           = clang
 | 
			
		||||
$cflags       = -m64 -DL_ENDIAN -DTERMIO -O3 -Weverything -Wno-language-extension-token -Wno-extended-offsetof -Wno-padded -Wno-shorten-64-to-32 -Wno-format-nonliteral -Wno-missing-noreturn -Wno-unused-parameter -Wno-sign-conversion -Wno-unreachable-code -Wno-conversion -Wno-documentation -Wno-missing-variable-declarations -Wno-cast-align -Wno-incompatible-pointer-types-discards-qualifiers -Wno-missing-variable-declarations -Wno-missing-field-initializers -Wno-unused-macros -Wno-disabled-macro-expansion -Wno-conditional-uninitialized -Wno-switch-enum -Qunused-arguments
 | 
			
		||||
$cflags       = -m64 -DL_ENDIAN -O3 -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token  -Wno-extended-offsetof -Qunused-arguments
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4762,7 +4762,7 @@ $multilib     = 64
 | 
			
		||||
 | 
			
		||||
*** linux-x86_64-icc
 | 
			
		||||
$cc           = icc
 | 
			
		||||
$cflags       = -DL_ENDIAN -DTERMIO -O2
 | 
			
		||||
$cflags       = -DL_ENDIAN -O2
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4796,7 +4796,7 @@ $multilib     = 64
 | 
			
		||||
 | 
			
		||||
*** linux32-s390x
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -m31 -Wa,-mzarch -DB_ENDIAN -DTERMIO -O3 -Wall
 | 
			
		||||
$cflags       = -m31 -Wa,-mzarch -DB_ENDIAN -O3 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4830,7 +4830,7 @@ $multilib     = /highgprs
 | 
			
		||||
 | 
			
		||||
*** linux64-mips64
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -mabi=64 -DTERMIO -O3 -Wall -DBN_DIV3W
 | 
			
		||||
$cflags       = -mabi=64 -O3 -Wall -DBN_DIV3W
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4864,7 +4864,7 @@ $multilib     = 64
 | 
			
		||||
 | 
			
		||||
*** linux64-s390x
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -m64 -DB_ENDIAN -DTERMIO -O3 -Wall
 | 
			
		||||
$cflags       = -m64 -DB_ENDIAN -O3 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -4898,7 +4898,7 @@ $multilib     = 64
 | 
			
		||||
 | 
			
		||||
*** linux64-sparcv9
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -m64 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall
 | 
			
		||||
$cflags       = -m64 -mcpu=ultrasparc -DB_ENDIAN -O3 -fomit-frame-pointer -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = ULTRASPARC
 | 
			
		||||
@@ -5748,7 +5748,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** solaris-sparcv8-gcc
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W
 | 
			
		||||
$cflags       = -mcpu=v8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -6054,7 +6054,7 @@ $multilib     = /64
 | 
			
		||||
 | 
			
		||||
*** sunos-gcc
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -O3 -mv8 -Dssize_t=int
 | 
			
		||||
$cflags       = -O3 -mcpu=v8 -Dssize_t=int
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = (unknown)
 | 
			
		||||
$sys_id       = SUNOS
 | 
			
		||||
 
 | 
			
		||||
@@ -94,6 +94,9 @@ req: sreq.o $(A_OBJ) $(DLIBCRYPTO)
 | 
			
		||||
sreq.o: req.c 
 | 
			
		||||
	$(CC) -c $(INCLUDES) $(CFLAG) -o sreq.o req.c
 | 
			
		||||
 | 
			
		||||
openssl-vms.cnf: openssl.cnf
 | 
			
		||||
	$(PERL) $(TOP)/VMS/VMSify-conf.pl < openssl.cnf > openssl-vms.cnf
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
 | 
			
		||||
@@ -127,12 +130,12 @@ links:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@if [ -z "$(THIS)" ]; then \
 | 
			
		||||
	    $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; \
 | 
			
		||||
	else \
 | 
			
		||||
	    $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(SRC); \
 | 
			
		||||
	fi
 | 
			
		||||
update: openssl-vms.cnf local_depend
 | 
			
		||||
 | 
			
		||||
depend: local_depend
 | 
			
		||||
	@if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
 | 
			
		||||
local_depend:
 | 
			
		||||
	@[ -z "$(THIS)" ] || $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(SRC); \
 | 
			
		||||
 | 
			
		||||
dclean:
 | 
			
		||||
	$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
 | 
			
		||||
@@ -144,10 +147,10 @@ clean:
 | 
			
		||||
	rm -f req
 | 
			
		||||
 | 
			
		||||
$(DLIBSSL):
 | 
			
		||||
	(cd ..; $(MAKE) DIRS=ssl all)
 | 
			
		||||
	(cd ..; $(MAKE) build_libssl)
 | 
			
		||||
 | 
			
		||||
$(DLIBCRYPTO):
 | 
			
		||||
	(cd ..; $(MAKE) DIRS=crypto all)
 | 
			
		||||
	(cd ..; $(MAKE) build_libcrypto)
 | 
			
		||||
 | 
			
		||||
$(EXE): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL)
 | 
			
		||||
	$(RM) $(EXE)
 | 
			
		||||
 
 | 
			
		||||
@@ -574,7 +574,7 @@ int password_callback(char *buf, int bufsiz, int verify, PW_CB_DATA *cb_tmp)
 | 
			
		||||
        char *prompt = NULL;
 | 
			
		||||
 | 
			
		||||
        prompt = UI_construct_prompt(ui, "pass phrase", prompt_info);
 | 
			
		||||
        if(!prompt) {
 | 
			
		||||
        if (!prompt) {
 | 
			
		||||
            BIO_printf(bio_err, "Out of memory\n");
 | 
			
		||||
            UI_free(ui);
 | 
			
		||||
            return 0;
 | 
			
		||||
@@ -588,7 +588,7 @@ int password_callback(char *buf, int bufsiz, int verify, PW_CB_DATA *cb_tmp)
 | 
			
		||||
                                     PW_MIN_LENGTH, bufsiz - 1);
 | 
			
		||||
        if (ok >= 0 && verify) {
 | 
			
		||||
            buff = (char *)OPENSSL_malloc(bufsiz);
 | 
			
		||||
            if(!buff) {
 | 
			
		||||
            if (!buff) {
 | 
			
		||||
                BIO_printf(bio_err, "Out of memory\n");
 | 
			
		||||
                UI_free(ui);
 | 
			
		||||
                OPENSSL_free(prompt);
 | 
			
		||||
@@ -2371,6 +2371,8 @@ int args_verify(char ***pargs, int *pargc,
 | 
			
		||||
        flags |= X509_V_FLAG_SUITEB_192_LOS;
 | 
			
		||||
    else if (!strcmp(arg, "-partial_chain"))
 | 
			
		||||
        flags |= X509_V_FLAG_PARTIAL_CHAIN;
 | 
			
		||||
    else if (!strcmp(arg, "-no_alt_chains"))
 | 
			
		||||
        flags |= X509_V_FLAG_NO_ALT_CHAINS;
 | 
			
		||||
    else
 | 
			
		||||
        return 0;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -375,7 +375,7 @@ static int do_generate(BIO *bio, char *genstr, char *genconf, BUF_MEM *buf)
 | 
			
		||||
{
 | 
			
		||||
    CONF *cnf = NULL;
 | 
			
		||||
    int len;
 | 
			
		||||
    long errline;
 | 
			
		||||
    long errline = 0;
 | 
			
		||||
    unsigned char *p;
 | 
			
		||||
    ASN1_TYPE *atyp = NULL;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								apps/ca.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								apps/ca.c
									
									
									
									
									
								
							@@ -563,7 +563,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
#ifdef OPENSSL_SYS_VMS
 | 
			
		||||
        len = strlen(s) + sizeof(CONFIG_FILE);
 | 
			
		||||
        tofree = OPENSSL_malloc(len);
 | 
			
		||||
        if(!tofree) {
 | 
			
		||||
        if (!tofree) {
 | 
			
		||||
            BIO_printf(bio_err, "Out of memory\n");
 | 
			
		||||
            goto err;
 | 
			
		||||
        }
 | 
			
		||||
@@ -571,7 +571,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
#else
 | 
			
		||||
        len = strlen(s) + sizeof(CONFIG_FILE) + 1;
 | 
			
		||||
        tofree = OPENSSL_malloc(len);
 | 
			
		||||
        if(!tofree) {
 | 
			
		||||
        if (!tofree) {
 | 
			
		||||
            BIO_printf(bio_err, "Out of memory\n");
 | 
			
		||||
            goto err;
 | 
			
		||||
        }
 | 
			
		||||
@@ -2821,7 +2821,7 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
 | 
			
		||||
    ASN1_GENERALIZEDTIME *comp_time = NULL;
 | 
			
		||||
    tmp = BUF_strdup(str);
 | 
			
		||||
 | 
			
		||||
    if(!tmp) {
 | 
			
		||||
    if (!tmp) {
 | 
			
		||||
        BIO_printf(bio_err, "memory allocation failure\n");
 | 
			
		||||
        goto err;
 | 
			
		||||
    }
 | 
			
		||||
@@ -2843,7 +2843,7 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
 | 
			
		||||
 | 
			
		||||
    if (prevtm) {
 | 
			
		||||
        *prevtm = ASN1_UTCTIME_new();
 | 
			
		||||
        if(!*prevtm) {
 | 
			
		||||
        if (!*prevtm) {
 | 
			
		||||
            BIO_printf(bio_err, "memory allocation failure\n");
 | 
			
		||||
            goto err;
 | 
			
		||||
        }
 | 
			
		||||
@@ -2887,7 +2887,7 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
 | 
			
		||||
                goto err;
 | 
			
		||||
            }
 | 
			
		||||
            comp_time = ASN1_GENERALIZEDTIME_new();
 | 
			
		||||
            if(!comp_time) {
 | 
			
		||||
            if (!comp_time) {
 | 
			
		||||
                BIO_printf(bio_err, "memory allocation failure\n");
 | 
			
		||||
                goto err;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -463,7 +463,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
            if (key_param == NULL || key_param->idx != keyidx) {
 | 
			
		||||
                cms_key_param *nparam;
 | 
			
		||||
                nparam = OPENSSL_malloc(sizeof(cms_key_param));
 | 
			
		||||
                if(!nparam) {
 | 
			
		||||
                if (!nparam) {
 | 
			
		||||
                    BIO_printf(bio_err, "Out of memory\n");
 | 
			
		||||
                    goto argerr;
 | 
			
		||||
                }
 | 
			
		||||
@@ -645,6 +645,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
        BIO_printf(bio_err,
 | 
			
		||||
                   "-CApath dir    trusted certificates directory\n");
 | 
			
		||||
        BIO_printf(bio_err, "-CAfile file   trusted certificates file\n");
 | 
			
		||||
        BIO_printf(bio_err,
 | 
			
		||||
                   "-no_alt_chains only ever use the first certificate chain found\n");
 | 
			
		||||
        BIO_printf(bio_err,
 | 
			
		||||
                   "-crl_check     check revocation status of signer's certificate using CRLs\n");
 | 
			
		||||
        BIO_printf(bio_err,
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								apps/enc.c
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								apps/enc.c
									
									
									
									
									
								
							@@ -548,9 +548,14 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
            else
 | 
			
		||||
                OPENSSL_cleanse(str, strlen(str));
 | 
			
		||||
        }
 | 
			
		||||
        if ((hiv != NULL) && !set_hex(hiv, iv, sizeof iv)) {
 | 
			
		||||
            BIO_printf(bio_err, "invalid hex iv value\n");
 | 
			
		||||
            goto end;
 | 
			
		||||
        if (hiv != NULL) {
 | 
			
		||||
            int siz = EVP_CIPHER_iv_length(cipher);
 | 
			
		||||
            if (siz == 0) {
 | 
			
		||||
                BIO_printf(bio_err, "warning: iv not use by this cipher\n");
 | 
			
		||||
            } else if (!set_hex(hiv, iv, sizeof iv)) {
 | 
			
		||||
                BIO_printf(bio_err, "invalid hex iv value\n");
 | 
			
		||||
                goto end;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if ((hiv == NULL) && (str == NULL)
 | 
			
		||||
            && EVP_CIPHER_iv_length(cipher) != 0) {
 | 
			
		||||
@@ -562,7 +567,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
            BIO_printf(bio_err, "iv undefined\n");
 | 
			
		||||
            goto end;
 | 
			
		||||
        }
 | 
			
		||||
        if ((hkey != NULL) && !set_hex(hkey, key, sizeof key)) {
 | 
			
		||||
        if ((hkey != NULL) && !set_hex(hkey, key, EVP_CIPHER_key_length(cipher))) {
 | 
			
		||||
            BIO_printf(bio_err, "invalid hex key value\n");
 | 
			
		||||
            goto end;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -535,6 +535,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
                   "-CApath dir          trusted certificates directory\n");
 | 
			
		||||
        BIO_printf(bio_err,
 | 
			
		||||
                   "-CAfile file         trusted certificates file\n");
 | 
			
		||||
        BIO_printf(bio_err,
 | 
			
		||||
                   "-no_alt_chains       only ever use the first certificate chain found\n");
 | 
			
		||||
        BIO_printf(bio_err,
 | 
			
		||||
                   "-VAfile file         validator certificates file\n");
 | 
			
		||||
        BIO_printf(bio_err,
 | 
			
		||||
 
 | 
			
		||||
@@ -111,6 +111,7 @@
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h> /* for memcpy() and strcmp() */
 | 
			
		||||
#define USE_SOCKETS
 | 
			
		||||
#define NON_MAIN
 | 
			
		||||
#include "apps.h"
 | 
			
		||||
@@ -456,7 +457,7 @@ int ssl_print_curves(BIO *out, SSL *s, int noshared)
 | 
			
		||||
    if (ncurves <= 0)
 | 
			
		||||
        return 1;
 | 
			
		||||
    curves = OPENSSL_malloc(ncurves * sizeof(int));
 | 
			
		||||
    if(!curves) {
 | 
			
		||||
    if (!curves) {
 | 
			
		||||
        BIO_puts(out, "Malloc error getting supported curves\n");
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
@@ -1012,7 +1013,7 @@ int MS_CALLBACK generate_cookie_callback(SSL *ssl, unsigned char *cookie,
 | 
			
		||||
 | 
			
		||||
    /* Initialize a random secret */
 | 
			
		||||
    if (!cookie_initialized) {
 | 
			
		||||
        if (!RAND_bytes(cookie_secret, COOKIE_SECRET_LENGTH)) {
 | 
			
		||||
        if (RAND_bytes(cookie_secret, COOKIE_SECRET_LENGTH) <= 0) {
 | 
			
		||||
            BIO_printf(bio_err, "error setting random cookie secret\n");
 | 
			
		||||
            return 0;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -331,6 +331,8 @@ static void sc_usage(void)
 | 
			
		||||
               " -pass arg     - private key file pass phrase source\n");
 | 
			
		||||
    BIO_printf(bio_err, " -CApath arg   - PEM format directory of CA's\n");
 | 
			
		||||
    BIO_printf(bio_err, " -CAfile arg   - PEM format file of CA's\n");
 | 
			
		||||
    BIO_printf(bio_err,
 | 
			
		||||
               " -no_alt_chains - only ever use the first certificate chain found\n");
 | 
			
		||||
    BIO_printf(bio_err,
 | 
			
		||||
               " -reconnect    - Drop and re-make the connection with the same Session-ID\n");
 | 
			
		||||
    BIO_printf(bio_err,
 | 
			
		||||
@@ -560,7 +562,7 @@ static char *MS_CALLBACK ssl_give_srp_client_pwd_cb(SSL *s, void *arg)
 | 
			
		||||
    PW_CB_DATA cb_tmp;
 | 
			
		||||
    int l;
 | 
			
		||||
 | 
			
		||||
    if(!pass) {
 | 
			
		||||
    if (!pass) {
 | 
			
		||||
        BIO_printf(bio_err, "Malloc failure\n");
 | 
			
		||||
        return NULL;
 | 
			
		||||
    }
 | 
			
		||||
@@ -1336,13 +1338,12 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
    SSL_CTX_set_verify(ctx, verify, verify_callback);
 | 
			
		||||
 | 
			
		||||
    if ((!SSL_CTX_load_verify_locations(ctx, CAfile, CApath)) ||
 | 
			
		||||
        (!SSL_CTX_set_default_verify_paths(ctx))) {
 | 
			
		||||
        /*
 | 
			
		||||
         * BIO_printf(bio_err,"error setting default verify locations\n");
 | 
			
		||||
         */
 | 
			
		||||
    if ((CAfile || CApath)
 | 
			
		||||
        && !SSL_CTX_load_verify_locations(ctx, CAfile, CApath)) {
 | 
			
		||||
        ERR_print_errors(bio_err);
 | 
			
		||||
    }
 | 
			
		||||
    if (!SSL_CTX_set_default_verify_paths(ctx)) {
 | 
			
		||||
        ERR_print_errors(bio_err);
 | 
			
		||||
        /* goto end; */
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ssl_ctx_add_crls(ctx, crls, crl_download);
 | 
			
		||||
 
 | 
			
		||||
@@ -222,7 +222,7 @@ static void init_session_cache_ctx(SSL_CTX *sctx);
 | 
			
		||||
static void free_sessions(void);
 | 
			
		||||
#ifndef OPENSSL_NO_DH
 | 
			
		||||
static DH *load_dh_param(const char *dhfile);
 | 
			
		||||
static DH *get_dh512(void);
 | 
			
		||||
static DH *get_dh2048(void);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef MONOLITH
 | 
			
		||||
@@ -230,30 +230,48 @@ static void s_server_init(void);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_DH
 | 
			
		||||
static unsigned char dh512_p[] = {
 | 
			
		||||
    0xDA, 0x58, 0x3C, 0x16, 0xD9, 0x85, 0x22, 0x89, 0xD0, 0xE4, 0xAF, 0x75,
 | 
			
		||||
    0x6F, 0x4C, 0xCA, 0x92, 0xDD, 0x4B, 0xE5, 0x33, 0xB8, 0x04, 0xFB, 0x0F,
 | 
			
		||||
    0xED, 0x94, 0xEF, 0x9C, 0x8A, 0x44, 0x03, 0xED, 0x57, 0x46, 0x50, 0xD3,
 | 
			
		||||
    0x69, 0x99, 0xDB, 0x29, 0xD7, 0x76, 0x27, 0x6B, 0xA2, 0xD3, 0xD4, 0x12,
 | 
			
		||||
    0xE2, 0x18, 0xF4, 0xDD, 0x1E, 0x08, 0x4C, 0xF6, 0xD8, 0x00, 0x3E, 0x7C,
 | 
			
		||||
    0x47, 0x74, 0xE8, 0x33,
 | 
			
		||||
static unsigned char dh2048_p[] = {
 | 
			
		||||
    0xF6,0x42,0x57,0xB7,0x08,0x7F,0x08,0x17,0x72,0xA2,0xBA,0xD6,
 | 
			
		||||
    0xA9,0x42,0xF3,0x05,0xE8,0xF9,0x53,0x11,0x39,0x4F,0xB6,0xF1,
 | 
			
		||||
    0x6E,0xB9,0x4B,0x38,0x20,0xDA,0x01,0xA7,0x56,0xA3,0x14,0xE9,
 | 
			
		||||
    0x8F,0x40,0x55,0xF3,0xD0,0x07,0xC6,0xCB,0x43,0xA9,0x94,0xAD,
 | 
			
		||||
    0xF7,0x4C,0x64,0x86,0x49,0xF8,0x0C,0x83,0xBD,0x65,0xE9,0x17,
 | 
			
		||||
    0xD4,0xA1,0xD3,0x50,0xF8,0xF5,0x59,0x5F,0xDC,0x76,0x52,0x4F,
 | 
			
		||||
    0x3D,0x3D,0x8D,0xDB,0xCE,0x99,0xE1,0x57,0x92,0x59,0xCD,0xFD,
 | 
			
		||||
    0xB8,0xAE,0x74,0x4F,0xC5,0xFC,0x76,0xBC,0x83,0xC5,0x47,0x30,
 | 
			
		||||
    0x61,0xCE,0x7C,0xC9,0x66,0xFF,0x15,0xF9,0xBB,0xFD,0x91,0x5E,
 | 
			
		||||
    0xC7,0x01,0xAA,0xD3,0x5B,0x9E,0x8D,0xA0,0xA5,0x72,0x3A,0xD4,
 | 
			
		||||
    0x1A,0xF0,0xBF,0x46,0x00,0x58,0x2B,0xE5,0xF4,0x88,0xFD,0x58,
 | 
			
		||||
    0x4E,0x49,0xDB,0xCD,0x20,0xB4,0x9D,0xE4,0x91,0x07,0x36,0x6B,
 | 
			
		||||
    0x33,0x6C,0x38,0x0D,0x45,0x1D,0x0F,0x7C,0x88,0xB3,0x1C,0x7C,
 | 
			
		||||
    0x5B,0x2D,0x8E,0xF6,0xF3,0xC9,0x23,0xC0,0x43,0xF0,0xA5,0x5B,
 | 
			
		||||
    0x18,0x8D,0x8E,0xBB,0x55,0x8C,0xB8,0x5D,0x38,0xD3,0x34,0xFD,
 | 
			
		||||
    0x7C,0x17,0x57,0x43,0xA3,0x1D,0x18,0x6C,0xDE,0x33,0x21,0x2C,
 | 
			
		||||
    0xB5,0x2A,0xFF,0x3C,0xE1,0xB1,0x29,0x40,0x18,0x11,0x8D,0x7C,
 | 
			
		||||
    0x84,0xA7,0x0A,0x72,0xD6,0x86,0xC4,0x03,0x19,0xC8,0x07,0x29,
 | 
			
		||||
    0x7A,0xCA,0x95,0x0C,0xD9,0x96,0x9F,0xAB,0xD0,0x0A,0x50,0x9B,
 | 
			
		||||
    0x02,0x46,0xD3,0x08,0x3D,0x66,0xA4,0x5D,0x41,0x9F,0x9C,0x7C,
 | 
			
		||||
    0xBD,0x89,0x4B,0x22,0x19,0x26,0xBA,0xAB,0xA2,0x5E,0xC3,0x55,
 | 
			
		||||
    0xE9,0x32,0x0B,0x3B,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static unsigned char dh512_g[] = {
 | 
			
		||||
static unsigned char dh2048_g[] = {
 | 
			
		||||
    0x02,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static DH *get_dh512(void)
 | 
			
		||||
DH *get_dh2048()
 | 
			
		||||
{
 | 
			
		||||
    DH *dh = NULL;
 | 
			
		||||
    DH *dh;
 | 
			
		||||
 | 
			
		||||
    if ((dh = DH_new()) == NULL)
 | 
			
		||||
        return (NULL);
 | 
			
		||||
    dh->p = BN_bin2bn(dh512_p, sizeof(dh512_p), NULL);
 | 
			
		||||
    dh->g = BN_bin2bn(dh512_g, sizeof(dh512_g), NULL);
 | 
			
		||||
    if ((dh->p == NULL) || (dh->g == NULL))
 | 
			
		||||
        return (NULL);
 | 
			
		||||
    return (dh);
 | 
			
		||||
        return NULL;
 | 
			
		||||
    dh->p=BN_bin2bn(dh2048_p, sizeof(dh2048_p), NULL);
 | 
			
		||||
    dh->g=BN_bin2bn(dh2048_g, sizeof(dh2048_g), NULL);
 | 
			
		||||
    if (dh->p == NULL || dh->g == NULL) {
 | 
			
		||||
        DH_free(dh);
 | 
			
		||||
        return NULL;
 | 
			
		||||
    }
 | 
			
		||||
    return dh;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -553,6 +571,8 @@ static void sv_usage(void)
 | 
			
		||||
    BIO_printf(bio_err, " -state        - Print the SSL states\n");
 | 
			
		||||
    BIO_printf(bio_err, " -CApath arg   - PEM format directory of CA's\n");
 | 
			
		||||
    BIO_printf(bio_err, " -CAfile arg   - PEM format file of CA's\n");
 | 
			
		||||
    BIO_printf(bio_err,
 | 
			
		||||
               " -no_alt_chains - only ever use the first certificate chain found\n");
 | 
			
		||||
    BIO_printf(bio_err,
 | 
			
		||||
               " -nocert       - Don't use any certificates (Anon-DH)\n");
 | 
			
		||||
    BIO_printf(bio_err,
 | 
			
		||||
@@ -754,7 +774,7 @@ static int ebcdic_write(BIO *b, const char *in, int inl)
 | 
			
		||||
            num = inl;
 | 
			
		||||
        wbuf =
 | 
			
		||||
            (EBCDIC_OUTBUFF *) OPENSSL_malloc(sizeof(EBCDIC_OUTBUFF) + num);
 | 
			
		||||
        if(!wbuf)
 | 
			
		||||
        if (!wbuf)
 | 
			
		||||
            return 0;
 | 
			
		||||
        OPENSSL_free(b->ptr);
 | 
			
		||||
 | 
			
		||||
@@ -1865,7 +1885,11 @@ int MAIN(int argc, char *argv[])
 | 
			
		||||
            BIO_printf(bio_s_out, "Setting temp DH parameters\n");
 | 
			
		||||
        } else {
 | 
			
		||||
            BIO_printf(bio_s_out, "Using default temp DH parameters\n");
 | 
			
		||||
            dh = get_dh512();
 | 
			
		||||
            dh = get_dh2048();
 | 
			
		||||
            if (dh == NULL) {
 | 
			
		||||
                ERR_print_errors(bio_err);
 | 
			
		||||
                goto end;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        (void)BIO_flush(bio_s_out);
 | 
			
		||||
 | 
			
		||||
@@ -2453,8 +2477,10 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context)
 | 
			
		||||
                    ret = 1;
 | 
			
		||||
                    goto err;
 | 
			
		||||
                }
 | 
			
		||||
                l += k;
 | 
			
		||||
                i -= k;
 | 
			
		||||
                if (k > 0) {
 | 
			
		||||
                    l += k;
 | 
			
		||||
                    i -= k;
 | 
			
		||||
                }
 | 
			
		||||
                if (i <= 0)
 | 
			
		||||
                    break;
 | 
			
		||||
            }
 | 
			
		||||
@@ -3281,7 +3307,8 @@ static int generate_session_id(const SSL *ssl, unsigned char *id,
 | 
			
		||||
{
 | 
			
		||||
    unsigned int count = 0;
 | 
			
		||||
    do {
 | 
			
		||||
        RAND_pseudo_bytes(id, *id_len);
 | 
			
		||||
        if (RAND_pseudo_bytes(id, *id_len) < 0)
 | 
			
		||||
            return 0;
 | 
			
		||||
        /*
 | 
			
		||||
         * Prefix the session_id with the required prefix. NB: If our prefix
 | 
			
		||||
         * is too long, clip it - but there will be worse effects anyway, eg.
 | 
			
		||||
@@ -3323,7 +3350,7 @@ static int add_session(SSL *ssl, SSL_SESSION *session)
 | 
			
		||||
    unsigned char *p;
 | 
			
		||||
 | 
			
		||||
    sess = OPENSSL_malloc(sizeof(simple_ssl_session));
 | 
			
		||||
    if(!sess) {
 | 
			
		||||
    if (!sess) {
 | 
			
		||||
        BIO_printf(bio_err, "Out of memory adding session to external cache\n");
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
@@ -3334,12 +3361,12 @@ static int add_session(SSL *ssl, SSL_SESSION *session)
 | 
			
		||||
    sess->id = BUF_memdup(SSL_SESSION_get_id(session, NULL), sess->idlen);
 | 
			
		||||
 | 
			
		||||
    sess->der = OPENSSL_malloc(sess->derlen);
 | 
			
		||||
    if(!sess->id || !sess->der) {
 | 
			
		||||
    if (!sess->id || !sess->der) {
 | 
			
		||||
        BIO_printf(bio_err, "Out of memory adding session to external cache\n");
 | 
			
		||||
 | 
			
		||||
        if(sess->id)
 | 
			
		||||
        if (sess->id)
 | 
			
		||||
            OPENSSL_free(sess->id);
 | 
			
		||||
        if(sess->der)
 | 
			
		||||
        if (sess->der)
 | 
			
		||||
            OPENSSL_free(sess->der);
 | 
			
		||||
        OPENSSL_free(sess);
 | 
			
		||||
        return 0;
 | 
			
		||||
 
 | 
			
		||||
@@ -302,7 +302,7 @@ static int parseArgs(int argc, char **argv)
 | 
			
		||||
            if (--argc < 1)
 | 
			
		||||
                goto bad;
 | 
			
		||||
            maxTime = atoi(*(++argv));
 | 
			
		||||
            if(maxTime <= 0) {
 | 
			
		||||
            if (maxTime <= 0) {
 | 
			
		||||
                BIO_printf(bio_err, "time must be > 0\n");
 | 
			
		||||
                badop = 1;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -441,6 +441,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
        BIO_printf(bio_err,
 | 
			
		||||
                   "-CApath dir    trusted certificates directory\n");
 | 
			
		||||
        BIO_printf(bio_err, "-CAfile file   trusted certificates file\n");
 | 
			
		||||
        BIO_printf(bio_err,
 | 
			
		||||
                   "-no_alt_chains only ever use the first certificate chain found\n");
 | 
			
		||||
        BIO_printf(bio_err,
 | 
			
		||||
                   "-crl_check     check revocation status of signer's certificate using CRLs\n");
 | 
			
		||||
        BIO_printf(bio_err,
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								apps/speed.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								apps/speed.c
									
									
									
									
									
								
							@@ -2775,7 +2775,7 @@ static void multiblock_speed(const EVP_CIPHER *evp_cipher)
 | 
			
		||||
 | 
			
		||||
    inp = OPENSSL_malloc(mblengths[num - 1]);
 | 
			
		||||
    out = OPENSSL_malloc(mblengths[num - 1] + 1024);
 | 
			
		||||
    if(!inp || !out) {
 | 
			
		||||
    if (!inp || !out) {
 | 
			
		||||
        BIO_printf(bio_err,"Out of memory\n");
 | 
			
		||||
        goto end;
 | 
			
		||||
    }
 | 
			
		||||
@@ -2791,7 +2791,7 @@ static void multiblock_speed(const EVP_CIPHER *evp_cipher)
 | 
			
		||||
        print_message(alg_name, 0, mblengths[j]);
 | 
			
		||||
        Time_F(START);
 | 
			
		||||
        for (count = 0, run = 1; run && count < 0x7fffffff; count++) {
 | 
			
		||||
            unsigned char aad[13];
 | 
			
		||||
            unsigned char aad[EVP_AEAD_TLS1_AAD_LEN];
 | 
			
		||||
            EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM mb_param;
 | 
			
		||||
            size_t len = mblengths[j];
 | 
			
		||||
            int packlen;
 | 
			
		||||
@@ -2826,7 +2826,8 @@ static void multiblock_speed(const EVP_CIPHER *evp_cipher)
 | 
			
		||||
                aad[11] = len >> 8;
 | 
			
		||||
                aad[12] = len;
 | 
			
		||||
                pad = EVP_CIPHER_CTX_ctrl(&ctx,
 | 
			
		||||
                                          EVP_CTRL_AEAD_TLS1_AAD, 13, aad);
 | 
			
		||||
                                          EVP_CTRL_AEAD_TLS1_AAD,
 | 
			
		||||
                                          EVP_AEAD_TLS1_AAD_LEN, aad);
 | 
			
		||||
                EVP_Cipher(&ctx, out, inp, len + pad);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@@ -2865,9 +2866,9 @@ static void multiblock_speed(const EVP_CIPHER *evp_cipher)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
end:
 | 
			
		||||
    if(inp)
 | 
			
		||||
    if (inp)
 | 
			
		||||
        OPENSSL_free(inp);
 | 
			
		||||
    if(out)
 | 
			
		||||
    if (out)
 | 
			
		||||
        OPENSSL_free(out);
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -435,7 +435,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
# ifdef OPENSSL_SYS_VMS
 | 
			
		||||
            len = strlen(s) + sizeof(CONFIG_FILE);
 | 
			
		||||
            tofree = OPENSSL_malloc(len);
 | 
			
		||||
            if(!tofree) {
 | 
			
		||||
            if (!tofree) {
 | 
			
		||||
                BIO_printf(bio_err, "Out of memory\n");
 | 
			
		||||
                goto err;
 | 
			
		||||
            }
 | 
			
		||||
@@ -443,7 +443,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
# else
 | 
			
		||||
            len = strlen(s) + sizeof(CONFIG_FILE) + 1;
 | 
			
		||||
            tofree = OPENSSL_malloc(len);
 | 
			
		||||
            if(!tofree) {
 | 
			
		||||
            if (!tofree) {
 | 
			
		||||
                BIO_printf(bio_err, "Out of memory\n");
 | 
			
		||||
                goto err;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -232,7 +232,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
    if (ret == 1) {
 | 
			
		||||
        BIO_printf(bio_err,
 | 
			
		||||
                   "usage: verify [-verbose] [-CApath path] [-CAfile file] [-purpose purpose] [-crl_check]");
 | 
			
		||||
        BIO_printf(bio_err, " [-attime timestamp]");
 | 
			
		||||
        BIO_printf(bio_err, " [-no_alt_chains] [-attime timestamp]");
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
        BIO_printf(bio_err, " [-engine e]");
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -125,12 +125,17 @@ install:
 | 
			
		||||
lint:
 | 
			
		||||
	@target=lint; $(RECURSIVE_MAKE)
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
update: local_depend
 | 
			
		||||
	@[ -z "$(THIS)" ] || (set -e; target=update; $(RECURSIVE_MAKE) )
 | 
			
		||||
	@if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
 | 
			
		||||
 | 
			
		||||
depend: local_depend
 | 
			
		||||
	@[ -z "$(THIS)" ] || (set -e; target=depend; $(RECURSIVE_MAKE) )
 | 
			
		||||
	@if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
 | 
			
		||||
local_depend:
 | 
			
		||||
	@[ -z "$(THIS)" -o -f buildinf.h ] || touch buildinf.h # fake buildinf.h if it does not exist
 | 
			
		||||
	@[ -z "$(THIS)" ] || $(MAKEDEPEND) -- $(CFLAG) $(INCLUDE) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
	@[ -z "$(THIS)" -o -s buildinf.h ] || rm buildinf.h
 | 
			
		||||
	@[ -z "$(THIS)" ] || (set -e; target=depend; $(RECURSIVE_MAKE) )
 | 
			
		||||
	@if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	rm -f buildinf.h *.s *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
 | 
			
		||||
 
 | 
			
		||||
@@ -122,6 +122,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -1499,13 +1499,13 @@ ___
 | 
			
		||||
 | 
			
		||||
# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
 | 
			
		||||
#		CONTEXT *context,DISPATCHER_CONTEXT *disp)
 | 
			
		||||
if ($win64) {
 | 
			
		||||
if ($win64 && $avx) {
 | 
			
		||||
$rec="%rcx";
 | 
			
		||||
$frame="%rdx";
 | 
			
		||||
$context="%r8";
 | 
			
		||||
$disp="%r9";
 | 
			
		||||
 | 
			
		||||
$code.=<<___ if ($avx);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
.extern	__imp_RtlVirtualUnwind
 | 
			
		||||
.type	se_handler,\@abi-omnipotent
 | 
			
		||||
.align	16
 | 
			
		||||
@@ -1643,7 +1643,7 @@ $code.=<<___ if ($shaext);
 | 
			
		||||
	.rva	.LSEH_end_${func}_shaext
 | 
			
		||||
	.rva	.LSEH_info_${func}_shaext
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___ if ($avx);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
.section	.xdata
 | 
			
		||||
.align	8
 | 
			
		||||
.LSEH_info_${func}_xop:
 | 
			
		||||
 
 | 
			
		||||
@@ -51,7 +51,7 @@
 | 
			
		||||
# Westmere	3.77/1.37	1.37	1.52	1.27
 | 
			
		||||
# * Bridge	5.07/0.98	0.99	1.09	0.91
 | 
			
		||||
# Haswell	4.44/0.80	0.97	1.03	0.72
 | 
			
		||||
# Atom		5.77/3.56	3.67	4.03	3.46
 | 
			
		||||
# Silvermont	5.77/3.56	3.67	4.03	3.46
 | 
			
		||||
# Bulldozer	5.80/0.98	1.05	1.24	0.93
 | 
			
		||||
 | 
			
		||||
$PREFIX="aesni";	# if $PREFIX is set to "AES", the script
 | 
			
		||||
@@ -65,6 +65,9 @@ require "x86asm.pl";
 | 
			
		||||
 | 
			
		||||
&asm_init($ARGV[0],$0);
 | 
			
		||||
 | 
			
		||||
&external_label("OPENSSL_ia32cap_P");
 | 
			
		||||
&static_label("key_const");
 | 
			
		||||
 | 
			
		||||
if ($PREFIX eq "aesni")	{ $movekey=\&movups; }
 | 
			
		||||
else			{ $movekey=\&movups; }
 | 
			
		||||
 | 
			
		||||
@@ -181,7 +184,10 @@ sub aesni_generate1	# fully unrolled loop
 | 
			
		||||
	{   &aesni_inline_generate1("enc");	}
 | 
			
		||||
	else
 | 
			
		||||
	{   &call	("_aesni_encrypt1");	}
 | 
			
		||||
	&pxor	($rndkey0,$rndkey0);		# clear register bank
 | 
			
		||||
	&pxor	($rndkey1,$rndkey1);
 | 
			
		||||
	&movups	(&QWP(0,"eax"),$inout0);
 | 
			
		||||
	&pxor	($inout0,$inout0);
 | 
			
		||||
	&ret	();
 | 
			
		||||
&function_end_B("${PREFIX}_encrypt");
 | 
			
		||||
 | 
			
		||||
@@ -197,7 +203,10 @@ sub aesni_generate1	# fully unrolled loop
 | 
			
		||||
	{   &aesni_inline_generate1("dec");	}
 | 
			
		||||
	else
 | 
			
		||||
	{   &call	("_aesni_decrypt1");	}
 | 
			
		||||
	&pxor	($rndkey0,$rndkey0);		# clear register bank
 | 
			
		||||
	&pxor	($rndkey1,$rndkey1);
 | 
			
		||||
	&movups	(&QWP(0,"eax"),$inout0);
 | 
			
		||||
	&pxor	($inout0,$inout0);
 | 
			
		||||
	&ret	();
 | 
			
		||||
&function_end_B("${PREFIX}_decrypt");
 | 
			
		||||
 | 
			
		||||
@@ -349,17 +358,15 @@ sub aesni_generate6
 | 
			
		||||
	&neg		($rounds);
 | 
			
		||||
	eval"&aes${p}	($inout2,$rndkey1)";
 | 
			
		||||
	&pxor		($inout5,$rndkey0);
 | 
			
		||||
	&$movekey	($rndkey0,&QWP(0,$key,$rounds));
 | 
			
		||||
	&add		($rounds,16);
 | 
			
		||||
	eval"&aes${p}	($inout3,$rndkey1)";
 | 
			
		||||
	eval"&aes${p}	($inout4,$rndkey1)";
 | 
			
		||||
	eval"&aes${p}	($inout5,$rndkey1)";
 | 
			
		||||
	&$movekey	($rndkey0,&QWP(-16,$key,$rounds));
 | 
			
		||||
	&jmp		(&label("_aesni_${p}rypt6_enter"));
 | 
			
		||||
	&jmp		(&label("_aesni_${p}rypt6_inner"));
 | 
			
		||||
 | 
			
		||||
    &set_label("${p}6_loop",16);
 | 
			
		||||
	eval"&aes${p}	($inout0,$rndkey1)";
 | 
			
		||||
	eval"&aes${p}	($inout1,$rndkey1)";
 | 
			
		||||
	eval"&aes${p}	($inout2,$rndkey1)";
 | 
			
		||||
    &set_label("_aesni_${p}rypt6_inner");
 | 
			
		||||
	eval"&aes${p}	($inout3,$rndkey1)";
 | 
			
		||||
	eval"&aes${p}	($inout4,$rndkey1)";
 | 
			
		||||
	eval"&aes${p}	($inout5,$rndkey1)";
 | 
			
		||||
@@ -615,6 +622,14 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&movups	(&QWP(0x30,$out),$inout3);
 | 
			
		||||
 | 
			
		||||
&set_label("ecb_ret");
 | 
			
		||||
	&pxor	("xmm0","xmm0");		# clear register bank
 | 
			
		||||
	&pxor	("xmm1","xmm1");
 | 
			
		||||
	&pxor	("xmm2","xmm2");
 | 
			
		||||
	&pxor	("xmm3","xmm3");
 | 
			
		||||
	&pxor	("xmm4","xmm4");
 | 
			
		||||
	&pxor	("xmm5","xmm5");
 | 
			
		||||
	&pxor	("xmm6","xmm6");
 | 
			
		||||
	&pxor	("xmm7","xmm7");
 | 
			
		||||
&function_end("aesni_ecb_encrypt");
 | 
			
		||||
 | 
			
		||||
######################################################################
 | 
			
		||||
@@ -704,6 +719,15 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&mov	("esp",&DWP(48,"esp"));
 | 
			
		||||
	&mov	($out,&wparam(5));
 | 
			
		||||
	&movups	(&QWP(0,$out),$cmac);
 | 
			
		||||
 | 
			
		||||
	&pxor	("xmm0","xmm0");		# clear register bank
 | 
			
		||||
	&pxor	("xmm1","xmm1");
 | 
			
		||||
	&pxor	("xmm2","xmm2");
 | 
			
		||||
	&pxor	("xmm3","xmm3");
 | 
			
		||||
	&pxor	("xmm4","xmm4");
 | 
			
		||||
	&pxor	("xmm5","xmm5");
 | 
			
		||||
	&pxor	("xmm6","xmm6");
 | 
			
		||||
	&pxor	("xmm7","xmm7");
 | 
			
		||||
&function_end("aesni_ccm64_encrypt_blocks");
 | 
			
		||||
 | 
			
		||||
&function_begin("aesni_ccm64_decrypt_blocks");
 | 
			
		||||
@@ -804,6 +828,15 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&mov	("esp",&DWP(48,"esp"));
 | 
			
		||||
	&mov	($out,&wparam(5));
 | 
			
		||||
	&movups	(&QWP(0,$out),$cmac);
 | 
			
		||||
 | 
			
		||||
	&pxor	("xmm0","xmm0");		# clear register bank
 | 
			
		||||
	&pxor	("xmm1","xmm1");
 | 
			
		||||
	&pxor	("xmm2","xmm2");
 | 
			
		||||
	&pxor	("xmm3","xmm3");
 | 
			
		||||
	&pxor	("xmm4","xmm4");
 | 
			
		||||
	&pxor	("xmm5","xmm5");
 | 
			
		||||
	&pxor	("xmm6","xmm6");
 | 
			
		||||
	&pxor	("xmm7","xmm7");
 | 
			
		||||
&function_end("aesni_ccm64_decrypt_blocks");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1053,6 +1086,17 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&movups	(&QWP(0x30,$out),$inout3);
 | 
			
		||||
 | 
			
		||||
&set_label("ctr32_ret");
 | 
			
		||||
	&pxor	("xmm0","xmm0");		# clear register bank
 | 
			
		||||
	&pxor	("xmm1","xmm1");
 | 
			
		||||
	&pxor	("xmm2","xmm2");
 | 
			
		||||
	&pxor	("xmm3","xmm3");
 | 
			
		||||
	&pxor	("xmm4","xmm4");
 | 
			
		||||
	&movdqa	(&QWP(32,"esp"),"xmm0");	# clear stack
 | 
			
		||||
	&pxor	("xmm5","xmm5");
 | 
			
		||||
	&movdqa	(&QWP(48,"esp"),"xmm0");
 | 
			
		||||
	&pxor	("xmm6","xmm6");
 | 
			
		||||
	&movdqa	(&QWP(64,"esp"),"xmm0");
 | 
			
		||||
	&pxor	("xmm7","xmm7");
 | 
			
		||||
	&mov	("esp",&DWP(80,"esp"));
 | 
			
		||||
&function_end("aesni_ctr32_encrypt_blocks");
 | 
			
		||||
 | 
			
		||||
@@ -1394,6 +1438,20 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&movups	(&QWP(-16,$out),$inout0);	# write output
 | 
			
		||||
 | 
			
		||||
&set_label("xts_enc_ret");
 | 
			
		||||
	&pxor	("xmm0","xmm0");		# clear register bank
 | 
			
		||||
	&pxor	("xmm1","xmm1");
 | 
			
		||||
	&pxor	("xmm2","xmm2");
 | 
			
		||||
	&movdqa	(&QWP(16*0,"esp"),"xmm0");	# clear stack
 | 
			
		||||
	&pxor	("xmm3","xmm3");
 | 
			
		||||
	&movdqa	(&QWP(16*1,"esp"),"xmm0");
 | 
			
		||||
	&pxor	("xmm4","xmm4");
 | 
			
		||||
	&movdqa	(&QWP(16*2,"esp"),"xmm0");
 | 
			
		||||
	&pxor	("xmm5","xmm5");
 | 
			
		||||
	&movdqa	(&QWP(16*3,"esp"),"xmm0");
 | 
			
		||||
	&pxor	("xmm6","xmm6");
 | 
			
		||||
	&movdqa	(&QWP(16*4,"esp"),"xmm0");
 | 
			
		||||
	&pxor	("xmm7","xmm7");
 | 
			
		||||
	&movdqa	(&QWP(16*5,"esp"),"xmm0");
 | 
			
		||||
	&mov	("esp",&DWP(16*7+4,"esp"));	# restore %esp
 | 
			
		||||
&function_end("aesni_xts_encrypt");
 | 
			
		||||
 | 
			
		||||
@@ -1756,6 +1814,20 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&movups	(&QWP(0,$out),$inout0);		# write output
 | 
			
		||||
 | 
			
		||||
&set_label("xts_dec_ret");
 | 
			
		||||
	&pxor	("xmm0","xmm0");		# clear register bank
 | 
			
		||||
	&pxor	("xmm1","xmm1");
 | 
			
		||||
	&pxor	("xmm2","xmm2");
 | 
			
		||||
	&movdqa	(&QWP(16*0,"esp"),"xmm0");	# clear stack
 | 
			
		||||
	&pxor	("xmm3","xmm3");
 | 
			
		||||
	&movdqa	(&QWP(16*1,"esp"),"xmm0");
 | 
			
		||||
	&pxor	("xmm4","xmm4");
 | 
			
		||||
	&movdqa	(&QWP(16*2,"esp"),"xmm0");
 | 
			
		||||
	&pxor	("xmm5","xmm5");
 | 
			
		||||
	&movdqa	(&QWP(16*3,"esp"),"xmm0");
 | 
			
		||||
	&pxor	("xmm6","xmm6");
 | 
			
		||||
	&movdqa	(&QWP(16*4,"esp"),"xmm0");
 | 
			
		||||
	&pxor	("xmm7","xmm7");
 | 
			
		||||
	&movdqa	(&QWP(16*5,"esp"),"xmm0");
 | 
			
		||||
	&mov	("esp",&DWP(16*7+4,"esp"));	# restore %esp
 | 
			
		||||
&function_end("aesni_xts_decrypt");
 | 
			
		||||
}
 | 
			
		||||
@@ -1808,6 +1880,7 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&add	($len,16);
 | 
			
		||||
	&jnz	(&label("cbc_enc_tail"));
 | 
			
		||||
	&movaps	($ivec,$inout0);
 | 
			
		||||
	&pxor	($inout0,$inout0);
 | 
			
		||||
	&jmp	(&label("cbc_ret"));
 | 
			
		||||
 | 
			
		||||
&set_label("cbc_enc_tail");
 | 
			
		||||
@@ -1871,7 +1944,7 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&movaps	($inout0,$inout5);
 | 
			
		||||
	&movaps	($ivec,$rndkey0);
 | 
			
		||||
	&add	($len,0x50);
 | 
			
		||||
	&jle	(&label("cbc_dec_tail_collected"));
 | 
			
		||||
	&jle	(&label("cbc_dec_clear_tail_collected"));
 | 
			
		||||
	&movups	(&QWP(0,$out),$inout0);
 | 
			
		||||
	&lea	($out,&DWP(0x10,$out));
 | 
			
		||||
&set_label("cbc_dec_tail");
 | 
			
		||||
@@ -1910,10 +1983,14 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&xorps	($inout4,$rndkey0);
 | 
			
		||||
	&movups	(&QWP(0,$out),$inout0);
 | 
			
		||||
	&movups	(&QWP(0x10,$out),$inout1);
 | 
			
		||||
	&pxor	($inout1,$inout1);
 | 
			
		||||
	&movups	(&QWP(0x20,$out),$inout2);
 | 
			
		||||
	&pxor	($inout2,$inout2);
 | 
			
		||||
	&movups	(&QWP(0x30,$out),$inout3);
 | 
			
		||||
	&pxor	($inout3,$inout3);
 | 
			
		||||
	&lea	($out,&DWP(0x40,$out));
 | 
			
		||||
	&movaps	($inout0,$inout4);
 | 
			
		||||
	&pxor	($inout4,$inout4);
 | 
			
		||||
	&sub	($len,0x50);
 | 
			
		||||
	&jmp	(&label("cbc_dec_tail_collected"));
 | 
			
		||||
 | 
			
		||||
@@ -1933,6 +2010,7 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&xorps	($inout1,$in0);
 | 
			
		||||
	&movups	(&QWP(0,$out),$inout0);
 | 
			
		||||
	&movaps	($inout0,$inout1);
 | 
			
		||||
	&pxor	($inout1,$inout1);
 | 
			
		||||
	&lea	($out,&DWP(0x10,$out));
 | 
			
		||||
	&movaps	($ivec,$in1);
 | 
			
		||||
	&sub	($len,0x20);
 | 
			
		||||
@@ -1945,7 +2023,9 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&xorps	($inout2,$in1);
 | 
			
		||||
	&movups	(&QWP(0,$out),$inout0);
 | 
			
		||||
	&movaps	($inout0,$inout2);
 | 
			
		||||
	&pxor	($inout2,$inout2);
 | 
			
		||||
	&movups	(&QWP(0x10,$out),$inout1);
 | 
			
		||||
	&pxor	($inout1,$inout1);
 | 
			
		||||
	&lea	($out,&DWP(0x20,$out));
 | 
			
		||||
	&movups	($ivec,&QWP(0x20,$inp));
 | 
			
		||||
	&sub	($len,0x30);
 | 
			
		||||
@@ -1961,29 +2041,44 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&movups	(&QWP(0,$out),$inout0);
 | 
			
		||||
	&xorps	($inout2,$rndkey1);
 | 
			
		||||
	&movups	(&QWP(0x10,$out),$inout1);
 | 
			
		||||
	&pxor	($inout1,$inout1);
 | 
			
		||||
	&xorps	($inout3,$rndkey0);
 | 
			
		||||
	&movups	(&QWP(0x20,$out),$inout2);
 | 
			
		||||
	&pxor	($inout2,$inout2);
 | 
			
		||||
	&lea	($out,&DWP(0x30,$out));
 | 
			
		||||
	&movaps	($inout0,$inout3);
 | 
			
		||||
	&pxor	($inout3,$inout3);
 | 
			
		||||
	&sub	($len,0x40);
 | 
			
		||||
	&jmp	(&label("cbc_dec_tail_collected"));
 | 
			
		||||
 | 
			
		||||
&set_label("cbc_dec_clear_tail_collected",16);
 | 
			
		||||
	&pxor	($inout1,$inout1);
 | 
			
		||||
	&pxor	($inout2,$inout2);
 | 
			
		||||
	&pxor	($inout3,$inout3);
 | 
			
		||||
	&pxor	($inout4,$inout4);
 | 
			
		||||
&set_label("cbc_dec_tail_collected");
 | 
			
		||||
	&and	($len,15);
 | 
			
		||||
	&jnz	(&label("cbc_dec_tail_partial"));
 | 
			
		||||
	&movups	(&QWP(0,$out),$inout0);
 | 
			
		||||
	&pxor	($rndkey0,$rndkey0);
 | 
			
		||||
	&jmp	(&label("cbc_ret"));
 | 
			
		||||
 | 
			
		||||
&set_label("cbc_dec_tail_partial",16);
 | 
			
		||||
	&movaps	(&QWP(0,"esp"),$inout0);
 | 
			
		||||
	&pxor	($rndkey0,$rndkey0);
 | 
			
		||||
	&mov	("ecx",16);
 | 
			
		||||
	&mov	($inp,"esp");
 | 
			
		||||
	&sub	("ecx",$len);
 | 
			
		||||
	&data_word(0xA4F3F689);		# rep movsb
 | 
			
		||||
	&movdqa	(&QWP(0,"esp"),$inout0);
 | 
			
		||||
 | 
			
		||||
&set_label("cbc_ret");
 | 
			
		||||
	&mov	("esp",&DWP(16,"esp"));	# pull original %esp
 | 
			
		||||
	&mov	($key_,&wparam(4));
 | 
			
		||||
	&pxor	($inout0,$inout0);
 | 
			
		||||
	&pxor	($rndkey1,$rndkey1);
 | 
			
		||||
	&movups	(&QWP(0,$key_),$ivec);	# output IV
 | 
			
		||||
	&pxor	($ivec,$ivec);
 | 
			
		||||
&set_label("cbc_abort");
 | 
			
		||||
&function_end("${PREFIX}_cbc_encrypt");
 | 
			
		||||
 | 
			
		||||
@@ -2000,14 +2095,24 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
#	$round	rounds
 | 
			
		||||
 | 
			
		||||
&function_begin_B("_aesni_set_encrypt_key");
 | 
			
		||||
	&push	("ebp");
 | 
			
		||||
	&push	("ebx");
 | 
			
		||||
	&test	("eax","eax");
 | 
			
		||||
	&jz	(&label("bad_pointer"));
 | 
			
		||||
	&test	($key,$key);
 | 
			
		||||
	&jz	(&label("bad_pointer"));
 | 
			
		||||
 | 
			
		||||
	&call	(&label("pic"));
 | 
			
		||||
&set_label("pic");
 | 
			
		||||
	&blindpop("ebx");
 | 
			
		||||
	&lea	("ebx",&DWP(&label("key_const")."-".&label("pic"),"ebx"));
 | 
			
		||||
 | 
			
		||||
	&picmeup("ebp","OPENSSL_ia32cap_P","ebx",&label("key_const"));
 | 
			
		||||
	&movups	("xmm0",&QWP(0,"eax"));	# pull first 128 bits of *userKey
 | 
			
		||||
	&xorps	("xmm4","xmm4");	# low dword of xmm4 is assumed 0
 | 
			
		||||
	&mov	("ebp",&DWP(4,"ebp"));
 | 
			
		||||
	&lea	($key,&DWP(16,$key));
 | 
			
		||||
	&and	("ebp",1<<28|1<<11);	# AVX and XOP bits
 | 
			
		||||
	&cmp	($rounds,256);
 | 
			
		||||
	&je	(&label("14rounds"));
 | 
			
		||||
	&cmp	($rounds,192);
 | 
			
		||||
@@ -2016,6 +2121,9 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&jne	(&label("bad_keybits"));
 | 
			
		||||
 | 
			
		||||
&set_label("10rounds",16);
 | 
			
		||||
	&cmp		("ebp",1<<28);
 | 
			
		||||
	&je		(&label("10rounds_alt"));
 | 
			
		||||
 | 
			
		||||
	&mov		($rounds,9);
 | 
			
		||||
	&$movekey	(&QWP(-16,$key),"xmm0");	# round 0
 | 
			
		||||
	&aeskeygenassist("xmm1","xmm0",0x01);		# round 1
 | 
			
		||||
@@ -2040,8 +2148,8 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&call		(&label("key_128"));
 | 
			
		||||
	&$movekey	(&QWP(0,$key),"xmm0");
 | 
			
		||||
	&mov		(&DWP(80,$key),$rounds);
 | 
			
		||||
	&xor		("eax","eax");
 | 
			
		||||
	&ret();
 | 
			
		||||
 | 
			
		||||
	&jmp	(&label("good_key"));
 | 
			
		||||
 | 
			
		||||
&set_label("key_128",16);
 | 
			
		||||
	&$movekey	(&QWP(0,$key),"xmm0");
 | 
			
		||||
@@ -2055,8 +2163,76 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&xorps		("xmm0","xmm1");
 | 
			
		||||
	&ret();
 | 
			
		||||
 | 
			
		||||
&set_label("10rounds_alt",16);
 | 
			
		||||
	&movdqa		("xmm5",&QWP(0x00,"ebx"));
 | 
			
		||||
	&mov		($rounds,8);
 | 
			
		||||
	&movdqa		("xmm4",&QWP(0x20,"ebx"));
 | 
			
		||||
	&movdqa		("xmm2","xmm0");
 | 
			
		||||
	&movdqu		(&QWP(-16,$key),"xmm0");
 | 
			
		||||
 | 
			
		||||
&set_label("loop_key128");
 | 
			
		||||
	&pshufb		("xmm0","xmm5");
 | 
			
		||||
	&aesenclast	("xmm0","xmm4");
 | 
			
		||||
	&pslld		("xmm4",1);
 | 
			
		||||
	&lea		($key,&DWP(16,$key));
 | 
			
		||||
 | 
			
		||||
	&movdqa		("xmm3","xmm2");
 | 
			
		||||
	&pslldq		("xmm2",4);
 | 
			
		||||
	&pxor		("xmm3","xmm2");
 | 
			
		||||
	&pslldq		("xmm2",4);
 | 
			
		||||
	&pxor		("xmm3","xmm2");
 | 
			
		||||
	&pslldq		("xmm2",4);
 | 
			
		||||
	&pxor		("xmm2","xmm3");
 | 
			
		||||
 | 
			
		||||
	&pxor		("xmm0","xmm2");
 | 
			
		||||
	&movdqu		(&QWP(-16,$key),"xmm0");
 | 
			
		||||
	&movdqa		("xmm2","xmm0");
 | 
			
		||||
 | 
			
		||||
	&dec		($rounds);
 | 
			
		||||
	&jnz		(&label("loop_key128"));
 | 
			
		||||
 | 
			
		||||
	&movdqa		("xmm4",&QWP(0x30,"ebx"));
 | 
			
		||||
 | 
			
		||||
	&pshufb		("xmm0","xmm5");
 | 
			
		||||
	&aesenclast	("xmm0","xmm4");
 | 
			
		||||
	&pslld		("xmm4",1);
 | 
			
		||||
 | 
			
		||||
	&movdqa		("xmm3","xmm2");
 | 
			
		||||
	&pslldq		("xmm2",4);
 | 
			
		||||
	&pxor		("xmm3","xmm2");
 | 
			
		||||
	&pslldq		("xmm2",4);
 | 
			
		||||
	&pxor		("xmm3","xmm2");
 | 
			
		||||
	&pslldq		("xmm2",4);
 | 
			
		||||
	&pxor		("xmm2","xmm3");
 | 
			
		||||
 | 
			
		||||
	&pxor		("xmm0","xmm2");
 | 
			
		||||
	&movdqu		(&QWP(0,$key),"xmm0");
 | 
			
		||||
 | 
			
		||||
	&movdqa		("xmm2","xmm0");
 | 
			
		||||
	&pshufb		("xmm0","xmm5");
 | 
			
		||||
	&aesenclast	("xmm0","xmm4");
 | 
			
		||||
 | 
			
		||||
	&movdqa		("xmm3","xmm2");
 | 
			
		||||
	&pslldq		("xmm2",4);
 | 
			
		||||
	&pxor		("xmm3","xmm2");
 | 
			
		||||
	&pslldq		("xmm2",4);
 | 
			
		||||
	&pxor		("xmm3","xmm2");
 | 
			
		||||
	&pslldq		("xmm2",4);
 | 
			
		||||
	&pxor		("xmm2","xmm3");
 | 
			
		||||
 | 
			
		||||
	&pxor		("xmm0","xmm2");
 | 
			
		||||
	&movdqu		(&QWP(16,$key),"xmm0");
 | 
			
		||||
 | 
			
		||||
	&mov		($rounds,9);
 | 
			
		||||
	&mov		(&DWP(96,$key),$rounds);
 | 
			
		||||
 | 
			
		||||
	&jmp	(&label("good_key"));
 | 
			
		||||
 | 
			
		||||
&set_label("12rounds",16);
 | 
			
		||||
	&movq		("xmm2",&QWP(16,"eax"));	# remaining 1/3 of *userKey
 | 
			
		||||
	&cmp		("ebp",1<<28);
 | 
			
		||||
	&je		(&label("12rounds_alt"));
 | 
			
		||||
 | 
			
		||||
	&mov		($rounds,11);
 | 
			
		||||
	&$movekey	(&QWP(-16,$key),"xmm0");	# round 0
 | 
			
		||||
	&aeskeygenassist("xmm1","xmm2",0x01);		# round 1,2
 | 
			
		||||
@@ -2077,8 +2253,8 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&call		(&label("key_192b"));
 | 
			
		||||
	&$movekey	(&QWP(0,$key),"xmm0");
 | 
			
		||||
	&mov		(&DWP(48,$key),$rounds);
 | 
			
		||||
	&xor		("eax","eax");
 | 
			
		||||
	&ret();
 | 
			
		||||
 | 
			
		||||
	&jmp	(&label("good_key"));
 | 
			
		||||
 | 
			
		||||
&set_label("key_192a",16);
 | 
			
		||||
	&$movekey	(&QWP(0,$key),"xmm0");
 | 
			
		||||
@@ -2108,10 +2284,52 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&lea		($key,&DWP(32,$key));
 | 
			
		||||
	&jmp		(&label("key_192b_warm"));
 | 
			
		||||
 | 
			
		||||
&set_label("12rounds_alt",16);
 | 
			
		||||
	&movdqa		("xmm5",&QWP(0x10,"ebx"));
 | 
			
		||||
	&movdqa		("xmm4",&QWP(0x20,"ebx"));
 | 
			
		||||
	&mov		($rounds,8);
 | 
			
		||||
	&movdqu		(&QWP(-16,$key),"xmm0");
 | 
			
		||||
 | 
			
		||||
&set_label("loop_key192");
 | 
			
		||||
	&movq		(&QWP(0,$key),"xmm2");
 | 
			
		||||
	&movdqa		("xmm1","xmm2");
 | 
			
		||||
	&pshufb		("xmm2","xmm5");
 | 
			
		||||
	&aesenclast	("xmm2","xmm4");
 | 
			
		||||
	&pslld		("xmm4",1);
 | 
			
		||||
	&lea		($key,&DWP(24,$key));
 | 
			
		||||
 | 
			
		||||
	&movdqa		("xmm3","xmm0");
 | 
			
		||||
	&pslldq		("xmm0",4);
 | 
			
		||||
	&pxor		("xmm3","xmm0");
 | 
			
		||||
	&pslldq		("xmm0",4);
 | 
			
		||||
	&pxor		("xmm3","xmm0");
 | 
			
		||||
	&pslldq		("xmm0",4);
 | 
			
		||||
	&pxor		("xmm0","xmm3");
 | 
			
		||||
 | 
			
		||||
	&pshufd		("xmm3","xmm0",0xff);
 | 
			
		||||
	&pxor		("xmm3","xmm1");
 | 
			
		||||
	&pslldq		("xmm1",4);
 | 
			
		||||
	&pxor		("xmm3","xmm1");
 | 
			
		||||
 | 
			
		||||
	&pxor		("xmm0","xmm2");
 | 
			
		||||
	&pxor		("xmm2","xmm3");
 | 
			
		||||
	&movdqu		(&QWP(-16,$key),"xmm0");
 | 
			
		||||
 | 
			
		||||
	&dec		($rounds);
 | 
			
		||||
	&jnz		(&label("loop_key192"));
 | 
			
		||||
 | 
			
		||||
	&mov	($rounds,11);
 | 
			
		||||
	&mov	(&DWP(32,$key),$rounds);
 | 
			
		||||
 | 
			
		||||
	&jmp	(&label("good_key"));
 | 
			
		||||
 | 
			
		||||
&set_label("14rounds",16);
 | 
			
		||||
	&movups		("xmm2",&QWP(16,"eax"));	# remaining half of *userKey
 | 
			
		||||
	&mov		($rounds,13);
 | 
			
		||||
	&lea		($key,&DWP(16,$key));
 | 
			
		||||
	&cmp		("ebp",1<<28);
 | 
			
		||||
	&je		(&label("14rounds_alt"));
 | 
			
		||||
 | 
			
		||||
	&mov		($rounds,13);
 | 
			
		||||
	&$movekey	(&QWP(-32,$key),"xmm0");	# round 0
 | 
			
		||||
	&$movekey	(&QWP(-16,$key),"xmm2");	# round 1
 | 
			
		||||
	&aeskeygenassist("xmm1","xmm2",0x01);		# round 2
 | 
			
		||||
@@ -2143,7 +2361,8 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&$movekey	(&QWP(0,$key),"xmm0");
 | 
			
		||||
	&mov		(&DWP(16,$key),$rounds);
 | 
			
		||||
	&xor		("eax","eax");
 | 
			
		||||
	&ret();
 | 
			
		||||
 | 
			
		||||
	&jmp	(&label("good_key"));
 | 
			
		||||
 | 
			
		||||
&set_label("key_256a",16);
 | 
			
		||||
	&$movekey	(&QWP(0,$key),"xmm2");
 | 
			
		||||
@@ -2169,11 +2388,77 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&xorps		("xmm2","xmm1");
 | 
			
		||||
	&ret();
 | 
			
		||||
 | 
			
		||||
&set_label("14rounds_alt",16);
 | 
			
		||||
	&movdqa		("xmm5",&QWP(0x00,"ebx"));
 | 
			
		||||
	&movdqa		("xmm4",&QWP(0x20,"ebx"));
 | 
			
		||||
	&mov		($rounds,7);
 | 
			
		||||
	&movdqu		(&QWP(-32,$key),"xmm0");
 | 
			
		||||
	&movdqa		("xmm1","xmm2");
 | 
			
		||||
	&movdqu		(&QWP(-16,$key),"xmm2");
 | 
			
		||||
 | 
			
		||||
&set_label("loop_key256");
 | 
			
		||||
	&pshufb		("xmm2","xmm5");
 | 
			
		||||
	&aesenclast	("xmm2","xmm4");
 | 
			
		||||
 | 
			
		||||
	&movdqa		("xmm3","xmm0");
 | 
			
		||||
	&pslldq		("xmm0",4);
 | 
			
		||||
	&pxor		("xmm3","xmm0");
 | 
			
		||||
	&pslldq		("xmm0",4);
 | 
			
		||||
	&pxor		("xmm3","xmm0");
 | 
			
		||||
	&pslldq		("xmm0",4);
 | 
			
		||||
	&pxor		("xmm0","xmm3");
 | 
			
		||||
	&pslld		("xmm4",1);
 | 
			
		||||
 | 
			
		||||
	&pxor		("xmm0","xmm2");
 | 
			
		||||
	&movdqu		(&QWP(0,$key),"xmm0");
 | 
			
		||||
 | 
			
		||||
	&dec		($rounds);
 | 
			
		||||
	&jz		(&label("done_key256"));
 | 
			
		||||
 | 
			
		||||
	&pshufd		("xmm2","xmm0",0xff);
 | 
			
		||||
	&pxor		("xmm3","xmm3");
 | 
			
		||||
	&aesenclast	("xmm2","xmm3");
 | 
			
		||||
 | 
			
		||||
	&movdqa		("xmm3","xmm1")
 | 
			
		||||
	&pslldq		("xmm1",4);
 | 
			
		||||
	&pxor		("xmm3","xmm1");
 | 
			
		||||
	&pslldq		("xmm1",4);
 | 
			
		||||
	&pxor		("xmm3","xmm1");
 | 
			
		||||
	&pslldq		("xmm1",4);
 | 
			
		||||
	&pxor		("xmm1","xmm3");
 | 
			
		||||
 | 
			
		||||
	&pxor		("xmm2","xmm1");
 | 
			
		||||
	&movdqu		(&QWP(16,$key),"xmm2");
 | 
			
		||||
	&lea		($key,&DWP(32,$key));
 | 
			
		||||
	&movdqa		("xmm1","xmm2");
 | 
			
		||||
	&jmp		(&label("loop_key256"));
 | 
			
		||||
 | 
			
		||||
&set_label("done_key256");
 | 
			
		||||
	&mov		($rounds,13);
 | 
			
		||||
	&mov		(&DWP(16,$key),$rounds);
 | 
			
		||||
 | 
			
		||||
&set_label("good_key");
 | 
			
		||||
	&pxor	("xmm0","xmm0");
 | 
			
		||||
	&pxor	("xmm1","xmm1");
 | 
			
		||||
	&pxor	("xmm2","xmm2");
 | 
			
		||||
	&pxor	("xmm3","xmm3");
 | 
			
		||||
	&pxor	("xmm4","xmm4");
 | 
			
		||||
	&pxor	("xmm5","xmm5");
 | 
			
		||||
	&xor	("eax","eax");
 | 
			
		||||
	&pop	("ebx");
 | 
			
		||||
	&pop	("ebp");
 | 
			
		||||
	&ret	();
 | 
			
		||||
 | 
			
		||||
&set_label("bad_pointer",4);
 | 
			
		||||
	&mov	("eax",-1);
 | 
			
		||||
	&pop	("ebx");
 | 
			
		||||
	&pop	("ebp");
 | 
			
		||||
	&ret	();
 | 
			
		||||
&set_label("bad_keybits",4);
 | 
			
		||||
	&pxor	("xmm0","xmm0");
 | 
			
		||||
	&mov	("eax",-2);
 | 
			
		||||
	&pop	("ebx");
 | 
			
		||||
	&pop	("ebp");
 | 
			
		||||
	&ret	();
 | 
			
		||||
&function_end_B("_aesni_set_encrypt_key");
 | 
			
		||||
 | 
			
		||||
@@ -2223,10 +2508,18 @@ if ($PREFIX eq "aesni") {
 | 
			
		||||
	&aesimc		("xmm0","xmm0");
 | 
			
		||||
	&$movekey	(&QWP(0,$key),"xmm0");
 | 
			
		||||
 | 
			
		||||
	&pxor		("xmm0","xmm0");
 | 
			
		||||
	&pxor		("xmm1","xmm1");
 | 
			
		||||
	&xor		("eax","eax");		# return success
 | 
			
		||||
&set_label("dec_key_ret");
 | 
			
		||||
	&ret	();
 | 
			
		||||
&function_end_B("${PREFIX}_set_decrypt_key");
 | 
			
		||||
 | 
			
		||||
&set_label("key_const",64);
 | 
			
		||||
&data_word(0x0c0f0e0d,0x0c0f0e0d,0x0c0f0e0d,0x0c0f0e0d);
 | 
			
		||||
&data_word(0x04070605,0x04070605,0x04070605,0x04070605);
 | 
			
		||||
&data_word(1,1,1,1);
 | 
			
		||||
&data_word(0x1b,0x1b,0x1b,0x1b);
 | 
			
		||||
&asciz("AES for Intel AES-NI, CRYPTOGAMS by <appro\@openssl.org>");
 | 
			
		||||
 | 
			
		||||
&asm_finish();
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -24,8 +24,12 @@
 | 
			
		||||
#
 | 
			
		||||
#		CBC enc		CBC dec		CTR
 | 
			
		||||
# Apple A7	2.39		1.20		1.20
 | 
			
		||||
# Cortex-A53	2.45		1.87		1.94
 | 
			
		||||
# Cortex-A57	3.64		1.34		1.32
 | 
			
		||||
# Cortex-A53	1.32		1.29		1.46
 | 
			
		||||
# Cortex-A57(*)	1.95		0.85		0.93
 | 
			
		||||
# Denver	1.96		0.86		0.80
 | 
			
		||||
#
 | 
			
		||||
# (*)	original 3.64/1.34/1.32 results were for r0p0 revision
 | 
			
		||||
#	and are still same even for updated module;
 | 
			
		||||
 | 
			
		||||
$flavour = shift;
 | 
			
		||||
open STDOUT,">".shift;
 | 
			
		||||
@@ -308,17 +312,17 @@ ${prefix}_${dir}crypt:
 | 
			
		||||
 | 
			
		||||
.Loop_${dir}c:
 | 
			
		||||
	aes$e	$inout,$rndkey0
 | 
			
		||||
	vld1.32	{$rndkey0},[$key],#16
 | 
			
		||||
	aes$mc	$inout,$inout
 | 
			
		||||
	vld1.32	{$rndkey0},[$key],#16
 | 
			
		||||
	subs	$rounds,$rounds,#2
 | 
			
		||||
	aes$e	$inout,$rndkey1
 | 
			
		||||
	vld1.32	{$rndkey1},[$key],#16
 | 
			
		||||
	aes$mc	$inout,$inout
 | 
			
		||||
	vld1.32	{$rndkey1},[$key],#16
 | 
			
		||||
	b.gt	.Loop_${dir}c
 | 
			
		||||
 | 
			
		||||
	aes$e	$inout,$rndkey0
 | 
			
		||||
	vld1.32	{$rndkey0},[$key]
 | 
			
		||||
	aes$mc	$inout,$inout
 | 
			
		||||
	vld1.32	{$rndkey0},[$key]
 | 
			
		||||
	aes$e	$inout,$rndkey1
 | 
			
		||||
	veor	$inout,$inout,$rndkey0
 | 
			
		||||
 | 
			
		||||
@@ -336,6 +340,7 @@ my ($rounds,$cnt,$key_,$step,$step1)=($enc,"w6","x7","x8","x12");
 | 
			
		||||
my ($dat0,$dat1,$in0,$in1,$tmp0,$tmp1,$ivec,$rndlast)=map("q$_",(0..7));
 | 
			
		||||
 | 
			
		||||
my ($dat,$tmp,$rndzero_n_last)=($dat0,$tmp0,$tmp1);
 | 
			
		||||
my ($key4,$key5,$key6,$key7)=("x6","x12","x14",$key);
 | 
			
		||||
 | 
			
		||||
### q8-q15	preloaded key schedule
 | 
			
		||||
 | 
			
		||||
@@ -385,16 +390,42 @@ $code.=<<___;
 | 
			
		||||
	veor	$rndzero_n_last,q8,$rndlast
 | 
			
		||||
	b.eq	.Lcbc_enc128
 | 
			
		||||
 | 
			
		||||
	vld1.32	{$in0-$in1},[$key_]
 | 
			
		||||
	add	$key_,$key,#16
 | 
			
		||||
	add	$key4,$key,#16*4
 | 
			
		||||
	add	$key5,$key,#16*5
 | 
			
		||||
	aese	$dat,q8
 | 
			
		||||
	aesmc	$dat,$dat
 | 
			
		||||
	add	$key6,$key,#16*6
 | 
			
		||||
	add	$key7,$key,#16*7
 | 
			
		||||
	b	.Lenter_cbc_enc
 | 
			
		||||
 | 
			
		||||
.align	4
 | 
			
		||||
.Loop_cbc_enc:
 | 
			
		||||
	aese	$dat,q8
 | 
			
		||||
	vld1.32	{q8},[$key_],#16
 | 
			
		||||
	aesmc	$dat,$dat
 | 
			
		||||
	subs	$cnt,$cnt,#2
 | 
			
		||||
	 vst1.8	{$ivec},[$out],#16
 | 
			
		||||
.Lenter_cbc_enc:
 | 
			
		||||
	aese	$dat,q9
 | 
			
		||||
	vld1.32	{q9},[$key_],#16
 | 
			
		||||
	aesmc	$dat,$dat
 | 
			
		||||
	b.gt	.Loop_cbc_enc
 | 
			
		||||
	aese	$dat,$in0
 | 
			
		||||
	aesmc	$dat,$dat
 | 
			
		||||
	vld1.32	{q8},[$key4]
 | 
			
		||||
	cmp	$rounds,#4
 | 
			
		||||
	aese	$dat,$in1
 | 
			
		||||
	aesmc	$dat,$dat
 | 
			
		||||
	vld1.32	{q9},[$key5]
 | 
			
		||||
	b.eq	.Lcbc_enc192
 | 
			
		||||
 | 
			
		||||
	aese	$dat,q8
 | 
			
		||||
	aesmc	$dat,$dat
 | 
			
		||||
	vld1.32	{q8},[$key6]
 | 
			
		||||
	aese	$dat,q9
 | 
			
		||||
	aesmc	$dat,$dat
 | 
			
		||||
	vld1.32	{q9},[$key7]
 | 
			
		||||
	nop
 | 
			
		||||
 | 
			
		||||
.Lcbc_enc192:
 | 
			
		||||
	aese	$dat,q8
 | 
			
		||||
	aesmc	$dat,$dat
 | 
			
		||||
	 subs	$len,$len,#16
 | 
			
		||||
@@ -403,7 +434,6 @@ $code.=<<___;
 | 
			
		||||
	 cclr	$step,eq
 | 
			
		||||
	aese	$dat,q10
 | 
			
		||||
	aesmc	$dat,$dat
 | 
			
		||||
	 add	$key_,$key,#16
 | 
			
		||||
	aese	$dat,q11
 | 
			
		||||
	aesmc	$dat,$dat
 | 
			
		||||
	 vld1.8	{q8},[$inp],$step
 | 
			
		||||
@@ -412,16 +442,14 @@ $code.=<<___;
 | 
			
		||||
	 veor	q8,q8,$rndzero_n_last
 | 
			
		||||
	aese	$dat,q13
 | 
			
		||||
	aesmc	$dat,$dat
 | 
			
		||||
	 vld1.32 {q9},[$key_],#16	// re-pre-load rndkey[1]
 | 
			
		||||
	 vld1.32 {q9},[$key_]		// re-pre-load rndkey[1]
 | 
			
		||||
	aese	$dat,q14
 | 
			
		||||
	aesmc	$dat,$dat
 | 
			
		||||
	aese	$dat,q15
 | 
			
		||||
 | 
			
		||||
	 mov	$cnt,$rounds
 | 
			
		||||
	veor	$ivec,$dat,$rndlast
 | 
			
		||||
	vst1.8	{$ivec},[$out],#16
 | 
			
		||||
	b.hs	.Loop_cbc_enc
 | 
			
		||||
 | 
			
		||||
	vst1.8	{$ivec},[$out],#16
 | 
			
		||||
	b	.Lcbc_done
 | 
			
		||||
 | 
			
		||||
.align	5
 | 
			
		||||
@@ -483,79 +511,78 @@ $code.=<<___;
 | 
			
		||||
 | 
			
		||||
.Loop3x_cbc_dec:
 | 
			
		||||
	aesd	$dat0,q8
 | 
			
		||||
	aesd	$dat1,q8
 | 
			
		||||
	aesd	$dat2,q8
 | 
			
		||||
	vld1.32	{q8},[$key_],#16
 | 
			
		||||
	aesimc	$dat0,$dat0
 | 
			
		||||
	aesd	$dat1,q8
 | 
			
		||||
	aesimc	$dat1,$dat1
 | 
			
		||||
	aesd	$dat2,q8
 | 
			
		||||
	aesimc	$dat2,$dat2
 | 
			
		||||
	vld1.32	{q8},[$key_],#16
 | 
			
		||||
	subs	$cnt,$cnt,#2
 | 
			
		||||
	aesd	$dat0,q9
 | 
			
		||||
	aesd	$dat1,q9
 | 
			
		||||
	aesd	$dat2,q9
 | 
			
		||||
	vld1.32	{q9},[$key_],#16
 | 
			
		||||
	aesimc	$dat0,$dat0
 | 
			
		||||
	aesd	$dat1,q9
 | 
			
		||||
	aesimc	$dat1,$dat1
 | 
			
		||||
	aesd	$dat2,q9
 | 
			
		||||
	aesimc	$dat2,$dat2
 | 
			
		||||
	vld1.32	{q9},[$key_],#16
 | 
			
		||||
	b.gt	.Loop3x_cbc_dec
 | 
			
		||||
 | 
			
		||||
	aesd	$dat0,q8
 | 
			
		||||
	aesimc	$dat0,$dat0
 | 
			
		||||
	aesd	$dat1,q8
 | 
			
		||||
	aesimc	$dat1,$dat1
 | 
			
		||||
	aesd	$dat2,q8
 | 
			
		||||
	aesimc	$dat2,$dat2
 | 
			
		||||
	 veor	$tmp0,$ivec,$rndlast
 | 
			
		||||
	aesimc	$dat0,$dat0
 | 
			
		||||
	aesimc	$dat1,$dat1
 | 
			
		||||
	aesimc	$dat2,$dat2
 | 
			
		||||
	 veor	$tmp1,$in0,$rndlast
 | 
			
		||||
	aesd	$dat0,q9
 | 
			
		||||
	aesd	$dat1,q9
 | 
			
		||||
	aesd	$dat2,q9
 | 
			
		||||
	 veor	$tmp2,$in1,$rndlast
 | 
			
		||||
	 subs	$len,$len,#0x30
 | 
			
		||||
	aesimc	$dat0,$dat0
 | 
			
		||||
	aesimc	$dat1,$dat1
 | 
			
		||||
	aesimc	$dat2,$dat2
 | 
			
		||||
	 vorr	$ivec,$in2,$in2
 | 
			
		||||
	 veor	$tmp1,$in0,$rndlast
 | 
			
		||||
	 mov.lo	x6,$len			// x6, $cnt, is zero at this point
 | 
			
		||||
	aesd	$dat0,q12
 | 
			
		||||
	aesd	$dat1,q12
 | 
			
		||||
	aesd	$dat2,q12
 | 
			
		||||
	aesd	$dat0,q9
 | 
			
		||||
	aesimc	$dat0,$dat0
 | 
			
		||||
	aesd	$dat1,q9
 | 
			
		||||
	aesimc	$dat1,$dat1
 | 
			
		||||
	aesd	$dat2,q9
 | 
			
		||||
	aesimc	$dat2,$dat2
 | 
			
		||||
	 veor	$tmp2,$in1,$rndlast
 | 
			
		||||
	 add	$inp,$inp,x6		// $inp is adjusted in such way that
 | 
			
		||||
					// at exit from the loop $dat1-$dat2
 | 
			
		||||
					// are loaded with last "words"
 | 
			
		||||
	aesimc	$dat0,$dat0
 | 
			
		||||
	aesimc	$dat1,$dat1
 | 
			
		||||
	aesimc	$dat2,$dat2
 | 
			
		||||
	 vorr	$ivec,$in2,$in2
 | 
			
		||||
	 mov	$key_,$key
 | 
			
		||||
	aesd	$dat0,q13
 | 
			
		||||
	aesd	$dat1,q13
 | 
			
		||||
	aesd	$dat2,q13
 | 
			
		||||
	 vld1.8	{$in0},[$inp],#16
 | 
			
		||||
	aesd	$dat0,q12
 | 
			
		||||
	aesimc	$dat0,$dat0
 | 
			
		||||
	aesd	$dat1,q12
 | 
			
		||||
	aesimc	$dat1,$dat1
 | 
			
		||||
	aesd	$dat2,q12
 | 
			
		||||
	aesimc	$dat2,$dat2
 | 
			
		||||
	 vld1.8	{$in0},[$inp],#16
 | 
			
		||||
	aesd	$dat0,q13
 | 
			
		||||
	aesimc	$dat0,$dat0
 | 
			
		||||
	aesd	$dat1,q13
 | 
			
		||||
	aesimc	$dat1,$dat1
 | 
			
		||||
	aesd	$dat2,q13
 | 
			
		||||
	aesimc	$dat2,$dat2
 | 
			
		||||
	 vld1.8	{$in1},[$inp],#16
 | 
			
		||||
	aesd	$dat0,q14
 | 
			
		||||
	aesd	$dat1,q14
 | 
			
		||||
	aesd	$dat2,q14
 | 
			
		||||
	 vld1.8	{$in2},[$inp],#16
 | 
			
		||||
	aesimc	$dat0,$dat0
 | 
			
		||||
	aesd	$dat1,q14
 | 
			
		||||
	aesimc	$dat1,$dat1
 | 
			
		||||
	aesd	$dat2,q14
 | 
			
		||||
	aesimc	$dat2,$dat2
 | 
			
		||||
	 vld1.32 {q8},[$key_],#16	// re-pre-load rndkey[0]
 | 
			
		||||
	 vld1.8	{$in2},[$inp],#16
 | 
			
		||||
	aesd	$dat0,q15
 | 
			
		||||
	aesd	$dat1,q15
 | 
			
		||||
	aesd	$dat2,q15
 | 
			
		||||
 | 
			
		||||
	 vld1.32 {q8},[$key_],#16	// re-pre-load rndkey[0]
 | 
			
		||||
	 add	$cnt,$rounds,#2
 | 
			
		||||
	veor	$tmp0,$tmp0,$dat0
 | 
			
		||||
	veor	$tmp1,$tmp1,$dat1
 | 
			
		||||
	veor	$dat2,$dat2,$tmp2
 | 
			
		||||
	 vld1.32 {q9},[$key_],#16	// re-pre-load rndkey[1]
 | 
			
		||||
	 vorr	$dat0,$in0,$in0
 | 
			
		||||
	vst1.8	{$tmp0},[$out],#16
 | 
			
		||||
	 vorr	$dat1,$in1,$in1
 | 
			
		||||
	 vorr	$dat0,$in0,$in0
 | 
			
		||||
	vst1.8	{$tmp1},[$out],#16
 | 
			
		||||
	 vorr	$dat1,$in1,$in1
 | 
			
		||||
	vst1.8	{$dat2},[$out],#16
 | 
			
		||||
	 vorr	$dat2,$in2,$in2
 | 
			
		||||
	b.hs	.Loop3x_cbc_dec
 | 
			
		||||
@@ -566,39 +593,39 @@ $code.=<<___;
 | 
			
		||||
 | 
			
		||||
.Lcbc_dec_tail:
 | 
			
		||||
	aesd	$dat1,q8
 | 
			
		||||
	aesd	$dat2,q8
 | 
			
		||||
	vld1.32	{q8},[$key_],#16
 | 
			
		||||
	aesimc	$dat1,$dat1
 | 
			
		||||
	aesd	$dat2,q8
 | 
			
		||||
	aesimc	$dat2,$dat2
 | 
			
		||||
	vld1.32	{q8},[$key_],#16
 | 
			
		||||
	subs	$cnt,$cnt,#2
 | 
			
		||||
	aesd	$dat1,q9
 | 
			
		||||
	aesd	$dat2,q9
 | 
			
		||||
	vld1.32	{q9},[$key_],#16
 | 
			
		||||
	aesimc	$dat1,$dat1
 | 
			
		||||
	aesd	$dat2,q9
 | 
			
		||||
	aesimc	$dat2,$dat2
 | 
			
		||||
	vld1.32	{q9},[$key_],#16
 | 
			
		||||
	b.gt	.Lcbc_dec_tail
 | 
			
		||||
 | 
			
		||||
	aesd	$dat1,q8
 | 
			
		||||
	aesd	$dat2,q8
 | 
			
		||||
	aesimc	$dat1,$dat1
 | 
			
		||||
	aesd	$dat2,q8
 | 
			
		||||
	aesimc	$dat2,$dat2
 | 
			
		||||
	aesd	$dat1,q9
 | 
			
		||||
	aesd	$dat2,q9
 | 
			
		||||
	aesimc	$dat1,$dat1
 | 
			
		||||
	aesd	$dat2,q9
 | 
			
		||||
	aesimc	$dat2,$dat2
 | 
			
		||||
	aesd	$dat1,q12
 | 
			
		||||
	aesd	$dat2,q12
 | 
			
		||||
	aesimc	$dat1,$dat1
 | 
			
		||||
	aesd	$dat2,q12
 | 
			
		||||
	aesimc	$dat2,$dat2
 | 
			
		||||
	 cmn	$len,#0x20
 | 
			
		||||
	aesd	$dat1,q13
 | 
			
		||||
	aesd	$dat2,q13
 | 
			
		||||
	aesimc	$dat1,$dat1
 | 
			
		||||
	aesd	$dat2,q13
 | 
			
		||||
	aesimc	$dat2,$dat2
 | 
			
		||||
	 veor	$tmp1,$ivec,$rndlast
 | 
			
		||||
	aesd	$dat1,q14
 | 
			
		||||
	aesd	$dat2,q14
 | 
			
		||||
	aesimc	$dat1,$dat1
 | 
			
		||||
	aesd	$dat2,q14
 | 
			
		||||
	aesimc	$dat2,$dat2
 | 
			
		||||
	 veor	$tmp2,$in1,$rndlast
 | 
			
		||||
	aesd	$dat1,q15
 | 
			
		||||
@@ -699,70 +726,69 @@ $code.=<<___;
 | 
			
		||||
.align	4
 | 
			
		||||
.Loop3x_ctr32:
 | 
			
		||||
	aese		$dat0,q8
 | 
			
		||||
	aese		$dat1,q8
 | 
			
		||||
	aese		$dat2,q8
 | 
			
		||||
	vld1.32		{q8},[$key_],#16
 | 
			
		||||
	aesmc		$dat0,$dat0
 | 
			
		||||
	aese		$dat1,q8
 | 
			
		||||
	aesmc		$dat1,$dat1
 | 
			
		||||
	aese		$dat2,q8
 | 
			
		||||
	aesmc		$dat2,$dat2
 | 
			
		||||
	vld1.32		{q8},[$key_],#16
 | 
			
		||||
	subs		$cnt,$cnt,#2
 | 
			
		||||
	aese		$dat0,q9
 | 
			
		||||
	aese		$dat1,q9
 | 
			
		||||
	aese		$dat2,q9
 | 
			
		||||
	vld1.32		{q9},[$key_],#16
 | 
			
		||||
	aesmc		$dat0,$dat0
 | 
			
		||||
	aese		$dat1,q9
 | 
			
		||||
	aesmc		$dat1,$dat1
 | 
			
		||||
	aese		$dat2,q9
 | 
			
		||||
	aesmc		$dat2,$dat2
 | 
			
		||||
	vld1.32		{q9},[$key_],#16
 | 
			
		||||
	b.gt		.Loop3x_ctr32
 | 
			
		||||
 | 
			
		||||
	aese		$dat0,q8
 | 
			
		||||
	aese		$dat1,q8
 | 
			
		||||
	aese		$dat2,q8
 | 
			
		||||
	 mov		$key_,$key
 | 
			
		||||
	aesmc		$tmp0,$dat0
 | 
			
		||||
	 vld1.8		{$in0},[$inp],#16
 | 
			
		||||
	aese		$dat1,q8
 | 
			
		||||
	aesmc		$tmp1,$dat1
 | 
			
		||||
	aesmc		$dat2,$dat2
 | 
			
		||||
	 vld1.8		{$in0},[$inp],#16
 | 
			
		||||
	 vorr		$dat0,$ivec,$ivec
 | 
			
		||||
	aese		$tmp0,q9
 | 
			
		||||
	aese		$dat2,q8
 | 
			
		||||
	aesmc		$dat2,$dat2
 | 
			
		||||
	 vld1.8		{$in1},[$inp],#16
 | 
			
		||||
	aese		$tmp1,q9
 | 
			
		||||
	aese		$dat2,q9
 | 
			
		||||
	 vorr		$dat1,$ivec,$ivec
 | 
			
		||||
	aese		$tmp0,q9
 | 
			
		||||
	aesmc		$tmp0,$tmp0
 | 
			
		||||
	 vld1.8		{$in2},[$inp],#16
 | 
			
		||||
	aese		$tmp1,q9
 | 
			
		||||
	aesmc		$tmp1,$tmp1
 | 
			
		||||
	 vld1.8		{$in2},[$inp],#16
 | 
			
		||||
	 mov		$key_,$key
 | 
			
		||||
	aese		$dat2,q9
 | 
			
		||||
	aesmc		$tmp2,$dat2
 | 
			
		||||
	 vorr		$dat2,$ivec,$ivec
 | 
			
		||||
	 add		$tctr0,$ctr,#1
 | 
			
		||||
	aese		$tmp0,q12
 | 
			
		||||
	aesmc		$tmp0,$tmp0
 | 
			
		||||
	aese		$tmp1,q12
 | 
			
		||||
	aese		$tmp2,q12
 | 
			
		||||
	aesmc		$tmp1,$tmp1
 | 
			
		||||
	 veor		$in0,$in0,$rndlast
 | 
			
		||||
	 add		$tctr1,$ctr,#2
 | 
			
		||||
	aesmc		$tmp0,$tmp0
 | 
			
		||||
	aesmc		$tmp1,$tmp1
 | 
			
		||||
	aese		$tmp2,q12
 | 
			
		||||
	aesmc		$tmp2,$tmp2
 | 
			
		||||
	 veor		$in1,$in1,$rndlast
 | 
			
		||||
	 add		$ctr,$ctr,#3
 | 
			
		||||
	aese		$tmp0,q13
 | 
			
		||||
	aesmc		$tmp0,$tmp0
 | 
			
		||||
	aese		$tmp1,q13
 | 
			
		||||
	aese		$tmp2,q13
 | 
			
		||||
	aesmc		$tmp1,$tmp1
 | 
			
		||||
	 veor		$in2,$in2,$rndlast
 | 
			
		||||
	 rev		$tctr0,$tctr0
 | 
			
		||||
	aesmc		$tmp0,$tmp0
 | 
			
		||||
	 vld1.32	 {q8},[$key_],#16	// re-pre-load rndkey[0]
 | 
			
		||||
	aesmc		$tmp1,$tmp1
 | 
			
		||||
	aese		$tmp2,q13
 | 
			
		||||
	aesmc		$tmp2,$tmp2
 | 
			
		||||
	 vmov.32	${dat0}[3], $tctr0
 | 
			
		||||
	 rev		$tctr1,$tctr1
 | 
			
		||||
	aese		$tmp0,q14
 | 
			
		||||
	aesmc		$tmp0,$tmp0
 | 
			
		||||
	aese		$tmp1,q14
 | 
			
		||||
	aese		$tmp2,q14
 | 
			
		||||
	aesmc		$tmp1,$tmp1
 | 
			
		||||
	 vmov.32	${dat1}[3], $tctr1
 | 
			
		||||
	 rev		$tctr2,$ctr
 | 
			
		||||
	aesmc		$tmp0,$tmp0
 | 
			
		||||
	aesmc		$tmp1,$tmp1
 | 
			
		||||
	aese		$tmp2,q14
 | 
			
		||||
	aesmc		$tmp2,$tmp2
 | 
			
		||||
	 vmov.32	${dat2}[3], $tctr2
 | 
			
		||||
	 subs		$len,$len,#3
 | 
			
		||||
@@ -770,13 +796,14 @@ $code.=<<___;
 | 
			
		||||
	aese		$tmp1,q15
 | 
			
		||||
	aese		$tmp2,q15
 | 
			
		||||
 | 
			
		||||
	 mov		$cnt,$rounds
 | 
			
		||||
	veor		$in0,$in0,$tmp0
 | 
			
		||||
	 vld1.32	 {q8},[$key_],#16	// re-pre-load rndkey[0]
 | 
			
		||||
	vst1.8		{$in0},[$out],#16
 | 
			
		||||
	veor		$in1,$in1,$tmp1
 | 
			
		||||
	 mov		$cnt,$rounds
 | 
			
		||||
	vst1.8		{$in1},[$out],#16
 | 
			
		||||
	veor		$in2,$in2,$tmp2
 | 
			
		||||
	 vld1.32	 {q9},[$key_],#16	// re-pre-load rndkey[1]
 | 
			
		||||
	vst1.8		{$in0},[$out],#16
 | 
			
		||||
	vst1.8		{$in1},[$out],#16
 | 
			
		||||
	vst1.8		{$in2},[$out],#16
 | 
			
		||||
	b.hs		.Loop3x_ctr32
 | 
			
		||||
 | 
			
		||||
@@ -788,40 +815,40 @@ $code.=<<___;
 | 
			
		||||
 | 
			
		||||
.Lctr32_tail:
 | 
			
		||||
	aese		$dat0,q8
 | 
			
		||||
	aese		$dat1,q8
 | 
			
		||||
	vld1.32		{q8},[$key_],#16
 | 
			
		||||
	aesmc		$dat0,$dat0
 | 
			
		||||
	aese		$dat1,q8
 | 
			
		||||
	aesmc		$dat1,$dat1
 | 
			
		||||
	vld1.32		{q8},[$key_],#16
 | 
			
		||||
	subs		$cnt,$cnt,#2
 | 
			
		||||
	aese		$dat0,q9
 | 
			
		||||
	aese		$dat1,q9
 | 
			
		||||
	vld1.32		{q9},[$key_],#16
 | 
			
		||||
	aesmc		$dat0,$dat0
 | 
			
		||||
	aese		$dat1,q9
 | 
			
		||||
	aesmc		$dat1,$dat1
 | 
			
		||||
	vld1.32		{q9},[$key_],#16
 | 
			
		||||
	b.gt		.Lctr32_tail
 | 
			
		||||
 | 
			
		||||
	aese		$dat0,q8
 | 
			
		||||
	aese		$dat1,q8
 | 
			
		||||
	aesmc		$dat0,$dat0
 | 
			
		||||
	aese		$dat1,q8
 | 
			
		||||
	aesmc		$dat1,$dat1
 | 
			
		||||
	aese		$dat0,q9
 | 
			
		||||
	aese		$dat1,q9
 | 
			
		||||
	aesmc		$dat0,$dat0
 | 
			
		||||
	aese		$dat1,q9
 | 
			
		||||
	aesmc		$dat1,$dat1
 | 
			
		||||
	 vld1.8		{$in0},[$inp],$step
 | 
			
		||||
	aese		$dat0,q12
 | 
			
		||||
	aesmc		$dat0,$dat0
 | 
			
		||||
	aese		$dat1,q12
 | 
			
		||||
	aesmc		$dat1,$dat1
 | 
			
		||||
	 vld1.8		{$in1},[$inp]
 | 
			
		||||
	aesmc		$dat0,$dat0
 | 
			
		||||
	aesmc		$dat1,$dat1
 | 
			
		||||
	aese		$dat0,q13
 | 
			
		||||
	aesmc		$dat0,$dat0
 | 
			
		||||
	aese		$dat1,q13
 | 
			
		||||
	aesmc		$dat0,$dat0
 | 
			
		||||
	aesmc		$dat1,$dat1
 | 
			
		||||
	aese		$dat0,q14
 | 
			
		||||
	aese		$dat1,q14
 | 
			
		||||
	 veor		$in0,$in0,$rndlast
 | 
			
		||||
	aese		$dat0,q14
 | 
			
		||||
	aesmc		$dat0,$dat0
 | 
			
		||||
	aese		$dat1,q14
 | 
			
		||||
	aesmc		$dat1,$dat1
 | 
			
		||||
	 veor		$in1,$in1,$rndlast
 | 
			
		||||
	aese		$dat0,q15
 | 
			
		||||
 
 | 
			
		||||
@@ -93,6 +93,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by top Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -124,6 +124,8 @@ int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp)
 | 
			
		||||
    else {
 | 
			
		||||
        ret = a->length;
 | 
			
		||||
        i = a->data[0];
 | 
			
		||||
        if (ret == 1 && i == 0)
 | 
			
		||||
            neg = 0;
 | 
			
		||||
        if (!neg && (i > 127)) {
 | 
			
		||||
            pad = 1;
 | 
			
		||||
            pb = 0;
 | 
			
		||||
@@ -162,7 +164,7 @@ int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp)
 | 
			
		||||
        p += a->length - 1;
 | 
			
		||||
        i = a->length;
 | 
			
		||||
        /* Copy zeros to destination as long as source is zero */
 | 
			
		||||
        while (!*n) {
 | 
			
		||||
        while (!*n && i > 1) {
 | 
			
		||||
            *(p--) = 0;
 | 
			
		||||
            n--;
 | 
			
		||||
            i--;
 | 
			
		||||
@@ -419,7 +421,7 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai)
 | 
			
		||||
        ASN1err(ASN1_F_BN_TO_ASN1_INTEGER, ERR_R_NESTED_ASN1_ERROR);
 | 
			
		||||
        goto err;
 | 
			
		||||
    }
 | 
			
		||||
    if (BN_is_negative(bn))
 | 
			
		||||
    if (BN_is_negative(bn) && !BN_is_zero(bn))
 | 
			
		||||
        ret->type = V_ASN1_NEG_INTEGER;
 | 
			
		||||
    else
 | 
			
		||||
        ret->type = V_ASN1_INTEGER;
 | 
			
		||||
 
 | 
			
		||||
@@ -464,3 +464,21 @@ void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,
 | 
			
		||||
{
 | 
			
		||||
    ameth->pkey_ctrl = pkey_ctrl;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth,
 | 
			
		||||
                            int (*item_verify) (EVP_MD_CTX *ctx,
 | 
			
		||||
                                                const ASN1_ITEM *it,
 | 
			
		||||
                                                void *asn,
 | 
			
		||||
                                                X509_ALGOR *a,
 | 
			
		||||
                                                ASN1_BIT_STRING *sig,
 | 
			
		||||
                                                EVP_PKEY *pkey),
 | 
			
		||||
                            int (*item_sign) (EVP_MD_CTX *ctx,
 | 
			
		||||
                                              const ASN1_ITEM *it,
 | 
			
		||||
                                              void *asn,
 | 
			
		||||
                                              X509_ALGOR *alg1,
 | 
			
		||||
                                              X509_ALGOR *alg2,
 | 
			
		||||
                                              ASN1_BIT_STRING *sig))
 | 
			
		||||
{
 | 
			
		||||
    ameth->item_sign = item_sign;
 | 
			
		||||
    ameth->item_verify = item_verify;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -74,6 +74,8 @@
 | 
			
		||||
#define ASN1_GEN_STR(str,val)   {str, sizeof(str) - 1, val}
 | 
			
		||||
 | 
			
		||||
#define ASN1_FLAG_EXP_MAX       20
 | 
			
		||||
/* Maximum number of nested sequences */
 | 
			
		||||
#define ASN1_GEN_SEQ_MAX_DEPTH  50
 | 
			
		||||
 | 
			
		||||
/* Input formats */
 | 
			
		||||
 | 
			
		||||
@@ -110,13 +112,16 @@ typedef struct {
 | 
			
		||||
    int exp_count;
 | 
			
		||||
} tag_exp_arg;
 | 
			
		||||
 | 
			
		||||
static ASN1_TYPE *generate_v3(char *str, X509V3_CTX *cnf, int depth,
 | 
			
		||||
                              int *perr);
 | 
			
		||||
static int bitstr_cb(const char *elem, int len, void *bitstr);
 | 
			
		||||
static int asn1_cb(const char *elem, int len, void *bitstr);
 | 
			
		||||
static int append_exp(tag_exp_arg *arg, int exp_tag, int exp_class,
 | 
			
		||||
                      int exp_constructed, int exp_pad, int imp_ok);
 | 
			
		||||
static int parse_tagging(const char *vstart, int vlen, int *ptag,
 | 
			
		||||
                         int *pclass);
 | 
			
		||||
static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf);
 | 
			
		||||
static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf,
 | 
			
		||||
                             int depth, int *perr);
 | 
			
		||||
static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype);
 | 
			
		||||
static int asn1_str2tag(const char *tagstr, int len);
 | 
			
		||||
 | 
			
		||||
@@ -132,6 +137,16 @@ ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf)
 | 
			
		||||
{
 | 
			
		||||
    int err = 0;
 | 
			
		||||
    ASN1_TYPE *ret = generate_v3(str, cnf, 0, &err);
 | 
			
		||||
    if (err)
 | 
			
		||||
        ASN1err(ASN1_F_ASN1_GENERATE_V3, err);
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static ASN1_TYPE *generate_v3(char *str, X509V3_CTX *cnf, int depth,
 | 
			
		||||
                              int *perr)
 | 
			
		||||
{
 | 
			
		||||
    ASN1_TYPE *ret;
 | 
			
		||||
    tag_exp_arg asn1_tags;
 | 
			
		||||
@@ -152,17 +167,22 @@ ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf)
 | 
			
		||||
    asn1_tags.imp_class = -1;
 | 
			
		||||
    asn1_tags.format = ASN1_GEN_FORMAT_ASCII;
 | 
			
		||||
    asn1_tags.exp_count = 0;
 | 
			
		||||
    if (CONF_parse_list(str, ',', 1, asn1_cb, &asn1_tags) != 0)
 | 
			
		||||
    if (CONF_parse_list(str, ',', 1, asn1_cb, &asn1_tags) != 0) {
 | 
			
		||||
        *perr = ASN1_R_UNKNOWN_TAG;
 | 
			
		||||
        return NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((asn1_tags.utype == V_ASN1_SEQUENCE)
 | 
			
		||||
        || (asn1_tags.utype == V_ASN1_SET)) {
 | 
			
		||||
        if (!cnf) {
 | 
			
		||||
            ASN1err(ASN1_F_ASN1_GENERATE_V3,
 | 
			
		||||
                    ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG);
 | 
			
		||||
            *perr = ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG;
 | 
			
		||||
            return NULL;
 | 
			
		||||
        }
 | 
			
		||||
        ret = asn1_multi(asn1_tags.utype, asn1_tags.str, cnf);
 | 
			
		||||
        if (depth >= ASN1_GEN_SEQ_MAX_DEPTH) {
 | 
			
		||||
            *perr = ASN1_R_ILLEGAL_NESTED_TAGGING;
 | 
			
		||||
            return NULL;
 | 
			
		||||
        }
 | 
			
		||||
        ret = asn1_multi(asn1_tags.utype, asn1_tags.str, cnf, depth, perr);
 | 
			
		||||
    } else
 | 
			
		||||
        ret = asn1_str2type(asn1_tags.str, asn1_tags.format, asn1_tags.utype);
 | 
			
		||||
 | 
			
		||||
@@ -280,7 +300,7 @@ static int asn1_cb(const char *elem, int len, void *bitstr)
 | 
			
		||||
    int tmp_tag, tmp_class;
 | 
			
		||||
 | 
			
		||||
    if (elem == NULL)
 | 
			
		||||
        return 0;
 | 
			
		||||
        return -1;
 | 
			
		||||
 | 
			
		||||
    for (i = 0, p = elem; i < len; p++, i++) {
 | 
			
		||||
        /* Look for the ':' in name value pairs */
 | 
			
		||||
@@ -353,7 +373,7 @@ static int asn1_cb(const char *elem, int len, void *bitstr)
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case ASN1_GEN_FLAG_FORMAT:
 | 
			
		||||
        if(!vstart) {
 | 
			
		||||
        if (!vstart) {
 | 
			
		||||
            ASN1err(ASN1_F_ASN1_CB, ASN1_R_UNKNOWN_FORMAT);
 | 
			
		||||
            return -1;
 | 
			
		||||
        }
 | 
			
		||||
@@ -435,7 +455,8 @@ static int parse_tagging(const char *vstart, int vlen, int *ptag, int *pclass)
 | 
			
		||||
 | 
			
		||||
/* Handle multiple types: SET and SEQUENCE */
 | 
			
		||||
 | 
			
		||||
static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
 | 
			
		||||
static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf,
 | 
			
		||||
                             int depth, int *perr)
 | 
			
		||||
{
 | 
			
		||||
    ASN1_TYPE *ret = NULL;
 | 
			
		||||
    STACK_OF(ASN1_TYPE) *sk = NULL;
 | 
			
		||||
@@ -454,7 +475,8 @@ static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
 | 
			
		||||
            goto bad;
 | 
			
		||||
        for (i = 0; i < sk_CONF_VALUE_num(sect); i++) {
 | 
			
		||||
            ASN1_TYPE *typ =
 | 
			
		||||
                ASN1_generate_v3(sk_CONF_VALUE_value(sect, i)->value, cnf);
 | 
			
		||||
                generate_v3(sk_CONF_VALUE_value(sect, i)->value, cnf,
 | 
			
		||||
                            depth + 1, perr);
 | 
			
		||||
            if (!typ)
 | 
			
		||||
                goto bad;
 | 
			
		||||
            if (!sk_ASN1_TYPE_push(sk, typ))
 | 
			
		||||
 
 | 
			
		||||
@@ -289,7 +289,8 @@ int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
 | 
			
		||||
    if ((flags & SMIME_DETACHED) && data) {
 | 
			
		||||
        /* We want multipart/signed */
 | 
			
		||||
        /* Generate a random boundary */
 | 
			
		||||
        RAND_pseudo_bytes((unsigned char *)bound, 32);
 | 
			
		||||
        if (RAND_pseudo_bytes((unsigned char *)bound, 32) < 0)
 | 
			
		||||
            return 0;
 | 
			
		||||
        for (i = 0; i < 32; i++) {
 | 
			
		||||
            c = bound[i] & 0xf;
 | 
			
		||||
            if (c < 10)
 | 
			
		||||
 
 | 
			
		||||
@@ -162,7 +162,7 @@ static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
 | 
			
		||||
 | 
			
		||||
    derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it);
 | 
			
		||||
    p = OPENSSL_malloc(derlen);
 | 
			
		||||
    if(!p)
 | 
			
		||||
    if (!p)
 | 
			
		||||
        return 0;
 | 
			
		||||
 | 
			
		||||
    ndef_aux->derbuf = p;
 | 
			
		||||
@@ -232,7 +232,7 @@ static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg)
 | 
			
		||||
 | 
			
		||||
    derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it);
 | 
			
		||||
    p = OPENSSL_malloc(derlen);
 | 
			
		||||
    if(!p)
 | 
			
		||||
    if (!p)
 | 
			
		||||
        return 0;
 | 
			
		||||
 | 
			
		||||
    ndef_aux->derbuf = p;
 | 
			
		||||
 
 | 
			
		||||
@@ -100,9 +100,6 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
 | 
			
		||||
    else
 | 
			
		||||
        asn1_cb = 0;
 | 
			
		||||
 | 
			
		||||
    if (!combine)
 | 
			
		||||
        *pval = NULL;
 | 
			
		||||
 | 
			
		||||
#ifdef CRYPTO_MDEBUG
 | 
			
		||||
    if (it->sname)
 | 
			
		||||
        CRYPTO_push_info(it->sname);
 | 
			
		||||
 
 | 
			
		||||
@@ -290,7 +290,7 @@ static int asn1_item_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
 | 
			
		||||
        for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
 | 
			
		||||
            const ASN1_TEMPLATE *seqtt;
 | 
			
		||||
            seqtt = asn1_do_adb(fld, tt, 1);
 | 
			
		||||
            if(!seqtt)
 | 
			
		||||
            if (!seqtt)
 | 
			
		||||
                return 0;
 | 
			
		||||
            tmpfld = asn1_get_field_ptr(fld, seqtt);
 | 
			
		||||
            if (!asn1_template_print_ctx(out, tmpfld,
 | 
			
		||||
 
 | 
			
		||||
@@ -177,7 +177,7 @@ X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length)
 | 
			
		||||
    /* Save start position */
 | 
			
		||||
    q = *pp;
 | 
			
		||||
 | 
			
		||||
    if(!a || *a == NULL) {
 | 
			
		||||
    if (!a || *a == NULL) {
 | 
			
		||||
        freeret = 1;
 | 
			
		||||
    }
 | 
			
		||||
    ret = d2i_X509(a, pp, length);
 | 
			
		||||
@@ -192,7 +192,7 @@ X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length)
 | 
			
		||||
        goto err;
 | 
			
		||||
    return ret;
 | 
			
		||||
 err:
 | 
			
		||||
    if(freeret) {
 | 
			
		||||
    if (freeret) {
 | 
			
		||||
        X509_free(ret);
 | 
			
		||||
        if (a)
 | 
			
		||||
            *a = NULL;
 | 
			
		||||
 
 | 
			
		||||
@@ -72,6 +72,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -73,6 +73,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -704,32 +704,29 @@ doapr_outch(char **sbuffer,
 | 
			
		||||
    /* If we haven't at least one buffer, someone has doe a big booboo */
 | 
			
		||||
    assert(*sbuffer != NULL || buffer != NULL);
 | 
			
		||||
 | 
			
		||||
    if (buffer) {
 | 
			
		||||
        while (*currlen >= *maxlen) {
 | 
			
		||||
            if (*buffer == NULL) {
 | 
			
		||||
                if (*maxlen == 0)
 | 
			
		||||
                    *maxlen = 1024;
 | 
			
		||||
                *buffer = OPENSSL_malloc(*maxlen);
 | 
			
		||||
                if(!*buffer) {
 | 
			
		||||
                    /* Panic! Can't really do anything sensible. Just return */
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                if (*currlen > 0) {
 | 
			
		||||
                    assert(*sbuffer != NULL);
 | 
			
		||||
                    memcpy(*buffer, *sbuffer, *currlen);
 | 
			
		||||
                }
 | 
			
		||||
                *sbuffer = NULL;
 | 
			
		||||
            } else {
 | 
			
		||||
                *maxlen += 1024;
 | 
			
		||||
                *buffer = OPENSSL_realloc(*buffer, *maxlen);
 | 
			
		||||
                if(!*buffer) {
 | 
			
		||||
                    /* Panic! Can't really do anything sensible. Just return */
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
    /* |currlen| must always be <= |*maxlen| */
 | 
			
		||||
    assert(*currlen <= *maxlen);
 | 
			
		||||
 | 
			
		||||
    if (buffer && *currlen == *maxlen) {
 | 
			
		||||
        *maxlen += 1024;
 | 
			
		||||
        if (*buffer == NULL) {
 | 
			
		||||
            *buffer = OPENSSL_malloc(*maxlen);
 | 
			
		||||
            if (!*buffer) {
 | 
			
		||||
                /* Panic! Can't really do anything sensible. Just return */
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            if (*currlen > 0) {
 | 
			
		||||
                assert(*sbuffer != NULL);
 | 
			
		||||
                memcpy(*buffer, *sbuffer, *currlen);
 | 
			
		||||
            }
 | 
			
		||||
            *sbuffer = NULL;
 | 
			
		||||
        } else {
 | 
			
		||||
            *buffer = OPENSSL_realloc(*buffer, *maxlen);
 | 
			
		||||
            if (!*buffer) {
 | 
			
		||||
                /* Panic! Can't really do anything sensible. Just return */
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        /* What to do if *buffer is NULL? */
 | 
			
		||||
        assert(*sbuffer != NULL || *buffer != NULL);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (*currlen < *maxlen) {
 | 
			
		||||
 
 | 
			
		||||
@@ -139,7 +139,8 @@ static int nbiof_read(BIO *b, char *out, int outl)
 | 
			
		||||
 | 
			
		||||
    BIO_clear_retry_flags(b);
 | 
			
		||||
#if 1
 | 
			
		||||
    RAND_pseudo_bytes(&n, 1);
 | 
			
		||||
    if (RAND_pseudo_bytes(&n, 1) < 0)
 | 
			
		||||
        return -1;
 | 
			
		||||
    num = (n & 0x07);
 | 
			
		||||
 | 
			
		||||
    if (outl > num)
 | 
			
		||||
@@ -178,7 +179,8 @@ static int nbiof_write(BIO *b, const char *in, int inl)
 | 
			
		||||
        num = nt->lwn;
 | 
			
		||||
        nt->lwn = 0;
 | 
			
		||||
    } else {
 | 
			
		||||
        RAND_pseudo_bytes(&n, 1);
 | 
			
		||||
        if (RAND_pseudo_bytes(&n, 1) < 0)
 | 
			
		||||
            return -1;
 | 
			
		||||
        num = (n & 7);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -536,8 +536,10 @@ BIO *BIO_dup_chain(BIO *in)
 | 
			
		||||
 | 
			
		||||
        /* copy app data */
 | 
			
		||||
        if (!CRYPTO_dup_ex_data(CRYPTO_EX_INDEX_BIO, &new_bio->ex_data,
 | 
			
		||||
                                &bio->ex_data))
 | 
			
		||||
                                &bio->ex_data)) {
 | 
			
		||||
            BIO_free(new_bio);
 | 
			
		||||
            goto err;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (ret == NULL) {
 | 
			
		||||
            eoc = new_bio;
 | 
			
		||||
@@ -549,8 +551,8 @@ BIO *BIO_dup_chain(BIO *in)
 | 
			
		||||
    }
 | 
			
		||||
    return (ret);
 | 
			
		||||
 err:
 | 
			
		||||
    if (ret != NULL)
 | 
			
		||||
        BIO_free(ret);
 | 
			
		||||
    BIO_free_all(ret);
 | 
			
		||||
 | 
			
		||||
    return (NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -303,16 +303,17 @@ static void dgram_adjust_rcv_timeout(BIO *b)
 | 
			
		||||
 | 
			
		||||
        /* Calculate time left until timer expires */
 | 
			
		||||
        memcpy(&timeleft, &(data->next_timeout), sizeof(struct timeval));
 | 
			
		||||
        timeleft.tv_sec -= timenow.tv_sec;
 | 
			
		||||
        timeleft.tv_usec -= timenow.tv_usec;
 | 
			
		||||
        if (timeleft.tv_usec < 0) {
 | 
			
		||||
        if (timeleft.tv_usec < timenow.tv_usec) {
 | 
			
		||||
            timeleft.tv_usec = 1000000 - timenow.tv_usec + timeleft.tv_usec;
 | 
			
		||||
            timeleft.tv_sec--;
 | 
			
		||||
            timeleft.tv_usec += 1000000;
 | 
			
		||||
        } else {
 | 
			
		||||
            timeleft.tv_usec -= timenow.tv_usec;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (timeleft.tv_sec < 0) {
 | 
			
		||||
        if (timeleft.tv_sec < timenow.tv_sec) {
 | 
			
		||||
            timeleft.tv_sec = 0;
 | 
			
		||||
            timeleft.tv_usec = 1;
 | 
			
		||||
        } else {
 | 
			
		||||
            timeleft.tv_sec -= timenow.tv_sec;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
@@ -896,7 +897,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
                perror("setsockopt");
 | 
			
		||||
                ret = -1;
 | 
			
		||||
            }
 | 
			
		||||
# elif defined(OPENSSL_SYS_LINUX) && defined(IP_MTUDISCOVER)
 | 
			
		||||
# elif defined(OPENSSL_SYS_LINUX) && defined(IP_MTU_DISCOVER) && defined (IP_PMTUDISC_PROBE)
 | 
			
		||||
            if ((sockopt_val = num ? IP_PMTUDISC_PROBE : IP_PMTUDISC_DONT),
 | 
			
		||||
                (ret = setsockopt(b->num, IPPROTO_IP, IP_MTU_DISCOVER,
 | 
			
		||||
                                  &sockopt_val, sizeof(sockopt_val))) < 0) {
 | 
			
		||||
@@ -1012,7 +1013,7 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag)
 | 
			
		||||
     */
 | 
			
		||||
    sockopt_len = (socklen_t) (sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t));
 | 
			
		||||
    authchunks = OPENSSL_malloc(sockopt_len);
 | 
			
		||||
    if(!authchunks) {
 | 
			
		||||
    if (!authchunks) {
 | 
			
		||||
        BIO_vfree(bio);
 | 
			
		||||
        return (NULL);
 | 
			
		||||
    }
 | 
			
		||||
@@ -1352,7 +1353,7 @@ static int dgram_sctp_read(BIO *b, char *out, int outl)
 | 
			
		||||
                (socklen_t) (sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t));
 | 
			
		||||
            authchunks = OPENSSL_malloc(optlen);
 | 
			
		||||
            if (!authchunks) {
 | 
			
		||||
                BIOerr(BIO_F_DGRAM_SCTP_READ, ERR_R_MALLOC_ERROR);
 | 
			
		||||
                BIOerr(BIO_F_DGRAM_SCTP_READ, ERR_R_MALLOC_FAILURE);
 | 
			
		||||
                return -1;
 | 
			
		||||
            }
 | 
			
		||||
            memset(authchunks, 0, sizeof(optlen));
 | 
			
		||||
@@ -1423,8 +1424,8 @@ static int dgram_sctp_write(BIO *b, const char *in, int inl)
 | 
			
		||||
    if (data->save_shutdown && !BIO_dgram_sctp_wait_for_dry(b)) {
 | 
			
		||||
        char *tmp;
 | 
			
		||||
        data->saved_message.bio = b;
 | 
			
		||||
        if(!(tmp = OPENSSL_malloc(inl))) {
 | 
			
		||||
            BIOerr(BIO_F_DGRAM_SCTP_WRITE, ERR_R_MALLOC_ERROR);
 | 
			
		||||
        if (!(tmp = OPENSSL_malloc(inl))) {
 | 
			
		||||
            BIOerr(BIO_F_DGRAM_SCTP_WRITE, ERR_R_MALLOC_FAILURE);
 | 
			
		||||
            return -1;
 | 
			
		||||
        }
 | 
			
		||||
        if (data->saved_message.data)
 | 
			
		||||
 
 | 
			
		||||
@@ -176,6 +176,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: bn_prime.h depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -100,7 +100,7 @@ $code.=<<___;
 | 
			
		||||
	ld	[$ap+12],	$t3
 | 
			
		||||
	or	$t0,	$aj,	$aj
 | 
			
		||||
	add	$ap,	16,	$ap
 | 
			
		||||
	stxa	$aj,	[$anp]0xe2	! converted ap[0]
 | 
			
		||||
	stx	$aj,	[$anp]		! converted ap[0]
 | 
			
		||||
 | 
			
		||||
	mulx	$aj,	$m0,	$lo0	! ap[0]*bp[0]
 | 
			
		||||
	umulxhi	$aj,	$m0,	$hi0
 | 
			
		||||
@@ -150,7 +150,7 @@ $code.=<<___;
 | 
			
		||||
	sllx	$t1,	32,	$aj
 | 
			
		||||
	add	$ap,	8,	$ap
 | 
			
		||||
	or	$t0,	$aj,	$aj
 | 
			
		||||
	stxa	$aj,	[$anp]0xe2	! converted ap[j]
 | 
			
		||||
	stx	$aj,	[$anp]		! converted ap[j]
 | 
			
		||||
 | 
			
		||||
	ld	[$np+0],	$t2	! np[j]
 | 
			
		||||
	addcc	$nlo,	$hi1,	$lo1
 | 
			
		||||
@@ -169,7 +169,7 @@ $code.=<<___;
 | 
			
		||||
	addcc	$lo0,	$lo1,	$lo1	! np[j]*m1+ap[j]*bp[0]
 | 
			
		||||
	umulxhi	$nj,	$m1,	$nj	! nhi=nj
 | 
			
		||||
	addxc	%g0,	$hi1,	$hi1
 | 
			
		||||
	stxa	$lo1,	[$tp]0xe2	! tp[j-1]
 | 
			
		||||
	stx	$lo1,	[$tp]		! tp[j-1]
 | 
			
		||||
	add	$tp,	8,	$tp	! tp++
 | 
			
		||||
 | 
			
		||||
	brnz,pt	$cnt,	.L1st
 | 
			
		||||
@@ -182,12 +182,12 @@ $code.=<<___;
 | 
			
		||||
	addxc	$nj,	%g0,	$hi1
 | 
			
		||||
	addcc	$lo0,	$lo1,	$lo1	! np[j]*m1+ap[j]*bp[0]
 | 
			
		||||
	addxc	%g0,	$hi1,	$hi1
 | 
			
		||||
	stxa	$lo1,	[$tp]0xe2	! tp[j-1]
 | 
			
		||||
	stx	$lo1,	[$tp]		! tp[j-1]
 | 
			
		||||
	add	$tp,	8,	$tp
 | 
			
		||||
 | 
			
		||||
	addcc	$hi0,	$hi1,	$hi1
 | 
			
		||||
	addxc	%g0,	%g0,	$ovf	! upmost overflow bit
 | 
			
		||||
	stxa	$hi1,	[$tp]0xe2
 | 
			
		||||
	stx	$hi1,	[$tp]
 | 
			
		||||
	add	$tp,	8,	$tp
 | 
			
		||||
 | 
			
		||||
	ba	.Louter
 | 
			
		||||
 
 | 
			
		||||
@@ -3226,11 +3226,16 @@ $code.=<<___;
 | 
			
		||||
.type	bn_get_bits5,\@abi-omnipotent
 | 
			
		||||
.align	16
 | 
			
		||||
bn_get_bits5:
 | 
			
		||||
	mov	$inp,%r10
 | 
			
		||||
	lea	0($inp),%r10
 | 
			
		||||
	lea	1($inp),%r11
 | 
			
		||||
	mov	$num,%ecx
 | 
			
		||||
	shr	\$3,$num
 | 
			
		||||
	movzw	(%r10,$num),%eax
 | 
			
		||||
	and	\$7,%ecx
 | 
			
		||||
	shr	\$4,$num
 | 
			
		||||
	and	\$15,%ecx
 | 
			
		||||
	lea	-8(%ecx),%eax
 | 
			
		||||
	cmp	\$11,%ecx
 | 
			
		||||
	cmova	%r11,%r10
 | 
			
		||||
	cmova	%eax,%ecx
 | 
			
		||||
	movzw	(%r10,$num,2),%eax
 | 
			
		||||
	shrl	%cl,%eax
 | 
			
		||||
	and	\$31,%eax
 | 
			
		||||
	ret
 | 
			
		||||
 
 | 
			
		||||
@@ -779,6 +779,7 @@ int RAND_pseudo_bytes(unsigned char *buf, int num);
 | 
			
		||||
                         * wouldn't be constructed with top!=dmax. */ \
 | 
			
		||||
                        BN_ULONG *_not_const; \
 | 
			
		||||
                        memcpy(&_not_const, &_bnum1->d, sizeof(BN_ULONG*)); \
 | 
			
		||||
                        /* Debug only - safe to ignore error return */ \
 | 
			
		||||
                        RAND_pseudo_bytes(&_tmp_char, 1); \
 | 
			
		||||
                        memset((unsigned char *)(_not_const + _bnum1->top), _tmp_char, \
 | 
			
		||||
                                (_bnum1->dmax - _bnum1->top) * sizeof(BN_ULONG)); \
 | 
			
		||||
@@ -892,6 +893,7 @@ void ERR_load_BN_strings(void);
 | 
			
		||||
# define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR                  135
 | 
			
		||||
# define BN_F_BN_GF2M_MOD_SQR                             136
 | 
			
		||||
# define BN_F_BN_GF2M_MOD_SQRT                            137
 | 
			
		||||
# define BN_F_BN_LSHIFT                                   145
 | 
			
		||||
# define BN_F_BN_MOD_EXP2_MONT                            118
 | 
			
		||||
# define BN_F_BN_MOD_EXP_MONT                             109
 | 
			
		||||
# define BN_F_BN_MOD_EXP_MONT_CONSTTIME                   124
 | 
			
		||||
@@ -907,12 +909,14 @@ void ERR_load_BN_strings(void);
 | 
			
		||||
# define BN_F_BN_NEW                                      113
 | 
			
		||||
# define BN_F_BN_RAND                                     114
 | 
			
		||||
# define BN_F_BN_RAND_RANGE                               122
 | 
			
		||||
# define BN_F_BN_RSHIFT                                   146
 | 
			
		||||
# define BN_F_BN_USUB                                     115
 | 
			
		||||
 | 
			
		||||
/* Reason codes. */
 | 
			
		||||
# define BN_R_ARG2_LT_ARG3                                100
 | 
			
		||||
# define BN_R_BAD_RECIPROCAL                              101
 | 
			
		||||
# define BN_R_BIGNUM_TOO_LONG                             114
 | 
			
		||||
# define BN_R_BITS_TOO_SMALL                              118
 | 
			
		||||
# define BN_R_CALLED_WITH_EVEN_MODULUS                    102
 | 
			
		||||
# define BN_R_DIV_BY_ZERO                                 103
 | 
			
		||||
# define BN_R_ENCODING_ERROR                              104
 | 
			
		||||
@@ -920,6 +924,7 @@ void ERR_load_BN_strings(void);
 | 
			
		||||
# define BN_R_INPUT_NOT_REDUCED                           110
 | 
			
		||||
# define BN_R_INVALID_LENGTH                              106
 | 
			
		||||
# define BN_R_INVALID_RANGE                               115
 | 
			
		||||
# define BN_R_INVALID_SHIFT                               119
 | 
			
		||||
# define BN_R_NOT_A_SQUARE                                111
 | 
			
		||||
# define BN_R_NOT_INITIALIZED                             107
 | 
			
		||||
# define BN_R_NO_INVERSE                                  108
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/* crypto/bn/bn_err.c */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 1999-2007 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 * Copyright (c) 1999-2015 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
 | 
			
		||||
@@ -94,6 +94,7 @@ static ERR_STRING_DATA BN_str_functs[] = {
 | 
			
		||||
    {ERR_FUNC(BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR), "BN_GF2m_mod_solve_quad_arr"},
 | 
			
		||||
    {ERR_FUNC(BN_F_BN_GF2M_MOD_SQR), "BN_GF2m_mod_sqr"},
 | 
			
		||||
    {ERR_FUNC(BN_F_BN_GF2M_MOD_SQRT), "BN_GF2m_mod_sqrt"},
 | 
			
		||||
    {ERR_FUNC(BN_F_BN_LSHIFT), "BN_lshift"},
 | 
			
		||||
    {ERR_FUNC(BN_F_BN_MOD_EXP2_MONT), "BN_mod_exp2_mont"},
 | 
			
		||||
    {ERR_FUNC(BN_F_BN_MOD_EXP_MONT), "BN_mod_exp_mont"},
 | 
			
		||||
    {ERR_FUNC(BN_F_BN_MOD_EXP_MONT_CONSTTIME), "BN_mod_exp_mont_consttime"},
 | 
			
		||||
@@ -109,6 +110,7 @@ static ERR_STRING_DATA BN_str_functs[] = {
 | 
			
		||||
    {ERR_FUNC(BN_F_BN_NEW), "BN_new"},
 | 
			
		||||
    {ERR_FUNC(BN_F_BN_RAND), "BN_rand"},
 | 
			
		||||
    {ERR_FUNC(BN_F_BN_RAND_RANGE), "BN_rand_range"},
 | 
			
		||||
    {ERR_FUNC(BN_F_BN_RSHIFT), "BN_rshift"},
 | 
			
		||||
    {ERR_FUNC(BN_F_BN_USUB), "BN_usub"},
 | 
			
		||||
    {0, NULL}
 | 
			
		||||
};
 | 
			
		||||
@@ -117,6 +119,7 @@ static ERR_STRING_DATA BN_str_reasons[] = {
 | 
			
		||||
    {ERR_REASON(BN_R_ARG2_LT_ARG3), "arg2 lt arg3"},
 | 
			
		||||
    {ERR_REASON(BN_R_BAD_RECIPROCAL), "bad reciprocal"},
 | 
			
		||||
    {ERR_REASON(BN_R_BIGNUM_TOO_LONG), "bignum too long"},
 | 
			
		||||
    {ERR_REASON(BN_R_BITS_TOO_SMALL), "bits too small"},
 | 
			
		||||
    {ERR_REASON(BN_R_CALLED_WITH_EVEN_MODULUS), "called with even modulus"},
 | 
			
		||||
    {ERR_REASON(BN_R_DIV_BY_ZERO), "div by zero"},
 | 
			
		||||
    {ERR_REASON(BN_R_ENCODING_ERROR), "encoding error"},
 | 
			
		||||
@@ -125,6 +128,7 @@ static ERR_STRING_DATA BN_str_reasons[] = {
 | 
			
		||||
    {ERR_REASON(BN_R_INPUT_NOT_REDUCED), "input not reduced"},
 | 
			
		||||
    {ERR_REASON(BN_R_INVALID_LENGTH), "invalid length"},
 | 
			
		||||
    {ERR_REASON(BN_R_INVALID_RANGE), "invalid range"},
 | 
			
		||||
    {ERR_REASON(BN_R_INVALID_SHIFT), "invalid shift"},
 | 
			
		||||
    {ERR_REASON(BN_R_NOT_A_SQUARE), "not a square"},
 | 
			
		||||
    {ERR_REASON(BN_R_NOT_INITIALIZED), "not initialized"},
 | 
			
		||||
    {ERR_REASON(BN_R_NO_INVERSE), "no inverse"},
 | 
			
		||||
 
 | 
			
		||||
@@ -450,8 +450,7 @@ int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[])
 | 
			
		||||
            d0 = p[k] % BN_BITS2;
 | 
			
		||||
            d1 = BN_BITS2 - d0;
 | 
			
		||||
            z[n] ^= (zz << d0);
 | 
			
		||||
            tmp_ulong = zz >> d1;
 | 
			
		||||
            if (d0 && tmp_ulong)
 | 
			
		||||
            if (d0 && (tmp_ulong = zz >> d1))
 | 
			
		||||
                z[n + 1] ^= tmp_ulong;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -694,9 +693,10 @@ int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
 | 
			
		||||
    }
 | 
			
		||||
# else
 | 
			
		||||
    {
 | 
			
		||||
        int i, ubits = BN_num_bits(u), vbits = BN_num_bits(v), /* v is copy
 | 
			
		||||
                                                                * of p */
 | 
			
		||||
            top = p->top;
 | 
			
		||||
        int i;
 | 
			
		||||
        int ubits = BN_num_bits(u);
 | 
			
		||||
        int vbits = BN_num_bits(v); /* v is copy of p */
 | 
			
		||||
        int top = p->top;
 | 
			
		||||
        BN_ULONG *udp, *bdp, *vdp, *cdp;
 | 
			
		||||
 | 
			
		||||
        bn_wexpand(u, top);
 | 
			
		||||
@@ -740,8 +740,12 @@ int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
 | 
			
		||||
                ubits--;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (ubits <= BN_BITS2 && udp[0] == 1)
 | 
			
		||||
                break;
 | 
			
		||||
            if (ubits <= BN_BITS2) {
 | 
			
		||||
                if (udp[0] == 0) /* poly was reducible */
 | 
			
		||||
                    goto err;
 | 
			
		||||
                if (udp[0] == 1)
 | 
			
		||||
                    break;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (ubits < vbits) {
 | 
			
		||||
                i = ubits;
 | 
			
		||||
 
 | 
			
		||||
@@ -294,7 +294,7 @@ unsigned __int64 _umul128(unsigned __int64 a, unsigned __int64 b,
 | 
			
		||||
#   endif
 | 
			
		||||
#  elif defined(__mips) && (defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG))
 | 
			
		||||
#   if defined(__GNUC__) && __GNUC__>=2
 | 
			
		||||
#    if __GNUC__>=4 && __GNUC_MINOR__>=4
 | 
			
		||||
#    if __GNUC__>4 || (__GNUC__>=4 && __GNUC_MINOR__>=4)
 | 
			
		||||
                                     /* "h" constraint is no more since 4.4 */
 | 
			
		||||
#     define BN_UMULT_HIGH(a,b)          (((__uint128_t)(a)*(b))>>64)
 | 
			
		||||
#     define BN_UMULT_LOHI(low,high,a,b) ({     \
 | 
			
		||||
 
 | 
			
		||||
@@ -71,7 +71,12 @@ char *BN_bn2hex(const BIGNUM *a)
 | 
			
		||||
    char *buf;
 | 
			
		||||
    char *p;
 | 
			
		||||
 | 
			
		||||
    buf = (char *)OPENSSL_malloc(a->top * BN_BYTES * 2 + 2);
 | 
			
		||||
    if (a->neg && BN_is_zero(a)) {
 | 
			
		||||
        /* "-0" == 3 bytes including NULL terminator */
 | 
			
		||||
        buf = OPENSSL_malloc(3);
 | 
			
		||||
    } else {
 | 
			
		||||
        buf = OPENSSL_malloc(a->top * BN_BYTES * 2 + 2);
 | 
			
		||||
    }
 | 
			
		||||
    if (buf == NULL) {
 | 
			
		||||
        BNerr(BN_F_BN_BN2HEX, ERR_R_MALLOC_FAILURE);
 | 
			
		||||
        goto err;
 | 
			
		||||
 
 | 
			
		||||
@@ -121,6 +121,11 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
 | 
			
		||||
    int ret = 0, bit, bytes, mask;
 | 
			
		||||
    time_t tim;
 | 
			
		||||
 | 
			
		||||
    if (bits < 0 || (bits == 1 && top > 0)) {
 | 
			
		||||
        BNerr(BN_F_BNRAND, BN_R_BITS_TOO_SMALL);
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (bits == 0) {
 | 
			
		||||
        BN_zero(rnd);
 | 
			
		||||
        return 1;
 | 
			
		||||
@@ -157,7 +162,8 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
 | 
			
		||||
        unsigned char c;
 | 
			
		||||
 | 
			
		||||
        for (i = 0; i < bytes; i++) {
 | 
			
		||||
            RAND_pseudo_bytes(&c, 1);
 | 
			
		||||
            if (RAND_pseudo_bytes(&c, 1) < 0)
 | 
			
		||||
                goto err;
 | 
			
		||||
            if (c >= 128 && i > 0)
 | 
			
		||||
                buf[i] = buf[i - 1];
 | 
			
		||||
            else if (c < 42)
 | 
			
		||||
@@ -168,7 +174,7 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    if (top != -1) {
 | 
			
		||||
    if (top >= 0) {
 | 
			
		||||
        if (top) {
 | 
			
		||||
            if (bit == 0) {
 | 
			
		||||
                buf[0] = 1;
 | 
			
		||||
 
 | 
			
		||||
@@ -137,6 +137,11 @@ int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
 | 
			
		||||
    bn_check_top(r);
 | 
			
		||||
    bn_check_top(a);
 | 
			
		||||
 | 
			
		||||
    if (n < 0) {
 | 
			
		||||
        BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT);
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    r->neg = a->neg;
 | 
			
		||||
    nw = n / BN_BITS2;
 | 
			
		||||
    if (bn_wexpand(r, a->top + nw + 1) == NULL)
 | 
			
		||||
@@ -174,6 +179,11 @@ int BN_rshift(BIGNUM *r, const BIGNUM *a, int n)
 | 
			
		||||
    bn_check_top(r);
 | 
			
		||||
    bn_check_top(a);
 | 
			
		||||
 | 
			
		||||
    if (n < 0) {
 | 
			
		||||
        BNerr(BN_F_BN_RSHIFT, BN_R_INVALID_SHIFT);
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    nw = n / BN_BITS2;
 | 
			
		||||
    rb = n % BN_BITS2;
 | 
			
		||||
    lb = BN_BITS2 - rb;
 | 
			
		||||
 
 | 
			
		||||
@@ -61,6 +61,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -88,7 +88,7 @@ void BUF_MEM_free(BUF_MEM *a)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    if (a->data != NULL) {
 | 
			
		||||
        memset(a->data, 0, (unsigned int)a->max);
 | 
			
		||||
        OPENSSL_cleanse(a->data, a->max);
 | 
			
		||||
        OPENSSL_free(a->data);
 | 
			
		||||
    }
 | 
			
		||||
    OPENSSL_free(a);
 | 
			
		||||
 
 | 
			
		||||
@@ -75,6 +75,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -69,6 +69,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -61,6 +61,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -126,6 +126,8 @@ EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx)
 | 
			
		||||
 | 
			
		||||
void CMAC_CTX_free(CMAC_CTX *ctx)
 | 
			
		||||
{
 | 
			
		||||
    if (!ctx)
 | 
			
		||||
        return;
 | 
			
		||||
    CMAC_CTX_cleanup(ctx);
 | 
			
		||||
    OPENSSL_free(ctx);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -67,6 +67,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -66,6 +66,7 @@
 | 
			
		||||
DECLARE_ASN1_ITEM(CMS_KeyAgreeRecipientInfo)
 | 
			
		||||
DECLARE_ASN1_ITEM(CMS_RecipientEncryptedKey)
 | 
			
		||||
DECLARE_ASN1_ITEM(CMS_OriginatorPublicKey)
 | 
			
		||||
DECLARE_ASN1_ITEM(CMS_RecipientKeyIdentifier)
 | 
			
		||||
 | 
			
		||||
/* Key Agreement Recipient Info (KARI) routines */
 | 
			
		||||
 | 
			
		||||
@@ -362,6 +363,9 @@ int cms_RecipientInfo_kari_init(CMS_RecipientInfo *ri, X509 *recip,
 | 
			
		||||
 | 
			
		||||
    if (flags & CMS_USE_KEYID) {
 | 
			
		||||
        rek->rid->type = CMS_REK_KEYIDENTIFIER;
 | 
			
		||||
        rek->rid->d.rKeyId = M_ASN1_new_of(CMS_RecipientKeyIdentifier);
 | 
			
		||||
        if (rek->rid->d.rKeyId == NULL)
 | 
			
		||||
            return 0;
 | 
			
		||||
        if (!cms_set1_keyid(&rek->rid->d.rKeyId->subjectKeyIdentifier, recip))
 | 
			
		||||
            return 0;
 | 
			
		||||
    } else {
 | 
			
		||||
 
 | 
			
		||||
@@ -231,7 +231,7 @@ static int kek_unwrap_key(unsigned char *out, size_t *outlen,
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
    tmp = OPENSSL_malloc(inlen);
 | 
			
		||||
    if(!tmp)
 | 
			
		||||
    if (!tmp)
 | 
			
		||||
        return 0;
 | 
			
		||||
    /* setup IV by decrypting last two blocks */
 | 
			
		||||
    EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl,
 | 
			
		||||
@@ -297,8 +297,9 @@ static int kek_wrap_key(unsigned char *out, size_t *outlen,
 | 
			
		||||
        out[3] = in[2] ^ 0xFF;
 | 
			
		||||
        memcpy(out + 4, in, inlen);
 | 
			
		||||
        /* Add random padding to end */
 | 
			
		||||
        if (olen > inlen + 4)
 | 
			
		||||
            RAND_pseudo_bytes(out + 4 + inlen, olen - 4 - inlen);
 | 
			
		||||
        if (olen > inlen + 4
 | 
			
		||||
            && RAND_pseudo_bytes(out + 4 + inlen, olen - 4 - inlen) < 0)
 | 
			
		||||
            return 0;
 | 
			
		||||
        /* Encrypt twice */
 | 
			
		||||
        EVP_EncryptUpdate(ctx, out, &dummy, out, olen);
 | 
			
		||||
        EVP_EncryptUpdate(ctx, out, &dummy, out, olen);
 | 
			
		||||
 
 | 
			
		||||
@@ -132,7 +132,7 @@ static void do_free_upto(BIO *f, BIO *upto)
 | 
			
		||||
            BIO_free(f);
 | 
			
		||||
            f = tbio;
 | 
			
		||||
        }
 | 
			
		||||
        while (f != upto);
 | 
			
		||||
        while (f && f != upto);
 | 
			
		||||
    } else
 | 
			
		||||
        BIO_free_all(f);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -64,6 +64,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -64,6 +64,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -825,8 +825,6 @@ int OPENSSL_isservice(void)
 | 
			
		||||
    if (_OPENSSL_isservice.p != (void *)-1)
 | 
			
		||||
        return (*_OPENSSL_isservice.f) ();
 | 
			
		||||
 | 
			
		||||
    (void)GetDesktopWindow();   /* return value is ignored */
 | 
			
		||||
 | 
			
		||||
    h = GetProcessWindowStation();
 | 
			
		||||
    if (h == NULL)
 | 
			
		||||
        return -1;
 | 
			
		||||
 
 | 
			
		||||
@@ -96,6 +96,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -455,8 +455,10 @@ void doencryption(void)
 | 
			
		||||
            rem = l % 8;
 | 
			
		||||
            len = l - rem;
 | 
			
		||||
            if (feof(DES_IN)) {
 | 
			
		||||
                for (i = 7 - rem; i > 0; i--)
 | 
			
		||||
                    RAND_pseudo_bytes(buf + l++, 1);
 | 
			
		||||
                for (i = 7 - rem; i > 0; i--) {
 | 
			
		||||
                    if (RAND_pseudo_bytes(buf + l++, 1) < 0)
 | 
			
		||||
                        goto problems;
 | 
			
		||||
                }
 | 
			
		||||
                buf[l++] = rem;
 | 
			
		||||
                ex = 1;
 | 
			
		||||
                len += rem;
 | 
			
		||||
 
 | 
			
		||||
@@ -96,6 +96,9 @@ int DES_enc_write(int fd, const void *_buf, int len,
 | 
			
		||||
    const unsigned char *cp;
 | 
			
		||||
    static int start = 1;
 | 
			
		||||
 | 
			
		||||
    if (len < 0)
 | 
			
		||||
        return -1;
 | 
			
		||||
 | 
			
		||||
    if (outbuf == NULL) {
 | 
			
		||||
        outbuf = OPENSSL_malloc(BSIZE + HDRSIZE);
 | 
			
		||||
        if (outbuf == NULL)
 | 
			
		||||
@@ -132,7 +135,9 @@ int DES_enc_write(int fd, const void *_buf, int len,
 | 
			
		||||
    if (len < 8) {
 | 
			
		||||
        cp = shortbuf;
 | 
			
		||||
        memcpy(shortbuf, buf, len);
 | 
			
		||||
        RAND_pseudo_bytes(shortbuf + len, 8 - len);
 | 
			
		||||
        if (RAND_pseudo_bytes(shortbuf + len, 8 - len) < 0) {
 | 
			
		||||
            return -1;
 | 
			
		||||
        }
 | 
			
		||||
        rnum = 8;
 | 
			
		||||
    } else {
 | 
			
		||||
        cp = buf;
 | 
			
		||||
 
 | 
			
		||||
@@ -63,6 +63,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -160,7 +160,7 @@ static int dh_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
 | 
			
		||||
    dh = pkey->pkey.dh;
 | 
			
		||||
 | 
			
		||||
    str = ASN1_STRING_new();
 | 
			
		||||
    if(!str) {
 | 
			
		||||
    if (!str) {
 | 
			
		||||
        DHerr(DH_F_DH_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
 | 
			
		||||
        goto err;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -462,7 +462,7 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
 | 
			
		||||
        ret = 0;
 | 
			
		||||
        Zlen = DH_size(dh);
 | 
			
		||||
        Z = OPENSSL_malloc(Zlen);
 | 
			
		||||
        if(!Z) {
 | 
			
		||||
        if (!Z) {
 | 
			
		||||
            goto err;
 | 
			
		||||
        }
 | 
			
		||||
        if (DH_compute_key_padded(Z, dhpub, dh) <= 0)
 | 
			
		||||
 
 | 
			
		||||
@@ -63,6 +63,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -204,7 +204,8 @@ int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits,
 | 
			
		||||
                goto err;
 | 
			
		||||
 | 
			
		||||
            if (!seed_len) {
 | 
			
		||||
                RAND_pseudo_bytes(seed, qsize);
 | 
			
		||||
                if (RAND_pseudo_bytes(seed, qsize) < 0)
 | 
			
		||||
                    goto err;
 | 
			
		||||
                seed_is_random = 1;
 | 
			
		||||
            } else {
 | 
			
		||||
                seed_is_random = 0;
 | 
			
		||||
 
 | 
			
		||||
@@ -106,23 +106,23 @@ static DSA_METHOD openssl_dsa_meth = {
 | 
			
		||||
#define DSA_MOD_EXP(err_instr,dsa,rr,a1,p1,a2,p2,m,ctx,in_mont) \
 | 
			
		||||
        do { \
 | 
			
		||||
        int _tmp_res53; \
 | 
			
		||||
        if((dsa)->meth->dsa_mod_exp) \
 | 
			
		||||
        if ((dsa)->meth->dsa_mod_exp) \
 | 
			
		||||
                _tmp_res53 = (dsa)->meth->dsa_mod_exp((dsa), (rr), (a1), (p1), \
 | 
			
		||||
                                (a2), (p2), (m), (ctx), (in_mont)); \
 | 
			
		||||
        else \
 | 
			
		||||
                _tmp_res53 = BN_mod_exp2_mont((rr), (a1), (p1), (a2), (p2), \
 | 
			
		||||
                                (m), (ctx), (in_mont)); \
 | 
			
		||||
        if(!_tmp_res53) err_instr; \
 | 
			
		||||
        if (!_tmp_res53) err_instr; \
 | 
			
		||||
        } while(0)
 | 
			
		||||
#define DSA_BN_MOD_EXP(err_instr,dsa,r,a,p,m,ctx,m_ctx) \
 | 
			
		||||
        do { \
 | 
			
		||||
        int _tmp_res53; \
 | 
			
		||||
        if((dsa)->meth->bn_mod_exp) \
 | 
			
		||||
        if ((dsa)->meth->bn_mod_exp) \
 | 
			
		||||
                _tmp_res53 = (dsa)->meth->bn_mod_exp((dsa), (r), (a), (p), \
 | 
			
		||||
                                (m), (ctx), (m_ctx)); \
 | 
			
		||||
        else \
 | 
			
		||||
                _tmp_res53 = BN_mod_exp_mont((r), (a), (p), (m), (ctx), (m_ctx)); \
 | 
			
		||||
        if(!_tmp_res53) err_instr; \
 | 
			
		||||
        if (!_tmp_res53) err_instr; \
 | 
			
		||||
        } while(0)
 | 
			
		||||
 | 
			
		||||
const DSA_METHOD *DSA_OpenSSL(void)
 | 
			
		||||
 
 | 
			
		||||
@@ -63,6 +63,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -285,7 +285,7 @@ DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname)
 | 
			
		||||
 * honest. For one thing, I think I have to return a negative value for any
 | 
			
		||||
 * error because possible DSO_ctrl() commands may return values such as
 | 
			
		||||
 * "size"s that can legitimately be zero (making the standard
 | 
			
		||||
 * "if(DSO_cmd(...))" form that works almost everywhere else fail at odd
 | 
			
		||||
 * "if (DSO_cmd(...))" form that works almost everywhere else fail at odd
 | 
			
		||||
 * times. I'd prefer "output" values to be passed by reference and the return
 | 
			
		||||
 * value as success/failure like usual ... but we conform when we must... :-)
 | 
			
		||||
 */
 | 
			
		||||
 
 | 
			
		||||
@@ -539,7 +539,7 @@ static char *vms_name_converter(DSO *dso, const char *filename)
 | 
			
		||||
{
 | 
			
		||||
    int len = strlen(filename);
 | 
			
		||||
    char *not_translated = OPENSSL_malloc(len + 1);
 | 
			
		||||
    if(not_translated)
 | 
			
		||||
    if (not_translated)
 | 
			
		||||
        strcpy(not_translated, filename);
 | 
			
		||||
    return (not_translated);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
#ifndef CHARSET_EBCDIC
 | 
			
		||||
 | 
			
		||||
# include <openssl/e_os2.h>
 | 
			
		||||
# if defined(PEDANTIC) || defined(__DECC) || defined(OPENSSL_SYS_MACOSX)
 | 
			
		||||
# if defined(PEDANTIC) || defined(__DECC) || defined(OPENSSL_SYS_MACOSX) || defined(__clang__)
 | 
			
		||||
static void *dummy = &dummy;
 | 
			
		||||
# endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -78,6 +78,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -30,20 +30,24 @@
 | 
			
		||||
 | 
			
		||||
# Further optimization by <appro@openssl.org>:
 | 
			
		||||
#
 | 
			
		||||
#		this/original
 | 
			
		||||
# Opteron	+12-49%
 | 
			
		||||
# Bulldozer	+14-45%
 | 
			
		||||
# P4		+18-46%
 | 
			
		||||
# Westmere	+12-34%
 | 
			
		||||
# Sandy Bridge	+9-35%
 | 
			
		||||
# Ivy Bridge	+9-35%
 | 
			
		||||
# Haswell	+8-37%
 | 
			
		||||
# Broadwell	+18-58%
 | 
			
		||||
# Atom		+15-50%
 | 
			
		||||
# VIA Nano	+43-160%
 | 
			
		||||
#		this/original	with/without -DECP_NISTZ256_ASM(*)
 | 
			
		||||
# Opteron	+12-49%		+110-150%
 | 
			
		||||
# Bulldozer	+14-45%		+175-210%
 | 
			
		||||
# P4		+18-46%		n/a :-(
 | 
			
		||||
# Westmere	+12-34%		+80-87%
 | 
			
		||||
# Sandy Bridge	+9-35%		+110-120%
 | 
			
		||||
# Ivy Bridge	+9-35%		+110-125%
 | 
			
		||||
# Haswell	+8-37%		+140-160%
 | 
			
		||||
# Broadwell	+18-58%		+145-210%
 | 
			
		||||
# Atom		+15-50%		+130-180%
 | 
			
		||||
# VIA Nano	+43-160%	+300-480%
 | 
			
		||||
#
 | 
			
		||||
# (*)	"without -DECP_NISTZ256_ASM" refers to build with
 | 
			
		||||
#	"enable-ec_nistp_64_gcc_128";
 | 
			
		||||
#
 | 
			
		||||
# Ranges denote minimum and maximum improvement coefficients depending
 | 
			
		||||
# on benchmark.
 | 
			
		||||
# on benchmark. Lower coefficients are for ECDSA sign, relatively fastest
 | 
			
		||||
# server-side operation. Keep in mind that +100% means 2x improvement.
 | 
			
		||||
 | 
			
		||||
$flavour = shift;
 | 
			
		||||
$output  = shift;
 | 
			
		||||
 
 | 
			
		||||
@@ -1097,6 +1097,12 @@ void ERR_load_EC_strings(void);
 | 
			
		||||
# define EC_F_ECPARAMETERS_PRINT_FP                       148
 | 
			
		||||
# define EC_F_ECPKPARAMETERS_PRINT                        149
 | 
			
		||||
# define EC_F_ECPKPARAMETERS_PRINT_FP                     150
 | 
			
		||||
# define EC_F_ECP_NISTZ256_GET_AFFINE                     240
 | 
			
		||||
# define EC_F_ECP_NISTZ256_MULT_PRECOMPUTE                243
 | 
			
		||||
# define EC_F_ECP_NISTZ256_POINTS_MUL                     241
 | 
			
		||||
# define EC_F_ECP_NISTZ256_PRE_COMP_NEW                   244
 | 
			
		||||
# define EC_F_ECP_NISTZ256_SET_WORDS                      245
 | 
			
		||||
# define EC_F_ECP_NISTZ256_WINDOWED_MUL                   242
 | 
			
		||||
# define EC_F_ECP_NIST_MOD_192                            203
 | 
			
		||||
# define EC_F_ECP_NIST_MOD_224                            204
 | 
			
		||||
# define EC_F_ECP_NIST_MOD_256                            205
 | 
			
		||||
@@ -1208,11 +1214,6 @@ void ERR_load_EC_strings(void);
 | 
			
		||||
# define EC_F_NISTP224_PRE_COMP_NEW                       227
 | 
			
		||||
# define EC_F_NISTP256_PRE_COMP_NEW                       236
 | 
			
		||||
# define EC_F_NISTP521_PRE_COMP_NEW                       237
 | 
			
		||||
# define EC_F_ECP_NISTZ256_GET_AFFINE                     240
 | 
			
		||||
# define EC_F_ECP_NISTZ256_POINTS_MUL                     241
 | 
			
		||||
# define EC_F_ECP_NISTZ256_WINDOWED_MUL                   242
 | 
			
		||||
# define EC_F_ECP_NISTZ256_MULT_PRECOMPUTE                243
 | 
			
		||||
# define EC_F_ECP_NISTZ256_PRE_COMP_NEW                   244
 | 
			
		||||
# define EC_F_O2I_ECPUBLICKEY                             152
 | 
			
		||||
# define EC_F_OLD_EC_PRIV_DECODE                          222
 | 
			
		||||
# define EC_F_PKEY_EC_CTRL                                197
 | 
			
		||||
 
 | 
			
		||||
@@ -387,7 +387,7 @@ int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* test required by X9.62 */
 | 
			
		||||
    if (!EC_POINT_is_on_curve(group, point, ctx)) {
 | 
			
		||||
    if (EC_POINT_is_on_curve(group, point, ctx) <= 0) {
 | 
			
		||||
        ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_POINT_IS_NOT_ON_CURVE);
 | 
			
		||||
        goto err;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1114,7 +1114,7 @@ int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out)
 | 
			
		||||
{
 | 
			
		||||
    int ret = 0, ok = 0;
 | 
			
		||||
    unsigned char *buffer = NULL;
 | 
			
		||||
    size_t buf_len = 0, tmp_len;
 | 
			
		||||
    size_t buf_len = 0, tmp_len, bn_len;
 | 
			
		||||
    EC_PRIVATEKEY *priv_key = NULL;
 | 
			
		||||
 | 
			
		||||
    if (a == NULL || a->group == NULL || a->priv_key == NULL ||
 | 
			
		||||
@@ -1130,18 +1130,32 @@ int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out)
 | 
			
		||||
 | 
			
		||||
    priv_key->version = a->version;
 | 
			
		||||
 | 
			
		||||
    buf_len = (size_t)BN_num_bytes(a->priv_key);
 | 
			
		||||
    bn_len = (size_t)BN_num_bytes(a->priv_key);
 | 
			
		||||
 | 
			
		||||
    /* Octetstring may need leading zeros if BN is to short */
 | 
			
		||||
 | 
			
		||||
    buf_len = (EC_GROUP_get_degree(a->group) + 7) / 8;
 | 
			
		||||
 | 
			
		||||
    if (bn_len > buf_len) {
 | 
			
		||||
        ECerr(EC_F_I2D_ECPRIVATEKEY, EC_R_BUFFER_TOO_SMALL);
 | 
			
		||||
        goto err;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    buffer = OPENSSL_malloc(buf_len);
 | 
			
		||||
    if (buffer == NULL) {
 | 
			
		||||
        ECerr(EC_F_I2D_ECPRIVATEKEY, ERR_R_MALLOC_FAILURE);
 | 
			
		||||
        goto err;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!BN_bn2bin(a->priv_key, buffer)) {
 | 
			
		||||
    if (!BN_bn2bin(a->priv_key, buffer + buf_len - bn_len)) {
 | 
			
		||||
        ECerr(EC_F_I2D_ECPRIVATEKEY, ERR_R_BN_LIB);
 | 
			
		||||
        goto err;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (buf_len - bn_len > 0) {
 | 
			
		||||
        memset(buffer, 0, buf_len - bn_len);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!M_ASN1_OCTET_STRING_set(priv_key->privateKey, buffer, buf_len)) {
 | 
			
		||||
        ECerr(EC_F_I2D_ECPRIVATEKEY, ERR_R_ASN1_LIB);
 | 
			
		||||
        goto err;
 | 
			
		||||
 
 | 
			
		||||
@@ -85,7 +85,7 @@ int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx)
 | 
			
		||||
        ECerr(EC_F_EC_GROUP_CHECK, EC_R_UNDEFINED_GENERATOR);
 | 
			
		||||
        goto err;
 | 
			
		||||
    }
 | 
			
		||||
    if (!EC_POINT_is_on_curve(group, group->generator, ctx)) {
 | 
			
		||||
    if (EC_POINT_is_on_curve(group, group->generator, ctx) <= 0) {
 | 
			
		||||
        ECerr(EC_F_EC_GROUP_CHECK, EC_R_POINT_IS_NOT_ON_CURVE);
 | 
			
		||||
        goto err;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/* crypto/ec/ec_err.c */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 1999-2014 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 * Copyright (c) 1999-2015 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
 | 
			
		||||
@@ -89,6 +89,13 @@ static ERR_STRING_DATA EC_str_functs[] = {
 | 
			
		||||
    {ERR_FUNC(EC_F_ECPARAMETERS_PRINT_FP), "ECParameters_print_fp"},
 | 
			
		||||
    {ERR_FUNC(EC_F_ECPKPARAMETERS_PRINT), "ECPKParameters_print"},
 | 
			
		||||
    {ERR_FUNC(EC_F_ECPKPARAMETERS_PRINT_FP), "ECPKParameters_print_fp"},
 | 
			
		||||
    {ERR_FUNC(EC_F_ECP_NISTZ256_GET_AFFINE), "ecp_nistz256_get_affine"},
 | 
			
		||||
    {ERR_FUNC(EC_F_ECP_NISTZ256_MULT_PRECOMPUTE),
 | 
			
		||||
     "ecp_nistz256_mult_precompute"},
 | 
			
		||||
    {ERR_FUNC(EC_F_ECP_NISTZ256_POINTS_MUL), "ecp_nistz256_points_mul"},
 | 
			
		||||
    {ERR_FUNC(EC_F_ECP_NISTZ256_PRE_COMP_NEW), "ecp_nistz256_pre_comp_new"},
 | 
			
		||||
    {ERR_FUNC(EC_F_ECP_NISTZ256_SET_WORDS), "ecp_nistz256_set_words"},
 | 
			
		||||
    {ERR_FUNC(EC_F_ECP_NISTZ256_WINDOWED_MUL), "ecp_nistz256_windowed_mul"},
 | 
			
		||||
    {ERR_FUNC(EC_F_ECP_NIST_MOD_192), "ECP_NIST_MOD_192"},
 | 
			
		||||
    {ERR_FUNC(EC_F_ECP_NIST_MOD_224), "ECP_NIST_MOD_224"},
 | 
			
		||||
    {ERR_FUNC(EC_F_ECP_NIST_MOD_256), "ECP_NIST_MOD_256"},
 | 
			
		||||
@@ -239,12 +246,6 @@ static ERR_STRING_DATA EC_str_functs[] = {
 | 
			
		||||
    {ERR_FUNC(EC_F_NISTP224_PRE_COMP_NEW), "NISTP224_PRE_COMP_NEW"},
 | 
			
		||||
    {ERR_FUNC(EC_F_NISTP256_PRE_COMP_NEW), "NISTP256_PRE_COMP_NEW"},
 | 
			
		||||
    {ERR_FUNC(EC_F_NISTP521_PRE_COMP_NEW), "NISTP521_PRE_COMP_NEW"},
 | 
			
		||||
    {ERR_FUNC(EC_F_ECP_NISTZ256_GET_AFFINE), "ecp_nistz256_get_affine"},
 | 
			
		||||
    {ERR_FUNC(EC_F_ECP_NISTZ256_POINTS_MUL), "ecp_nistz256_points_mul"},
 | 
			
		||||
    {ERR_FUNC(EC_F_ECP_NISTZ256_WINDOWED_MUL), "ecp_nistz256_windowed_mul"},
 | 
			
		||||
    {ERR_FUNC(EC_F_ECP_NISTZ256_MULT_PRECOMPUTE),
 | 
			
		||||
     "ecp_nistz256_mult_precompute"},
 | 
			
		||||
    {ERR_FUNC(EC_F_ECP_NISTZ256_PRE_COMP_NEW), "ecp_nistz256_pre_comp_new"},
 | 
			
		||||
    {ERR_FUNC(EC_F_O2I_ECPUBLICKEY), "o2i_ECPublicKey"},
 | 
			
		||||
    {ERR_FUNC(EC_F_OLD_EC_PRIV_DECODE), "OLD_EC_PRIV_DECODE"},
 | 
			
		||||
    {ERR_FUNC(EC_F_PKEY_EC_CTRL), "PKEY_EC_CTRL"},
 | 
			
		||||
 
 | 
			
		||||
@@ -314,7 +314,7 @@ int EC_KEY_check_key(const EC_KEY *eckey)
 | 
			
		||||
        goto err;
 | 
			
		||||
 | 
			
		||||
    /* testing whether the pub_key is on the elliptic curve */
 | 
			
		||||
    if (!EC_POINT_is_on_curve(eckey->group, eckey->pub_key, ctx)) {
 | 
			
		||||
    if (EC_POINT_is_on_curve(eckey->group, eckey->pub_key, ctx) <= 0) {
 | 
			
		||||
        ECerr(EC_F_EC_KEY_CHECK_KEY, EC_R_POINT_IS_NOT_ON_CURVE);
 | 
			
		||||
        goto err;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -459,14 +459,6 @@ int ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r,
 | 
			
		||||
int ec_GF2m_precompute_mult(EC_GROUP *group, BN_CTX *ctx);
 | 
			
		||||
int ec_GF2m_have_precompute_mult(const EC_GROUP *group);
 | 
			
		||||
 | 
			
		||||
/* method functions in ec2_mult.c */
 | 
			
		||||
int ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r,
 | 
			
		||||
                       const BIGNUM *scalar, size_t num,
 | 
			
		||||
                       const EC_POINT *points[], const BIGNUM *scalars[],
 | 
			
		||||
                       BN_CTX *);
 | 
			
		||||
int ec_GF2m_precompute_mult(EC_GROUP *group, BN_CTX *ctx);
 | 
			
		||||
int ec_GF2m_have_precompute_mult(const EC_GROUP *group);
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
 | 
			
		||||
/* method functions in ecp_nistp224.c */
 | 
			
		||||
int ec_GFp_nistp224_group_init(EC_GROUP *group);
 | 
			
		||||
 
 | 
			
		||||
@@ -970,6 +970,13 @@ int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point)
 | 
			
		||||
    return group->meth->is_at_infinity(group, point);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Check whether an EC_POINT is on the curve or not. Note that the return
 | 
			
		||||
 * value for this function should NOT be treated as a boolean. Return values:
 | 
			
		||||
 *  1: The point is on the curve
 | 
			
		||||
 *  0: The point is not on the curve
 | 
			
		||||
 * -1: An error occurred
 | 
			
		||||
 */
 | 
			
		||||
int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
 | 
			
		||||
                         BN_CTX *ctx)
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -346,12 +346,14 @@ static int print_bin(BIO *fp, const char *name, const unsigned char *buf,
 | 
			
		||||
 | 
			
		||||
    if (buf == NULL)
 | 
			
		||||
        return 1;
 | 
			
		||||
    if (off) {
 | 
			
		||||
    if (off > 0) {
 | 
			
		||||
        if (off > 128)
 | 
			
		||||
            off = 128;
 | 
			
		||||
        memset(str, ' ', off);
 | 
			
		||||
        if (BIO_write(fp, str, off) <= 0)
 | 
			
		||||
            return 0;
 | 
			
		||||
    } else {
 | 
			
		||||
        off = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (BIO_printf(fp, "%s", name) <= 0)
 | 
			
		||||
 
 | 
			
		||||
@@ -222,6 +222,18 @@ static BN_ULONG is_one(const BN_ULONG a[P256_LIMBS])
 | 
			
		||||
    return is_zero(res);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int ecp_nistz256_set_words(BIGNUM *a, BN_ULONG words[P256_LIMBS])
 | 
			
		||||
 {
 | 
			
		||||
     if (bn_wexpand(a, P256_LIMBS) == NULL) {
 | 
			
		||||
         ECerr(EC_F_ECP_NISTZ256_SET_WORDS, ERR_R_MALLOC_FAILURE);
 | 
			
		||||
         return 0;
 | 
			
		||||
     }
 | 
			
		||||
     memcpy(a->d, words, sizeof(BN_ULONG) * P256_LIMBS);
 | 
			
		||||
     a->top = P256_LIMBS;
 | 
			
		||||
     bn_correct_top(a);
 | 
			
		||||
     return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifndef ECP_NISTZ256_REFERENCE_IMPLEMENTATION
 | 
			
		||||
void ecp_nistz256_point_double(P256_POINT *r, const P256_POINT *a);
 | 
			
		||||
void ecp_nistz256_point_add(P256_POINT *r,
 | 
			
		||||
@@ -557,13 +569,14 @@ static int ecp_nistz256_bignum_to_field_elem(BN_ULONG out[P256_LIMBS],
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* r = sum(scalar[i]*point[i]) */
 | 
			
		||||
static void ecp_nistz256_windowed_mul(const EC_GROUP *group,
 | 
			
		||||
static int ecp_nistz256_windowed_mul(const EC_GROUP *group,
 | 
			
		||||
                                      P256_POINT *r,
 | 
			
		||||
                                      const BIGNUM **scalar,
 | 
			
		||||
                                      const EC_POINT **point,
 | 
			
		||||
                                      int num, BN_CTX *ctx)
 | 
			
		||||
{
 | 
			
		||||
    int i, j;
 | 
			
		||||
 | 
			
		||||
    int i, j, ret = 0;
 | 
			
		||||
    unsigned int index;
 | 
			
		||||
    unsigned char (*p_str)[33] = NULL;
 | 
			
		||||
    const unsigned int window_size = 5;
 | 
			
		||||
@@ -589,6 +602,7 @@ static void ecp_nistz256_windowed_mul(const EC_GROUP *group,
 | 
			
		||||
    for (i = 0; i < num; i++) {
 | 
			
		||||
        P256_POINT *row = table[i];
 | 
			
		||||
 | 
			
		||||
        /* This is an unusual input, we don't guarantee constant-timeness. */
 | 
			
		||||
        if ((BN_num_bits(scalar[i]) > 256) || BN_is_negative(scalar[i])) {
 | 
			
		||||
            BIGNUM *mod;
 | 
			
		||||
 | 
			
		||||
@@ -697,6 +711,7 @@ static void ecp_nistz256_windowed_mul(const EC_GROUP *group,
 | 
			
		||||
        ecp_nistz256_point_add(r, r, &h);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ret = 1;
 | 
			
		||||
 err:
 | 
			
		||||
    if (table_storage)
 | 
			
		||||
        OPENSSL_free(table_storage);
 | 
			
		||||
@@ -704,6 +719,7 @@ static void ecp_nistz256_windowed_mul(const EC_GROUP *group,
 | 
			
		||||
        OPENSSL_free(p_str);
 | 
			
		||||
    if (scalars)
 | 
			
		||||
        OPENSSL_free(scalars);
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Coordinates of G, for which we have precomputed tables */
 | 
			
		||||
@@ -742,6 +758,7 @@ static int ecp_nistz256_mult_precompute(EC_GROUP *group, BN_CTX *ctx)
 | 
			
		||||
    EC_POINT *P = NULL, *T = NULL;
 | 
			
		||||
    const EC_POINT *generator;
 | 
			
		||||
    EC_PRE_COMP *pre_comp;
 | 
			
		||||
    BN_CTX *new_ctx = NULL;
 | 
			
		||||
    int i, j, k, ret = 0;
 | 
			
		||||
    size_t w;
 | 
			
		||||
 | 
			
		||||
@@ -771,7 +788,7 @@ static int ecp_nistz256_mult_precompute(EC_GROUP *group, BN_CTX *ctx)
 | 
			
		||||
        return 0;
 | 
			
		||||
 | 
			
		||||
    if (ctx == NULL) {
 | 
			
		||||
        ctx = BN_CTX_new();
 | 
			
		||||
        ctx = new_ctx = BN_CTX_new();
 | 
			
		||||
        if (ctx == NULL)
 | 
			
		||||
            goto err;
 | 
			
		||||
    }
 | 
			
		||||
@@ -802,30 +819,41 @@ static int ecp_nistz256_mult_precompute(EC_GROUP *group, BN_CTX *ctx)
 | 
			
		||||
 | 
			
		||||
    P = EC_POINT_new(group);
 | 
			
		||||
    T = EC_POINT_new(group);
 | 
			
		||||
    if (P == NULL || T == NULL)
 | 
			
		||||
        goto err;
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * The zero entry is implicitly infinity, and we skip it, storing other
 | 
			
		||||
     * values with -1 offset.
 | 
			
		||||
     */
 | 
			
		||||
    EC_POINT_copy(T, generator);
 | 
			
		||||
    if (!EC_POINT_copy(T, generator))
 | 
			
		||||
        goto err;
 | 
			
		||||
 | 
			
		||||
    for (k = 0; k < 64; k++) {
 | 
			
		||||
        EC_POINT_copy(P, T);
 | 
			
		||||
        if (!EC_POINT_copy(P, T))
 | 
			
		||||
            goto err;
 | 
			
		||||
        for (j = 0; j < 37; j++) {
 | 
			
		||||
            /*
 | 
			
		||||
             * It would be faster to use
 | 
			
		||||
             * ec_GFp_simple_points_make_affine and make multiple
 | 
			
		||||
             * points affine at the same time.
 | 
			
		||||
             * It would be faster to use EC_POINTs_make_affine and
 | 
			
		||||
             * make multiple points affine at the same time.
 | 
			
		||||
             */
 | 
			
		||||
            ec_GFp_simple_make_affine(group, P, ctx);
 | 
			
		||||
            ecp_nistz256_bignum_to_field_elem(preComputedTable[j]
 | 
			
		||||
                                              [k].X, &P->X);
 | 
			
		||||
            ecp_nistz256_bignum_to_field_elem(preComputedTable[j]
 | 
			
		||||
                                              [k].Y, &P->Y);
 | 
			
		||||
            for (i = 0; i < 7; i++)
 | 
			
		||||
                ec_GFp_simple_dbl(group, P, P, ctx);
 | 
			
		||||
            if (!EC_POINT_make_affine(group, P, ctx))
 | 
			
		||||
                goto err;
 | 
			
		||||
            if (!ecp_nistz256_bignum_to_field_elem(preComputedTable[j][k].X,
 | 
			
		||||
                                                   &P->X) ||
 | 
			
		||||
                !ecp_nistz256_bignum_to_field_elem(preComputedTable[j][k].Y,
 | 
			
		||||
                                                   &P->Y)) {
 | 
			
		||||
                ECerr(EC_F_ECP_NISTZ256_MULT_PRECOMPUTE,
 | 
			
		||||
                      EC_R_COORDINATES_OUT_OF_RANGE);
 | 
			
		||||
                goto err;
 | 
			
		||||
            }
 | 
			
		||||
            for (i = 0; i < 7; i++) {
 | 
			
		||||
                if (!EC_POINT_dbl(group, P, P, ctx))
 | 
			
		||||
                    goto err;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        ec_GFp_simple_add(group, T, T, generator, ctx);
 | 
			
		||||
        if (!EC_POINT_add(group, T, T, generator, ctx))
 | 
			
		||||
            goto err;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pre_comp->group = group;
 | 
			
		||||
@@ -849,6 +877,8 @@ static int ecp_nistz256_mult_precompute(EC_GROUP *group, BN_CTX *ctx)
 | 
			
		||||
 err:
 | 
			
		||||
    if (ctx != NULL)
 | 
			
		||||
        BN_CTX_end(ctx);
 | 
			
		||||
    BN_CTX_free(new_ctx);
 | 
			
		||||
 | 
			
		||||
    if (pre_comp)
 | 
			
		||||
        ecp_nistz256_pre_comp_free(pre_comp);
 | 
			
		||||
    if (precomp_storage)
 | 
			
		||||
@@ -1102,6 +1132,9 @@ static int ecp_nistz256_points_mul(const EC_GROUP *group,
 | 
			
		||||
    const EC_PRE_COMP *pre_comp = NULL;
 | 
			
		||||
    const EC_POINT *generator = NULL;
 | 
			
		||||
    unsigned int index = 0;
 | 
			
		||||
    BN_CTX *new_ctx = NULL;
 | 
			
		||||
    const BIGNUM **new_scalars = NULL;
 | 
			
		||||
    const EC_POINT **new_points = NULL;
 | 
			
		||||
    const unsigned int window_size = 7;
 | 
			
		||||
    const unsigned int mask = (1 << (window_size + 1)) - 1;
 | 
			
		||||
    unsigned int wvalue;
 | 
			
		||||
@@ -1115,6 +1148,7 @@ static int ecp_nistz256_points_mul(const EC_GROUP *group,
 | 
			
		||||
        ECerr(EC_F_ECP_NISTZ256_POINTS_MUL, EC_R_INCOMPATIBLE_OBJECTS);
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((scalar == NULL) && (num == 0))
 | 
			
		||||
        return EC_POINT_set_to_infinity(group, r);
 | 
			
		||||
 | 
			
		||||
@@ -1125,13 +1159,13 @@ static int ecp_nistz256_points_mul(const EC_GROUP *group,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* Need 256 bits for space for all coordinates. */
 | 
			
		||||
    bn_wexpand(&r->X, P256_LIMBS);
 | 
			
		||||
    bn_wexpand(&r->Y, P256_LIMBS);
 | 
			
		||||
    bn_wexpand(&r->Z, P256_LIMBS);
 | 
			
		||||
    r->X.top = P256_LIMBS;
 | 
			
		||||
    r->Y.top = P256_LIMBS;
 | 
			
		||||
    r->Z.top = P256_LIMBS;
 | 
			
		||||
    if (ctx == NULL) {
 | 
			
		||||
        ctx = new_ctx = BN_CTX_new();
 | 
			
		||||
        if (ctx == NULL)
 | 
			
		||||
            goto err;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    BN_CTX_start(ctx);
 | 
			
		||||
 | 
			
		||||
    if (scalar) {
 | 
			
		||||
        generator = EC_GROUP_get0_generator(group);
 | 
			
		||||
@@ -1156,8 +1190,10 @@ static int ecp_nistz256_points_mul(const EC_GROUP *group,
 | 
			
		||||
                goto err;
 | 
			
		||||
 | 
			
		||||
            if (!ecp_nistz256_set_from_affine
 | 
			
		||||
                (pre_comp_generator, group, pre_comp->precomp[0], ctx))
 | 
			
		||||
                (pre_comp_generator, group, pre_comp->precomp[0], ctx)) {
 | 
			
		||||
                EC_POINT_free(pre_comp_generator);
 | 
			
		||||
                goto err;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (0 == EC_POINT_cmp(group, generator, pre_comp_generator, ctx))
 | 
			
		||||
                preComputedTable = (const PRECOMP256_ROW *)pre_comp->precomp;
 | 
			
		||||
@@ -1255,20 +1291,16 @@ static int ecp_nistz256_points_mul(const EC_GROUP *group,
 | 
			
		||||
         * Without a precomputed table for the generator, it has to be
 | 
			
		||||
         * handled like a normal point.
 | 
			
		||||
         */
 | 
			
		||||
        const BIGNUM **new_scalars;
 | 
			
		||||
        const EC_POINT **new_points;
 | 
			
		||||
 | 
			
		||||
        new_scalars = OPENSSL_malloc((num + 1) * sizeof(BIGNUM *));
 | 
			
		||||
        if (!new_scalars) {
 | 
			
		||||
            ECerr(EC_F_ECP_NISTZ256_POINTS_MUL, ERR_R_MALLOC_FAILURE);
 | 
			
		||||
            return 0;
 | 
			
		||||
            goto err;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        new_points = OPENSSL_malloc((num + 1) * sizeof(EC_POINT *));
 | 
			
		||||
        if (!new_points) {
 | 
			
		||||
            OPENSSL_free(new_scalars);
 | 
			
		||||
            ECerr(EC_F_ECP_NISTZ256_POINTS_MUL, ERR_R_MALLOC_FAILURE);
 | 
			
		||||
            return 0;
 | 
			
		||||
            goto err;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        memcpy(new_scalars, scalars, num * sizeof(BIGNUM *));
 | 
			
		||||
@@ -1286,27 +1318,31 @@ static int ecp_nistz256_points_mul(const EC_GROUP *group,
 | 
			
		||||
        if (p_is_infinity)
 | 
			
		||||
            out = &p.p;
 | 
			
		||||
 | 
			
		||||
        ecp_nistz256_windowed_mul(group, out, scalars, points, num, ctx);
 | 
			
		||||
        if (!ecp_nistz256_windowed_mul(group, out, scalars, points, num, ctx))
 | 
			
		||||
            goto err;
 | 
			
		||||
 | 
			
		||||
        if (!p_is_infinity)
 | 
			
		||||
            ecp_nistz256_point_add(&p.p, &p.p, out);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (no_precomp_for_generator) {
 | 
			
		||||
        OPENSSL_free(points);
 | 
			
		||||
        OPENSSL_free(scalars);
 | 
			
		||||
    /* Not constant-time, but we're only operating on the public output. */
 | 
			
		||||
    if (!ecp_nistz256_set_words(&r->X, p.p.X) ||
 | 
			
		||||
        !ecp_nistz256_set_words(&r->Y, p.p.Y) ||
 | 
			
		||||
        !ecp_nistz256_set_words(&r->Z, p.p.Z)) {
 | 
			
		||||
        goto err;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    memcpy(r->X.d, p.p.X, sizeof(p.p.X));
 | 
			
		||||
    memcpy(r->Y.d, p.p.Y, sizeof(p.p.Y));
 | 
			
		||||
    memcpy(r->Z.d, p.p.Z, sizeof(p.p.Z));
 | 
			
		||||
    bn_correct_top(&r->X);
 | 
			
		||||
    bn_correct_top(&r->Y);
 | 
			
		||||
    bn_correct_top(&r->Z);
 | 
			
		||||
    r->Z_is_one = is_one(p.p.Z) & 1;
 | 
			
		||||
 | 
			
		||||
    ret = 1;
 | 
			
		||||
 | 
			
		||||
 err:
 | 
			
		||||
err:
 | 
			
		||||
    if (ctx)
 | 
			
		||||
        BN_CTX_end(ctx);
 | 
			
		||||
    BN_CTX_free(new_ctx);
 | 
			
		||||
    if (new_points)
 | 
			
		||||
        OPENSSL_free(new_points);
 | 
			
		||||
    if (new_scalars)
 | 
			
		||||
        OPENSSL_free(new_scalars);
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1319,6 +1355,7 @@ static int ecp_nistz256_get_affine(const EC_GROUP *group,
 | 
			
		||||
    BN_ULONG x_aff[P256_LIMBS];
 | 
			
		||||
    BN_ULONG y_aff[P256_LIMBS];
 | 
			
		||||
    BN_ULONG point_x[P256_LIMBS], point_y[P256_LIMBS], point_z[P256_LIMBS];
 | 
			
		||||
    BN_ULONG x_ret[P256_LIMBS], y_ret[P256_LIMBS];
 | 
			
		||||
 | 
			
		||||
    if (EC_POINT_is_at_infinity(group, point)) {
 | 
			
		||||
        ECerr(EC_F_ECP_NISTZ256_GET_AFFINE, EC_R_POINT_AT_INFINITY);
 | 
			
		||||
@@ -1337,19 +1374,17 @@ static int ecp_nistz256_get_affine(const EC_GROUP *group,
 | 
			
		||||
    ecp_nistz256_mul_mont(x_aff, z_inv2, point_x);
 | 
			
		||||
 | 
			
		||||
    if (x != NULL) {
 | 
			
		||||
        bn_wexpand(x, P256_LIMBS);
 | 
			
		||||
        x->top = P256_LIMBS;
 | 
			
		||||
        ecp_nistz256_from_mont(x->d, x_aff);
 | 
			
		||||
        bn_correct_top(x);
 | 
			
		||||
        ecp_nistz256_from_mont(x_ret, x_aff);
 | 
			
		||||
        if (!ecp_nistz256_set_words(x, x_ret))
 | 
			
		||||
            return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (y != NULL) {
 | 
			
		||||
        ecp_nistz256_mul_mont(z_inv3, z_inv3, z_inv2);
 | 
			
		||||
        ecp_nistz256_mul_mont(y_aff, z_inv3, point_y);
 | 
			
		||||
        bn_wexpand(y, P256_LIMBS);
 | 
			
		||||
        y->top = P256_LIMBS;
 | 
			
		||||
        ecp_nistz256_from_mont(y->d, y_aff);
 | 
			
		||||
        bn_correct_top(y);
 | 
			
		||||
        ecp_nistz256_from_mont(y_ret, y_aff);
 | 
			
		||||
        if (!ecp_nistz256_set_words(y, y_ret))
 | 
			
		||||
            return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return 1;
 | 
			
		||||
 
 | 
			
		||||
@@ -413,7 +413,7 @@ int ec_GFp_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* test required by X9.62 */
 | 
			
		||||
    if (!EC_POINT_is_on_curve(group, point, ctx)) {
 | 
			
		||||
    if (EC_POINT_is_on_curve(group, point, ctx) <= 0) {
 | 
			
		||||
        ECerr(EC_F_EC_GFP_SIMPLE_OCT2POINT, EC_R_POINT_IS_NOT_ON_CURVE);
 | 
			
		||||
        goto err;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -412,7 +412,7 @@ static void prime_field_tests(void)
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_set_compressed_coordinates_GFp(group, Q, x, 1, ctx))
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_is_on_curve(group, Q, ctx)) {
 | 
			
		||||
    if (EC_POINT_is_on_curve(group, Q, ctx) <= 0) {
 | 
			
		||||
        if (!EC_POINT_get_affine_coordinates_GFp(group, Q, x, y, ctx))
 | 
			
		||||
            ABORT;
 | 
			
		||||
        fprintf(stderr, "Point is not on curve: x = 0x");
 | 
			
		||||
@@ -544,7 +544,7 @@ static void prime_field_tests(void)
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_set_affine_coordinates_GFp(group, P, x, y, ctx))
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_is_on_curve(group, P, ctx))
 | 
			
		||||
    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!BN_hex2bn(&z, "0100000000000000000001F4C8F927AED3CA752257"))
 | 
			
		||||
        ABORT;
 | 
			
		||||
@@ -593,7 +593,7 @@ static void prime_field_tests(void)
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx))
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_is_on_curve(group, P, ctx))
 | 
			
		||||
    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831"))
 | 
			
		||||
        ABORT;
 | 
			
		||||
@@ -646,7 +646,7 @@ static void prime_field_tests(void)
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx))
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_is_on_curve(group, P, ctx))
 | 
			
		||||
    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!BN_hex2bn
 | 
			
		||||
        (&z, "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D"))
 | 
			
		||||
@@ -705,7 +705,7 @@ static void prime_field_tests(void)
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx))
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_is_on_curve(group, P, ctx))
 | 
			
		||||
    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!BN_hex2bn(&z, "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E"
 | 
			
		||||
                   "84F3B9CAC2FC632551"))
 | 
			
		||||
@@ -761,7 +761,7 @@ static void prime_field_tests(void)
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx))
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_is_on_curve(group, P, ctx))
 | 
			
		||||
    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
 | 
			
		||||
                   "FFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973"))
 | 
			
		||||
@@ -820,7 +820,7 @@ static void prime_field_tests(void)
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx))
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_is_on_curve(group, P, ctx))
 | 
			
		||||
    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!BN_hex2bn(&z, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
 | 
			
		||||
                   "FFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5"
 | 
			
		||||
@@ -864,7 +864,7 @@ static void prime_field_tests(void)
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_dbl(group, P, P, ctx))
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_is_on_curve(group, P, ctx))
 | 
			
		||||
    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_invert(group, Q, ctx))
 | 
			
		||||
        ABORT;                  /* P = -2Q */
 | 
			
		||||
@@ -1008,7 +1008,7 @@ static void prime_field_tests(void)
 | 
			
		||||
#  define CHAR2_CURVE_TEST_INTERNAL(_name, _p, _a, _b, _x, _y, _y_bit, _order, _cof, _degree, _variable) \
 | 
			
		||||
        if (!BN_hex2bn(&x, _x)) ABORT; \
 | 
			
		||||
        if (!EC_POINT_set_compressed_coordinates_GF2m(group, P, x, _y_bit, ctx)) ABORT; \
 | 
			
		||||
        if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; \
 | 
			
		||||
        if (EC_POINT_is_on_curve(group, P, ctx) <= 0) ABORT; \
 | 
			
		||||
        if (!BN_hex2bn(&z, _order)) ABORT; \
 | 
			
		||||
        if (!BN_hex2bn(&cof, _cof)) ABORT; \
 | 
			
		||||
        if (!EC_GROUP_set_generator(group, P, z, cof)) ABORT; \
 | 
			
		||||
@@ -1026,7 +1026,7 @@ static void prime_field_tests(void)
 | 
			
		||||
        if (!BN_hex2bn(&x, _x)) ABORT; \
 | 
			
		||||
        if (!BN_hex2bn(&y, _y)) ABORT; \
 | 
			
		||||
        if (!EC_POINT_set_affine_coordinates_GF2m(group, P, x, y, ctx)) ABORT; \
 | 
			
		||||
        if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; \
 | 
			
		||||
        if (EC_POINT_is_on_curve(group, P, ctx) <= 0) ABORT; \
 | 
			
		||||
        if (!BN_hex2bn(&z, _order)) ABORT; \
 | 
			
		||||
        if (!BN_hex2bn(&cof, _cof)) ABORT; \
 | 
			
		||||
        if (!EC_GROUP_set_generator(group, P, z, cof)) ABORT; \
 | 
			
		||||
@@ -1157,7 +1157,7 @@ static void char2_field_tests(void)
 | 
			
		||||
    if (!EC_POINT_set_affine_coordinates_GF2m(group, Q, x, y, ctx))
 | 
			
		||||
        ABORT;
 | 
			
		||||
#  endif
 | 
			
		||||
    if (!EC_POINT_is_on_curve(group, Q, ctx)) {
 | 
			
		||||
    if (EC_POINT_is_on_curve(group, Q, ctx) <= 0) {
 | 
			
		||||
/* Change test based on whether binary point compression is enabled or not. */
 | 
			
		||||
#  ifdef OPENSSL_EC_BIN_PT_COMP
 | 
			
		||||
        if (!EC_POINT_get_affine_coordinates_GF2m(group, Q, x, y, ctx))
 | 
			
		||||
@@ -1378,7 +1378,7 @@ static void char2_field_tests(void)
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_dbl(group, P, P, ctx))
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_is_on_curve(group, P, ctx))
 | 
			
		||||
    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
 | 
			
		||||
        ABORT;
 | 
			
		||||
    if (!EC_POINT_invert(group, Q, ctx))
 | 
			
		||||
        ABORT;                  /* P = -2Q */
 | 
			
		||||
 
 | 
			
		||||
@@ -62,6 +62,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -62,6 +62,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -296,8 +296,8 @@ int test_builtin(BIO *out)
 | 
			
		||||
    int nid, ret = 0;
 | 
			
		||||
 | 
			
		||||
    /* fill digest values with some random data */
 | 
			
		||||
    if (!RAND_pseudo_bytes(digest, 20) ||
 | 
			
		||||
        !RAND_pseudo_bytes(wrong_digest, 20)) {
 | 
			
		||||
    if (RAND_pseudo_bytes(digest, 20) <= 0 ||
 | 
			
		||||
        RAND_pseudo_bytes(wrong_digest, 20) <= 0) {
 | 
			
		||||
        BIO_printf(out, "ERROR: unable to get random data\n");
 | 
			
		||||
        goto builtin_err;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -71,6 +71,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -61,6 +61,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -86,6 +86,8 @@ tests:
 | 
			
		||||
lint:
 | 
			
		||||
	lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
			
		||||
 | 
			
		||||
update: depend
 | 
			
		||||
 | 
			
		||||
depend:
 | 
			
		||||
	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
 | 
			
		||||
	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC)
 | 
			
		||||
 
 | 
			
		||||
@@ -491,7 +491,8 @@ static int sig_out(BIO *b)
 | 
			
		||||
     * FIXME: there's absolutely no guarantee this makes any sense at all,
 | 
			
		||||
     * particularly now EVP_MD_CTX has been restructured.
 | 
			
		||||
     */
 | 
			
		||||
    RAND_pseudo_bytes(md->md_data, md->digest->md_size);
 | 
			
		||||
    if (RAND_pseudo_bytes(md->md_data, md->digest->md_size) < 0)
 | 
			
		||||
        goto berr;
 | 
			
		||||
    memcpy(&(ctx->buf[ctx->buf_len]), md->md_data, md->digest->md_size);
 | 
			
		||||
    longswap(&(ctx->buf[ctx->buf_len]), md->digest->md_size);
 | 
			
		||||
    ctx->buf_len += md->digest->md_size;
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user