Compare commits
	
		
			184 Commits
		
	
	
		
			OpenSSL_1_
			...
			OpenSSL_1_
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					46ebd9e3bb | ||
| 
						 | 
					f66db68e1f | ||
| 
						 | 
					0c4b72e9c0 | ||
| 
						 | 
					f88dbb8385 | ||
| 
						 | 
					1113fc31ba | ||
| 
						 | 
					0898147090 | ||
| 
						 | 
					4d8da30fc1 | ||
| 
						 | 
					579f3a631e | ||
| 
						 | 
					47061af106 | ||
| 
						 | 
					13e225300f | ||
| 
						 | 
					26bc56d014 | ||
| 
						 | 
					496681cd51 | ||
| 
						 | 
					746c6f3a53 | ||
| 
						 | 
					8545f73b89 | ||
| 
						 | 
					32cc2479b4 | ||
| 
						 | 
					f306b87d76 | ||
| 
						 | 
					41cf07f0ec | ||
| 
						 | 
					62f4033381 | ||
| 
						 | 
					f9f6a8f96c | ||
| 
						 | 
					df0d93564e | ||
| 
						 | 
					0d589ac150 | ||
| 
						 | 
					35d732fc2e | ||
| 
						 | 
					896ddb9851 | ||
| 
						 | 
					e630b3c218 | ||
| 
						 | 
					f1ca56a69f | ||
| 
						 | 
					529d27ea47 | ||
| 
						 | 
					b2226c6c83 | ||
| 
						 | 
					024de2174b | ||
| 
						 | 
					125093b59f | ||
| 
						 | 
					f3e99ea072 | ||
| 
						 | 
					8bfd4c659f | ||
| 
						 | 
					ec07246a08 | ||
| 
						 | 
					04e45b52ee | ||
| 
						 | 
					d5371324d9 | ||
| 
						 | 
					36260233e7 | ||
| 
						 | 
					cab13fc847 | ||
| 
						 | 
					34ab3c8c71 | ||
| 
						 | 
					25c93fd240 | ||
| 
						 | 
					428c1064c3 | ||
| 
						 | 
					81ce0e14e7 | ||
| 
						 | 
					b908e88ec1 | ||
| 
						 | 
					62e4506a7d | ||
| 
						 | 
					014265eb02 | ||
| 
						 | 
					9f27de170d | ||
| 
						 | 
					6cb19b7681 | ||
| 
						 | 
					e130841bcc | ||
| 
						 | 
					2ee798880a | ||
| 
						 | 
					ffcf4c6164 | ||
| 
						 | 
					b286a96811 | ||
| 
						 | 
					2a2df2e9f2 | ||
| 
						 | 
					15481c5e42 | ||
| 
						 | 
					366b60b9da | ||
| 
						 | 
					4782444a35 | ||
| 
						 | 
					8a17e161d1 | ||
| 
						 | 
					72f27cd2df | ||
| 
						 | 
					3b3674ae58 | ||
| 
						 | 
					9d75e765bc | ||
| 
						 | 
					bf07bd4d61 | ||
| 
						 | 
					296cc7f4b8 | ||
| 
						 | 
					3d92984689 | ||
| 
						 | 
					51447d5db5 | ||
| 
						 | 
					1dcf520fe2 | ||
| 
						 | 
					fca84dabe6 | ||
| 
						 | 
					3ea1e13569 | ||
| 
						 | 
					dd6639bd3a | ||
| 
						 | 
					bee0550397 | ||
| 
						 | 
					fc57c58c81 | ||
| 
						 | 
					5bb6d96558 | ||
| 
						 | 
					28e1bd35bd | ||
| 
						 | 
					dd83cc298d | ||
| 
						 | 
					ea00598596 | ||
| 
						 | 
					a650314f72 | ||
| 
						 | 
					54fdc39a08 | ||
| 
						 | 
					7dc98a62b2 | ||
| 
						 | 
					f20ba1c9bb | ||
| 
						 | 
					7c3562947a | ||
| 
						 | 
					eb3a3911fc | ||
| 
						 | 
					540f7c75ef | ||
| 
						 | 
					d6342aab08 | ||
| 
						 | 
					e7b85bc402 | ||
| 
						 | 
					07eaaab2f6 | ||
| 
						 | 
					96f7fafa24 | ||
| 
						 | 
					487a0df700 | ||
| 
						 | 
					09ef5f6258 | ||
| 
						 | 
					bcc0e4ca7c | ||
| 
						 | 
					caac8fefdc | ||
| 
						 | 
					353e845120 | ||
| 
						 | 
					d1451f18d9 | ||
| 
						 | 
					c3a5b7b82a | ||
| 
						 | 
					70d91d60bc | ||
| 
						 | 
					bc78883017 | ||
| 
						 | 
					f929f201fb | ||
| 
						 | 
					554cf97f03 | ||
| 
						 | 
					48ccbeefda | ||
| 
						 | 
					7a217076d9 | ||
| 
						 | 
					0720bf7df1 | ||
| 
						 | 
					9d6727781d | ||
| 
						 | 
					12c1621523 | ||
| 
						 | 
					f9b48d60f2 | ||
| 
						 | 
					5c29127666 | ||
| 
						 | 
					78d767f5ec | ||
| 
						 | 
					c8b979e929 | ||
| 
						 | 
					2beaa91ca7 | ||
| 
						 | 
					efa288ceac | ||
| 
						 | 
					ad3bbd4a16 | ||
| 
						 | 
					73913443a5 | ||
| 
						 | 
					e133ff7190 | ||
| 
						 | 
					25da47c3c8 | ||
| 
						 | 
					4dc40f5eec | ||
| 
						 | 
					a1a37575f0 | ||
| 
						 | 
					c64c0e03d3 | ||
| 
						 | 
					e1e882a368 | ||
| 
						 | 
					36b0719793 | ||
| 
						 | 
					7655044dd3 | ||
| 
						 | 
					58fdd30664 | ||
| 
						 | 
					7175dbaeba | ||
| 
						 | 
					af454b5bb0 | ||
| 
						 | 
					5b2bbf37fa | ||
| 
						 | 
					6321ac9e15 | ||
| 
						 | 
					eeca72f71e | ||
| 
						 | 
					6e164e5c3d | ||
| 
						 | 
					1b452133ae | ||
| 
						 | 
					d9c34505e5 | ||
| 
						 | 
					f9885acc8c | ||
| 
						 | 
					fa9df48401 | ||
| 
						 | 
					d414a5a0f0 | ||
| 
						 | 
					9eb4460e68 | ||
| 
						 | 
					6984d16671 | ||
| 
						 | 
					5b9d0995a1 | ||
| 
						 | 
					7ad8e1fc4e | ||
| 
						 | 
					c9b31189a9 | ||
| 
						 | 
					c76b7a1a82 | ||
| 
						 | 
					c940e07014 | ||
| 
						 | 
					88be4ebfbc | ||
| 
						 | 
					effa47b80a | ||
| 
						 | 
					067400b16e | ||
| 
						 | 
					748628ced0 | ||
| 
						 | 
					6791060eae | ||
| 
						 | 
					502dfeb8de | ||
| 
						 | 
					5bbed29518 | ||
| 
						 | 
					2f2d33f470 | ||
| 
						 | 
					be60a3feaa | ||
| 
						 | 
					e504a829a0 | ||
| 
						 | 
					0d829f6681 | ||
| 
						 | 
					d9540579c5 | ||
| 
						 | 
					ecf963b80d | ||
| 
						 | 
					7fc6d35be0 | ||
| 
						 | 
					e7d2a37158 | ||
| 
						 | 
					531c6fc8f3 | ||
| 
						 | 
					e011d0a3c4 | ||
| 
						 | 
					8d5505d099 | ||
| 
						 | 
					d36e0ee460 | ||
| 
						 | 
					143619ccf6 | ||
| 
						 | 
					9f339d75b5 | ||
| 
						 | 
					28583660fb | ||
| 
						 | 
					dedfe959dd | ||
| 
						 | 
					4d936ace08 | ||
| 
						 | 
					89bd25eb26 | ||
| 
						 | 
					4a1cf50187 | ||
| 
						 | 
					32e12316e5 | ||
| 
						 | 
					ad7b24f145 | ||
| 
						 | 
					c2770c0e0e | ||
| 
						 | 
					371056f2b9 | ||
| 
						 | 
					2d613908e8 | ||
| 
						 | 
					18fb1fae08 | ||
| 
						 | 
					39ef161c72 | ||
| 
						 | 
					a7612c5066 | ||
| 
						 | 
					6cbae10b5e | ||
| 
						 | 
					ebe81134c0 | ||
| 
						 | 
					a1d573e282 | ||
| 
						 | 
					e959e24b47 | ||
| 
						 | 
					3f98d7c0b5 | ||
| 
						 | 
					d2f950c984 | ||
| 
						 | 
					63e8f16737 | ||
| 
						 | 
					9bf5fd894f | ||
| 
						 | 
					6296729fae | ||
| 
						 | 
					67d216801b | ||
| 
						 | 
					0a5575f3f6 | ||
| 
						 | 
					418044cbab | ||
| 
						 | 
					8c67b13407 | ||
| 
						 | 
					2a477ccf0b | ||
| 
						 | 
					c34137bef9 | ||
| 
						 | 
					914d91c5b3 | ||
| 
						 | 
					e733dea3ce | 
							
								
								
									
										77
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,77 @@
 | 
			
		||||
# Object files
 | 
			
		||||
*.o
 | 
			
		||||
 | 
			
		||||
# editor artefacts
 | 
			
		||||
*.swp
 | 
			
		||||
.#*
 | 
			
		||||
#*#
 | 
			
		||||
*~
 | 
			
		||||
 | 
			
		||||
# Top level excludes
 | 
			
		||||
/Makefile.bak
 | 
			
		||||
/Makefile
 | 
			
		||||
/*.a
 | 
			
		||||
/include
 | 
			
		||||
/*.pc
 | 
			
		||||
/rehash.time
 | 
			
		||||
 | 
			
		||||
# Most *.c files under test/ are symlinks
 | 
			
		||||
/test/*.c
 | 
			
		||||
# Apart from these
 | 
			
		||||
!/test/asn1test.c
 | 
			
		||||
!/test/methtest.c
 | 
			
		||||
!/test/dummytest.c
 | 
			
		||||
!/test/igetest.c
 | 
			
		||||
!/test/r160test.c
 | 
			
		||||
!/test/fips_algvs.c
 | 
			
		||||
 | 
			
		||||
/test/*.ss
 | 
			
		||||
/test/*.srl
 | 
			
		||||
/test/.rnd
 | 
			
		||||
/test/test*.pem
 | 
			
		||||
/test/newkey.pem
 | 
			
		||||
 | 
			
		||||
# Certificate symbolic links
 | 
			
		||||
*.0
 | 
			
		||||
 | 
			
		||||
# Links under apps
 | 
			
		||||
/apps/CA.pl
 | 
			
		||||
/apps/md4.c
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Auto generated headers
 | 
			
		||||
/crypto/buildinf.h
 | 
			
		||||
/crypto/opensslconf.h
 | 
			
		||||
 | 
			
		||||
# Auto generated assembly language source files
 | 
			
		||||
*.s
 | 
			
		||||
!/crypto/bn/asm/pa-risc2.s
 | 
			
		||||
!/crypto/bn/asm/pa-risc2W.s
 | 
			
		||||
 | 
			
		||||
# Executables
 | 
			
		||||
/apps/openssl
 | 
			
		||||
/test/sha256t
 | 
			
		||||
/test/sha512t
 | 
			
		||||
/test/*test
 | 
			
		||||
/test/fips_aesavs
 | 
			
		||||
/test/fips_desmovs
 | 
			
		||||
/test/fips_dhvs
 | 
			
		||||
/test/fips_drbgvs
 | 
			
		||||
/test/fips_dssvs
 | 
			
		||||
/test/fips_ecdhvs
 | 
			
		||||
/test/fips_ecdsavs
 | 
			
		||||
/test/fips_rngvs
 | 
			
		||||
/test/fips_test_suite
 | 
			
		||||
*.so*
 | 
			
		||||
*.dylib*
 | 
			
		||||
*.dll*
 | 
			
		||||
# Exceptions
 | 
			
		||||
!/test/bctest
 | 
			
		||||
!/crypto/des/times/486-50.sol
 | 
			
		||||
 | 
			
		||||
# Misc auto generated files
 | 
			
		||||
/tools/c_rehash
 | 
			
		||||
/test/evptests.txt
 | 
			
		||||
lib
 | 
			
		||||
Makefile.save
 | 
			
		||||
*.bak
 | 
			
		||||
							
								
								
									
										132
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										132
									
								
								CHANGES
									
									
									
									
									
								
							@@ -2,6 +2,125 @@
 | 
			
		||||
 OpenSSL CHANGES
 | 
			
		||||
 _______________
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.1d and 1.0.1e [11 Feb 2013]
 | 
			
		||||
 | 
			
		||||
  *)
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.1c and 1.0.1d [5 Feb 2013]
 | 
			
		||||
 | 
			
		||||
  *) Make the decoding of SSLv3, TLS and DTLS CBC records constant time.
 | 
			
		||||
 | 
			
		||||
     This addresses the flaw in CBC record processing discovered by 
 | 
			
		||||
     Nadhem Alfardan and Kenny Paterson. Details of this attack can be found
 | 
			
		||||
     at: http://www.isg.rhul.ac.uk/tls/     
 | 
			
		||||
 | 
			
		||||
     Thanks go to Nadhem Alfardan and Kenny Paterson of the Information
 | 
			
		||||
     Security Group at Royal Holloway, University of London
 | 
			
		||||
     (www.isg.rhul.ac.uk) for discovering this flaw and Adam Langley and
 | 
			
		||||
     Emilia K<>sper for the initial patch.
 | 
			
		||||
     (CVE-2013-0169)
 | 
			
		||||
     [Emilia K<>sper, Adam Langley, Ben Laurie, Andy Polyakov, Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Fix flaw in AESNI handling of TLS 1.2 and 1.1 records for CBC mode
 | 
			
		||||
     ciphersuites which can be exploited in a denial of service attack.
 | 
			
		||||
     Thanks go to and to Adam Langley <agl@chromium.org> for discovering
 | 
			
		||||
     and detecting this bug and to Wolfgang Ettlinger
 | 
			
		||||
     <wolfgang.ettlinger@gmail.com> for independently discovering this issue.
 | 
			
		||||
     (CVE-2012-2686)
 | 
			
		||||
     [Adam Langley]
 | 
			
		||||
 | 
			
		||||
  *) Return an error when checking OCSP signatures when key is NULL.
 | 
			
		||||
     This fixes a DoS attack. (CVE-2013-0166)
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Make openssl verify return errors.
 | 
			
		||||
     [Chris Palmer <palmer@google.com> and Ben Laurie]
 | 
			
		||||
 | 
			
		||||
  *) Call OCSP Stapling callback after ciphersuite has been chosen, so
 | 
			
		||||
     the right response is stapled. Also change SSL_get_certificate()
 | 
			
		||||
     so it returns the certificate actually sent.
 | 
			
		||||
     See http://rt.openssl.org/Ticket/Display.html?id=2836.
 | 
			
		||||
     [Rob Stradling <rob.stradling@comodo.com>]
 | 
			
		||||
 | 
			
		||||
  *) Fix possible deadlock when decoding public keys.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Don't use TLS 1.0 record version number in initial client hello
 | 
			
		||||
     if renegotiating.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.1b and 1.0.1c [10 May 2012]
 | 
			
		||||
 | 
			
		||||
  *) Sanity check record length before skipping explicit IV in TLS
 | 
			
		||||
     1.2, 1.1 and DTLS to fix DoS attack.
 | 
			
		||||
 | 
			
		||||
     Thanks to Codenomicon for discovering this issue using Fuzz-o-Matic
 | 
			
		||||
     fuzzing as a service testing platform.
 | 
			
		||||
     (CVE-2012-2333)
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Initialise tkeylen properly when encrypting CMS messages.
 | 
			
		||||
     Thanks to Solar Designer of Openwall for reporting this issue.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) In FIPS mode don't try to use composite ciphers as they are not
 | 
			
		||||
     approved.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.1a and 1.0.1b [26 Apr 2012]
 | 
			
		||||
 | 
			
		||||
  *) OpenSSL 1.0.0 sets SSL_OP_ALL to 0x80000FFFL and OpenSSL 1.0.1 and
 | 
			
		||||
     1.0.1a set SSL_OP_NO_TLSv1_1 to 0x00000400L which would unfortunately
 | 
			
		||||
     mean any application compiled against OpenSSL 1.0.0 headers setting
 | 
			
		||||
     SSL_OP_ALL would also set SSL_OP_NO_TLSv1_1, unintentionally disablng
 | 
			
		||||
     TLS 1.1 also. Fix this by changing the value of SSL_OP_NO_TLSv1_1 to
 | 
			
		||||
     0x10000000L Any application which was previously compiled against
 | 
			
		||||
     OpenSSL 1.0.1 or 1.0.1a headers and which cares about SSL_OP_NO_TLSv1_1
 | 
			
		||||
     will need to be recompiled as a result. Letting be results in
 | 
			
		||||
     inability to disable specifically TLS 1.1 and in client context,
 | 
			
		||||
     in unlike event, limit maximum offered version to TLS 1.0 [see below].
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) In order to ensure interoperabilty SSL_OP_NO_protocolX does not
 | 
			
		||||
     disable just protocol X, but all protocols above X *if* there are
 | 
			
		||||
     protocols *below* X still enabled. In more practical terms it means
 | 
			
		||||
     that if application wants to disable TLS1.0 in favor of TLS1.1 and
 | 
			
		||||
     above, it's not sufficient to pass SSL_OP_NO_TLSv1, one has to pass
 | 
			
		||||
     SSL_OP_NO_TLSv1|SSL_OP_NO_SSLv3|SSL_OP_NO_SSLv2. This applies to
 | 
			
		||||
     client side.
 | 
			
		||||
     [Andy Polyakov]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.1 and 1.0.1a [19 Apr 2012]
 | 
			
		||||
 | 
			
		||||
  *) Check for potentially exploitable overflows in asn1_d2i_read_bio
 | 
			
		||||
     BUF_mem_grow and BUF_mem_grow_clean. Refuse attempts to shrink buffer
 | 
			
		||||
     in CRYPTO_realloc_clean.
 | 
			
		||||
 | 
			
		||||
     Thanks to Tavis Ormandy, Google Security Team, for discovering this
 | 
			
		||||
     issue and to Adam Langley <agl@chromium.org> for fixing it.
 | 
			
		||||
     (CVE-2012-2110)
 | 
			
		||||
     [Adam Langley (Google), Tavis Ormandy, Google Security Team]
 | 
			
		||||
 | 
			
		||||
  *) Don't allow TLS 1.2 SHA-256 ciphersuites in TLS 1.0, 1.1 connections.
 | 
			
		||||
     [Adam Langley]
 | 
			
		||||
 | 
			
		||||
  *) Workarounds for some broken servers that "hang" if a client hello
 | 
			
		||||
     record length exceeds 255 bytes.
 | 
			
		||||
 | 
			
		||||
     1. Do not use record version number > TLS 1.0 in initial client
 | 
			
		||||
        hello: some (but not all) hanging servers will now work.
 | 
			
		||||
     2. If we set OPENSSL_MAX_TLS1_2_CIPHER_LENGTH this will truncate
 | 
			
		||||
	the number of ciphers sent in the client hello. This should be
 | 
			
		||||
        set to an even number, such as 50, for example by passing:
 | 
			
		||||
        -DOPENSSL_MAX_TLS1_2_CIPHER_LENGTH=50 to config or Configure.
 | 
			
		||||
        Most broken servers should now work.
 | 
			
		||||
     3. If all else fails setting OPENSSL_NO_TLS1_2_CLIENT will disable
 | 
			
		||||
	TLS 1.2 client support entirely.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Fix SEGV in Vector Permutation AES module observed in OpenSSH.
 | 
			
		||||
     [Andy Polyakov]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.0h and 1.0.1  [14 Mar 2012]
 | 
			
		||||
 | 
			
		||||
  *) Add compatibility with old MDC2 signatures which use an ASN1 OCTET
 | 
			
		||||
@@ -285,7 +404,18 @@
 | 
			
		||||
       Add command line options to s_client/s_server.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.0g and 1.0.0h [xx XXX xxxx]
 | 
			
		||||
 Changes between 1.0.0g and 1.0.0h [12 Mar 2012]
 | 
			
		||||
 | 
			
		||||
  *) Fix MMA (Bleichenbacher's attack on PKCS #1 v1.5 RSA padding) weakness
 | 
			
		||||
     in CMS and PKCS7 code. When RSA decryption fails use a random key for
 | 
			
		||||
     content decryption and always return the same error. Note: this attack
 | 
			
		||||
     needs on average 2^20 messages so it only affects automated senders. The
 | 
			
		||||
     old behaviour can be reenabled in the CMS code by setting the
 | 
			
		||||
     CMS_DEBUG_DECRYPT flag: this is useful for debugging and testing where
 | 
			
		||||
     an MMA defence is not necessary.
 | 
			
		||||
     Thanks to Ivan Nestlerode <inestlerode@us.ibm.com> for discovering
 | 
			
		||||
     this issue. (CVE-2012-0884)
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Fix CVE-2011-4619: make sure we really are receiving a 
 | 
			
		||||
     client hello before rejecting multiple SGC restarts. Thanks to
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										18
									
								
								Configure
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								Configure
									
									
									
									
									
								
							@@ -171,20 +171,22 @@ my %table=(
 | 
			
		||||
"debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
 | 
			
		||||
"debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
 | 
			
		||||
"debug-ben-debug",	"gcc44:$gcc_devteam_warn -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O2 -pipe::(unknown)::::::",
 | 
			
		||||
"debug-ben-debug-64",	"gcc:$gcc_devteam_warn -Wno-error=overlength-strings -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O3 -pipe::${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)",
 | 
			
		||||
"debug-ben-macos",	"cc:$gcc_devteam_warn -arch i386 -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::-Wl,-search_paths_first::::",
 | 
			
		||||
"debug-ben-macos-gcc46",	"gcc-mp-4.6:$gcc_devteam_warn -Wconversion -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::::::",
 | 
			
		||||
"debug-ben-darwin64","cc:$gcc_devteam_warn -Wno-language-extension-token -Wno-extended-offsetof -arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
			
		||||
"debug-ben-no-opt",	"gcc: -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG -Werror -DL_ENDIAN -DTERMIOS -Wall -g3::(unknown)::::::",
 | 
			
		||||
"debug-ben-strict",	"gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith -Wcast-qual -Wwrite-strings -pipe::(unknown)::::::",
 | 
			
		||||
"debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
 | 
			
		||||
"debug-bodo",	"gcc:$gcc_devteam_warn -DBN_DEBUG -DBN_DEBUG_RAND -DCONF_DEBUG -DBIO_PAIR_DEBUG -m64 -DL_ENDIAN -DTERMIO -g -DMD32_REG_T=int::-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",
 | 
			
		||||
"debug-ulf", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DBN_DEBUG_RAND -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations:::CYGWIN32:::${no_asm}:win32:cygwin-shared:::.dll",
 | 
			
		||||
"debug-steve64", "gcc:$gcc_devteam_warn -m64 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -g::-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)",
 | 
			
		||||
"debug-steve64", "gcc:$gcc_devteam_warn -m64 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -Wno-overlength-strings -g::-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)",
 | 
			
		||||
"debug-steve32", "gcc:$gcc_devteam_warn -m32 -DL_ENDIAN -DCONF_DEBUG -DDEBUG_SAFESTACK -g -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-steve-opt", "gcc:$gcc_devteam_warn -m64 -O3 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -g::-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)",
 | 
			
		||||
"debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-levitte-linux-noasm-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -ggdb -g3 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -ggdb -g3 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-levitte-linux-noasm-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -ggdb -g3 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-geoff32","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:BN_LLONG:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-geoff64","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
 | 
			
		||||
@@ -243,7 +245,7 @@ my %table=(
 | 
			
		||||
"solaris-sparcv7-cc","cc:-xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"solaris-sparcv8-cc","cc:-xarch=v8 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"solaris-sparcv9-cc","cc:-xtarget=ultra -xarch=v8plus -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"solaris64-sparcv9-cc","cc:-xtarget=ultra -xarch=v9 -xO5 -xstrconst -xdepend -Xa -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:-KPIC:-xarch=v9 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):/usr/ccs/bin/ar rs::/64",
 | 
			
		||||
"solaris64-sparcv9-cc","cc:-xtarget=ultra -xarch=v9 -xO5 -xstrconst -xdepend -Xa -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:-KPIC:-xarch=v9 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64",
 | 
			
		||||
####
 | 
			
		||||
"debug-solaris-sparcv8-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xarch=v8 -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-solaris-sparcv9-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xtarget=ultra -xarch=v8plus -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", 
 | 
			
		||||
@@ -464,8 +466,8 @@ my %table=(
 | 
			
		||||
"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-pthread:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-maix64 -shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64",
 | 
			
		||||
# Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE
 | 
			
		||||
# at build time. $OBJECT_MODE is respected at ./config stage!
 | 
			
		||||
"aix-cc",   "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::BN_LLONG RC4_CHAR:${ppc32_asm}:aix32:dlfcn:aix-shared::-q32 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
 | 
			
		||||
"aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64",
 | 
			
		||||
"aix-cc",   "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded -D_THREAD_SAFE:AIX::BN_LLONG RC4_CHAR:${ppc32_asm}:aix32:dlfcn:aix-shared::-q32 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
 | 
			
		||||
"aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded -D_THREAD_SAFE:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64",
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Cray T90 and similar (SDSC)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										24
									
								
								FAQ
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								FAQ
									
									
									
									
									
								
							@@ -10,6 +10,7 @@ OpenSSL  -  Frequently Asked Questions
 | 
			
		||||
* Why aren't tools like 'autoconf' and 'libtool' used?
 | 
			
		||||
* What is an 'engine' version?
 | 
			
		||||
* How do I check the authenticity of the OpenSSL distribution?
 | 
			
		||||
* How does the versioning scheme work?
 | 
			
		||||
 | 
			
		||||
[LEGAL] Legal questions
 | 
			
		||||
 | 
			
		||||
@@ -82,11 +83,11 @@ OpenSSL  -  Frequently Asked Questions
 | 
			
		||||
* Which is the current version of OpenSSL?
 | 
			
		||||
 | 
			
		||||
The current version is available from <URL: http://www.openssl.org>.
 | 
			
		||||
OpenSSL 1.0.1 was released on Mar 14th, 2012.
 | 
			
		||||
OpenSSL 1.0.1e was released on Feb 11th, 2013.
 | 
			
		||||
 | 
			
		||||
In addition to the current stable release, you can also access daily
 | 
			
		||||
snapshots of the OpenSSL development version at <URL:
 | 
			
		||||
ftp://ftp.openssl.org/snapshot/>, or get it by anonymous CVS access.
 | 
			
		||||
ftp://ftp.openssl.org/snapshot/>, or get it by anonymous Git access.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
* Where is the documentation?
 | 
			
		||||
@@ -108,7 +109,9 @@ In addition, you can read the most current versions at
 | 
			
		||||
<URL: http://www.openssl.org/docs/>. Note that the online documents refer
 | 
			
		||||
to the very latest development versions of OpenSSL and may include features
 | 
			
		||||
not present in released versions. If in doubt refer to the documentation
 | 
			
		||||
that came with the version of OpenSSL you are using.
 | 
			
		||||
that came with the version of OpenSSL you are using. The pod format
 | 
			
		||||
documentation is included in each OpenSSL distribution under the docs
 | 
			
		||||
directory.
 | 
			
		||||
 | 
			
		||||
For information on parts of libcrypto that are not yet documented, you
 | 
			
		||||
might want to read Ariel Glenn's documentation on SSLeay 0.9, OpenSSL's
 | 
			
		||||
@@ -173,6 +176,19 @@ just do:
 | 
			
		||||
 | 
			
		||||
   pgp TARBALL.asc
 | 
			
		||||
 | 
			
		||||
* How does the versioning scheme work?
 | 
			
		||||
 | 
			
		||||
After the release of OpenSSL 1.0.0 the versioning scheme changed. Letter 
 | 
			
		||||
releases (e.g. 1.0.1a) can only contain bug and security fixes and no
 | 
			
		||||
new features. Minor releases change the last number (e.g. 1.0.2) and 
 | 
			
		||||
can contain new features that retain binary compatibility. Changes to
 | 
			
		||||
the middle number are considered major releases and neither source nor
 | 
			
		||||
binary compatibility is guaranteed.
 | 
			
		||||
 | 
			
		||||
Therefore the answer to the common question "when will feature X be
 | 
			
		||||
backported to OpenSSL 1.0.0/0.9.8?" is "never" but it could appear
 | 
			
		||||
in the next minor release.
 | 
			
		||||
 | 
			
		||||
[LEGAL] =======================================================================
 | 
			
		||||
 | 
			
		||||
* Do I need patent licenses to use OpenSSL?
 | 
			
		||||
@@ -284,7 +300,7 @@ current directory in this case, but this has changed with 0.9.6a.)
 | 
			
		||||
Check out the CA.pl(1) manual page. This provides a simple wrapper round
 | 
			
		||||
the 'req', 'verify', 'ca' and 'pkcs12' utilities. For finer control check
 | 
			
		||||
out the manual pages for the individual utilities and the certificate
 | 
			
		||||
extensions documentation (currently in doc/openssl.txt).
 | 
			
		||||
extensions documentation (in ca(1), req(1), x509v3_config(5) )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
* Why can't I create certificate requests?
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,7 @@
 | 
			
		||||
  is required if you intend to utilize assembler modules. Note that NASM
 | 
			
		||||
  is now the only supported assembler.
 | 
			
		||||
 | 
			
		||||
 If you are compiling from a tarball or a CVS snapshot then the Win32 files
 | 
			
		||||
 If you are compiling from a tarball or a Git snapshot then the Win32 files
 | 
			
		||||
 may well be not up to date. This may mean that some "tweaking" is required to
 | 
			
		||||
 get it all to work. See the trouble shooting section later on for if (when?)
 | 
			
		||||
 it goes wrong.
 | 
			
		||||
@@ -257,7 +257,7 @@
 | 
			
		||||
 | 
			
		||||
 then ms\do_XXX should not give a warning any more. However the numbers that
 | 
			
		||||
 get assigned by this technique may not match those that eventually get
 | 
			
		||||
 assigned in the CVS tree: so anything linked against this version of the
 | 
			
		||||
 assigned in the Git tree: so anything linked against this version of the
 | 
			
		||||
 library may need to be recompiled.
 | 
			
		||||
 | 
			
		||||
 If you get errors about unresolved symbols there are several possible
 | 
			
		||||
 
 | 
			
		||||
@@ -69,7 +69,7 @@ RANLIB= ranlib
 | 
			
		||||
NM= nm
 | 
			
		||||
PERL= perl
 | 
			
		||||
TAR= tar
 | 
			
		||||
TARFLAGS= --no-recursion
 | 
			
		||||
TARFLAGS= --no-recursion --record-size=10240
 | 
			
		||||
MAKEDEPPROG=makedepend
 | 
			
		||||
LIBDIR=lib
 | 
			
		||||
 | 
			
		||||
@@ -198,7 +198,7 @@ CLEARENV=	TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS}	\
 | 
			
		||||
		$${EXHEADER+EXHEADER} $${HEADER+HEADER}		\
 | 
			
		||||
		$${GENERAL+GENERAL} $${CFLAGS+CFLAGS}		\
 | 
			
		||||
		$${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS}		\
 | 
			
		||||
		$${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS}		\
 | 
			
		||||
		$${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS}	\
 | 
			
		||||
		$${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS}	\
 | 
			
		||||
		$${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
 | 
			
		||||
 | 
			
		||||
@@ -444,7 +444,7 @@ rehash.time: certs apps
 | 
			
		||||
		[ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \
 | 
			
		||||
		OPENSSL_DEBUG_MEMORY=on; \
 | 
			
		||||
		export OPENSSL OPENSSL_DEBUG_MEMORY; \
 | 
			
		||||
		$(PERL) tools/c_rehash certs) && \
 | 
			
		||||
		$(PERL) tools/c_rehash certs/demo) && \
 | 
			
		||||
		touch rehash.time; \
 | 
			
		||||
	else :; fi
 | 
			
		||||
 | 
			
		||||
@@ -469,9 +469,9 @@ tags:
 | 
			
		||||
	find . -name '[^.]*.[ch]' | xargs etags -a
 | 
			
		||||
 | 
			
		||||
errors:
 | 
			
		||||
	$(PERL) util/ck_errf.pl -strict */*.c */*/*.c
 | 
			
		||||
	$(PERL) util/mkerr.pl -recurse -write
 | 
			
		||||
	(cd engines; $(MAKE) PERL=$(PERL) errors)
 | 
			
		||||
	$(PERL) util/ck_errf.pl -strict */*.c */*/*.c
 | 
			
		||||
 | 
			
		||||
stacks:
 | 
			
		||||
	$(PERL) util/mkstack.pl -write
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										29
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								NEWS
									
									
									
									
									
								
							@@ -5,6 +5,35 @@
 | 
			
		||||
  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.1d and OpenSSL 1.0.1e:
 | 
			
		||||
 | 
			
		||||
      o Corrected fix for CVE-2013-0169
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.1c and OpenSSL 1.0.1d:
 | 
			
		||||
 | 
			
		||||
      o Fix renegotiation in TLS 1.1, 1.2 by using the correct TLS version.
 | 
			
		||||
      o Include the fips configuration module.
 | 
			
		||||
      o Fix OCSP bad key DoS attack CVE-2013-0166
 | 
			
		||||
      o Fix for SSL/TLS/DTLS CBC plaintext recovery attack CVE-2013-0169
 | 
			
		||||
      o Fix for TLS AESNI record handling flaw CVE-2012-2686
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.1b and OpenSSL 1.0.1c:
 | 
			
		||||
 | 
			
		||||
      o Fix TLS/DTLS record length checking bug CVE-2012-2333
 | 
			
		||||
      o Don't attempt to use non-FIPS composite ciphers in FIPS mode.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.1a and OpenSSL 1.0.1b:
 | 
			
		||||
 | 
			
		||||
      o Fix compilation error on non-x86 platforms.
 | 
			
		||||
      o Make FIPS capable OpenSSL ciphers work in non-FIPS mode.
 | 
			
		||||
      o Fix SSL_OP_NO_TLSv1_1 clash with SSL_OP_ALL in OpenSSL 1.0.0
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.1 and OpenSSL 1.0.1a:
 | 
			
		||||
 | 
			
		||||
      o Fix for ASN1 overflow bug CVE-2012-2110
 | 
			
		||||
      o Workarounds for some servers that hang on long client hellos.
 | 
			
		||||
      o Fix SEGV in AES code.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.0h and OpenSSL 1.0.1:
 | 
			
		||||
 | 
			
		||||
      o TLS/DTLS heartbeat support.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								PROBLEMS
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								PROBLEMS
									
									
									
									
									
								
							@@ -197,3 +197,17 @@ reconfigure with additional no-sse2 [or 386] option passed to ./config.
 | 
			
		||||
We don't have framework to associate -ldl with no-dso, therefore the only
 | 
			
		||||
way is to edit Makefile right after ./config no-dso and remove -ldl from
 | 
			
		||||
EX_LIBS line.
 | 
			
		||||
 | 
			
		||||
* hpux-parisc2-cc no-asm build fails with SEGV in ECDSA/DH.
 | 
			
		||||
 | 
			
		||||
Compiler bug, presumably at particular patch level. Remaining
 | 
			
		||||
hpux*-parisc*-cc configurations can be affected too. Drop optimization
 | 
			
		||||
level to +O2 when compiling bn_nist.o.
 | 
			
		||||
 | 
			
		||||
* solaris64-sparcv9-cc link failure
 | 
			
		||||
 | 
			
		||||
Solaris 8 ar can fail to maintain symbol table in .a, which results in
 | 
			
		||||
link failures. Apply 109147-09 or later or modify Makefile generated
 | 
			
		||||
by ./Configure solaris64-sparcv9-cc and replace RANLIB assignment with
 | 
			
		||||
 | 
			
		||||
	RANLIB= /usr/ccs/bin/ar rs
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								README
									
									
									
									
									
								
							@@ -1,5 +1,5 @@
 | 
			
		||||
 | 
			
		||||
 OpenSSL 1.0.1 14 Mar 2012
 | 
			
		||||
 OpenSSL 1.0.1e 11 Feb 2013
 | 
			
		||||
 | 
			
		||||
 Copyright (c) 1998-2011 The OpenSSL Project
 | 
			
		||||
 Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
 | 
			
		||||
@@ -190,7 +190,7 @@
 | 
			
		||||
 reason as to why that feature isn't implemented.
 | 
			
		||||
 | 
			
		||||
 Patches should be as up to date as possible, preferably relative to the
 | 
			
		||||
 current CVS or the last snapshot. They should follow the coding style of
 | 
			
		||||
 current Git or the last snapshot. They should follow the coding style of
 | 
			
		||||
 OpenSSL and compile without warnings. Some of the core team developer targets
 | 
			
		||||
 can be used for testing purposes, (debug-steve64, debug-geoff etc). OpenSSL
 | 
			
		||||
 compiles on many varied platforms: try to ensure you only use portable
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								STATUS
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								STATUS
									
									
									
									
									
								
							@@ -1,10 +1,15 @@
 | 
			
		||||
 | 
			
		||||
  OpenSSL STATUS                           Last modified at
 | 
			
		||||
  ______________                           $Date: 2012/03/14 12:14:06 $
 | 
			
		||||
  ______________                           $Date: 2012/05/10 15:16:36 $
 | 
			
		||||
 | 
			
		||||
  DEVELOPMENT STATE
 | 
			
		||||
 | 
			
		||||
    o  OpenSSL 1.1.0:  Under development...
 | 
			
		||||
    o  OpenSSL 1.0.1e: Released on February  11th, 2013
 | 
			
		||||
    o  OpenSSL 1.0.1d: Released on February   5th, 2013
 | 
			
		||||
    o  OpenSSL 1.0.1c: Released on May       10th, 2012
 | 
			
		||||
    o  OpenSSL 1.0.1b: Released on April     26th, 2012
 | 
			
		||||
    o  OpenSSL 1.0.1a: Released on April     19th, 2012
 | 
			
		||||
    o  OpenSSL 1.0.1:  Released on March     14th, 2012
 | 
			
		||||
    o  OpenSSL 1.0.0h: Released on March     12th, 2012
 | 
			
		||||
    o  OpenSSL 1.0.0g: Released on January   18th, 2012
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								TABLE
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								TABLE
									
									
									
									
									
								
							@@ -862,7 +862,7 @@ $multilib     =
 | 
			
		||||
$cc           = cc
 | 
			
		||||
$cflags       = -q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -qthreaded
 | 
			
		||||
$thread_cflag = -qthreaded -D_THREAD_SAFE
 | 
			
		||||
$sys_id       = AIX
 | 
			
		||||
$lflags       = 
 | 
			
		||||
$bn_ops       = BN_LLONG RC4_CHAR
 | 
			
		||||
@@ -961,7 +961,7 @@ $multilib     =
 | 
			
		||||
$cc           = cc
 | 
			
		||||
$cflags       = -q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -qthreaded
 | 
			
		||||
$thread_cflag = -qthreaded -D_THREAD_SAFE
 | 
			
		||||
$sys_id       = AIX
 | 
			
		||||
$lflags       = 
 | 
			
		||||
$bn_ops       = SIXTY_FOUR_BIT_LONG RC4_CHAR
 | 
			
		||||
@@ -2114,7 +2114,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** debug-levitte-linux-elf
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe
 | 
			
		||||
$cflags       = -DLEVITTE_DEBUG -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -ggdb -g3 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -2147,7 +2147,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 -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe
 | 
			
		||||
$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
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -2180,7 +2180,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** debug-levitte-linux-noasm
 | 
			
		||||
$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 -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe
 | 
			
		||||
$cflags       = -DLEVITTE_DEBUG -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -ggdb -g3 -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -2213,7 +2213,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 -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe
 | 
			
		||||
$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
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -5441,7 +5441,7 @@ $shared_target= solaris-shared
 | 
			
		||||
$shared_cflag = -KPIC
 | 
			
		||||
$shared_ldflag = -xarch=v9 -G -dy -z text
 | 
			
		||||
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
 | 
			
		||||
$ranlib       = /usr/ccs/bin/ar rs
 | 
			
		||||
$ranlib       = 
 | 
			
		||||
$arflags      = 
 | 
			
		||||
$multilib     = /64
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2132,7 +2132,7 @@ X509_NAME *parse_name(char *subject, long chtype, int multirdn)
 | 
			
		||||
	X509_NAME *n = NULL;
 | 
			
		||||
	int nid;
 | 
			
		||||
 | 
			
		||||
	if (!buf || !ne_types || !ne_values)
 | 
			
		||||
	if (!buf || !ne_types || !ne_values || !mval)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err, "malloc error\n");
 | 
			
		||||
		goto error;
 | 
			
		||||
@@ -2236,6 +2236,7 @@ X509_NAME *parse_name(char *subject, long chtype, int multirdn)
 | 
			
		||||
	OPENSSL_free(ne_values);
 | 
			
		||||
	OPENSSL_free(ne_types);
 | 
			
		||||
	OPENSSL_free(buf);
 | 
			
		||||
	OPENSSL_free(mval);
 | 
			
		||||
	return n;
 | 
			
		||||
 | 
			
		||||
error:
 | 
			
		||||
@@ -2244,6 +2245,8 @@ error:
 | 
			
		||||
		OPENSSL_free(ne_values);
 | 
			
		||||
	if (ne_types)
 | 
			
		||||
		OPENSSL_free(ne_types);
 | 
			
		||||
	if (mval)
 | 
			
		||||
		OPENSSL_free(mval);
 | 
			
		||||
	if (buf)
 | 
			
		||||
		OPENSSL_free(buf);
 | 
			
		||||
	return NULL;
 | 
			
		||||
 
 | 
			
		||||
@@ -1408,6 +1408,7 @@ bad:
 | 
			
		||||
			if (!NCONF_get_number(conf,section,
 | 
			
		||||
				ENV_DEFAULT_CRL_HOURS, &crlhours))
 | 
			
		||||
				crlhours = 0;
 | 
			
		||||
			ERR_clear_error();
 | 
			
		||||
			}
 | 
			
		||||
		if ((crldays == 0) && (crlhours == 0) && (crlsec == 0))
 | 
			
		||||
			{
 | 
			
		||||
 
 | 
			
		||||
@@ -233,6 +233,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		else if (!strcmp(*args,"-camellia256"))
 | 
			
		||||
				cipher = EVP_camellia_256_cbc();
 | 
			
		||||
#endif
 | 
			
		||||
		else if (!strcmp (*args, "-debug_decrypt")) 
 | 
			
		||||
				flags |= CMS_DEBUG_DECRYPT;
 | 
			
		||||
		else if (!strcmp (*args, "-text")) 
 | 
			
		||||
				flags |= CMS_TEXT;
 | 
			
		||||
		else if (!strcmp (*args, "-nointern")) 
 | 
			
		||||
@@ -1039,6 +1041,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	ret = 4;
 | 
			
		||||
	if (operation == SMIME_DECRYPT)
 | 
			
		||||
		{
 | 
			
		||||
		if (flags & CMS_DEBUG_DECRYPT)
 | 
			
		||||
			CMS_decrypt(cms, NULL, NULL, NULL, NULL, flags);
 | 
			
		||||
 | 
			
		||||
		if (secret_key)
 | 
			
		||||
			{
 | 
			
		||||
 
 | 
			
		||||
@@ -216,10 +216,10 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			out_bin = 1;
 | 
			
		||||
		else if (strcmp(*argv,"-d") == 0)
 | 
			
		||||
			debug=1;
 | 
			
		||||
		else if (strcmp(*argv,"-non-fips-allow") == 0)
 | 
			
		||||
			non_fips_allow=1;
 | 
			
		||||
		else if (!strcmp(*argv,"-fips-fingerprint"))
 | 
			
		||||
			hmac_key = "etaonrishdlcupfm";
 | 
			
		||||
		else if (strcmp(*argv,"-non-fips-allow") == 0)
 | 
			
		||||
			non_fips_allow=1;
 | 
			
		||||
		else if (!strcmp(*argv,"-hmac"))
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1)
 | 
			
		||||
 
 | 
			
		||||
@@ -332,7 +332,6 @@ bad:
 | 
			
		||||
			BIO_printf(bio_err,"This is going to take a long time\n");
 | 
			
		||||
			if(!dh || !DH_generate_parameters_ex(dh, num, g, &cb))
 | 
			
		||||
				{
 | 
			
		||||
				if(dh) DH_free(dh);
 | 
			
		||||
				ERR_print_errors(bio_err);
 | 
			
		||||
				goto end;
 | 
			
		||||
				}
 | 
			
		||||
 
 | 
			
		||||
@@ -326,6 +326,7 @@ bad:
 | 
			
		||||
				goto end;
 | 
			
		||||
				}
 | 
			
		||||
#endif
 | 
			
		||||
			ERR_print_errors(bio_err);
 | 
			
		||||
			BIO_printf(bio_err,"Error, DSA key generation failed\n");
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
@@ -429,13 +430,19 @@ bad:
 | 
			
		||||
 | 
			
		||||
		assert(need_rand);
 | 
			
		||||
		if ((dsakey=DSAparams_dup(dsa)) == NULL) goto end;
 | 
			
		||||
		if (!DSA_generate_key(dsakey)) goto end;
 | 
			
		||||
		if (!DSA_generate_key(dsakey))
 | 
			
		||||
			{
 | 
			
		||||
			ERR_print_errors(bio_err);
 | 
			
		||||
			DSA_free(dsakey);
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
		if 	(outformat == FORMAT_ASN1)
 | 
			
		||||
			i=i2d_DSAPrivateKey_bio(out,dsakey);
 | 
			
		||||
		else if (outformat == FORMAT_PEM)
 | 
			
		||||
			i=PEM_write_bio_DSAPrivateKey(out,dsakey,NULL,NULL,0,NULL,NULL);
 | 
			
		||||
		else	{
 | 
			
		||||
			BIO_printf(bio_err,"bad output format specified for outfile\n");
 | 
			
		||||
			DSA_free(dsakey);
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
		DSA_free(dsakey);
 | 
			
		||||
 
 | 
			
		||||
@@ -78,7 +78,7 @@
 | 
			
		||||
#include <openssl/pem.h>
 | 
			
		||||
#include <openssl/rand.h>
 | 
			
		||||
 | 
			
		||||
#define DEFBITS	512
 | 
			
		||||
#define DEFBITS	1024
 | 
			
		||||
#undef PROG
 | 
			
		||||
#define PROG genrsa_main
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -617,7 +617,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		BIO_printf (bio_err, "-ndays n	 	 number of days before next update\n");
 | 
			
		||||
		BIO_printf (bio_err, "-resp_key_id       identify reponse by signing certificate key ID\n");
 | 
			
		||||
		BIO_printf (bio_err, "-nrequest n        number of requests to accept (default unlimited)\n");
 | 
			
		||||
		BIO_printf (bio_err, "-<dgst alg>     use specified digest in the request");
 | 
			
		||||
		BIO_printf (bio_err, "-<dgst alg>     use specified digest in the request\n");
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -237,8 +237,8 @@ int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file)
 | 
			
		||||
 | 
			
		||||
		/* If we are using DSA, we can copy the parameters from
 | 
			
		||||
		 * the private key */
 | 
			
		||||
		
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		/* Now we know that a key and cert have been set against
 | 
			
		||||
		 * the SSL context */
 | 
			
		||||
		if (!SSL_CTX_check_private_key(ctx))
 | 
			
		||||
@@ -436,6 +436,8 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *
 | 
			
		||||
 | 
			
		||||
	if (version == SSL3_VERSION ||
 | 
			
		||||
	    version == TLS1_VERSION ||
 | 
			
		||||
	    version == TLS1_1_VERSION ||
 | 
			
		||||
	    version == TLS1_2_VERSION ||
 | 
			
		||||
	    version == DTLS1_VERSION ||
 | 
			
		||||
	    version == DTLS1_BAD_VER)
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -357,12 +357,14 @@ static void sc_usage(void)
 | 
			
		||||
	BIO_printf(bio_err," -tlsextdebug      - hex dump of all TLS extensions received\n");
 | 
			
		||||
	BIO_printf(bio_err," -status           - request certificate status from server\n");
 | 
			
		||||
	BIO_printf(bio_err," -no_ticket        - disable use of RFC4507bis session tickets\n");
 | 
			
		||||
# if !defined(OPENSSL_NO_NEXTPROTONEG)
 | 
			
		||||
# ifndef OPENSSL_NO_NEXTPROTONEG
 | 
			
		||||
	BIO_printf(bio_err," -nextprotoneg arg - enable NPN extension, considering named protocols supported (comma-separated list)\n");
 | 
			
		||||
# endif
 | 
			
		||||
#endif
 | 
			
		||||
	BIO_printf(bio_err," -legacy_renegotiation - enable use of legacy renegotiation (dangerous)\n");
 | 
			
		||||
#ifndef OPENSSL_NO_SRTP
 | 
			
		||||
	BIO_printf(bio_err," -use_srtp profiles - Offer SRTP key management with a colon-separated profile list\n");
 | 
			
		||||
#endif
 | 
			
		||||
 	BIO_printf(bio_err," -keymatexport label   - Export keying material using label\n");
 | 
			
		||||
 	BIO_printf(bio_err," -keymatexportlen len  - Export len bytes of keying material (default 20)\n");
 | 
			
		||||
	}
 | 
			
		||||
@@ -502,7 +504,9 @@ static char * MS_CALLBACK ssl_give_srp_client_pwd_cb(SSL *s, void *arg)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_SRTP
 | 
			
		||||
	char *srtp_profiles = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
# ifndef OPENSSL_NO_NEXTPROTONEG
 | 
			
		||||
/* This the context that we pass to next_proto_cb */
 | 
			
		||||
@@ -536,7 +540,7 @@ static int next_proto_cb(SSL *s, unsigned char **out, unsigned char *outlen, con
 | 
			
		||||
	ctx->status = SSL_select_next_proto(out, outlen, in, inlen, ctx->data, ctx->len);
 | 
			
		||||
	return SSL_TLSEXT_ERR_OK;
 | 
			
		||||
	}
 | 
			
		||||
# endif
 | 
			
		||||
# endif  /* ndef OPENSSL_NO_NEXTPROTONEG */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
enum
 | 
			
		||||
@@ -945,11 +949,13 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			jpake_secret = *++argv;
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_SRTP
 | 
			
		||||
		else if (strcmp(*argv,"-use_srtp") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			srtp_profiles = *(++argv);
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
		else if (strcmp(*argv,"-keymatexport") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
@@ -1130,6 +1136,8 @@ bad:
 | 
			
		||||
			BIO_printf(bio_c_out, "PSK key given or JPAKE in use, setting client callback\n");
 | 
			
		||||
		SSL_CTX_set_psk_client_callback(ctx, psk_client_cb);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_SRTP
 | 
			
		||||
	if (srtp_profiles != NULL)
 | 
			
		||||
		SSL_CTX_set_tlsext_use_srtp(ctx, srtp_profiles);
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1890,6 +1898,10 @@ end:
 | 
			
		||||
			print_stuff(bio_c_out,con,1);
 | 
			
		||||
		SSL_free(con);
 | 
			
		||||
		}
 | 
			
		||||
#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
 | 
			
		||||
	if (next_proto.data)
 | 
			
		||||
		OPENSSL_free(next_proto.data);
 | 
			
		||||
#endif
 | 
			
		||||
	if (ctx != NULL) SSL_CTX_free(ctx);
 | 
			
		||||
	if (cert)
 | 
			
		||||
		X509_free(cert);
 | 
			
		||||
@@ -1897,6 +1909,8 @@ end:
 | 
			
		||||
		EVP_PKEY_free(key);
 | 
			
		||||
	if (pass)
 | 
			
		||||
		OPENSSL_free(pass);
 | 
			
		||||
	if (vpm)
 | 
			
		||||
		X509_VERIFY_PARAM_free(vpm);
 | 
			
		||||
	if (cbuf != NULL) { OPENSSL_cleanse(cbuf,BUFSIZZ); OPENSSL_free(cbuf); }
 | 
			
		||||
	if (sbuf != NULL) { OPENSSL_cleanse(sbuf,BUFSIZZ); OPENSSL_free(sbuf); }
 | 
			
		||||
	if (mbuf != NULL) { OPENSSL_cleanse(mbuf,BUFSIZZ); OPENSSL_free(mbuf); }
 | 
			
		||||
@@ -2061,6 +2075,7 @@ static void print_stuff(BIO *bio, SSL *s, int full)
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_SRTP
 | 
			
		||||
 	{
 | 
			
		||||
 	SRTP_PROTECTION_PROFILE *srtp_profile=SSL_get_selected_srtp_profile(s);
 | 
			
		||||
 
 | 
			
		||||
@@ -2068,6 +2083,7 @@ static void print_stuff(BIO *bio, SSL *s, int full)
 | 
			
		||||
		BIO_printf(bio,"SRTP Extension negotiated, profile=%s\n",
 | 
			
		||||
			   srtp_profile->name);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
	SSL_SESSION_print(bio,SSL_get_session(s));
 | 
			
		||||
	if (keymatexportlabel != NULL)
 | 
			
		||||
 
 | 
			
		||||
@@ -556,7 +556,9 @@ static void sv_usage(void)
 | 
			
		||||
# ifndef OPENSSL_NO_NEXTPROTONEG
 | 
			
		||||
	BIO_printf(bio_err," -nextprotoneg arg - set the advertised protocols for the NPN extension (comma-separated list)\n");
 | 
			
		||||
# endif
 | 
			
		||||
# ifndef OPENSSL_NO_SRTP
 | 
			
		||||
        BIO_printf(bio_err," -use_srtp profiles - Offer SRTP key management with a colon-separated profile list\n");
 | 
			
		||||
# endif
 | 
			
		||||
#endif
 | 
			
		||||
	BIO_printf(bio_err," -keymatexport label   - Export keying material using label\n");
 | 
			
		||||
	BIO_printf(bio_err," -keymatexportlen len  - Export len bytes of keying material (default 20)\n");
 | 
			
		||||
@@ -923,7 +925,9 @@ static char *jpake_secret = NULL;
 | 
			
		||||
#ifndef OPENSSL_NO_SRP
 | 
			
		||||
	static srpsrvparm srp_callback_parm;
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_SRTP
 | 
			
		||||
static char *srtp_profiles = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int MAIN(int argc, char *argv[])
 | 
			
		||||
	{
 | 
			
		||||
@@ -1206,13 +1210,13 @@ int MAIN(int argc, char *argv[])
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			srp_verifier_file = *(++argv);
 | 
			
		||||
			meth=TLSv1_server_method();
 | 
			
		||||
			meth = TLSv1_server_method();
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv, "-srpuserseed") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			srpuserseed = *(++argv);
 | 
			
		||||
			meth=TLSv1_server_method();
 | 
			
		||||
			meth = TLSv1_server_method();
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
		else if	(strcmp(*argv,"-www") == 0)
 | 
			
		||||
@@ -1319,11 +1323,13 @@ int MAIN(int argc, char *argv[])
 | 
			
		||||
			jpake_secret = *(++argv);
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_SRTP
 | 
			
		||||
		else if (strcmp(*argv,"-use_srtp") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			srtp_profiles = *(++argv);
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
		else if (strcmp(*argv,"-keymatexport") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
@@ -1431,25 +1437,24 @@ bad:
 | 
			
		||||
				goto end;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
# ifndef OPENSSL_NO_NEXTPROTONEG
 | 
			
		||||
		if (next_proto_neg_in)
 | 
			
		||||
			{
 | 
			
		||||
			unsigned short len;
 | 
			
		||||
			next_proto.data = next_protos_parse(&len,
 | 
			
		||||
				next_proto_neg_in);
 | 
			
		||||
			if (next_proto.data == NULL)
 | 
			
		||||
				goto end;
 | 
			
		||||
			next_proto.len = len;
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			next_proto.data = NULL;
 | 
			
		||||
			}
 | 
			
		||||
# endif
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) 
 | 
			
		||||
	if (next_proto_neg_in)
 | 
			
		||||
		{
 | 
			
		||||
		unsigned short len;
 | 
			
		||||
		next_proto.data = next_protos_parse(&len, next_proto_neg_in);
 | 
			
		||||
		if (next_proto.data == NULL)
 | 
			
		||||
			goto end;
 | 
			
		||||
		next_proto.len = len;
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		next_proto.data = NULL;
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	if (s_dcert_file)
 | 
			
		||||
		{
 | 
			
		||||
@@ -1550,8 +1555,10 @@ bad:
 | 
			
		||||
	else
 | 
			
		||||
		SSL_CTX_sess_set_cache_size(ctx,128);
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_SRTP
 | 
			
		||||
	if (srtp_profiles != NULL)
 | 
			
		||||
		SSL_CTX_set_tlsext_use_srtp(ctx, srtp_profiles);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
	if (cipher == NULL) cipher=getenv("SSL_CIPHER");
 | 
			
		||||
@@ -1730,7 +1737,7 @@ bad:
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
	
 | 
			
		||||
	if (!set_cert_key_stuff(ctx,s_cert,s_key))
 | 
			
		||||
	if (!set_cert_key_stuff(ctx, s_cert, s_key))
 | 
			
		||||
		goto end;
 | 
			
		||||
#ifndef OPENSSL_NO_TLSEXT
 | 
			
		||||
	if (ctx2 && !set_cert_key_stuff(ctx2,s_cert2,s_key2))
 | 
			
		||||
@@ -1738,7 +1745,7 @@ bad:
 | 
			
		||||
#endif
 | 
			
		||||
	if (s_dcert != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		if (!set_cert_key_stuff(ctx,s_dcert,s_dkey))
 | 
			
		||||
		if (!set_cert_key_stuff(ctx, s_dcert, s_dkey))
 | 
			
		||||
			goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -1893,7 +1900,15 @@ end:
 | 
			
		||||
		OPENSSL_free(pass);
 | 
			
		||||
	if (dpass)
 | 
			
		||||
		OPENSSL_free(dpass);
 | 
			
		||||
	if (vpm)
 | 
			
		||||
		X509_VERIFY_PARAM_free(vpm);
 | 
			
		||||
#ifndef OPENSSL_NO_TLSEXT
 | 
			
		||||
	if (tlscstatp.host)
 | 
			
		||||
		OPENSSL_free(tlscstatp.host);
 | 
			
		||||
	if (tlscstatp.port)
 | 
			
		||||
		OPENSSL_free(tlscstatp.port);
 | 
			
		||||
	if (tlscstatp.path)
 | 
			
		||||
		OPENSSL_free(tlscstatp.path);
 | 
			
		||||
	if (ctx2 != NULL) SSL_CTX_free(ctx2);
 | 
			
		||||
	if (s_cert2)
 | 
			
		||||
		X509_free(s_cert2);
 | 
			
		||||
@@ -2433,6 +2448,7 @@ static int init_ssl_connection(SSL *con)
 | 
			
		||||
		BIO_printf(bio_s_out,"Shared ciphers:%s\n",buf);
 | 
			
		||||
	str=SSL_CIPHER_get_name(SSL_get_current_cipher(con));
 | 
			
		||||
	BIO_printf(bio_s_out,"CIPHER is %s\n",(str != NULL)?str:"(NONE)");
 | 
			
		||||
 | 
			
		||||
#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
 | 
			
		||||
	SSL_get0_next_proto_negotiated(con, &next_proto_neg, &next_proto_neg_len);
 | 
			
		||||
	if (next_proto_neg)
 | 
			
		||||
@@ -2442,6 +2458,7 @@ static int init_ssl_connection(SSL *con)
 | 
			
		||||
		BIO_printf(bio_s_out, "\n");
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_SRTP
 | 
			
		||||
	{
 | 
			
		||||
	SRTP_PROTECTION_PROFILE *srtp_profile
 | 
			
		||||
	  = SSL_get_selected_srtp_profile(con);
 | 
			
		||||
@@ -2450,6 +2467,7 @@ static int init_ssl_connection(SSL *con)
 | 
			
		||||
		BIO_printf(bio_s_out,"SRTP Extension negotiated, profile=%s\n",
 | 
			
		||||
			   srtp_profile->name);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
	if (SSL_cache_hit(con)) BIO_printf(bio_s_out,"Reused session-id\n");
 | 
			
		||||
	if (SSL_ctrl(con,SSL_CTRL_GET_FLAGS,0,NULL) &
 | 
			
		||||
		TLS1_FLAGS_TLS_PADDING_BUG)
 | 
			
		||||
@@ -2701,6 +2719,11 @@ static int www_body(char *hostname, int s, unsigned char *context)
 | 
			
		||||
				}
 | 
			
		||||
			BIO_puts(io,"\n");
 | 
			
		||||
 | 
			
		||||
			BIO_printf(io,
 | 
			
		||||
				"Secure Renegotiation IS%s supported\n",
 | 
			
		||||
		      		SSL_get_secure_renegotiation_support(con) ?
 | 
			
		||||
							"" : " NOT");
 | 
			
		||||
 | 
			
		||||
			/* The following is evil and should not really
 | 
			
		||||
			 * be done */
 | 
			
		||||
			BIO_printf(io,"Ciphers supported in s_server binary\n");
 | 
			
		||||
 
 | 
			
		||||
@@ -254,7 +254,7 @@ static const char *names[ALGOR_NUM]={
 | 
			
		||||
  "aes-128 cbc","aes-192 cbc","aes-256 cbc",
 | 
			
		||||
  "camellia-128 cbc","camellia-192 cbc","camellia-256 cbc",
 | 
			
		||||
  "evp","sha256","sha512","whirlpool",
 | 
			
		||||
  "aes-128 ige","aes-192 ige","aes-256 ige","ghash"};
 | 
			
		||||
  "aes-128 ige","aes-192 ige","aes-256 ige","ghash" };
 | 
			
		||||
static double results[ALGOR_NUM][SIZE_NUM];
 | 
			
		||||
static int lengths[SIZE_NUM]={16,64,256,1024,8*1024};
 | 
			
		||||
#ifndef OPENSSL_NO_RSA
 | 
			
		||||
@@ -299,7 +299,7 @@ static SIGRETTYPE sig_done(int sig)
 | 
			
		||||
#if defined(_WIN32)
 | 
			
		||||
 | 
			
		||||
#if !defined(SIGALRM)
 | 
			
		||||
#define SIGALRM
 | 
			
		||||
# define SIGALRM
 | 
			
		||||
#endif
 | 
			
		||||
static unsigned int lapse,schlock;
 | 
			
		||||
static void alarm_win32(unsigned int secs) { lapse = secs*1000; }
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										30
									
								
								apps/srp.c
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								apps/srp.c
									
									
									
									
									
								
							@@ -125,13 +125,13 @@ static int get_index(CA_DB *db, char* id, char type)
 | 
			
		||||
	if (type == DB_SRP_INDEX) 
 | 
			
		||||
	for (i = 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++)
 | 
			
		||||
		{
 | 
			
		||||
		pp = (char **)sk_OPENSSL_PSTRING_value(db->db->data, i);
 | 
			
		||||
		if (pp[DB_srptype][0] == DB_SRP_INDEX  && !strcmp(id, pp[DB_srpid])) 
 | 
			
		||||
		pp = sk_OPENSSL_PSTRING_value(db->db->data,i);
 | 
			
		||||
		if (pp[DB_srptype][0] == DB_SRP_INDEX  && !strcmp(id,pp[DB_srpid])) 
 | 
			
		||||
			return i;
 | 
			
		||||
		}
 | 
			
		||||
	else for (i = 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++)
 | 
			
		||||
		{
 | 
			
		||||
		pp = (char **)sk_OPENSSL_PSTRING_value(db->db->data, i);
 | 
			
		||||
		pp = sk_OPENSSL_PSTRING_value(db->db->data,i);
 | 
			
		||||
 | 
			
		||||
		if (pp[DB_srptype][0] != DB_SRP_INDEX && !strcmp(id,pp[DB_srpid])) 
 | 
			
		||||
			return i;
 | 
			
		||||
@@ -145,7 +145,7 @@ static void print_entry(CA_DB *db, BIO *bio, int indx, int verbose, char *s)
 | 
			
		||||
	if (indx >= 0 && verbose)
 | 
			
		||||
		{
 | 
			
		||||
		int j;
 | 
			
		||||
		char **pp = (char **)sk_OPENSSL_PSTRING_value(db->db->data, indx);
 | 
			
		||||
		char **pp = sk_OPENSSL_PSTRING_value(db->db->data, indx);
 | 
			
		||||
		BIO_printf(bio, "%s \"%s\"\n", s, pp[DB_srpid]);
 | 
			
		||||
		for (j = 0; j < DB_NUMBER; j++)
 | 
			
		||||
			{
 | 
			
		||||
@@ -163,7 +163,7 @@ static void print_user(CA_DB *db, BIO *bio, int userindex, int verbose)
 | 
			
		||||
	{
 | 
			
		||||
	if (verbose > 0)
 | 
			
		||||
		{
 | 
			
		||||
		char **pp = (char **)sk_OPENSSL_PSTRING_value(db->db->data, userindex);
 | 
			
		||||
		char **pp = sk_OPENSSL_PSTRING_value(db->db->data,userindex);
 | 
			
		||||
 | 
			
		||||
		if (pp[DB_srptype][0] != 'I')
 | 
			
		||||
			{
 | 
			
		||||
@@ -517,7 +517,7 @@ bad:
 | 
			
		||||
	/* Lets check some fields */
 | 
			
		||||
	for (i = 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++)
 | 
			
		||||
		{
 | 
			
		||||
		pp = (char **)sk_OPENSSL_PSTRING_value(db->db->data, i);
 | 
			
		||||
		pp = sk_OPENSSL_PSTRING_value(db->db->data, i);
 | 
			
		||||
	
 | 
			
		||||
		if (pp[DB_srptype][0] == DB_SRP_INDEX)
 | 
			
		||||
			{
 | 
			
		||||
@@ -533,8 +533,8 @@ bad:
 | 
			
		||||
 | 
			
		||||
	if (gNindex >= 0)
 | 
			
		||||
		{
 | 
			
		||||
		gNrow = (char **)sk_OPENSSL_PSTRING_value(db->db->data, gNindex);
 | 
			
		||||
		print_entry(db, bio_err, gNindex, verbose > 1, "Default g and N") ;
 | 
			
		||||
		gNrow = sk_OPENSSL_PSTRING_value(db->db->data,gNindex);
 | 
			
		||||
		print_entry(db, bio_err, gNindex, verbose > 1, "Default g and N");
 | 
			
		||||
		}
 | 
			
		||||
	else if (maxgN > 0 && !SRP_get_default_gN(gN))
 | 
			
		||||
		{
 | 
			
		||||
@@ -587,7 +587,7 @@ bad:
 | 
			
		||||
			if (userindex >= 0)
 | 
			
		||||
				{
 | 
			
		||||
				/* reactivation of a new user */
 | 
			
		||||
				char **row = (char **)sk_OPENSSL_PSTRING_value(db->db->data, userindex);
 | 
			
		||||
				char **row = sk_OPENSSL_PSTRING_value(db->db->data, userindex);
 | 
			
		||||
				BIO_printf(bio_err, "user \"%s\" reactivated.\n", user);
 | 
			
		||||
				row[DB_srptype][0] = 'V';
 | 
			
		||||
 | 
			
		||||
@@ -634,7 +634,7 @@ bad:
 | 
			
		||||
			else
 | 
			
		||||
				{
 | 
			
		||||
 | 
			
		||||
				char **row = (char **)sk_OPENSSL_PSTRING_value(db->db->data, userindex);
 | 
			
		||||
				char **row = sk_OPENSSL_PSTRING_value(db->db->data, userindex);
 | 
			
		||||
				char type = row[DB_srptype][0];
 | 
			
		||||
				if (type == 'v')
 | 
			
		||||
					{
 | 
			
		||||
@@ -664,9 +664,9 @@ bad:
 | 
			
		||||
 | 
			
		||||
					if (!(gNid=srp_create_user(user,&(row[DB_srpverifier]), &(row[DB_srpsalt]),gNrow?gNrow[DB_srpsalt]:NULL, gNrow?gNrow[DB_srpverifier]:NULL, passout, bio_err,verbose)))
 | 
			
		||||
						{
 | 
			
		||||
							BIO_printf(bio_err, "Cannot create srp verifier for user \"%s\", operation abandoned.\n", user);
 | 
			
		||||
							errors++;
 | 
			
		||||
							goto err;
 | 
			
		||||
						BIO_printf(bio_err, "Cannot create srp verifier for user \"%s\", operation abandoned.\n", user);
 | 
			
		||||
						errors++;
 | 
			
		||||
						goto err;
 | 
			
		||||
						}
 | 
			
		||||
 | 
			
		||||
					row[DB_srptype][0] = 'v';
 | 
			
		||||
@@ -689,7 +689,7 @@ bad:
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				{
 | 
			
		||||
				char **xpp = (char **)sk_OPENSSL_PSTRING_value(db->db->data, userindex);
 | 
			
		||||
				char **xpp = sk_OPENSSL_PSTRING_value(db->db->data,userindex);
 | 
			
		||||
				BIO_printf(bio_err, "user \"%s\" revoked. t\n", user);
 | 
			
		||||
 | 
			
		||||
				xpp[DB_srptype][0] = 'R';
 | 
			
		||||
@@ -714,7 +714,7 @@ bad:
 | 
			
		||||
		/* Lets check some fields */
 | 
			
		||||
		for (i = 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++)
 | 
			
		||||
			{
 | 
			
		||||
			pp = (char **)sk_OPENSSL_PSTRING_value(db->db->data, i);
 | 
			
		||||
			pp = sk_OPENSSL_PSTRING_value(db->db->data,i);
 | 
			
		||||
	
 | 
			
		||||
			if (pp[DB_srptype][0] == 'v')
 | 
			
		||||
				{
 | 
			
		||||
 
 | 
			
		||||
@@ -222,11 +222,19 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (argc < 1) check(cert_ctx, NULL, untrusted, trusted, crls, e);
 | 
			
		||||
	ret = 0;
 | 
			
		||||
	if (argc < 1)
 | 
			
		||||
		{ 
 | 
			
		||||
		if (1 != check(cert_ctx, NULL, untrusted, trusted, crls, e))
 | 
			
		||||
			ret = -1;
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		for (i=0; i<argc; i++)
 | 
			
		||||
			check(cert_ctx,argv[i], untrusted, trusted, crls, e);
 | 
			
		||||
	ret=0;
 | 
			
		||||
			if (1 != check(cert_ctx,argv[i], untrusted, trusted, crls, e))
 | 
			
		||||
				ret = -1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
end:
 | 
			
		||||
	if (ret == 1) {
 | 
			
		||||
		BIO_printf(bio_err,"usage: verify [-verbose] [-CApath path] [-CAfile file] [-purpose purpose] [-crl_check]");
 | 
			
		||||
@@ -235,13 +243,16 @@ end:
 | 
			
		||||
		BIO_printf(bio_err," [-engine e]");
 | 
			
		||||
#endif
 | 
			
		||||
		BIO_printf(bio_err," cert1 cert2 ...\n");
 | 
			
		||||
 | 
			
		||||
		BIO_printf(bio_err,"recognized usages:\n");
 | 
			
		||||
		for(i = 0; i < X509_PURPOSE_get_count(); i++) {
 | 
			
		||||
		for(i = 0; i < X509_PURPOSE_get_count(); i++)
 | 
			
		||||
			{
 | 
			
		||||
			X509_PURPOSE *ptmp;
 | 
			
		||||
			ptmp = X509_PURPOSE_get0(i);
 | 
			
		||||
			BIO_printf(bio_err, "\t%-10s\t%s\n", X509_PURPOSE_get0_sname(ptmp),
 | 
			
		||||
								X509_PURPOSE_get0_name(ptmp));
 | 
			
		||||
		}
 | 
			
		||||
			BIO_printf(bio_err, "\t%-10s\t%s\n",
 | 
			
		||||
				   X509_PURPOSE_get0_sname(ptmp),
 | 
			
		||||
				   X509_PURPOSE_get0_name(ptmp));
 | 
			
		||||
			}
 | 
			
		||||
	}
 | 
			
		||||
	if (vpm) X509_VERIFY_PARAM_free(vpm);
 | 
			
		||||
	if (cert_ctx != NULL) X509_STORE_free(cert_ctx);
 | 
			
		||||
@@ -249,7 +260,7 @@ end:
 | 
			
		||||
	sk_X509_pop_free(trusted, X509_free);
 | 
			
		||||
	sk_X509_CRL_pop_free(crls, X509_CRL_free);
 | 
			
		||||
	apps_shutdown();
 | 
			
		||||
	OPENSSL_EXIT(ret);
 | 
			
		||||
	OPENSSL_EXIT(ret < 0 ? 2 : ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int check(X509_STORE *ctx, char *file,
 | 
			
		||||
 
 | 
			
		||||
@@ -288,7 +288,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			days=atoi(*(++argv));
 | 
			
		||||
			if (days == 0)
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(STDout,"bad number of days\n");
 | 
			
		||||
				BIO_printf(bio_err,"bad number of days\n");
 | 
			
		||||
				goto bad;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
@@ -912,7 +912,7 @@ bad:
 | 
			
		||||
				}
 | 
			
		||||
			else if (text == i)
 | 
			
		||||
				{
 | 
			
		||||
				X509_print_ex(out,x,nmflag, certflag);
 | 
			
		||||
				X509_print_ex(STDout,x,nmflag, certflag);
 | 
			
		||||
				}
 | 
			
		||||
			else if (startdate == i)
 | 
			
		||||
				{
 | 
			
		||||
 
 | 
			
		||||
@@ -408,6 +408,7 @@ _armv4_AES_encrypt:
 | 
			
		||||
.type   private_AES_set_encrypt_key,%function
 | 
			
		||||
.align	5
 | 
			
		||||
private_AES_set_encrypt_key:
 | 
			
		||||
_armv4_AES_set_encrypt_key:
 | 
			
		||||
	sub	r3,pc,#8		@ AES_set_encrypt_key
 | 
			
		||||
	teq	r0,#0
 | 
			
		||||
	moveq	r0,#-1
 | 
			
		||||
@@ -425,7 +426,7 @@ private_AES_set_encrypt_key:
 | 
			
		||||
	bne	.Labrt
 | 
			
		||||
 | 
			
		||||
.Lok:	stmdb   sp!,{r4-r12,lr}
 | 
			
		||||
	sub	$tbl,r3,#private_AES_set_encrypt_key-AES_Te-1024	@ Te4
 | 
			
		||||
	sub	$tbl,r3,#_armv4_AES_set_encrypt_key-AES_Te-1024	@ Te4
 | 
			
		||||
 | 
			
		||||
	mov	$rounds,r0		@ inp
 | 
			
		||||
	mov	lr,r1			@ bits
 | 
			
		||||
@@ -685,7 +686,7 @@ private_AES_set_encrypt_key:
 | 
			
		||||
.align	5
 | 
			
		||||
private_AES_set_decrypt_key:
 | 
			
		||||
	str	lr,[sp,#-4]!            @ push lr
 | 
			
		||||
	bl	private_AES_set_encrypt_key
 | 
			
		||||
	bl	_armv4_AES_set_encrypt_key
 | 
			
		||||
	teq	r0,#0
 | 
			
		||||
	ldrne	lr,[sp],#4              @ pop lr
 | 
			
		||||
	bne	.Labrt
 | 
			
		||||
 
 | 
			
		||||
@@ -1036,9 +1036,9 @@ _mips_AES_set_encrypt_key:
 | 
			
		||||
	nop
 | 
			
		||||
.end	_mips_AES_set_encrypt_key
 | 
			
		||||
 | 
			
		||||
.globl	AES_set_encrypt_key
 | 
			
		||||
.ent	AES_set_encrypt_key
 | 
			
		||||
AES_set_encrypt_key:
 | 
			
		||||
.globl	private_AES_set_encrypt_key
 | 
			
		||||
.ent	private_AES_set_encrypt_key
 | 
			
		||||
private_AES_set_encrypt_key:
 | 
			
		||||
	.frame	$sp,$FRAMESIZE,$ra
 | 
			
		||||
	.mask	$SAVED_REGS_MASK,-$SZREG
 | 
			
		||||
	.set	noreorder
 | 
			
		||||
@@ -1060,7 +1060,7 @@ $code.=<<___ if ($flavour =~ /nubi/i);	# optimize non-nubi prologue
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___ if ($flavour !~ /o32/i);	# non-o32 PIC-ification
 | 
			
		||||
	.cplocal	$Tbl
 | 
			
		||||
	.cpsetup	$pf,$zero,AES_set_encrypt_key
 | 
			
		||||
	.cpsetup	$pf,$zero,private_AES_set_encrypt_key
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	.set	reorder
 | 
			
		||||
@@ -1083,7 +1083,7 @@ ___
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	jr	$ra
 | 
			
		||||
	$PTR_ADD $sp,$FRAMESIZE
 | 
			
		||||
.end	AES_set_encrypt_key
 | 
			
		||||
.end	private_AES_set_encrypt_key
 | 
			
		||||
___
 | 
			
		||||
 | 
			
		||||
my ($head,$tail)=($inp,$bits);
 | 
			
		||||
@@ -1091,9 +1091,9 @@ my ($tp1,$tp2,$tp4,$tp8,$tp9,$tpb,$tpd,$tpe)=($a4,$a5,$a6,$a7,$s0,$s1,$s2,$s3);
 | 
			
		||||
my ($m,$x80808080,$x7f7f7f7f,$x1b1b1b1b)=($at,$t0,$t1,$t2);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
.align	5
 | 
			
		||||
.globl	AES_set_decrypt_key
 | 
			
		||||
.ent	AES_set_decrypt_key
 | 
			
		||||
AES_set_decrypt_key:
 | 
			
		||||
.globl	private_AES_set_decrypt_key
 | 
			
		||||
.ent	private_AES_set_decrypt_key
 | 
			
		||||
private_AES_set_decrypt_key:
 | 
			
		||||
	.frame	$sp,$FRAMESIZE,$ra
 | 
			
		||||
	.mask	$SAVED_REGS_MASK,-$SZREG
 | 
			
		||||
	.set	noreorder
 | 
			
		||||
@@ -1115,7 +1115,7 @@ $code.=<<___ if ($flavour =~ /nubi/i);	# optimize non-nubi prologue
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___ if ($flavour !~ /o32/i);	# non-o32 PIC-ification
 | 
			
		||||
	.cplocal	$Tbl
 | 
			
		||||
	.cpsetup	$pf,$zero,AES_set_decrypt_key
 | 
			
		||||
	.cpsetup	$pf,$zero,private_AES_set_decrypt_key
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	.set	reorder
 | 
			
		||||
@@ -1226,7 +1226,7 @@ ___
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	jr	$ra
 | 
			
		||||
	$PTR_ADD $sp,$FRAMESIZE
 | 
			
		||||
.end	AES_set_decrypt_key
 | 
			
		||||
.end	private_AES_set_decrypt_key
 | 
			
		||||
___
 | 
			
		||||
}}}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -783,6 +783,7 @@ $code.=<<___;
 | 
			
		||||
.type	private_AES_set_encrypt_key,\@function
 | 
			
		||||
.align	16
 | 
			
		||||
private_AES_set_encrypt_key:
 | 
			
		||||
_s390x_AES_set_encrypt_key:
 | 
			
		||||
	lghi	$t0,0
 | 
			
		||||
	cl${g}r	$inp,$t0
 | 
			
		||||
	je	.Lminus1
 | 
			
		||||
@@ -836,7 +837,8 @@ $code.=<<___ if (!$softonly);
 | 
			
		||||
	je	1f
 | 
			
		||||
	lg	%r1,24($inp)
 | 
			
		||||
	stg	%r1,24($key)
 | 
			
		||||
1:	st	$bits,236($key)	# save bits
 | 
			
		||||
1:	st	$bits,236($key)	# save bits [for debugging purposes]
 | 
			
		||||
	lgr	$t0,%r5
 | 
			
		||||
	st	%r5,240($key)	# save km code
 | 
			
		||||
	lghi	%r2,0
 | 
			
		||||
	br	%r14
 | 
			
		||||
@@ -844,7 +846,7 @@ ___
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
.align	16
 | 
			
		||||
.Lekey_internal:
 | 
			
		||||
	stm${g}	%r6,%r13,6*$SIZE_T($sp)	# all non-volatile regs
 | 
			
		||||
	stm${g}	%r4,%r13,4*$SIZE_T($sp)	# all non-volatile regs and $key
 | 
			
		||||
 | 
			
		||||
	larl	$tbl,AES_Te+2048
 | 
			
		||||
 | 
			
		||||
@@ -904,8 +906,9 @@ $code.=<<___;
 | 
			
		||||
	la	$key,16($key)		# key+=4
 | 
			
		||||
	la	$t3,4($t3)		# i++
 | 
			
		||||
	brct	$rounds,.L128_loop
 | 
			
		||||
	lghi	$t0,10
 | 
			
		||||
	lghi	%r2,0
 | 
			
		||||
	lm${g}	%r6,%r13,6*$SIZE_T($sp)
 | 
			
		||||
	lm${g}	%r4,%r13,4*$SIZE_T($sp)
 | 
			
		||||
	br	$ra
 | 
			
		||||
 | 
			
		||||
.align	16
 | 
			
		||||
@@ -952,8 +955,9 @@ $code.=<<___;
 | 
			
		||||
	st	$s2,32($key)
 | 
			
		||||
	st	$s3,36($key)
 | 
			
		||||
	brct	$rounds,.L192_continue
 | 
			
		||||
	lghi	$t0,12
 | 
			
		||||
	lghi	%r2,0
 | 
			
		||||
	lm${g}	%r6,%r13,6*$SIZE_T($sp)
 | 
			
		||||
	lm${g}	%r4,%r13,4*$SIZE_T($sp)
 | 
			
		||||
	br	$ra
 | 
			
		||||
 | 
			
		||||
.align	16
 | 
			
		||||
@@ -1014,8 +1018,9 @@ $code.=<<___;
 | 
			
		||||
	st	$s2,40($key)
 | 
			
		||||
	st	$s3,44($key)
 | 
			
		||||
	brct	$rounds,.L256_continue
 | 
			
		||||
	lghi	$t0,14
 | 
			
		||||
	lghi	%r2,0
 | 
			
		||||
	lm${g}	%r6,%r13,6*$SIZE_T($sp)
 | 
			
		||||
	lm${g}	%r4,%r13,4*$SIZE_T($sp)
 | 
			
		||||
	br	$ra
 | 
			
		||||
 | 
			
		||||
.align	16
 | 
			
		||||
@@ -1066,34 +1071,26 @@ $code.=<<___;
 | 
			
		||||
.type	private_AES_set_decrypt_key,\@function
 | 
			
		||||
.align	16
 | 
			
		||||
private_AES_set_decrypt_key:
 | 
			
		||||
	st${g}	$key,4*$SIZE_T($sp)	# I rely on AES_set_encrypt_key to
 | 
			
		||||
	st${g}	$ra,14*$SIZE_T($sp)	# save non-volatile registers!
 | 
			
		||||
	bras	$ra,AES_set_encrypt_key
 | 
			
		||||
	l${g}	$key,4*$SIZE_T($sp)
 | 
			
		||||
	#st${g}	$key,4*$SIZE_T($sp)	# I rely on AES_set_encrypt_key to
 | 
			
		||||
	st${g}	$ra,14*$SIZE_T($sp)	# save non-volatile registers and $key!
 | 
			
		||||
	bras	$ra,_s390x_AES_set_encrypt_key
 | 
			
		||||
	#l${g}	$key,4*$SIZE_T($sp)
 | 
			
		||||
	l${g}	$ra,14*$SIZE_T($sp)
 | 
			
		||||
	ltgr	%r2,%r2
 | 
			
		||||
	bnzr	$ra
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___ if (!$softonly);
 | 
			
		||||
	l	$t0,240($key)
 | 
			
		||||
	#l	$t0,240($key)
 | 
			
		||||
	lhi	$t1,16
 | 
			
		||||
	cr	$t0,$t1
 | 
			
		||||
	jl	.Lgo
 | 
			
		||||
	oill	$t0,0x80	# set "decrypt" bit
 | 
			
		||||
	st	$t0,240($key)
 | 
			
		||||
	br	$ra
 | 
			
		||||
 | 
			
		||||
.align	16
 | 
			
		||||
.Ldkey_internal:
 | 
			
		||||
	st${g}	$key,4*$SIZE_T($sp)
 | 
			
		||||
	st${g}	$ra,14*$SIZE_T($sp)
 | 
			
		||||
	bras	$ra,.Lekey_internal
 | 
			
		||||
	l${g}	$key,4*$SIZE_T($sp)
 | 
			
		||||
	l${g}	$ra,14*$SIZE_T($sp)
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
 | 
			
		||||
.Lgo:	llgf	$rounds,240($key)
 | 
			
		||||
.align	16
 | 
			
		||||
.Lgo:	lgr	$rounds,$t0	#llgf	$rounds,240($key)
 | 
			
		||||
	la	$i1,0($key)
 | 
			
		||||
	sllg	$i2,$rounds,4
 | 
			
		||||
	la	$i2,0($i2,$key)
 | 
			
		||||
@@ -1601,11 +1598,11 @@ $code.=<<___ if(1);
 | 
			
		||||
	lghi	$s1,0x7f
 | 
			
		||||
	nr	$s1,%r0
 | 
			
		||||
	lghi	%r0,0			# query capability vector
 | 
			
		||||
	la	%r1,2*$SIZE_T($sp)
 | 
			
		||||
	la	%r1,$tweak-16($sp)
 | 
			
		||||
	.long	0xb92e0042		# km %r4,%r2
 | 
			
		||||
	llihh	%r1,0x8000
 | 
			
		||||
	srlg	%r1,%r1,32($s1)		# check for 32+function code
 | 
			
		||||
	ng	%r1,2*$SIZE_T($sp)
 | 
			
		||||
	ng	%r1,$tweak-16($sp)
 | 
			
		||||
	lgr	%r0,$s0			# restore the function code
 | 
			
		||||
	la	%r1,0($key1)		# restore $key1
 | 
			
		||||
	jz	.Lxts_km_vanilla
 | 
			
		||||
@@ -1631,7 +1628,7 @@ $code.=<<___ if(1);
 | 
			
		||||
 | 
			
		||||
	lrvg	$s0,$tweak+0($sp)	# load the last tweak
 | 
			
		||||
	lrvg	$s1,$tweak+8($sp)
 | 
			
		||||
	stmg	%r0,%r3,$tweak-32(%r1)	# wipe copy of the key
 | 
			
		||||
	stmg	%r0,%r3,$tweak-32($sp)	# wipe copy of the key
 | 
			
		||||
 | 
			
		||||
	nill	%r0,0xffdf		# switch back to original function code
 | 
			
		||||
	la	%r1,0($key1)		# restore pointer to $key1
 | 
			
		||||
@@ -1687,11 +1684,9 @@ $code.=<<___;
 | 
			
		||||
	lghi	$i1,0x87
 | 
			
		||||
	srag	$i2,$s1,63		# broadcast upper bit
 | 
			
		||||
	ngr	$i1,$i2			# rem
 | 
			
		||||
	srlg	$i2,$s0,63		# carry bit from lower half
 | 
			
		||||
	sllg	$s0,$s0,1
 | 
			
		||||
	sllg	$s1,$s1,1
 | 
			
		||||
	algr	$s0,$s0
 | 
			
		||||
	alcgr	$s1,$s1
 | 
			
		||||
	xgr	$s0,$i1
 | 
			
		||||
	ogr	$s1,$i2
 | 
			
		||||
.Lxts_km_start:
 | 
			
		||||
	lrvgr	$i1,$s0			# flip byte order
 | 
			
		||||
	lrvgr	$i2,$s1
 | 
			
		||||
@@ -1748,11 +1743,9 @@ $code.=<<___;
 | 
			
		||||
	lghi	$i1,0x87
 | 
			
		||||
	srag	$i2,$s1,63		# broadcast upper bit
 | 
			
		||||
	ngr	$i1,$i2			# rem
 | 
			
		||||
	srlg	$i2,$s0,63		# carry bit from lower half
 | 
			
		||||
	sllg	$s0,$s0,1
 | 
			
		||||
	sllg	$s1,$s1,1
 | 
			
		||||
	algr	$s0,$s0
 | 
			
		||||
	alcgr	$s1,$s1
 | 
			
		||||
	xgr	$s0,$i1
 | 
			
		||||
	ogr	$s1,$i2
 | 
			
		||||
 | 
			
		||||
	ltr	$len,$len		# clear zero flag
 | 
			
		||||
	br	$ra
 | 
			
		||||
@@ -1784,8 +1777,8 @@ $code.=<<___ if (!$softonly);
 | 
			
		||||
	clr	%r0,%r1
 | 
			
		||||
	jl	.Lxts_enc_software
 | 
			
		||||
 | 
			
		||||
	st${g}	$ra,5*$SIZE_T($sp)
 | 
			
		||||
	stm${g}	%r6,$s3,6*$SIZE_T($sp)
 | 
			
		||||
	st${g}	$ra,14*$SIZE_T($sp)
 | 
			
		||||
 | 
			
		||||
	sllg	$len,$len,4		# $len&=~15
 | 
			
		||||
	slgr	$out,$inp
 | 
			
		||||
@@ -1833,9 +1826,9 @@ $code.=<<___ if (!$softonly);
 | 
			
		||||
	stg	$i2,8($i3)
 | 
			
		||||
 | 
			
		||||
.Lxts_enc_km_done:
 | 
			
		||||
	l${g}	$ra,14*$SIZE_T($sp)
 | 
			
		||||
	st${g}	$sp,$tweak($sp)		# wipe tweak
 | 
			
		||||
	st${g}	$sp,$tweak($sp)
 | 
			
		||||
	stg	$sp,$tweak+0($sp)	# wipe tweak
 | 
			
		||||
	stg	$sp,$tweak+8($sp)
 | 
			
		||||
	l${g}	$ra,5*$SIZE_T($sp)
 | 
			
		||||
	lm${g}	%r6,$s3,6*$SIZE_T($sp)
 | 
			
		||||
	br	$ra
 | 
			
		||||
.align	16
 | 
			
		||||
@@ -1846,12 +1839,11 @@ $code.=<<___;
 | 
			
		||||
 | 
			
		||||
	slgr	$out,$inp
 | 
			
		||||
 | 
			
		||||
	xgr	$s0,$s0			# clear upper half
 | 
			
		||||
	xgr	$s1,$s1
 | 
			
		||||
	lrv	$s0,$stdframe+4($sp)	# load secno
 | 
			
		||||
	lrv	$s1,$stdframe+0($sp)
 | 
			
		||||
	xgr	$s2,$s2
 | 
			
		||||
	xgr	$s3,$s3
 | 
			
		||||
	l${g}	$s3,$stdframe($sp)	# ivp
 | 
			
		||||
	llgf	$s0,0($s3)		# load iv
 | 
			
		||||
	llgf	$s1,4($s3)
 | 
			
		||||
	llgf	$s2,8($s3)
 | 
			
		||||
	llgf	$s3,12($s3)
 | 
			
		||||
	stm${g}	%r2,%r5,2*$SIZE_T($sp)
 | 
			
		||||
	la	$key,0($key2)
 | 
			
		||||
	larl	$tbl,AES_Te
 | 
			
		||||
@@ -1867,11 +1859,9 @@ $code.=<<___;
 | 
			
		||||
	lghi	%r1,0x87
 | 
			
		||||
	srag	%r0,$s3,63		# broadcast upper bit
 | 
			
		||||
	ngr	%r1,%r0			# rem
 | 
			
		||||
	srlg	%r0,$s1,63		# carry bit from lower half
 | 
			
		||||
	sllg	$s1,$s1,1
 | 
			
		||||
	sllg	$s3,$s3,1
 | 
			
		||||
	algr	$s1,$s1
 | 
			
		||||
	alcgr	$s3,$s3
 | 
			
		||||
	xgr	$s1,%r1
 | 
			
		||||
	ogr	$s3,%r0
 | 
			
		||||
	lrvgr	$s1,$s1			# flip byte order
 | 
			
		||||
	lrvgr	$s3,$s3
 | 
			
		||||
	srlg	$s0,$s1,32		# smash the tweak to 4x32-bits 
 | 
			
		||||
@@ -1920,11 +1910,9 @@ $code.=<<___;
 | 
			
		||||
	lghi	%r1,0x87
 | 
			
		||||
	srag	%r0,$s3,63		# broadcast upper bit
 | 
			
		||||
	ngr	%r1,%r0			# rem
 | 
			
		||||
	srlg	%r0,$s1,63		# carry bit from lower half
 | 
			
		||||
	sllg	$s1,$s1,1
 | 
			
		||||
	sllg	$s3,$s3,1
 | 
			
		||||
	algr	$s1,$s1
 | 
			
		||||
	alcgr	$s3,$s3
 | 
			
		||||
	xgr	$s1,%r1
 | 
			
		||||
	ogr	$s3,%r0
 | 
			
		||||
	lrvgr	$s1,$s1			# flip byte order
 | 
			
		||||
	lrvgr	$s3,$s3
 | 
			
		||||
	srlg	$s0,$s1,32		# smash the tweak to 4x32-bits 
 | 
			
		||||
@@ -1959,7 +1947,8 @@ $code.=<<___;
 | 
			
		||||
.size	AES_xts_encrypt,.-AES_xts_encrypt
 | 
			
		||||
___
 | 
			
		||||
# void AES_xts_decrypt(const char *inp,char *out,size_t len,
 | 
			
		||||
#	const AES_KEY *key1, const AES_KEY *key2,u64 secno);
 | 
			
		||||
#	const AES_KEY *key1, const AES_KEY *key2,
 | 
			
		||||
#	const unsigned char iv[16]);
 | 
			
		||||
#
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
.globl	AES_xts_decrypt
 | 
			
		||||
@@ -1991,8 +1980,8 @@ $code.=<<___ if (!$softonly);
 | 
			
		||||
	clr	%r0,%r1
 | 
			
		||||
	jl	.Lxts_dec_software
 | 
			
		||||
 | 
			
		||||
	st${g}	$ra,5*$SIZE_T($sp)
 | 
			
		||||
	stm${g}	%r6,$s3,6*$SIZE_T($sp)
 | 
			
		||||
	st${g}	$ra,14*$SIZE_T($sp)
 | 
			
		||||
 | 
			
		||||
	nill	$len,0xfff0		# $len&=~15
 | 
			
		||||
	slgr	$out,$inp
 | 
			
		||||
@@ -2031,11 +2020,9 @@ $code.=<<___ if (!$softonly);
 | 
			
		||||
	lghi	$i1,0x87
 | 
			
		||||
	srag	$i2,$s1,63		# broadcast upper bit
 | 
			
		||||
	ngr	$i1,$i2			# rem
 | 
			
		||||
	srlg	$i2,$s0,63		# carry bit from lower half
 | 
			
		||||
	sllg	$s0,$s0,1
 | 
			
		||||
	sllg	$s1,$s1,1
 | 
			
		||||
	algr	$s0,$s0
 | 
			
		||||
	alcgr	$s1,$s1
 | 
			
		||||
	xgr	$s0,$i1
 | 
			
		||||
	ogr	$s1,$i2
 | 
			
		||||
	lrvgr	$i1,$s0			# flip byte order
 | 
			
		||||
	lrvgr	$i2,$s1
 | 
			
		||||
 | 
			
		||||
@@ -2078,9 +2065,9 @@ $code.=<<___ if (!$softonly);
 | 
			
		||||
	stg	$s2,0($i3)
 | 
			
		||||
	stg	$s3,8($i3)
 | 
			
		||||
.Lxts_dec_km_done:
 | 
			
		||||
	l${g}	$ra,14*$SIZE_T($sp)
 | 
			
		||||
	st${g}	$sp,$tweak($sp)		# wipe tweak
 | 
			
		||||
	st${g}	$sp,$tweak($sp)
 | 
			
		||||
	stg	$sp,$tweak+0($sp)	# wipe tweak
 | 
			
		||||
	stg	$sp,$tweak+8($sp)
 | 
			
		||||
	l${g}	$ra,5*$SIZE_T($sp)
 | 
			
		||||
	lm${g}	%r6,$s3,6*$SIZE_T($sp)
 | 
			
		||||
	br	$ra
 | 
			
		||||
.align	16
 | 
			
		||||
@@ -2092,12 +2079,11 @@ $code.=<<___;
 | 
			
		||||
	srlg	$len,$len,4
 | 
			
		||||
	slgr	$out,$inp
 | 
			
		||||
 | 
			
		||||
	xgr	$s0,$s0			# clear upper half
 | 
			
		||||
	xgr	$s1,$s1
 | 
			
		||||
	lrv	$s0,$stdframe+4($sp)	# load secno
 | 
			
		||||
	lrv	$s1,$stdframe+0($sp)
 | 
			
		||||
	xgr	$s2,$s2
 | 
			
		||||
	xgr	$s3,$s3
 | 
			
		||||
	l${g}	$s3,$stdframe($sp)	# ivp
 | 
			
		||||
	llgf	$s0,0($s3)		# load iv
 | 
			
		||||
	llgf	$s1,4($s3)
 | 
			
		||||
	llgf	$s2,8($s3)
 | 
			
		||||
	llgf	$s3,12($s3)
 | 
			
		||||
	stm${g}	%r2,%r5,2*$SIZE_T($sp)
 | 
			
		||||
	la	$key,0($key2)
 | 
			
		||||
	larl	$tbl,AES_Te
 | 
			
		||||
@@ -2116,11 +2102,9 @@ $code.=<<___;
 | 
			
		||||
	lghi	%r1,0x87
 | 
			
		||||
	srag	%r0,$s3,63		# broadcast upper bit
 | 
			
		||||
	ngr	%r1,%r0			# rem
 | 
			
		||||
	srlg	%r0,$s1,63		# carry bit from lower half
 | 
			
		||||
	sllg	$s1,$s1,1
 | 
			
		||||
	sllg	$s3,$s3,1
 | 
			
		||||
	algr	$s1,$s1
 | 
			
		||||
	alcgr	$s3,$s3
 | 
			
		||||
	xgr	$s1,%r1
 | 
			
		||||
	ogr	$s3,%r0
 | 
			
		||||
	lrvgr	$s1,$s1			# flip byte order
 | 
			
		||||
	lrvgr	$s3,$s3
 | 
			
		||||
	srlg	$s0,$s1,32		# smash the tweak to 4x32-bits 
 | 
			
		||||
@@ -2159,11 +2143,9 @@ $code.=<<___;
 | 
			
		||||
	lghi	%r1,0x87
 | 
			
		||||
	srag	%r0,$s3,63		# broadcast upper bit
 | 
			
		||||
	ngr	%r1,%r0			# rem
 | 
			
		||||
	srlg	%r0,$s1,63		# carry bit from lower half
 | 
			
		||||
	sllg	$s1,$s1,1
 | 
			
		||||
	sllg	$s3,$s3,1
 | 
			
		||||
	algr	$s1,$s1
 | 
			
		||||
	alcgr	$s3,$s3
 | 
			
		||||
	xgr	$s1,%r1
 | 
			
		||||
	ogr	$s3,%r0
 | 
			
		||||
	lrvgr	$i2,$s1			# flip byte order
 | 
			
		||||
	lrvgr	$i3,$s3
 | 
			
		||||
	stmg	$i2,$i3,$tweak($sp)	# save the 1st tweak
 | 
			
		||||
@@ -2179,11 +2161,9 @@ $code.=<<___;
 | 
			
		||||
	lghi	%r1,0x87
 | 
			
		||||
	srag	%r0,$s3,63		# broadcast upper bit
 | 
			
		||||
	ngr	%r1,%r0			# rem
 | 
			
		||||
	srlg	%r0,$s1,63		# carry bit from lower half
 | 
			
		||||
	sllg	$s1,$s1,1
 | 
			
		||||
	sllg	$s3,$s3,1
 | 
			
		||||
	algr	$s1,$s1
 | 
			
		||||
	alcgr	$s3,$s3
 | 
			
		||||
	xgr	$s1,%r1
 | 
			
		||||
	ogr	$s3,%r0
 | 
			
		||||
	lrvgr	$s1,$s1			# flip byte order
 | 
			
		||||
	lrvgr	$s3,$s3
 | 
			
		||||
	srlg	$s0,$s1,32		# smash the tweak to 4x32-bits
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 | 
			
		||||
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
 | 
			
		||||
die "can't locate x86_64-xlate.pl";
 | 
			
		||||
 | 
			
		||||
open STDOUT,"| $^X $xlate $flavour $output";
 | 
			
		||||
open OUT,"| \"$^X\" $xlate $flavour $output";
 | 
			
		||||
*STDOUT=*OUT;
 | 
			
		||||
 | 
			
		||||
$verticalspin=1;	# unlike 32-bit version $verticalspin performs
 | 
			
		||||
			# ~15% better on both AMD and Intel cores
 | 
			
		||||
 
 | 
			
		||||
@@ -69,7 +69,8 @@ $avx=1 if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) &&
 | 
			
		||||
	   `ml64 2>&1` =~ /Version ([0-9]+)\./ &&
 | 
			
		||||
	   $1>=10);
 | 
			
		||||
 | 
			
		||||
open STDOUT,"| $^X $xlate $flavour $output";
 | 
			
		||||
open OUT,"| \"$^X\" $xlate $flavour $output";
 | 
			
		||||
*STDOUT=*OUT;
 | 
			
		||||
 | 
			
		||||
# void aesni_cbc_sha1_enc(const void *inp,
 | 
			
		||||
#			void *out,
 | 
			
		||||
 
 | 
			
		||||
@@ -172,7 +172,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 | 
			
		||||
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
 | 
			
		||||
die "can't locate x86_64-xlate.pl";
 | 
			
		||||
 | 
			
		||||
open STDOUT,"| $^X $xlate $flavour $output";
 | 
			
		||||
open OUT,"| \"$^X\" $xlate $flavour $output";
 | 
			
		||||
*STDOUT=*OUT;
 | 
			
		||||
 | 
			
		||||
$movkey = $PREFIX eq "aesni" ? "movups" : "movups";
 | 
			
		||||
@_4args=$win64?	("%rcx","%rdx","%r8", "%r9") :	# Win64 order
 | 
			
		||||
 
 | 
			
		||||
@@ -105,7 +105,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 | 
			
		||||
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
 | 
			
		||||
die "can't locate x86_64-xlate.pl";
 | 
			
		||||
 | 
			
		||||
open STDOUT,"| $^X $xlate $flavour $output";
 | 
			
		||||
open OUT,"| \"$^X\" $xlate $flavour $output";
 | 
			
		||||
*STDOUT=*OUT;
 | 
			
		||||
 | 
			
		||||
my ($inp,$out,$len,$key,$ivp)=("%rdi","%rsi","%rdx","%rcx");
 | 
			
		||||
my @XMM=map("%xmm$_",(15,0..14));	# best on Atom, +10% over (0..15)
 | 
			
		||||
 
 | 
			
		||||
@@ -843,6 +843,8 @@ $k_dsbo=0x2c0;		# decryption sbox final output
 | 
			
		||||
	&mov	($out,&wparam(1));		# out
 | 
			
		||||
	&mov	($round,&wparam(2));		# len
 | 
			
		||||
	&mov	($key,&wparam(3));		# key
 | 
			
		||||
	&sub	($round,16);
 | 
			
		||||
	&jc	(&label("cbc_abort"));
 | 
			
		||||
	&lea	($base,&DWP(-56,"esp"));
 | 
			
		||||
	&mov	($const,&wparam(4));		# ivp
 | 
			
		||||
	&and	($base,-16);
 | 
			
		||||
@@ -853,7 +855,6 @@ $k_dsbo=0x2c0;		# decryption sbox final output
 | 
			
		||||
	&mov	(&DWP(48,"esp"),$base);
 | 
			
		||||
 | 
			
		||||
	&mov	(&DWP(0,"esp"),$out);		# save out
 | 
			
		||||
	&sub	($round,16);
 | 
			
		||||
	&mov	(&DWP(4,"esp"),$key)		# save key
 | 
			
		||||
	&mov	(&DWP(8,"esp"),$const);		# save ivp
 | 
			
		||||
	&mov	($out,$round);			# $out works as $len
 | 
			
		||||
@@ -896,6 +897,7 @@ $k_dsbo=0x2c0;		# decryption sbox final output
 | 
			
		||||
	&mov	($base,&DWP(8,"esp"));		# restore ivp
 | 
			
		||||
	&mov	("esp",&DWP(48,"esp"));
 | 
			
		||||
	&movdqu	(&QWP(0,$base),"xmm1");		# write IV
 | 
			
		||||
&set_label("cbc_abort");
 | 
			
		||||
&function_end("${PREFIX}_cbc_encrypt");
 | 
			
		||||
 | 
			
		||||
&asm_finish();
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 | 
			
		||||
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
 | 
			
		||||
die "can't locate x86_64-xlate.pl";
 | 
			
		||||
 | 
			
		||||
open STDOUT,"| $^X $xlate $flavour $output";
 | 
			
		||||
open OUT,"| \"$^X\" $xlate $flavour $output";
 | 
			
		||||
*STDOUT=*OUT;
 | 
			
		||||
 | 
			
		||||
$PREFIX="vpaes";
 | 
			
		||||
 | 
			
		||||
@@ -263,7 +264,7 @@ _vpaes_decrypt_core:
 | 
			
		||||
	pshufb  %xmm2,  %xmm4	# 4 = sbou
 | 
			
		||||
	pxor	%xmm0,  %xmm4	# 4 = sb1u + k
 | 
			
		||||
	movdqa	0x70(%r10), %xmm0	# 0 : sbot
 | 
			
		||||
	movdqa	.Lk_sr-.Lk_dsbd(%r11), %xmm2
 | 
			
		||||
	movdqa	-0x160(%r11), %xmm2	# .Lk_sr-.Lk_dsbd=-0x160
 | 
			
		||||
	pshufb  %xmm3,	%xmm0	# 0 = sb1t
 | 
			
		||||
	pxor	%xmm4,	%xmm0	# 0 = A
 | 
			
		||||
	pshufb	%xmm2,	%xmm0
 | 
			
		||||
@@ -869,6 +870,8 @@ ${PREFIX}_cbc_encrypt:
 | 
			
		||||
___
 | 
			
		||||
($len,$key)=($key,$len);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	sub	\$16,$len
 | 
			
		||||
	jc	.Lcbc_abort
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___ if ($win64);
 | 
			
		||||
	lea	-0xb8(%rsp),%rsp
 | 
			
		||||
@@ -887,7 +890,6 @@ ___
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	movdqu	($ivp),%xmm6		# load IV
 | 
			
		||||
	sub	$inp,$out
 | 
			
		||||
	sub	\$16,$len
 | 
			
		||||
	call	_vpaes_preheat
 | 
			
		||||
	cmp	\$0,${enc}d
 | 
			
		||||
	je	.Lcbc_dec_loop
 | 
			
		||||
@@ -932,6 +934,7 @@ $code.=<<___ if ($win64);
 | 
			
		||||
.Lcbc_epilogue:
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
.Lcbc_abort:
 | 
			
		||||
	ret
 | 
			
		||||
.size	${PREFIX}_cbc_encrypt,.-${PREFIX}_cbc_encrypt
 | 
			
		||||
___
 | 
			
		||||
 
 | 
			
		||||
@@ -57,6 +57,7 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <limits.h>
 | 
			
		||||
#include "cryptlib.h"
 | 
			
		||||
#include <openssl/buffer.h>
 | 
			
		||||
#include <openssl/asn1_mac.h>
 | 
			
		||||
@@ -143,17 +144,11 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
 | 
			
		||||
	BUF_MEM *b;
 | 
			
		||||
	unsigned char *p;
 | 
			
		||||
	int i;
 | 
			
		||||
	int ret=-1;
 | 
			
		||||
	ASN1_const_CTX c;
 | 
			
		||||
	int want=HEADER_SIZE;
 | 
			
		||||
	size_t want=HEADER_SIZE;
 | 
			
		||||
	int eos=0;
 | 
			
		||||
#if defined(__GNUC__) && defined(__ia64)
 | 
			
		||||
	/* pathetic compiler bug in all known versions as of Nov. 2002 */
 | 
			
		||||
	long off=0;
 | 
			
		||||
#else
 | 
			
		||||
	int off=0;
 | 
			
		||||
#endif
 | 
			
		||||
	int len=0;
 | 
			
		||||
	size_t off=0;
 | 
			
		||||
	size_t len=0;
 | 
			
		||||
 | 
			
		||||
	b=BUF_MEM_new();
 | 
			
		||||
	if (b == NULL)
 | 
			
		||||
@@ -169,7 +164,7 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
 | 
			
		||||
			{
 | 
			
		||||
			want-=(len-off);
 | 
			
		||||
 | 
			
		||||
			if (!BUF_MEM_grow_clean(b,len+want))
 | 
			
		||||
			if (len + want < len || !BUF_MEM_grow_clean(b,len+want))
 | 
			
		||||
				{
 | 
			
		||||
				ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
				goto err;
 | 
			
		||||
@@ -181,7 +176,14 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
 | 
			
		||||
				goto err;
 | 
			
		||||
				}
 | 
			
		||||
			if (i > 0)
 | 
			
		||||
				{
 | 
			
		||||
				if (len+i < len)
 | 
			
		||||
					{
 | 
			
		||||
					ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ASN1_R_TOO_LONG);
 | 
			
		||||
					goto err;
 | 
			
		||||
					}
 | 
			
		||||
				len+=i;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		/* else data already loaded */
 | 
			
		||||
 | 
			
		||||
@@ -206,6 +208,11 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
 | 
			
		||||
			{
 | 
			
		||||
			/* no data body so go round again */
 | 
			
		||||
			eos++;
 | 
			
		||||
			if (eos < 0)
 | 
			
		||||
				{
 | 
			
		||||
				ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ASN1_R_HEADER_TOO_LONG);
 | 
			
		||||
				goto err;
 | 
			
		||||
				}
 | 
			
		||||
			want=HEADER_SIZE;
 | 
			
		||||
			}
 | 
			
		||||
		else if (eos && (c.slen == 0) && (c.tag == V_ASN1_EOC))
 | 
			
		||||
@@ -220,10 +227,16 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
 | 
			
		||||
		else 
 | 
			
		||||
			{
 | 
			
		||||
			/* suck in c.slen bytes of data */
 | 
			
		||||
			want=(int)c.slen;
 | 
			
		||||
			want=c.slen;
 | 
			
		||||
			if (want > (len-off))
 | 
			
		||||
				{
 | 
			
		||||
				want-=(len-off);
 | 
			
		||||
				if (want > INT_MAX /* BIO_read takes an int length */ ||
 | 
			
		||||
					len+want < len)
 | 
			
		||||
						{
 | 
			
		||||
						ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ASN1_R_TOO_LONG);
 | 
			
		||||
						goto err;
 | 
			
		||||
						}
 | 
			
		||||
				if (!BUF_MEM_grow_clean(b,len+want))
 | 
			
		||||
					{
 | 
			
		||||
					ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
@@ -238,11 +251,18 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
 | 
			
		||||
						    ASN1_R_NOT_ENOUGH_DATA);
 | 
			
		||||
						goto err;
 | 
			
		||||
						}
 | 
			
		||||
					/* This can't overflow because
 | 
			
		||||
					 * |len+want| didn't overflow. */
 | 
			
		||||
					len+=i;
 | 
			
		||||
					want -= i;
 | 
			
		||||
					want-=i;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			off+=(int)c.slen;
 | 
			
		||||
			if (off + c.slen < off)
 | 
			
		||||
				{
 | 
			
		||||
				ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ASN1_R_TOO_LONG);
 | 
			
		||||
				goto err;
 | 
			
		||||
				}
 | 
			
		||||
			off+=c.slen;
 | 
			
		||||
			if (eos <= 0)
 | 
			
		||||
				{
 | 
			
		||||
				break;
 | 
			
		||||
@@ -252,9 +272,15 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (off > INT_MAX)
 | 
			
		||||
		{
 | 
			
		||||
		ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ASN1_R_TOO_LONG);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	*pb = b;
 | 
			
		||||
	return off;
 | 
			
		||||
err:
 | 
			
		||||
	if (b != NULL) BUF_MEM_free(b);
 | 
			
		||||
	return(ret);
 | 
			
		||||
	return -1;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -567,6 +567,7 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in)
 | 
			
		||||
	if(mbflag == -1) return -1;
 | 
			
		||||
	mbflag |= MBSTRING_FLAG;
 | 
			
		||||
	stmp.data = NULL;
 | 
			
		||||
	stmp.length = 0;
 | 
			
		||||
	ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING);
 | 
			
		||||
	if(ret < 0) return ret;
 | 
			
		||||
	*out = stmp.data;
 | 
			
		||||
 
 | 
			
		||||
@@ -140,6 +140,12 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a,
 | 
			
		||||
 | 
			
		||||
	int mdnid, pknid;
 | 
			
		||||
 | 
			
		||||
	if (!pkey)
 | 
			
		||||
		{
 | 
			
		||||
		ASN1err(ASN1_F_ASN1_ITEM_VERIFY, ERR_R_PASSED_NULL_PARAMETER);
 | 
			
		||||
		return -1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	EVP_MD_CTX_init(&ctx);
 | 
			
		||||
 | 
			
		||||
	/* Convert signature OID into digest and public key OIDs */
 | 
			
		||||
 
 | 
			
		||||
@@ -446,11 +446,11 @@ static int asn1_print_fsname(BIO *out, int indent,
 | 
			
		||||
	return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int asn1_print_boolean_ctx(BIO *out, const int bool,
 | 
			
		||||
static int asn1_print_boolean_ctx(BIO *out, int boolval,
 | 
			
		||||
							const ASN1_PCTX *pctx)
 | 
			
		||||
	{
 | 
			
		||||
	const char *str;
 | 
			
		||||
	switch (bool)
 | 
			
		||||
	switch (boolval)
 | 
			
		||||
		{
 | 
			
		||||
		case -1:
 | 
			
		||||
		str = "BOOL ABSENT";
 | 
			
		||||
@@ -574,10 +574,10 @@ static int asn1_primitive_print(BIO *out, ASN1_VALUE **fld,
 | 
			
		||||
		{
 | 
			
		||||
		case V_ASN1_BOOLEAN:
 | 
			
		||||
			{
 | 
			
		||||
			int bool = *(int *)fld;
 | 
			
		||||
			if (bool == -1)
 | 
			
		||||
				bool = it->size;
 | 
			
		||||
			ret = asn1_print_boolean_ctx(out, bool, pctx);
 | 
			
		||||
			int boolval = *(int *)fld;
 | 
			
		||||
			if (boolval == -1)
 | 
			
		||||
				boolval = it->size;
 | 
			
		||||
			ret = asn1_print_boolean_ctx(out, boolval, pctx);
 | 
			
		||||
			}
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -175,12 +175,15 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
 | 
			
		||||
	CRYPTO_w_lock(CRYPTO_LOCK_EVP_PKEY);
 | 
			
		||||
	if (key->pkey)
 | 
			
		||||
		{
 | 
			
		||||
		CRYPTO_w_unlock(CRYPTO_LOCK_EVP_PKEY);
 | 
			
		||||
		EVP_PKEY_free(ret);
 | 
			
		||||
		ret = key->pkey;
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		key->pkey = ret;
 | 
			
		||||
	CRYPTO_w_unlock(CRYPTO_LOCK_EVP_PKEY);
 | 
			
		||||
		CRYPTO_w_unlock(CRYPTO_LOCK_EVP_PKEY);
 | 
			
		||||
		}
 | 
			
		||||
	CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY);
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
 
 | 
			
		||||
@@ -960,7 +960,6 @@ int BIO_set_tcp_ndelay(int s, int on)
 | 
			
		||||
#endif
 | 
			
		||||
	return(ret == 0);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int BIO_socket_nbio(int s, int mode)
 | 
			
		||||
	{
 | 
			
		||||
@@ -973,3 +972,4 @@ int BIO_socket_nbio(int s, int mode)
 | 
			
		||||
#endif
 | 
			
		||||
	return(ret == 0);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -521,40 +521,40 @@ void BIO_free_all(BIO *bio)
 | 
			
		||||
 | 
			
		||||
BIO *BIO_dup_chain(BIO *in)
 | 
			
		||||
	{
 | 
			
		||||
	BIO *ret=NULL,*eoc=NULL,*bio,*new;
 | 
			
		||||
	BIO *ret=NULL,*eoc=NULL,*bio,*new_bio;
 | 
			
		||||
 | 
			
		||||
	for (bio=in; bio != NULL; bio=bio->next_bio)
 | 
			
		||||
		{
 | 
			
		||||
		if ((new=BIO_new(bio->method)) == NULL) goto err;
 | 
			
		||||
		new->callback=bio->callback;
 | 
			
		||||
		new->cb_arg=bio->cb_arg;
 | 
			
		||||
		new->init=bio->init;
 | 
			
		||||
		new->shutdown=bio->shutdown;
 | 
			
		||||
		new->flags=bio->flags;
 | 
			
		||||
		if ((new_bio=BIO_new(bio->method)) == NULL) goto err;
 | 
			
		||||
		new_bio->callback=bio->callback;
 | 
			
		||||
		new_bio->cb_arg=bio->cb_arg;
 | 
			
		||||
		new_bio->init=bio->init;
 | 
			
		||||
		new_bio->shutdown=bio->shutdown;
 | 
			
		||||
		new_bio->flags=bio->flags;
 | 
			
		||||
 | 
			
		||||
		/* This will let SSL_s_sock() work with stdin/stdout */
 | 
			
		||||
		new->num=bio->num;
 | 
			
		||||
		new_bio->num=bio->num;
 | 
			
		||||
 | 
			
		||||
		if (!BIO_dup_state(bio,(char *)new))
 | 
			
		||||
		if (!BIO_dup_state(bio,(char *)new_bio))
 | 
			
		||||
			{
 | 
			
		||||
			BIO_free(new);
 | 
			
		||||
			BIO_free(new_bio);
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		/* copy app data */
 | 
			
		||||
		if (!CRYPTO_dup_ex_data(CRYPTO_EX_INDEX_BIO, &new->ex_data,
 | 
			
		||||
		if (!CRYPTO_dup_ex_data(CRYPTO_EX_INDEX_BIO, &new_bio->ex_data,
 | 
			
		||||
					&bio->ex_data))
 | 
			
		||||
			goto err;
 | 
			
		||||
 | 
			
		||||
		if (ret == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			eoc=new;
 | 
			
		||||
			eoc=new_bio;
 | 
			
		||||
			ret=eoc;
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			BIO_push(eoc,new);
 | 
			
		||||
			eoc=new;
 | 
			
		||||
			BIO_push(eoc,new_bio);
 | 
			
		||||
			eoc=new_bio;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	return(ret);
 | 
			
		||||
 
 | 
			
		||||
@@ -77,10 +77,20 @@
 | 
			
		||||
#define OPENSSL_SCTP_FORWARD_CUM_TSN_CHUNK_TYPE 0xc0
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef OPENSSL_SYS_LINUX
 | 
			
		||||
#if defined(OPENSSL_SYS_LINUX) && !defined(IP_MTU)
 | 
			
		||||
#define IP_MTU      14 /* linux is lame */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(__FreeBSD__) && defined(IN6_IS_ADDR_V4MAPPED)
 | 
			
		||||
/* Standard definition causes type-punning problems. */
 | 
			
		||||
#undef IN6_IS_ADDR_V4MAPPED
 | 
			
		||||
#define s6_addr32 __u6_addr.__u6_addr32
 | 
			
		||||
#define IN6_IS_ADDR_V4MAPPED(a)               \
 | 
			
		||||
        (((a)->s6_addr32[0] == 0) &&          \
 | 
			
		||||
         ((a)->s6_addr32[1] == 0) &&          \
 | 
			
		||||
         ((a)->s6_addr32[2] == htonl(0x0000ffff)))
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef WATT32
 | 
			
		||||
#define sock_write SockWrite  /* Watt-32 uses same names */
 | 
			
		||||
#define sock_read  SockRead
 | 
			
		||||
@@ -255,7 +265,7 @@ static void dgram_adjust_rcv_timeout(BIO *b)
 | 
			
		||||
	{
 | 
			
		||||
#if defined(SO_RCVTIMEO)
 | 
			
		||||
	bio_dgram_data *data = (bio_dgram_data *)b->ptr;
 | 
			
		||||
	int sz = sizeof(int);
 | 
			
		||||
	union { size_t s; int i; } sz = {0};
 | 
			
		||||
 | 
			
		||||
	/* Is a timer active? */
 | 
			
		||||
	if (data->next_timeout.tv_sec > 0 || data->next_timeout.tv_usec > 0)
 | 
			
		||||
@@ -265,8 +275,10 @@ static void dgram_adjust_rcv_timeout(BIO *b)
 | 
			
		||||
		/* Read current socket timeout */
 | 
			
		||||
#ifdef OPENSSL_SYS_WINDOWS
 | 
			
		||||
		int timeout;
 | 
			
		||||
 | 
			
		||||
		sz.i = sizeof(timeout);
 | 
			
		||||
		if (getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO,
 | 
			
		||||
					   (void*)&timeout, &sz) < 0)
 | 
			
		||||
					   (void*)&timeout, &sz.i) < 0)
 | 
			
		||||
			{ perror("getsockopt"); }
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
@@ -274,9 +286,12 @@ static void dgram_adjust_rcv_timeout(BIO *b)
 | 
			
		||||
			data->socket_timeout.tv_usec = (timeout % 1000) * 1000;
 | 
			
		||||
			}
 | 
			
		||||
#else
 | 
			
		||||
		sz.i = sizeof(data->socket_timeout);
 | 
			
		||||
		if ( getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, 
 | 
			
		||||
						&(data->socket_timeout), (void *)&sz) < 0)
 | 
			
		||||
			{ perror("getsockopt"); }
 | 
			
		||||
		else if (sizeof(sz.s)!=sizeof(sz.i) && sz.i==0)
 | 
			
		||||
			OPENSSL_assert(sz.s<=sizeof(data->socket_timeout));
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		/* Get current time */
 | 
			
		||||
@@ -445,11 +460,10 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
	int *ip;
 | 
			
		||||
	struct sockaddr *to = NULL;
 | 
			
		||||
	bio_dgram_data *data = NULL;
 | 
			
		||||
#if defined(IP_MTU_DISCOVER) || defined(IP_MTU)
 | 
			
		||||
	long sockopt_val = 0;
 | 
			
		||||
	unsigned int sockopt_len = 0;
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef OPENSSL_SYS_LINUX
 | 
			
		||||
#if defined(OPENSSL_SYS_LINUX) && (defined(IP_MTU_DISCOVER) || defined(IP_MTU))
 | 
			
		||||
	int sockopt_val = 0;
 | 
			
		||||
	socklen_t sockopt_len;	/* assume that system supporting IP_MTU is
 | 
			
		||||
				 * modern enough to define socklen_t */
 | 
			
		||||
	socklen_t addr_len;
 | 
			
		||||
	union	{
 | 
			
		||||
		struct sockaddr	sa;
 | 
			
		||||
@@ -531,7 +545,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
		break;
 | 
			
		||||
		/* (Linux)kernel sets DF bit on outgoing IP packets */
 | 
			
		||||
	case BIO_CTRL_DGRAM_MTU_DISCOVER:
 | 
			
		||||
#ifdef OPENSSL_SYS_LINUX
 | 
			
		||||
#if defined(OPENSSL_SYS_LINUX) && defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO)
 | 
			
		||||
		addr_len = (socklen_t)sizeof(addr);
 | 
			
		||||
		memset((void *)&addr, 0, sizeof(addr));
 | 
			
		||||
		if (getsockname(b->num, &addr.sa, &addr_len) < 0)
 | 
			
		||||
@@ -539,7 +553,6 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
			ret = 0;
 | 
			
		||||
			break;
 | 
			
		||||
			}
 | 
			
		||||
		sockopt_len = sizeof(sockopt_val);
 | 
			
		||||
		switch (addr.sa.sa_family)
 | 
			
		||||
			{
 | 
			
		||||
		case AF_INET:
 | 
			
		||||
@@ -548,7 +561,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
				&sockopt_val, sizeof(sockopt_val))) < 0)
 | 
			
		||||
				perror("setsockopt");
 | 
			
		||||
			break;
 | 
			
		||||
#if OPENSSL_USE_IPV6 && defined(IPV6_MTU_DISCOVER)
 | 
			
		||||
#if OPENSSL_USE_IPV6 && defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DO)
 | 
			
		||||
		case AF_INET6:
 | 
			
		||||
			sockopt_val = IPV6_PMTUDISC_DO;
 | 
			
		||||
			if ((ret = setsockopt(b->num, IPPROTO_IPV6, IPV6_MTU_DISCOVER,
 | 
			
		||||
@@ -565,7 +578,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
		break;
 | 
			
		||||
#endif
 | 
			
		||||
	case BIO_CTRL_DGRAM_QUERY_MTU:
 | 
			
		||||
#ifdef OPENSSL_SYS_LINUX
 | 
			
		||||
#if defined(OPENSSL_SYS_LINUX) && defined(IP_MTU)
 | 
			
		||||
		addr_len = (socklen_t)sizeof(addr);
 | 
			
		||||
		memset((void *)&addr, 0, sizeof(addr));
 | 
			
		||||
		if (getsockname(b->num, &addr.sa, &addr_len) < 0)
 | 
			
		||||
@@ -727,12 +740,15 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
#endif
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_CTRL_DGRAM_GET_RECV_TIMEOUT:
 | 
			
		||||
#ifdef OPENSSL_SYS_WINDOWS
 | 
			
		||||
		{
 | 
			
		||||
		int timeout, sz = sizeof(timeout);
 | 
			
		||||
		union { size_t s; int i; } sz = {0};
 | 
			
		||||
#ifdef OPENSSL_SYS_WINDOWS
 | 
			
		||||
		int timeout;
 | 
			
		||||
		struct timeval *tv = (struct timeval *)ptr;
 | 
			
		||||
 | 
			
		||||
		sz.i = sizeof(timeout);
 | 
			
		||||
		if (getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO,
 | 
			
		||||
			(void*)&timeout, &sz) < 0)
 | 
			
		||||
			(void*)&timeout, &sz.i) < 0)
 | 
			
		||||
			{ perror("getsockopt"); ret = -1; }
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
@@ -740,12 +756,20 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
			tv->tv_usec = (timeout % 1000) * 1000;
 | 
			
		||||
			ret = sizeof(*tv);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
#else
 | 
			
		||||
		sz.i = sizeof(struct timeval);
 | 
			
		||||
		if ( getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, 
 | 
			
		||||
			ptr, (void *)&ret) < 0)
 | 
			
		||||
			ptr, (void *)&sz) < 0)
 | 
			
		||||
			{ perror("getsockopt"); ret = -1; }
 | 
			
		||||
		else if (sizeof(sz.s)!=sizeof(sz.i) && sz.i==0)
 | 
			
		||||
			{
 | 
			
		||||
			OPENSSL_assert(sz.s<=sizeof(struct timeval));
 | 
			
		||||
			ret = (int)sz.s;
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			ret = sz.i;
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
		break;
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(SO_SNDTIMEO)
 | 
			
		||||
@@ -765,12 +789,15 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
#endif
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_CTRL_DGRAM_GET_SEND_TIMEOUT:
 | 
			
		||||
#ifdef OPENSSL_SYS_WINDOWS
 | 
			
		||||
		{
 | 
			
		||||
		int timeout, sz = sizeof(timeout);
 | 
			
		||||
		union { size_t s; int i; } sz = {0};
 | 
			
		||||
#ifdef OPENSSL_SYS_WINDOWS
 | 
			
		||||
		int timeout;
 | 
			
		||||
		struct timeval *tv = (struct timeval *)ptr;
 | 
			
		||||
 | 
			
		||||
		sz.i = sizeof(timeout);
 | 
			
		||||
		if (getsockopt(b->num, SOL_SOCKET, SO_SNDTIMEO,
 | 
			
		||||
			(void*)&timeout, &sz) < 0)
 | 
			
		||||
			(void*)&timeout, &sz.i) < 0)
 | 
			
		||||
			{ perror("getsockopt"); ret = -1; }
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
@@ -778,12 +805,20 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
			tv->tv_usec = (timeout % 1000) * 1000;
 | 
			
		||||
			ret = sizeof(*tv);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
#else
 | 
			
		||||
		sz.i = sizeof(struct timeval);
 | 
			
		||||
		if ( getsockopt(b->num, SOL_SOCKET, SO_SNDTIMEO, 
 | 
			
		||||
			ptr, (void *)&ret) < 0)
 | 
			
		||||
			ptr, (void *)&sz) < 0)
 | 
			
		||||
			{ perror("getsockopt"); ret = -1; }
 | 
			
		||||
		else if (sizeof(sz.s)!=sizeof(sz.i) && sz.i==0)
 | 
			
		||||
			{
 | 
			
		||||
			OPENSSL_assert(sz.s<=sizeof(struct timeval));
 | 
			
		||||
			ret = (int)sz.s;
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			ret = sz.i;
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
		break;
 | 
			
		||||
#endif
 | 
			
		||||
	case BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP:
 | 
			
		||||
@@ -955,7 +990,6 @@ static int dgram_sctp_free(BIO *a)
 | 
			
		||||
#ifdef SCTP_AUTHENTICATION_EVENT
 | 
			
		||||
void dgram_sctp_handle_auth_free_key_event(BIO *b, union sctp_notification *snp)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned int sockopt_len = 0;
 | 
			
		||||
	int ret;
 | 
			
		||||
	struct sctp_authkey_event* authkeyevent = &snp->sn_auth_event;
 | 
			
		||||
 | 
			
		||||
@@ -965,9 +999,8 @@ void dgram_sctp_handle_auth_free_key_event(BIO *b, union sctp_notification *snp)
 | 
			
		||||
 | 
			
		||||
		/* delete key */
 | 
			
		||||
		authkeyid.scact_keynumber = authkeyevent->auth_keynumber;
 | 
			
		||||
		sockopt_len = sizeof(struct sctp_authkeyid);
 | 
			
		||||
		ret = setsockopt(b->num, IPPROTO_SCTP, SCTP_AUTH_DELETE_KEY,
 | 
			
		||||
		      &authkeyid, sockopt_len);
 | 
			
		||||
		      &authkeyid, sizeof(struct sctp_authkeyid));
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1298,7 +1331,7 @@ static long dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
	{
 | 
			
		||||
	long ret=1;
 | 
			
		||||
	bio_dgram_sctp_data *data = NULL;
 | 
			
		||||
	unsigned int sockopt_len = 0;
 | 
			
		||||
	socklen_t sockopt_len = 0;
 | 
			
		||||
	struct sctp_authkeyid authkeyid;
 | 
			
		||||
	struct sctp_authkey *authkey;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -819,7 +819,7 @@ ___
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	.set	reorder
 | 
			
		||||
	move	$ta3,$ra
 | 
			
		||||
	bal	bn_div_words
 | 
			
		||||
	bal	bn_div_words_internal
 | 
			
		||||
	move	$ra,$ta3
 | 
			
		||||
	$MULTU	$ta2,$v0
 | 
			
		||||
	$LD	$t2,-2*$BNSZ($a3)
 | 
			
		||||
 
 | 
			
		||||
@@ -68,7 +68,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 | 
			
		||||
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
 | 
			
		||||
die "can't locate x86_64-xlate.pl";
 | 
			
		||||
 | 
			
		||||
open STDOUT,"| $^X $xlate $flavour $output";
 | 
			
		||||
open OUT,"| \"$^X\" $xlate $flavour $output";
 | 
			
		||||
*STDOUT=*OUT;
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
my $code=".text\n\n";
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 | 
			
		||||
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
 | 
			
		||||
die "can't locate x86_64-xlate.pl";
 | 
			
		||||
 | 
			
		||||
open STDOUT,"| $^X $xlate $flavour $output";
 | 
			
		||||
open STDOUT,"| \"$^X\" $xlate $flavour $output";
 | 
			
		||||
 | 
			
		||||
($lo,$hi)=("%rax","%rdx");	$a=$lo;
 | 
			
		||||
($i0,$i1)=("%rsi","%rdi");
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 | 
			
		||||
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
 | 
			
		||||
die "can't locate x86_64-xlate.pl";
 | 
			
		||||
 | 
			
		||||
open STDOUT,"| $^X $xlate $flavour $output";
 | 
			
		||||
open OUT,"| \"$^X\" $xlate $flavour $output";
 | 
			
		||||
*STDOUT=*OUT;
 | 
			
		||||
 | 
			
		||||
# int bn_mul_mont(
 | 
			
		||||
$rp="%rdi";	# BN_ULONG *rp,
 | 
			
		||||
 
 | 
			
		||||
@@ -28,7 +28,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 | 
			
		||||
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
 | 
			
		||||
die "can't locate x86_64-xlate.pl";
 | 
			
		||||
 | 
			
		||||
open STDOUT,"| $^X $xlate $flavour $output";
 | 
			
		||||
open OUT,"| \"$^X\" $xlate $flavour $output";
 | 
			
		||||
*STDOUT=*OUT;
 | 
			
		||||
 | 
			
		||||
# int bn_mul_mont_gather5(
 | 
			
		||||
$rp="%rdi";	# BN_ULONG *rp,
 | 
			
		||||
 
 | 
			
		||||
@@ -141,6 +141,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
 | 
			
		||||
    *
 | 
			
		||||
    *					<appro@fy.chalmers.se>
 | 
			
		||||
    */
 | 
			
		||||
#undef bn_div_words
 | 
			
		||||
#  define bn_div_words(n0,n1,d0)		\
 | 
			
		||||
	({  asm volatile (			\
 | 
			
		||||
		"divl	%4"			\
 | 
			
		||||
@@ -155,6 +156,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
 | 
			
		||||
    * Same story here, but it's 128-bit by 64-bit division. Wow!
 | 
			
		||||
    *					<appro@fy.chalmers.se>
 | 
			
		||||
    */
 | 
			
		||||
#  undef bn_div_words
 | 
			
		||||
#  define bn_div_words(n0,n1,d0)		\
 | 
			
		||||
	({  asm volatile (			\
 | 
			
		||||
		"divq	%4"			\
 | 
			
		||||
 
 | 
			
		||||
@@ -205,6 +205,7 @@ err:
 | 
			
		||||
/* solves ax == 1 (mod n) */
 | 
			
		||||
static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
 | 
			
		||||
        const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
 | 
			
		||||
 | 
			
		||||
BIGNUM *BN_mod_inverse(BIGNUM *in,
 | 
			
		||||
	const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
 | 
			
		||||
	{
 | 
			
		||||
 
 | 
			
		||||
@@ -628,8 +628,11 @@ int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
 | 
			
		||||
			}
 | 
			
		||||
		if (ubits==vbits)
 | 
			
		||||
			{
 | 
			
		||||
			bn_correct_top(u);
 | 
			
		||||
			ubits = BN_num_bits(u);
 | 
			
		||||
			BN_ULONG ul;
 | 
			
		||||
			int utop = (ubits-1)/BN_BITS2;
 | 
			
		||||
 | 
			
		||||
			while ((ul=udp[utop])==0 && utop) utop--;
 | 
			
		||||
			ubits = utop*BN_BITS2 + BN_num_bits_word(ul);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	bn_correct_top(b);
 | 
			
		||||
 
 | 
			
		||||
@@ -282,16 +282,23 @@ extern "C" {
 | 
			
		||||
#  endif
 | 
			
		||||
# elif defined(__mips) && (defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG))
 | 
			
		||||
#  if defined(__GNUC__) && __GNUC__>=2
 | 
			
		||||
#   define BN_UMULT_HIGH(a,b)	({	\
 | 
			
		||||
#   if __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) ({	\
 | 
			
		||||
	__uint128_t ret=(__uint128_t)(a)*(b);	\
 | 
			
		||||
	(high)=ret>>64; (low)=ret;	 })
 | 
			
		||||
#   else
 | 
			
		||||
#     define BN_UMULT_HIGH(a,b)	({	\
 | 
			
		||||
	register BN_ULONG ret;		\
 | 
			
		||||
	asm ("dmultu	%1,%2"		\
 | 
			
		||||
	     : "=h"(ret)		\
 | 
			
		||||
	     : "r"(a), "r"(b) : "l");	\
 | 
			
		||||
	ret;			})
 | 
			
		||||
#   define BN_UMULT_LOHI(low,high,a,b)	\
 | 
			
		||||
#     define BN_UMULT_LOHI(low,high,a,b)\
 | 
			
		||||
	asm ("dmultu	%2,%3"		\
 | 
			
		||||
	     : "=l"(low),"=h"(high)	\
 | 
			
		||||
	     : "r"(a), "r"(b));
 | 
			
		||||
#    endif
 | 
			
		||||
#  endif
 | 
			
		||||
# endif		/* cpu */
 | 
			
		||||
#endif		/* OPENSSL_NO_ASM */
 | 
			
		||||
 
 | 
			
		||||
@@ -144,26 +144,17 @@ int BN_add_word(BIGNUM *a, BN_ULONG w)
 | 
			
		||||
			a->neg=!(a->neg);
 | 
			
		||||
		return(i);
 | 
			
		||||
		}
 | 
			
		||||
	/* Only expand (and risk failing) if it's possibly necessary */
 | 
			
		||||
	if (((BN_ULONG)(a->d[a->top - 1] + 1) == 0) &&
 | 
			
		||||
			(bn_wexpand(a,a->top+1) == NULL))
 | 
			
		||||
		return(0);
 | 
			
		||||
	i=0;
 | 
			
		||||
	for (;;)
 | 
			
		||||
	for (i=0;w!=0 && i<a->top;i++)
 | 
			
		||||
		{
 | 
			
		||||
		if (i >= a->top)
 | 
			
		||||
			l=w;
 | 
			
		||||
		else
 | 
			
		||||
			l=(a->d[i]+w)&BN_MASK2;
 | 
			
		||||
		a->d[i]=l;
 | 
			
		||||
		if (w > l)
 | 
			
		||||
			w=1;
 | 
			
		||||
		else
 | 
			
		||||
			break;
 | 
			
		||||
		i++;
 | 
			
		||||
		a->d[i] = l = (a->d[i]+w)&BN_MASK2;
 | 
			
		||||
		w = (w>l)?1:0;
 | 
			
		||||
		}
 | 
			
		||||
	if (i >= a->top)
 | 
			
		||||
	if (w && i==a->top)
 | 
			
		||||
		{
 | 
			
		||||
		if (bn_wexpand(a,a->top+1) == NULL) return 0;
 | 
			
		||||
		a->top++;
 | 
			
		||||
		a->d[i]=w;
 | 
			
		||||
		}
 | 
			
		||||
	bn_check_top(a);
 | 
			
		||||
	return(1);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -60,6 +60,11 @@
 | 
			
		||||
#include "cryptlib.h"
 | 
			
		||||
#include <openssl/buffer.h>
 | 
			
		||||
 | 
			
		||||
/* LIMIT_BEFORE_EXPANSION is the maximum n such that (n+3)/3*4 < 2**31. That
 | 
			
		||||
 * function is applied in several functions in this file and this limit ensures
 | 
			
		||||
 * that the result fits in an int. */
 | 
			
		||||
#define LIMIT_BEFORE_EXPANSION 0x5ffffffc
 | 
			
		||||
 | 
			
		||||
BUF_MEM *BUF_MEM_new(void)
 | 
			
		||||
	{
 | 
			
		||||
	BUF_MEM *ret;
 | 
			
		||||
@@ -105,6 +110,12 @@ int BUF_MEM_grow(BUF_MEM *str, size_t len)
 | 
			
		||||
		str->length=len;
 | 
			
		||||
		return(len);
 | 
			
		||||
		}
 | 
			
		||||
	/* This limit is sufficient to ensure (len+3)/3*4 < 2**31 */
 | 
			
		||||
	if (len > LIMIT_BEFORE_EXPANSION)
 | 
			
		||||
		{
 | 
			
		||||
		BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
	n=(len+3)/3*4;
 | 
			
		||||
	if (str->data == NULL)
 | 
			
		||||
		ret=OPENSSL_malloc(n);
 | 
			
		||||
@@ -142,6 +153,12 @@ int BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
 | 
			
		||||
		str->length=len;
 | 
			
		||||
		return(len);
 | 
			
		||||
		}
 | 
			
		||||
	/* This limit is sufficient to ensure (len+3)/3*4 < 2**31 */
 | 
			
		||||
	if (len > LIMIT_BEFORE_EXPANSION)
 | 
			
		||||
		{
 | 
			
		||||
		BUFerr(BUF_F_BUF_MEM_GROW_CLEAN,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
	n=(len+3)/3*4;
 | 
			
		||||
	if (str->data == NULL)
 | 
			
		||||
		ret=OPENSSL_malloc(n);
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 | 
			
		||||
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
 | 
			
		||||
die "can't locate x86_64-xlate.pl";
 | 
			
		||||
 | 
			
		||||
open STDOUT,"| $^X $xlate $flavour $output";
 | 
			
		||||
open OUT,"| \"$^X\" $xlate $flavour $output";
 | 
			
		||||
*STDOUT=*OUT;
 | 
			
		||||
 | 
			
		||||
sub hi() { my $r=shift; $r =~ s/%[er]([a-d])x/%\1h/;    $r; }
 | 
			
		||||
sub lo() { my $r=shift; $r =~ s/%[er]([a-d])x/%\1l/;
 | 
			
		||||
 
 | 
			
		||||
@@ -179,6 +179,8 @@ int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen,
 | 
			
		||||
			return 0;
 | 
			
		||||
		if (!EVP_EncryptInit_ex(&ctx->cctx, NULL, NULL, NULL, zero_iv))
 | 
			
		||||
			return 0;
 | 
			
		||||
		memset(ctx->tbl, 0, EVP_CIPHER_CTX_block_size(&ctx->cctx));
 | 
			
		||||
		ctx->nlast_block = 0;
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
	/* Initialiase context */
 | 
			
		||||
 
 | 
			
		||||
@@ -58,7 +58,9 @@
 | 
			
		||||
#include <openssl/err.h>
 | 
			
		||||
#include <openssl/cms.h>
 | 
			
		||||
#include <openssl/bio.h>
 | 
			
		||||
#ifndef OPENSSL_NO_COMP
 | 
			
		||||
#include <openssl/comp.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include "cms_lcl.h"
 | 
			
		||||
 | 
			
		||||
DECLARE_ASN1_ITEM(CMS_CompressedData)
 | 
			
		||||
 
 | 
			
		||||
@@ -74,7 +74,7 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec)
 | 
			
		||||
	X509_ALGOR *calg = ec->contentEncryptionAlgorithm;
 | 
			
		||||
	unsigned char iv[EVP_MAX_IV_LENGTH], *piv = NULL;
 | 
			
		||||
	unsigned char *tkey = NULL;
 | 
			
		||||
	size_t tkeylen;
 | 
			
		||||
	size_t tkeylen = 0;
 | 
			
		||||
 | 
			
		||||
	int ok = 0;
 | 
			
		||||
 | 
			
		||||
@@ -139,10 +139,10 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec)
 | 
			
		||||
				CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
	tkeylen = EVP_CIPHER_CTX_key_length(ctx);
 | 
			
		||||
	/* Generate random session key */
 | 
			
		||||
	if (!enc || !ec->key)
 | 
			
		||||
		{
 | 
			
		||||
		tkeylen = EVP_CIPHER_CTX_key_length(ctx);
 | 
			
		||||
		tkey = OPENSSL_malloc(tkeylen);
 | 
			
		||||
		if (!tkey)
 | 
			
		||||
			{
 | 
			
		||||
@@ -174,7 +174,7 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec)
 | 
			
		||||
			/* Only reveal failure if debugging so we don't
 | 
			
		||||
			 * leak information which may be useful in MMA.
 | 
			
		||||
			 */
 | 
			
		||||
			if (ec->debug)
 | 
			
		||||
			if (enc || ec->debug)
 | 
			
		||||
				{
 | 
			
		||||
				CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO,
 | 
			
		||||
						CMS_R_INVALID_KEY_LENGTH);
 | 
			
		||||
 
 | 
			
		||||
@@ -411,9 +411,7 @@ int cms_DigestAlgorithm_find_ctx(EVP_MD_CTX *mctx, BIO *chain,
 | 
			
		||||
		 * algorithm  OID instead of digest.
 | 
			
		||||
		 */
 | 
			
		||||
			|| EVP_MD_pkey_type(EVP_MD_CTX_md(mtmp)) == nid)
 | 
			
		||||
			{
 | 
			
		||||
			return EVP_MD_CTX_copy_ex(mctx, mtmp);
 | 
			
		||||
			}
 | 
			
		||||
		chain = BIO_next(chain);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -76,5 +76,6 @@ void OPENSSL_load_builtin_modules(void)
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	ENGINE_add_conf_module();
 | 
			
		||||
#endif
 | 
			
		||||
	EVP_add_alg_module();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -504,7 +504,7 @@ void CRYPTO_THREADID_current(CRYPTO_THREADID *id)
 | 
			
		||||
	CRYPTO_THREADID_set_numeric(id, (unsigned long)find_thread(NULL));
 | 
			
		||||
#else
 | 
			
		||||
	/* For everything else, default to using the address of 'errno' */
 | 
			
		||||
	CRYPTO_THREADID_set_pointer(id, &errno);
 | 
			
		||||
	CRYPTO_THREADID_set_pointer(id, (void*)&errno);
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -704,6 +704,7 @@ void OPENSSL_cpuid_setup(void)
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
	vec = OPENSSL_ia32_cpuid();
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * |(1<<10) sets a reserved bit to signal that variable
 | 
			
		||||
     * was initialized already... This is to avoid interference
 | 
			
		||||
@@ -924,3 +925,16 @@ void OpenSSLDie(const char *file,int line,const char *assertion)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
void *OPENSSL_stderr(void)	{ return stderr; }
 | 
			
		||||
 | 
			
		||||
int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len)
 | 
			
		||||
	{
 | 
			
		||||
	size_t i;
 | 
			
		||||
	const unsigned char *a = in_a;
 | 
			
		||||
	const unsigned char *b = in_b;
 | 
			
		||||
	unsigned char x = 0;
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < len; i++)
 | 
			
		||||
		x |= a[i] ^ b[i];
 | 
			
		||||
 | 
			
		||||
	return x;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -100,7 +100,7 @@ extern "C" {
 | 
			
		||||
 | 
			
		||||
void OPENSSL_cpuid_setup(void);
 | 
			
		||||
extern unsigned int OPENSSL_ia32cap_P[];
 | 
			
		||||
void OPENSSL_showfatal(const char *,...);
 | 
			
		||||
void OPENSSL_showfatal(const char *fmta,...);
 | 
			
		||||
void *OPENSSL_stderr(void);
 | 
			
		||||
extern int OPENSSL_NONPIC_relocated;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -282,7 +282,7 @@ $ LIB_RAND = "md_rand,randfile,rand_lib,rand_err,rand_egd,"+ -
 | 
			
		||||
	"rand_vms"
 | 
			
		||||
$ LIB_ERR = "err,err_all,err_prn"
 | 
			
		||||
$ LIB_OBJECTS = "o_names,obj_dat,obj_lib,obj_err,obj_xref"
 | 
			
		||||
$ LIB_EVP = "encode,digest,evp_enc,evp_key,evp_acnf,"+ -
 | 
			
		||||
$ LIB_EVP = "encode,digest,evp_enc,evp_key,evp_acnf,evp_cnf,"+ -
 | 
			
		||||
	"e_des,e_bf,e_idea,e_des3,e_camellia,"+ -
 | 
			
		||||
	"e_rc4,e_aes,names,e_seed,"+ -
 | 
			
		||||
	"e_xcbc_d,e_rc2,e_cast,e_rc5"
 | 
			
		||||
 
 | 
			
		||||
@@ -488,10 +488,10 @@ void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int),
 | 
			
		||||
				    long (**go)(void));
 | 
			
		||||
 | 
			
		||||
void *CRYPTO_malloc_locked(int num, const char *file, int line);
 | 
			
		||||
void CRYPTO_free_locked(void *);
 | 
			
		||||
void CRYPTO_free_locked(void *ptr);
 | 
			
		||||
void *CRYPTO_malloc(int num, const char *file, int line);
 | 
			
		||||
char *CRYPTO_strdup(const char *str, const char *file, int line);
 | 
			
		||||
void CRYPTO_free(void *);
 | 
			
		||||
void CRYPTO_free(void *ptr);
 | 
			
		||||
void *CRYPTO_realloc(void *addr,int num, const char *file, int line);
 | 
			
		||||
void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file,
 | 
			
		||||
			   int line);
 | 
			
		||||
@@ -574,6 +574,13 @@ void OPENSSL_init(void);
 | 
			
		||||
#define fips_cipher_abort(alg) while(0)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. It
 | 
			
		||||
 * takes an amount of time dependent on |len|, but independent of the contents
 | 
			
		||||
 * of |a| and |b|. Unlike memcmp, it cannot be used to put elements into a
 | 
			
		||||
 * defined order as the return value when a != b is undefined, other than to be
 | 
			
		||||
 * non-zero. */
 | 
			
		||||
int CRYPTO_memcmp(const void *a, const void *b, size_t len);
 | 
			
		||||
 | 
			
		||||
/* BEGIN ERROR CODES */
 | 
			
		||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
 | 
			
		||||
 * made after this point may be overwritten when the script is next run.
 | 
			
		||||
 
 | 
			
		||||
@@ -63,9 +63,8 @@
 | 
			
		||||
 * 1.1 added norm_expand_bits
 | 
			
		||||
 * 1.0 First working version
 | 
			
		||||
 */
 | 
			
		||||
#include "des_locl.h"
 | 
			
		||||
 | 
			
		||||
#include <openssl/crypto.h>
 | 
			
		||||
#include "des_locl.h"
 | 
			
		||||
 | 
			
		||||
OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key,0)	/* defaults to false */
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -56,8 +56,8 @@
 | 
			
		||||
 * [including the GNU Public Licence.]
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "des_locl.h"
 | 
			
		||||
#include <openssl/crypto.h>
 | 
			
		||||
#include "des_locl.h"
 | 
			
		||||
 | 
			
		||||
void DES_string_to_key(const char *str, DES_cblock *key)
 | 
			
		||||
	{
 | 
			
		||||
 
 | 
			
		||||
@@ -274,10 +274,10 @@ int EC_GROUP_get_curve_name(const EC_GROUP *group);
 | 
			
		||||
void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag);
 | 
			
		||||
int EC_GROUP_get_asn1_flag(const EC_GROUP *group);
 | 
			
		||||
 | 
			
		||||
void EC_GROUP_set_point_conversion_form(EC_GROUP *, point_conversion_form_t);
 | 
			
		||||
void EC_GROUP_set_point_conversion_form(EC_GROUP *group, point_conversion_form_t form);
 | 
			
		||||
point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *);
 | 
			
		||||
 | 
			
		||||
unsigned char *EC_GROUP_get0_seed(const EC_GROUP *);
 | 
			
		||||
unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x);
 | 
			
		||||
size_t EC_GROUP_get_seed_len(const EC_GROUP *);
 | 
			
		||||
size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len);
 | 
			
		||||
 | 
			
		||||
@@ -626,8 +626,8 @@ int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *c
 | 
			
		||||
 */
 | 
			
		||||
int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx);
 | 
			
		||||
 | 
			
		||||
int EC_POINT_make_affine(const EC_GROUP *, EC_POINT *, BN_CTX *);
 | 
			
		||||
int EC_POINTs_make_affine(const EC_GROUP *, size_t num, EC_POINT *[], BN_CTX *);
 | 
			
		||||
int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx);
 | 
			
		||||
int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx);
 | 
			
		||||
 | 
			
		||||
/** Computes r = generator * n sum_{i=0}^num p[i] * m[i]
 | 
			
		||||
 *  \param  group  underlying EC_GROUP object
 | 
			
		||||
@@ -800,16 +800,24 @@ const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key);
 | 
			
		||||
int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub);
 | 
			
		||||
 | 
			
		||||
unsigned EC_KEY_get_enc_flags(const EC_KEY *key);
 | 
			
		||||
void EC_KEY_set_enc_flags(EC_KEY *, unsigned int);
 | 
			
		||||
point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *);
 | 
			
		||||
void EC_KEY_set_conv_form(EC_KEY *, point_conversion_form_t);
 | 
			
		||||
void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags);
 | 
			
		||||
point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key);
 | 
			
		||||
void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform);
 | 
			
		||||
/* functions to set/get method specific data  */
 | 
			
		||||
void *EC_KEY_get_key_method_data(EC_KEY *, 
 | 
			
		||||
void *EC_KEY_get_key_method_data(EC_KEY *key, 
 | 
			
		||||
	void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));
 | 
			
		||||
void EC_KEY_insert_key_method_data(EC_KEY *, void *data,
 | 
			
		||||
/** Sets the key method data of an EC_KEY object, if none has yet been set.
 | 
			
		||||
 *  \param  key              EC_KEY object
 | 
			
		||||
 *  \param  data             opaque data to install.
 | 
			
		||||
 *  \param  dup_func         a function that duplicates |data|.
 | 
			
		||||
 *  \param  free_func        a function that frees |data|.
 | 
			
		||||
 *  \param  clear_free_func  a function that wipes and frees |data|.
 | 
			
		||||
 *  \return the previously set data pointer, or NULL if |data| was inserted.
 | 
			
		||||
 */
 | 
			
		||||
void *EC_KEY_insert_key_method_data(EC_KEY *key, void *data,
 | 
			
		||||
	void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));
 | 
			
		||||
/* wrapper functions for the underlying EC_GROUP object */
 | 
			
		||||
void EC_KEY_set_asn1_flag(EC_KEY *, int);
 | 
			
		||||
void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag);
 | 
			
		||||
 | 
			
		||||
/** Creates a table of pre-computed multiples of the generator to 
 | 
			
		||||
 *  accelerate further EC_KEY operations.
 | 
			
		||||
 
 | 
			
		||||
@@ -520,18 +520,27 @@ void EC_KEY_set_conv_form(EC_KEY *key, point_conversion_form_t cform)
 | 
			
		||||
void *EC_KEY_get_key_method_data(EC_KEY *key,
 | 
			
		||||
	void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *))
 | 
			
		||||
	{
 | 
			
		||||
	return EC_EX_DATA_get_data(key->method_data, dup_func, free_func, clear_free_func);
 | 
			
		||||
	void *ret;
 | 
			
		||||
 | 
			
		||||
	CRYPTO_r_lock(CRYPTO_LOCK_EC);
 | 
			
		||||
	ret = EC_EX_DATA_get_data(key->method_data, dup_func, free_func, clear_free_func);
 | 
			
		||||
	CRYPTO_r_unlock(CRYPTO_LOCK_EC);
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
void EC_KEY_insert_key_method_data(EC_KEY *key, void *data,
 | 
			
		||||
void *EC_KEY_insert_key_method_data(EC_KEY *key, void *data,
 | 
			
		||||
	void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *))
 | 
			
		||||
	{
 | 
			
		||||
	EC_EXTRA_DATA *ex_data;
 | 
			
		||||
 | 
			
		||||
	CRYPTO_w_lock(CRYPTO_LOCK_EC);
 | 
			
		||||
	ex_data = EC_EX_DATA_get_data(key->method_data, dup_func, free_func, clear_free_func);
 | 
			
		||||
	if (ex_data == NULL)
 | 
			
		||||
		EC_EX_DATA_set_data(&key->method_data, data, dup_func, free_func, clear_free_func);
 | 
			
		||||
	CRYPTO_w_unlock(CRYPTO_LOCK_EC);
 | 
			
		||||
 | 
			
		||||
	return ex_data;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
void EC_KEY_set_asn1_flag(EC_KEY *key, int flag)
 | 
			
		||||
 
 | 
			
		||||
@@ -188,7 +188,7 @@ static int pkey_ec_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen)
 | 
			
		||||
 | 
			
		||||
	pubkey = EC_KEY_get0_public_key(ctx->peerkey->pkey.ec);
 | 
			
		||||
 | 
			
		||||
	/* NB: unlike PKS#3 DH, if *outlen is less than maximum size this is
 | 
			
		||||
	/* NB: unlike PKCS#3 DH, if *outlen is less than maximum size this is
 | 
			
		||||
	 * not an error, the result is truncated.
 | 
			
		||||
	 */
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -114,7 +114,6 @@ const EC_METHOD *EC_GFp_mont_method(void)
 | 
			
		||||
		ec_GFp_mont_field_decode,
 | 
			
		||||
		ec_GFp_mont_field_set_to_one };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	return &ret;
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -236,7 +236,7 @@ static void group_order_tests(EC_GROUP *group)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static void prime_field_tests(void)
 | 
			
		||||
	{	
 | 
			
		||||
	{
 | 
			
		||||
	BN_CTX *ctx = NULL;
 | 
			
		||||
	BIGNUM *p, *a, *b;
 | 
			
		||||
	EC_GROUP *group;
 | 
			
		||||
 
 | 
			
		||||
@@ -84,17 +84,12 @@ ech_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
 | 
			
		||||
ech_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
ech_err.o: ech_err.c
 | 
			
		||||
ech_key.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
			
		||||
ech_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
ech_key.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
ech_key.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
ech_key.o: ../../include/openssl/engine.h ../../include/openssl/evp.h
 | 
			
		||||
ech_key.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
ech_key.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
ech_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
ech_key.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
ech_key.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
ech_key.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
ech_key.o: ../../include/openssl/x509_vfy.h ech_key.c ech_locl.h
 | 
			
		||||
ech_key.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
ech_key.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
ech_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
ech_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
 | 
			
		||||
ech_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
ech_key.o: ech_key.c ech_locl.h
 | 
			
		||||
ech_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
			
		||||
ech_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
ech_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
 
 | 
			
		||||
@@ -68,9 +68,6 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "ech_locl.h"
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
#include <openssl/engine.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
 | 
			
		||||
	EC_KEY *eckey,
 | 
			
		||||
 
 | 
			
		||||
@@ -222,8 +222,15 @@ ECDH_DATA *ecdh_check(EC_KEY *key)
 | 
			
		||||
		ecdh_data = (ECDH_DATA *)ecdh_data_new();
 | 
			
		||||
		if (ecdh_data == NULL)
 | 
			
		||||
			return NULL;
 | 
			
		||||
		EC_KEY_insert_key_method_data(key, (void *)ecdh_data,
 | 
			
		||||
			ecdh_data_dup, ecdh_data_free, ecdh_data_free);
 | 
			
		||||
		data = EC_KEY_insert_key_method_data(key, (void *)ecdh_data,
 | 
			
		||||
			   ecdh_data_dup, ecdh_data_free, ecdh_data_free);
 | 
			
		||||
		if (data != NULL)
 | 
			
		||||
			{
 | 
			
		||||
			/* Another thread raced us to install the key_method
 | 
			
		||||
			 * data and won. */
 | 
			
		||||
			ecdh_data_free(ecdh_data);
 | 
			
		||||
			ecdh_data = (ECDH_DATA *)data;
 | 
			
		||||
			}
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
		ecdh_data = (ECDH_DATA *)data;
 | 
			
		||||
 
 | 
			
		||||
@@ -200,8 +200,15 @@ ECDSA_DATA *ecdsa_check(EC_KEY *key)
 | 
			
		||||
		ecdsa_data = (ECDSA_DATA *)ecdsa_data_new();
 | 
			
		||||
		if (ecdsa_data == NULL)
 | 
			
		||||
			return NULL;
 | 
			
		||||
		EC_KEY_insert_key_method_data(key, (void *)ecdsa_data,
 | 
			
		||||
			ecdsa_data_dup, ecdsa_data_free, ecdsa_data_free);
 | 
			
		||||
		data = EC_KEY_insert_key_method_data(key, (void *)ecdsa_data,
 | 
			
		||||
			   ecdsa_data_dup, ecdsa_data_free, ecdsa_data_free);
 | 
			
		||||
		if (data != NULL)
 | 
			
		||||
			{
 | 
			
		||||
			/* Another thread raced us to install the key_method
 | 
			
		||||
			 * data and won. */
 | 
			
		||||
			ecdsa_data_free(ecdsa_data);
 | 
			
		||||
			ecdsa_data = (ECDSA_DATA *)data;
 | 
			
		||||
			}
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
		ecdsa_data = (ECDSA_DATA *)data;
 | 
			
		||||
 
 | 
			
		||||
@@ -64,7 +64,9 @@
 | 
			
		||||
#endif
 | 
			
		||||
#include <openssl/buffer.h>
 | 
			
		||||
#include <openssl/bio.h>
 | 
			
		||||
#ifndef OPENSSL_NO_COMP
 | 
			
		||||
#include <openssl/comp.h>
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_RSA
 | 
			
		||||
#include <openssl/rsa.h>
 | 
			
		||||
#endif
 | 
			
		||||
@@ -95,6 +97,9 @@
 | 
			
		||||
#include <openssl/ui.h>
 | 
			
		||||
#include <openssl/ocsp.h>
 | 
			
		||||
#include <openssl/err.h>
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
#include <openssl/fips.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include <openssl/ts.h>
 | 
			
		||||
#ifndef OPENSSL_NO_CMS
 | 
			
		||||
#include <openssl/cms.h>
 | 
			
		||||
@@ -102,11 +107,6 @@
 | 
			
		||||
#ifndef OPENSSL_NO_JPAKE
 | 
			
		||||
#include <openssl/jpake.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include <openssl/comp.h>
 | 
			
		||||
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
#include <openssl/fips.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
void ERR_load_crypto_strings(void)
 | 
			
		||||
	{
 | 
			
		||||
@@ -130,7 +130,9 @@ void ERR_load_crypto_strings(void)
 | 
			
		||||
	ERR_load_ASN1_strings();
 | 
			
		||||
	ERR_load_CONF_strings();
 | 
			
		||||
	ERR_load_CRYPTO_strings();
 | 
			
		||||
#ifndef OPENSSL_NO_COMP
 | 
			
		||||
	ERR_load_COMP_strings();
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_EC
 | 
			
		||||
	ERR_load_EC_strings();
 | 
			
		||||
#endif
 | 
			
		||||
@@ -153,15 +155,14 @@ void ERR_load_crypto_strings(void)
 | 
			
		||||
#endif
 | 
			
		||||
	ERR_load_OCSP_strings();
 | 
			
		||||
	ERR_load_UI_strings();
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
	ERR_load_FIPS_strings();
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_CMS
 | 
			
		||||
	ERR_load_CMS_strings();
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_JPAKE
 | 
			
		||||
	ERR_load_JPAKE_strings();
 | 
			
		||||
#endif
 | 
			
		||||
	ERR_load_COMP_strings();
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
	ERR_load_FIPS_strings();
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ TESTDATA=evptests.txt
 | 
			
		||||
APPS=
 | 
			
		||||
 | 
			
		||||
LIB=$(TOP)/libcrypto.a
 | 
			
		||||
LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \
 | 
			
		||||
LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c evp_cnf.c \
 | 
			
		||||
	e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c\
 | 
			
		||||
	e_rc4.c e_aes.c names.c e_seed.c \
 | 
			
		||||
	e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \
 | 
			
		||||
@@ -31,7 +31,7 @@ LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \
 | 
			
		||||
	e_old.c pmeth_lib.c pmeth_fn.c pmeth_gn.c m_sigver.c evp_fips.c	\
 | 
			
		||||
	e_aes_cbc_hmac_sha1.c e_rc4_hmac_md5.c
 | 
			
		||||
 | 
			
		||||
LIBOBJ=	encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \
 | 
			
		||||
LIBOBJ=	encode.o digest.o evp_enc.o evp_key.o evp_acnf.o evp_cnf.o \
 | 
			
		||||
	e_des.o e_bf.o e_idea.o e_des3.o e_camellia.o\
 | 
			
		||||
	e_rc4.o e_aes.o names.o e_seed.o \
 | 
			
		||||
	e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \
 | 
			
		||||
@@ -67,7 +67,7 @@ files:
 | 
			
		||||
links:
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
 | 
			
		||||
	cp $(TESTDATA) ../../test
 | 
			
		||||
	[ ! -f $(TESTDATA) ] || cp $(TESTDATA) ../../test
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
 | 
			
		||||
 | 
			
		||||
install:
 | 
			
		||||
@@ -211,6 +211,7 @@ e_aes_cbc_hmac_sha1.o: ../../include/openssl/safestack.h
 | 
			
		||||
e_aes_cbc_hmac_sha1.o: ../../include/openssl/sha.h
 | 
			
		||||
e_aes_cbc_hmac_sha1.o: ../../include/openssl/stack.h
 | 
			
		||||
e_aes_cbc_hmac_sha1.o: ../../include/openssl/symhacks.h e_aes_cbc_hmac_sha1.c
 | 
			
		||||
e_aes_cbc_hmac_sha1.o: evp_locl.h
 | 
			
		||||
e_bf.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
			
		||||
e_bf.o: ../../include/openssl/blowfish.h ../../include/openssl/buffer.h
 | 
			
		||||
e_bf.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
@@ -355,6 +356,20 @@ evp_acnf.o: ../../include/openssl/opensslconf.h
 | 
			
		||||
evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
evp_acnf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 | 
			
		||||
evp_acnf.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_acnf.c
 | 
			
		||||
evp_cnf.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
evp_cnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
			
		||||
evp_cnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
 | 
			
		||||
evp_cnf.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
 | 
			
		||||
evp_cnf.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
evp_cnf.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 | 
			
		||||
evp_cnf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 | 
			
		||||
evp_cnf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
evp_cnf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
evp_cnf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
evp_cnf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
evp_cnf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
evp_cnf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
evp_cnf.o: ../../include/openssl/x509v3.h ../cryptlib.h evp_cnf.c
 | 
			
		||||
evp_enc.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
evp_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
			
		||||
evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
@@ -436,28 +451,22 @@ evp_pkey.o: ../asn1/asn1_locl.h ../cryptlib.h evp_pkey.c
 | 
			
		||||
m_dss.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
			
		||||
m_dss.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
m_dss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
 | 
			
		||||
m_dss.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
m_dss.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 | 
			
		||||
m_dss.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 | 
			
		||||
m_dss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
m_dss.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
m_dss.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
m_dss.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
m_dss.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
m_dss.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
m_dss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
m_dss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
m_dss.o: ../cryptlib.h m_dss.c
 | 
			
		||||
m_dss1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
			
		||||
m_dss1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
m_dss1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
 | 
			
		||||
m_dss1.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
m_dss1.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 | 
			
		||||
m_dss1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 | 
			
		||||
m_dss1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
m_dss1.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
m_dss1.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
m_dss1.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
m_dss1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
m_dss1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
m_dss1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
m_dss1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
m_dss1.o: ../cryptlib.h m_dss1.c
 | 
			
		||||
m_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
m_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
			
		||||
@@ -562,16 +571,13 @@ m_sha.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
m_sha.o: ../cryptlib.h evp_locl.h m_sha.c
 | 
			
		||||
m_sha1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
			
		||||
m_sha1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
m_sha1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
m_sha1.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
m_sha1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
m_sha1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
m_sha1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
m_sha1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
 | 
			
		||||
m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
 | 
			
		||||
m_sha1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 | 
			
		||||
m_sha1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
m_sha1.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
m_sha1.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h
 | 
			
		||||
m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
m_sha1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
m_sha1.o: ../cryptlib.h m_sha1.c
 | 
			
		||||
m_sigver.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
m_sigver.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
			
		||||
 
 | 
			
		||||
@@ -267,6 +267,7 @@ int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size)
 | 
			
		||||
	return FIPS_digestfinal(ctx, md, size);
 | 
			
		||||
#else
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
	OPENSSL_assert(ctx->digest->md_size <= EVP_MAX_MD_SIZE);
 | 
			
		||||
	ret=ctx->digest->final(ctx,md);
 | 
			
		||||
	if (size != NULL)
 | 
			
		||||
 
 | 
			
		||||
@@ -969,8 +969,6 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
 | 
			
		||||
	if (!gctx->iv_set)
 | 
			
		||||
		return -1;
 | 
			
		||||
	if (!ctx->encrypt && gctx->taglen < 0)
 | 
			
		||||
		return -1;
 | 
			
		||||
	if (in)
 | 
			
		||||
		{
 | 
			
		||||
		if (out == NULL)
 | 
			
		||||
@@ -1012,6 +1010,8 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
		{
 | 
			
		||||
		if (!ctx->encrypt)
 | 
			
		||||
			{
 | 
			
		||||
			if (gctx->taglen < 0)
 | 
			
		||||
				return -1;
 | 
			
		||||
			if (CRYPTO_gcm128_finish(&gctx->gcm,
 | 
			
		||||
					ctx->buf, gctx->taglen) != 0)
 | 
			
		||||
				return -1;
 | 
			
		||||
@@ -1217,6 +1217,7 @@ static int aes_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
 | 
			
		||||
			vpaes_set_encrypt_key(key, ctx->key_len*8, &cctx->ks);
 | 
			
		||||
			CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L,
 | 
			
		||||
					&cctx->ks, (block128_f)vpaes_encrypt);
 | 
			
		||||
			cctx->str = NULL;
 | 
			
		||||
			cctx->key_set = 1;
 | 
			
		||||
			break;
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 2011 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 * Copyright (c) 2011-2013 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
 | 
			
		||||
@@ -83,11 +83,17 @@ typedef struct
 | 
			
		||||
    } aux;
 | 
			
		||||
    } EVP_AES_HMAC_SHA1;
 | 
			
		||||
 | 
			
		||||
#define NO_PAYLOAD_LENGTH	((size_t)-1)
 | 
			
		||||
 | 
			
		||||
#if	defined(AES_ASM) &&	( \
 | 
			
		||||
	defined(__x86_64)	|| defined(__x86_64__)	|| \
 | 
			
		||||
	defined(_M_AMD64)	|| defined(_M_X64)	|| \
 | 
			
		||||
	defined(__INTEL__)	)
 | 
			
		||||
 | 
			
		||||
#if defined(__GNUC__) && __GNUC__>=2 && !defined(PEDANTIC)
 | 
			
		||||
# define BSWAP(x) ({ unsigned int r=(x); asm ("bswapl %0":"=r"(r):"0"(r)); r; })
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
extern unsigned int OPENSSL_ia32cap_P[2];
 | 
			
		||||
#define AESNI_CAPABLE   (1<<(57-32))
 | 
			
		||||
 | 
			
		||||
@@ -124,7 +130,7 @@ static int aesni_cbc_hmac_sha1_init_key(EVP_CIPHER_CTX *ctx,
 | 
			
		||||
	key->tail = key->head;
 | 
			
		||||
	key->md   = key->head;
 | 
			
		||||
 | 
			
		||||
	key->payload_length = 0;
 | 
			
		||||
	key->payload_length = NO_PAYLOAD_LENGTH;
 | 
			
		||||
 | 
			
		||||
	return ret<0?0:1;
 | 
			
		||||
	}
 | 
			
		||||
@@ -165,6 +171,9 @@ static void sha1_update(SHA_CTX *c,const void *data,size_t len)
 | 
			
		||||
		SHA1_Update(c,ptr,res);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef SHA1_Update
 | 
			
		||||
#undef SHA1_Update
 | 
			
		||||
#endif
 | 
			
		||||
#define SHA1_Update sha1_update
 | 
			
		||||
 | 
			
		||||
static int aesni_cbc_hmac_sha1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
@@ -182,10 +191,12 @@ static int aesni_cbc_hmac_sha1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
	sha_off = SHA_CBLOCK-key->md.num;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	key->payload_length = NO_PAYLOAD_LENGTH;
 | 
			
		||||
 | 
			
		||||
	if (len%AES_BLOCK_SIZE) return 0;
 | 
			
		||||
 | 
			
		||||
	if (ctx->encrypt) {
 | 
			
		||||
		if (plen==0)
 | 
			
		||||
		if (plen==NO_PAYLOAD_LENGTH)
 | 
			
		||||
			plen = len;
 | 
			
		||||
		else if (len!=((plen+SHA_DIGEST_LENGTH+AES_BLOCK_SIZE)&-AES_BLOCK_SIZE))
 | 
			
		||||
			return 0;
 | 
			
		||||
@@ -232,47 +243,210 @@ static int aesni_cbc_hmac_sha1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
					&key->ks,ctx->iv,1);
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		unsigned char mac[SHA_DIGEST_LENGTH];
 | 
			
		||||
		union { unsigned int  u[SHA_DIGEST_LENGTH/sizeof(unsigned int)];
 | 
			
		||||
			unsigned char c[32+SHA_DIGEST_LENGTH]; } mac, *pmac;
 | 
			
		||||
 | 
			
		||||
		/* arrange cache line alignment */
 | 
			
		||||
		pmac = (void *)(((size_t)mac.c+31)&((size_t)0-32));
 | 
			
		||||
 | 
			
		||||
		/* decrypt HMAC|padding at once */
 | 
			
		||||
		aesni_cbc_encrypt(in,out,len,
 | 
			
		||||
				&key->ks,ctx->iv,0);
 | 
			
		||||
 | 
			
		||||
		if (plen) {	/* "TLS" mode of operation */
 | 
			
		||||
			/* figure out payload length */
 | 
			
		||||
			if (len<(size_t)(out[len-1]+1+SHA_DIGEST_LENGTH))
 | 
			
		||||
				return 0;
 | 
			
		||||
 | 
			
		||||
			len -= (out[len-1]+1+SHA_DIGEST_LENGTH);
 | 
			
		||||
			size_t inp_len, mask, j, i;
 | 
			
		||||
			unsigned int res, maxpad, pad, bitlen;
 | 
			
		||||
			int ret = 1;
 | 
			
		||||
			union {	unsigned int  u[SHA_LBLOCK];
 | 
			
		||||
				unsigned char c[SHA_CBLOCK]; }
 | 
			
		||||
				*data = (void *)key->md.data;
 | 
			
		||||
 | 
			
		||||
			if ((key->aux.tls_aad[plen-4]<<8|key->aux.tls_aad[plen-3])
 | 
			
		||||
			    >= TLS1_1_VERSION) {
 | 
			
		||||
				len -= AES_BLOCK_SIZE;
 | 
			
		||||
			    >= TLS1_1_VERSION)
 | 
			
		||||
				iv = AES_BLOCK_SIZE;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			key->aux.tls_aad[plen-2] = len>>8;
 | 
			
		||||
			key->aux.tls_aad[plen-1] = len;
 | 
			
		||||
			if (len<(iv+SHA_DIGEST_LENGTH+1))
 | 
			
		||||
				return 0;
 | 
			
		||||
 | 
			
		||||
			/* calculate HMAC and verify it */
 | 
			
		||||
			/* omit explicit iv */
 | 
			
		||||
			out += iv;
 | 
			
		||||
			len -= iv;
 | 
			
		||||
 | 
			
		||||
			/* figure out payload length */
 | 
			
		||||
			pad = out[len-1];
 | 
			
		||||
			maxpad = len-(SHA_DIGEST_LENGTH+1);
 | 
			
		||||
			maxpad |= (255-maxpad)>>(sizeof(maxpad)*8-8);
 | 
			
		||||
			maxpad &= 255;
 | 
			
		||||
 | 
			
		||||
			inp_len = len - (SHA_DIGEST_LENGTH+pad+1);
 | 
			
		||||
			mask = (0-((inp_len-len)>>(sizeof(inp_len)*8-1)));
 | 
			
		||||
			inp_len &= mask;
 | 
			
		||||
			ret &= (int)mask;
 | 
			
		||||
 | 
			
		||||
			key->aux.tls_aad[plen-2] = inp_len>>8;
 | 
			
		||||
			key->aux.tls_aad[plen-1] = inp_len;
 | 
			
		||||
 | 
			
		||||
			/* calculate HMAC */
 | 
			
		||||
			key->md = key->head;
 | 
			
		||||
			SHA1_Update(&key->md,key->aux.tls_aad,plen);
 | 
			
		||||
			SHA1_Update(&key->md,out+iv,len);
 | 
			
		||||
			SHA1_Final(mac,&key->md);
 | 
			
		||||
 | 
			
		||||
#if 1
 | 
			
		||||
			len -= SHA_DIGEST_LENGTH;		/* amend mac */
 | 
			
		||||
			if (len>=(256+SHA_CBLOCK)) {
 | 
			
		||||
				j = (len-(256+SHA_CBLOCK))&(0-SHA_CBLOCK);
 | 
			
		||||
				j += SHA_CBLOCK-key->md.num;
 | 
			
		||||
				SHA1_Update(&key->md,out,j);
 | 
			
		||||
				out += j;
 | 
			
		||||
				len -= j;
 | 
			
		||||
				inp_len -= j;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			/* but pretend as if we hashed padded payload */
 | 
			
		||||
			bitlen = key->md.Nl+(inp_len<<3);	/* at most 18 bits */
 | 
			
		||||
#ifdef BSWAP
 | 
			
		||||
			bitlen = BSWAP(bitlen);
 | 
			
		||||
#else
 | 
			
		||||
			mac.c[0] = 0;
 | 
			
		||||
			mac.c[1] = (unsigned char)(bitlen>>16);
 | 
			
		||||
			mac.c[2] = (unsigned char)(bitlen>>8);
 | 
			
		||||
			mac.c[3] = (unsigned char)bitlen;
 | 
			
		||||
			bitlen = mac.u[0];
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
			pmac->u[0]=0;
 | 
			
		||||
			pmac->u[1]=0;
 | 
			
		||||
			pmac->u[2]=0;
 | 
			
		||||
			pmac->u[3]=0;
 | 
			
		||||
			pmac->u[4]=0;
 | 
			
		||||
 | 
			
		||||
			for (res=key->md.num, j=0;j<len;j++) {
 | 
			
		||||
				size_t c = out[j];
 | 
			
		||||
				mask = (j-inp_len)>>(sizeof(j)*8-8);
 | 
			
		||||
				c &= mask;
 | 
			
		||||
				c |= 0x80&~mask&~((inp_len-j)>>(sizeof(j)*8-8));
 | 
			
		||||
				data->c[res++]=(unsigned char)c;
 | 
			
		||||
 | 
			
		||||
				if (res!=SHA_CBLOCK) continue;
 | 
			
		||||
 | 
			
		||||
				mask = 0-((inp_len+8-j)>>(sizeof(j)*8-1));
 | 
			
		||||
				data->u[SHA_LBLOCK-1] |= bitlen&mask;
 | 
			
		||||
				sha1_block_data_order(&key->md,data,1);
 | 
			
		||||
				mask &= 0-((j-inp_len-73)>>(sizeof(j)*8-1));
 | 
			
		||||
				pmac->u[0] |= key->md.h0 & mask;
 | 
			
		||||
				pmac->u[1] |= key->md.h1 & mask;
 | 
			
		||||
				pmac->u[2] |= key->md.h2 & mask;
 | 
			
		||||
				pmac->u[3] |= key->md.h3 & mask;
 | 
			
		||||
				pmac->u[4] |= key->md.h4 & mask;
 | 
			
		||||
				res=0;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			for(i=res;i<SHA_CBLOCK;i++,j++) data->c[i]=0;
 | 
			
		||||
 | 
			
		||||
			if (res>SHA_CBLOCK-8) {
 | 
			
		||||
				mask = 0-((inp_len+8-j)>>(sizeof(j)*8-1));
 | 
			
		||||
				data->u[SHA_LBLOCK-1] |= bitlen&mask;
 | 
			
		||||
				sha1_block_data_order(&key->md,data,1);
 | 
			
		||||
				mask &= 0-((j-inp_len-73)>>(sizeof(j)*8-1));
 | 
			
		||||
				pmac->u[0] |= key->md.h0 & mask;
 | 
			
		||||
				pmac->u[1] |= key->md.h1 & mask;
 | 
			
		||||
				pmac->u[2] |= key->md.h2 & mask;
 | 
			
		||||
				pmac->u[3] |= key->md.h3 & mask;
 | 
			
		||||
				pmac->u[4] |= key->md.h4 & mask;
 | 
			
		||||
 | 
			
		||||
				memset(data,0,SHA_CBLOCK);
 | 
			
		||||
				j+=64;
 | 
			
		||||
			}
 | 
			
		||||
			data->u[SHA_LBLOCK-1] = bitlen;
 | 
			
		||||
			sha1_block_data_order(&key->md,data,1);
 | 
			
		||||
			mask = 0-((j-inp_len-73)>>(sizeof(j)*8-1));
 | 
			
		||||
			pmac->u[0] |= key->md.h0 & mask;
 | 
			
		||||
			pmac->u[1] |= key->md.h1 & mask;
 | 
			
		||||
			pmac->u[2] |= key->md.h2 & mask;
 | 
			
		||||
			pmac->u[3] |= key->md.h3 & mask;
 | 
			
		||||
			pmac->u[4] |= key->md.h4 & mask;
 | 
			
		||||
 | 
			
		||||
#ifdef BSWAP
 | 
			
		||||
			pmac->u[0] = BSWAP(pmac->u[0]);
 | 
			
		||||
			pmac->u[1] = BSWAP(pmac->u[1]);
 | 
			
		||||
			pmac->u[2] = BSWAP(pmac->u[2]);
 | 
			
		||||
			pmac->u[3] = BSWAP(pmac->u[3]);
 | 
			
		||||
			pmac->u[4] = BSWAP(pmac->u[4]);
 | 
			
		||||
#else
 | 
			
		||||
			for (i=0;i<5;i++) {
 | 
			
		||||
				res = pmac->u[i];
 | 
			
		||||
				pmac->c[4*i+0]=(unsigned char)(res>>24);
 | 
			
		||||
				pmac->c[4*i+1]=(unsigned char)(res>>16);
 | 
			
		||||
				pmac->c[4*i+2]=(unsigned char)(res>>8);
 | 
			
		||||
				pmac->c[4*i+3]=(unsigned char)res;
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
			len += SHA_DIGEST_LENGTH;
 | 
			
		||||
#else
 | 
			
		||||
			SHA1_Update(&key->md,out,inp_len);
 | 
			
		||||
			res = key->md.num;
 | 
			
		||||
			SHA1_Final(pmac->c,&key->md);
 | 
			
		||||
 | 
			
		||||
			{
 | 
			
		||||
			unsigned int inp_blocks, pad_blocks;
 | 
			
		||||
 | 
			
		||||
			/* but pretend as if we hashed padded payload */
 | 
			
		||||
			inp_blocks = 1+((SHA_CBLOCK-9-res)>>(sizeof(res)*8-1));
 | 
			
		||||
			res += (unsigned int)(len-inp_len);
 | 
			
		||||
			pad_blocks = res / SHA_CBLOCK;
 | 
			
		||||
			res %= SHA_CBLOCK;
 | 
			
		||||
			pad_blocks += 1+((SHA_CBLOCK-9-res)>>(sizeof(res)*8-1));
 | 
			
		||||
			for (;inp_blocks<pad_blocks;inp_blocks++)
 | 
			
		||||
				sha1_block_data_order(&key->md,data,1);
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
			key->md = key->tail;
 | 
			
		||||
			SHA1_Update(&key->md,mac,SHA_DIGEST_LENGTH);
 | 
			
		||||
			SHA1_Final(mac,&key->md);
 | 
			
		||||
			SHA1_Update(&key->md,pmac->c,SHA_DIGEST_LENGTH);
 | 
			
		||||
			SHA1_Final(pmac->c,&key->md);
 | 
			
		||||
 | 
			
		||||
			if (memcmp(out+iv+len,mac,SHA_DIGEST_LENGTH))
 | 
			
		||||
				return 0;
 | 
			
		||||
			/* verify HMAC */
 | 
			
		||||
			out += inp_len;
 | 
			
		||||
			len -= inp_len;
 | 
			
		||||
#if 1
 | 
			
		||||
			{
 | 
			
		||||
			unsigned char *p = out+len-1-maxpad-SHA_DIGEST_LENGTH;
 | 
			
		||||
			size_t off = out-p;
 | 
			
		||||
			unsigned int c, cmask;
 | 
			
		||||
 | 
			
		||||
			maxpad += SHA_DIGEST_LENGTH;
 | 
			
		||||
			for (res=0,i=0,j=0;j<maxpad;j++) {
 | 
			
		||||
				c = p[j];
 | 
			
		||||
				cmask = ((int)(j-off-SHA_DIGEST_LENGTH))>>(sizeof(int)*8-1);
 | 
			
		||||
				res |= (c^pad)&~cmask;	/* ... and padding */
 | 
			
		||||
				cmask &= ((int)(off-1-j))>>(sizeof(int)*8-1);
 | 
			
		||||
				res |= (c^pmac->c[i])&cmask;
 | 
			
		||||
				i += 1&cmask;
 | 
			
		||||
			}
 | 
			
		||||
			maxpad -= SHA_DIGEST_LENGTH;
 | 
			
		||||
 | 
			
		||||
			res = 0-((0-res)>>(sizeof(res)*8-1));
 | 
			
		||||
			ret &= (int)~res;
 | 
			
		||||
			}
 | 
			
		||||
#else
 | 
			
		||||
			for (res=0,i=0;i<SHA_DIGEST_LENGTH;i++)
 | 
			
		||||
				res |= out[i]^pmac->c[i];
 | 
			
		||||
			res = 0-((0-res)>>(sizeof(res)*8-1));
 | 
			
		||||
			ret &= (int)~res;
 | 
			
		||||
 | 
			
		||||
			/* verify padding */
 | 
			
		||||
			pad = (pad&~res) | (maxpad&res);
 | 
			
		||||
			out = out+len-1-pad;
 | 
			
		||||
			for (res=0,i=0;i<pad;i++)
 | 
			
		||||
				res |= out[i]^pad;
 | 
			
		||||
 | 
			
		||||
			res = (0-res)>>(sizeof(res)*8-1);
 | 
			
		||||
			ret &= (int)~res;
 | 
			
		||||
#endif
 | 
			
		||||
			return ret;
 | 
			
		||||
		} else {
 | 
			
		||||
			SHA1_Update(&key->md,out,len);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	key->payload_length = 0;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -307,6 +481,8 @@ static int aesni_cbc_hmac_sha1_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void
 | 
			
		||||
		SHA1_Init(&key->tail);
 | 
			
		||||
		SHA1_Update(&key->tail,hmac_key,sizeof(hmac_key));
 | 
			
		||||
 | 
			
		||||
		OPENSSL_cleanse(hmac_key,sizeof(hmac_key));
 | 
			
		||||
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
	case EVP_CTRL_AEAD_TLS1_AAD:
 | 
			
		||||
 
 | 
			
		||||
@@ -75,6 +75,8 @@ typedef struct
 | 
			
		||||
    size_t		payload_length;
 | 
			
		||||
    } EVP_RC4_HMAC_MD5;
 | 
			
		||||
 | 
			
		||||
#define NO_PAYLOAD_LENGTH	((size_t)-1)
 | 
			
		||||
 | 
			
		||||
void rc4_md5_enc (RC4_KEY *key, const void *in0, void *out,
 | 
			
		||||
		MD5_CTX *ctx,const void *inp,size_t blocks);
 | 
			
		||||
 | 
			
		||||
@@ -93,7 +95,7 @@ static int rc4_hmac_md5_init_key(EVP_CIPHER_CTX *ctx,
 | 
			
		||||
	key->tail = key->head;
 | 
			
		||||
	key->md   = key->head;
 | 
			
		||||
 | 
			
		||||
	key->payload_length = 0;
 | 
			
		||||
	key->payload_length = NO_PAYLOAD_LENGTH;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
	}
 | 
			
		||||
@@ -120,18 +122,20 @@ static int rc4_hmac_md5_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
		md5_off = MD5_CBLOCK-key->md.num,
 | 
			
		||||
		blocks;
 | 
			
		||||
	unsigned int l;
 | 
			
		||||
	extern unsigned int OPENSSL_ia32cap_P[];
 | 
			
		||||
#endif
 | 
			
		||||
	size_t	plen = key->payload_length;
 | 
			
		||||
 | 
			
		||||
	if (plen && len!=(plen+MD5_DIGEST_LENGTH)) return 0;
 | 
			
		||||
	if (plen!=NO_PAYLOAD_LENGTH && len!=(plen+MD5_DIGEST_LENGTH)) return 0;
 | 
			
		||||
 | 
			
		||||
	if (ctx->encrypt) {
 | 
			
		||||
		if (plen==0) plen = len;
 | 
			
		||||
		if (plen==NO_PAYLOAD_LENGTH) plen = len;
 | 
			
		||||
#if defined(STITCHED_CALL)
 | 
			
		||||
		/* cipher has to "fall behind" */
 | 
			
		||||
		if (rc4_off>md5_off) md5_off+=MD5_CBLOCK;
 | 
			
		||||
 | 
			
		||||
		if (plen>md5_off && (blocks=(plen-md5_off)/MD5_CBLOCK)) {
 | 
			
		||||
		if (plen>md5_off && (blocks=(plen-md5_off)/MD5_CBLOCK) &&
 | 
			
		||||
		    (OPENSSL_ia32cap_P[0]&(1<<20))==0) {
 | 
			
		||||
			MD5_Update(&key->md,in,md5_off);
 | 
			
		||||
			RC4(&key->ks,rc4_off,in,out);
 | 
			
		||||
 | 
			
		||||
@@ -171,7 +175,8 @@ static int rc4_hmac_md5_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
		if (md5_off>rc4_off)	rc4_off += 2*MD5_CBLOCK;
 | 
			
		||||
		else			rc4_off += MD5_CBLOCK;
 | 
			
		||||
 | 
			
		||||
		if (len>rc4_off && (blocks=(len-rc4_off)/MD5_CBLOCK)) {
 | 
			
		||||
		if (len>rc4_off && (blocks=(len-rc4_off)/MD5_CBLOCK) &&
 | 
			
		||||
		    (OPENSSL_ia32cap_P[0]&(1<<20))==0) {
 | 
			
		||||
			RC4(&key->ks,rc4_off,in,out);
 | 
			
		||||
			MD5_Update(&key->md,out,md5_off);
 | 
			
		||||
 | 
			
		||||
@@ -191,7 +196,7 @@ static int rc4_hmac_md5_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
#endif
 | 
			
		||||
		/* decrypt HMAC at once */
 | 
			
		||||
		RC4(&key->ks,len-rc4_off,in+rc4_off,out+rc4_off);
 | 
			
		||||
		if (plen) {	/* "TLS" mode of operation */
 | 
			
		||||
		if (plen!=NO_PAYLOAD_LENGTH) {	/* "TLS" mode of operation */
 | 
			
		||||
			MD5_Update(&key->md,out+md5_off,plen-md5_off);
 | 
			
		||||
 | 
			
		||||
			/* calculate HMAC and verify it */
 | 
			
		||||
@@ -207,7 +212,7 @@ static int rc4_hmac_md5_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	key->payload_length = 0;
 | 
			
		||||
	key->payload_length = NO_PAYLOAD_LENGTH;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -402,7 +402,6 @@ struct evp_cipher_st
 | 
			
		||||
/* Length of tag for TLS */
 | 
			
		||||
#define EVP_GCM_TLS_TAG_LEN				16
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
typedef struct evp_cipher_info_st
 | 
			
		||||
	{
 | 
			
		||||
	const EVP_CIPHER *cipher;
 | 
			
		||||
@@ -789,8 +788,8 @@ const EVP_CIPHER *EVP_aes_128_cfb128(void);
 | 
			
		||||
# define EVP_aes_128_cfb EVP_aes_128_cfb128
 | 
			
		||||
const EVP_CIPHER *EVP_aes_128_ofb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_128_ctr(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_128_gcm(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_128_ccm(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_128_gcm(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_128_xts(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_192_ecb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_192_cbc(void);
 | 
			
		||||
@@ -800,8 +799,8 @@ const EVP_CIPHER *EVP_aes_192_cfb128(void);
 | 
			
		||||
# define EVP_aes_192_cfb EVP_aes_192_cfb128
 | 
			
		||||
const EVP_CIPHER *EVP_aes_192_ofb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_192_ctr(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_192_gcm(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_192_ccm(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_192_gcm(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_256_ecb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_256_cbc(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_256_cfb1(void);
 | 
			
		||||
@@ -810,8 +809,8 @@ const EVP_CIPHER *EVP_aes_256_cfb128(void);
 | 
			
		||||
# define EVP_aes_256_cfb EVP_aes_256_cfb128
 | 
			
		||||
const EVP_CIPHER *EVP_aes_256_ofb(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_256_ctr(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_256_gcm(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_256_ccm(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_256_gcm(void);
 | 
			
		||||
const EVP_CIPHER *EVP_aes_256_xts(void);
 | 
			
		||||
#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
 | 
			
		||||
const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void);
 | 
			
		||||
@@ -1243,6 +1242,8 @@ void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth,
 | 
			
		||||
	int (*ctrl_str)(EVP_PKEY_CTX *ctx,
 | 
			
		||||
					const char *type, const char *value));
 | 
			
		||||
 | 
			
		||||
void EVP_add_alg_module(void);
 | 
			
		||||
 | 
			
		||||
/* BEGIN ERROR CODES */
 | 
			
		||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
 | 
			
		||||
 * made after this point may be overwritten when the script is next run.
 | 
			
		||||
@@ -1257,6 +1258,7 @@ void ERR_load_EVP_strings(void);
 | 
			
		||||
#define EVP_F_AES_INIT_KEY				 133
 | 
			
		||||
#define EVP_F_AES_XTS					 172
 | 
			
		||||
#define EVP_F_AES_XTS_CIPHER				 175
 | 
			
		||||
#define EVP_F_ALG_MODULE_INIT				 177
 | 
			
		||||
#define EVP_F_CAMELLIA_INIT_KEY				 159
 | 
			
		||||
#define EVP_F_CMAC_INIT					 173
 | 
			
		||||
#define EVP_F_D2I_PKEY					 100
 | 
			
		||||
@@ -1350,15 +1352,19 @@ void ERR_load_EVP_strings(void);
 | 
			
		||||
#define EVP_R_DIFFERENT_PARAMETERS			 153
 | 
			
		||||
#define EVP_R_DISABLED_FOR_FIPS				 163
 | 
			
		||||
#define EVP_R_ENCODE_ERROR				 115
 | 
			
		||||
#define EVP_R_ERROR_LOADING_SECTION			 165
 | 
			
		||||
#define EVP_R_ERROR_SETTING_FIPS_MODE			 166
 | 
			
		||||
#define EVP_R_EVP_PBE_CIPHERINIT_ERROR			 119
 | 
			
		||||
#define EVP_R_EXPECTING_AN_RSA_KEY			 127
 | 
			
		||||
#define EVP_R_EXPECTING_A_DH_KEY			 128
 | 
			
		||||
#define EVP_R_EXPECTING_A_DSA_KEY			 129
 | 
			
		||||
#define EVP_R_EXPECTING_A_ECDSA_KEY			 141
 | 
			
		||||
#define EVP_R_EXPECTING_A_EC_KEY			 142
 | 
			
		||||
#define EVP_R_FIPS_MODE_NOT_SUPPORTED			 167
 | 
			
		||||
#define EVP_R_INITIALIZATION_ERROR			 134
 | 
			
		||||
#define EVP_R_INPUT_NOT_INITIALIZED			 111
 | 
			
		||||
#define EVP_R_INVALID_DIGEST				 152
 | 
			
		||||
#define EVP_R_INVALID_FIPS_MODE				 168
 | 
			
		||||
#define EVP_R_INVALID_KEY_LENGTH			 130
 | 
			
		||||
#define EVP_R_INVALID_OPERATION				 148
 | 
			
		||||
#define EVP_R_IV_TOO_LARGE				 102
 | 
			
		||||
@@ -1383,6 +1389,7 @@ void ERR_load_EVP_strings(void);
 | 
			
		||||
#define EVP_R_TOO_LARGE					 164
 | 
			
		||||
#define EVP_R_UNKNOWN_CIPHER				 160
 | 
			
		||||
#define EVP_R_UNKNOWN_DIGEST				 161
 | 
			
		||||
#define EVP_R_UNKNOWN_OPTION				 169
 | 
			
		||||
#define EVP_R_UNKNOWN_PBE_ALGORITHM			 121
 | 
			
		||||
#define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS		 135
 | 
			
		||||
#define EVP_R_UNSUPPORTED_ALGORITHM			 156
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										125
									
								
								crypto/evp/evp_cnf.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										125
									
								
								crypto/evp/evp_cnf.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,125 @@
 | 
			
		||||
/* evp_cnf.c */
 | 
			
		||||
/* Written by Stephen Henson (steve@openssl.org) for the OpenSSL
 | 
			
		||||
 * project 2007.
 | 
			
		||||
 */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 2007 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 *
 | 
			
		||||
 * 1. Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer. 
 | 
			
		||||
 *
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in
 | 
			
		||||
 *    the documentation and/or other materials provided with the
 | 
			
		||||
 *    distribution.
 | 
			
		||||
 *
 | 
			
		||||
 * 3. All advertising materials mentioning features or use of this
 | 
			
		||||
 *    software must display the following acknowledgment:
 | 
			
		||||
 *    "This product includes software developed by the OpenSSL Project
 | 
			
		||||
 *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
 | 
			
		||||
 *
 | 
			
		||||
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
			
		||||
 *    endorse or promote products derived from this software without
 | 
			
		||||
 *    prior written permission. For written permission, please contact
 | 
			
		||||
 *    licensing@OpenSSL.org.
 | 
			
		||||
 *
 | 
			
		||||
 * 5. Products derived from this software may not be called "OpenSSL"
 | 
			
		||||
 *    nor may "OpenSSL" appear in their names without prior written
 | 
			
		||||
 *    permission of the OpenSSL Project.
 | 
			
		||||
 *
 | 
			
		||||
 * 6. Redistributions of any form whatsoever must retain the following
 | 
			
		||||
 *    acknowledgment:
 | 
			
		||||
 *    "This product includes software developed by the OpenSSL Project
 | 
			
		||||
 *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
			
		||||
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
			
		||||
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
			
		||||
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
			
		||||
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
			
		||||
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
			
		||||
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
			
		||||
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
			
		||||
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
			
		||||
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
			
		||||
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
			
		||||
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 * ====================================================================
 | 
			
		||||
 *
 | 
			
		||||
 * This product includes cryptographic software written by Eric Young
 | 
			
		||||
 * (eay@cryptsoft.com).  This product includes software written by Tim
 | 
			
		||||
 * Hudson (tjh@cryptsoft.com).
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <ctype.h>
 | 
			
		||||
#include <openssl/crypto.h>
 | 
			
		||||
#include "cryptlib.h"
 | 
			
		||||
#include <openssl/conf.h>
 | 
			
		||||
#include <openssl/dso.h>
 | 
			
		||||
#include <openssl/x509.h>
 | 
			
		||||
#include <openssl/x509v3.h>
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
#include <openssl/fips.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Algorithm configuration module. */
 | 
			
		||||
 | 
			
		||||
static int alg_module_init(CONF_IMODULE *md, const CONF *cnf)
 | 
			
		||||
	{
 | 
			
		||||
	int i;
 | 
			
		||||
	const char *oid_section;
 | 
			
		||||
	STACK_OF(CONF_VALUE) *sktmp;
 | 
			
		||||
	CONF_VALUE *oval;
 | 
			
		||||
	oid_section = CONF_imodule_get_value(md);
 | 
			
		||||
	if(!(sktmp = NCONF_get_section(cnf, oid_section)))
 | 
			
		||||
		{
 | 
			
		||||
		EVPerr(EVP_F_ALG_MODULE_INIT, EVP_R_ERROR_LOADING_SECTION);
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
	for(i = 0; i < sk_CONF_VALUE_num(sktmp); i++)
 | 
			
		||||
		{
 | 
			
		||||
		oval = sk_CONF_VALUE_value(sktmp, i);
 | 
			
		||||
		if (!strcmp(oval->name, "fips_mode"))
 | 
			
		||||
			{
 | 
			
		||||
			int m;
 | 
			
		||||
			if (!X509V3_get_value_bool(oval, &m))
 | 
			
		||||
				{
 | 
			
		||||
				EVPerr(EVP_F_ALG_MODULE_INIT, EVP_R_INVALID_FIPS_MODE);
 | 
			
		||||
				return 0;
 | 
			
		||||
				}
 | 
			
		||||
			if (m > 0)
 | 
			
		||||
				{
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
				if (!FIPS_mode() && !FIPS_mode_set(1))
 | 
			
		||||
					{
 | 
			
		||||
					EVPerr(EVP_F_ALG_MODULE_INIT, EVP_R_ERROR_SETTING_FIPS_MODE);
 | 
			
		||||
					return 0;
 | 
			
		||||
					}
 | 
			
		||||
#else
 | 
			
		||||
				EVPerr(EVP_F_ALG_MODULE_INIT, EVP_R_FIPS_MODE_NOT_SUPPORTED);
 | 
			
		||||
				return 0;
 | 
			
		||||
#endif
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			EVPerr(EVP_F_ALG_MODULE_INIT, EVP_R_UNKNOWN_OPTION);
 | 
			
		||||
			ERR_add_error_data(4, "name=", oval->name,
 | 
			
		||||
						", value=", oval->value);
 | 
			
		||||
			}
 | 
			
		||||
				
 | 
			
		||||
		}
 | 
			
		||||
	return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
void EVP_add_alg_module(void)
 | 
			
		||||
	{
 | 
			
		||||
	CONF_module_add("alg_section", alg_module_init, 0);
 | 
			
		||||
	}
 | 
			
		||||
@@ -170,8 +170,9 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *imp
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
		return FIPS_cipherinit(ctx, cipher, key, iv, enc);
 | 
			
		||||
#else
 | 
			
		||||
		if (FIPS_mode())
 | 
			
		||||
			return FIPS_cipherinit(ctx, cipher, key, iv, enc);
 | 
			
		||||
#endif
 | 
			
		||||
		ctx->cipher=cipher;
 | 
			
		||||
		if (ctx->cipher->ctx_size)
 | 
			
		||||
			{
 | 
			
		||||
@@ -196,7 +197,6 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *imp
 | 
			
		||||
				return 0;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
	else if(!ctx->cipher)
 | 
			
		||||
		{
 | 
			
		||||
@@ -207,8 +207,9 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *imp
 | 
			
		||||
skip_to_init:
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
	return FIPS_cipherinit(ctx, cipher, key, iv, enc);
 | 
			
		||||
#else
 | 
			
		||||
	if (FIPS_mode())
 | 
			
		||||
		return FIPS_cipherinit(ctx, cipher, key, iv, enc);
 | 
			
		||||
#endif
 | 
			
		||||
	/* we assume block size is a power of 2 in *cryptUpdate */
 | 
			
		||||
	OPENSSL_assert(ctx->cipher->block_size == 1
 | 
			
		||||
	    || ctx->cipher->block_size == 8
 | 
			
		||||
@@ -255,7 +256,6 @@ skip_to_init:
 | 
			
		||||
	ctx->final_used=0;
 | 
			
		||||
	ctx->block_mask=ctx->cipher->block_size-1;
 | 
			
		||||
	return 1;
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
 | 
			
		||||
 
 | 
			
		||||
@@ -75,6 +75,7 @@ static ERR_STRING_DATA EVP_str_functs[]=
 | 
			
		||||
{ERR_FUNC(EVP_F_AES_INIT_KEY),	"AES_INIT_KEY"},
 | 
			
		||||
{ERR_FUNC(EVP_F_AES_XTS),	"AES_XTS"},
 | 
			
		||||
{ERR_FUNC(EVP_F_AES_XTS_CIPHER),	"AES_XTS_CIPHER"},
 | 
			
		||||
{ERR_FUNC(EVP_F_ALG_MODULE_INIT),	"ALG_MODULE_INIT"},
 | 
			
		||||
{ERR_FUNC(EVP_F_CAMELLIA_INIT_KEY),	"CAMELLIA_INIT_KEY"},
 | 
			
		||||
{ERR_FUNC(EVP_F_CMAC_INIT),	"CMAC_INIT"},
 | 
			
		||||
{ERR_FUNC(EVP_F_D2I_PKEY),	"D2I_PKEY"},
 | 
			
		||||
@@ -171,15 +172,19 @@ static ERR_STRING_DATA EVP_str_reasons[]=
 | 
			
		||||
{ERR_REASON(EVP_R_DIFFERENT_PARAMETERS)  ,"different parameters"},
 | 
			
		||||
{ERR_REASON(EVP_R_DISABLED_FOR_FIPS)     ,"disabled for fips"},
 | 
			
		||||
{ERR_REASON(EVP_R_ENCODE_ERROR)          ,"encode error"},
 | 
			
		||||
{ERR_REASON(EVP_R_ERROR_LOADING_SECTION) ,"error loading section"},
 | 
			
		||||
{ERR_REASON(EVP_R_ERROR_SETTING_FIPS_MODE),"error setting fips mode"},
 | 
			
		||||
{ERR_REASON(EVP_R_EVP_PBE_CIPHERINIT_ERROR),"evp pbe cipherinit error"},
 | 
			
		||||
{ERR_REASON(EVP_R_EXPECTING_AN_RSA_KEY)  ,"expecting an rsa key"},
 | 
			
		||||
{ERR_REASON(EVP_R_EXPECTING_A_DH_KEY)    ,"expecting a dh key"},
 | 
			
		||||
{ERR_REASON(EVP_R_EXPECTING_A_DSA_KEY)   ,"expecting a dsa key"},
 | 
			
		||||
{ERR_REASON(EVP_R_EXPECTING_A_ECDSA_KEY) ,"expecting a ecdsa key"},
 | 
			
		||||
{ERR_REASON(EVP_R_EXPECTING_A_EC_KEY)    ,"expecting a ec key"},
 | 
			
		||||
{ERR_REASON(EVP_R_FIPS_MODE_NOT_SUPPORTED),"fips mode not supported"},
 | 
			
		||||
{ERR_REASON(EVP_R_INITIALIZATION_ERROR)  ,"initialization error"},
 | 
			
		||||
{ERR_REASON(EVP_R_INPUT_NOT_INITIALIZED) ,"input not initialized"},
 | 
			
		||||
{ERR_REASON(EVP_R_INVALID_DIGEST)        ,"invalid digest"},
 | 
			
		||||
{ERR_REASON(EVP_R_INVALID_FIPS_MODE)     ,"invalid fips mode"},
 | 
			
		||||
{ERR_REASON(EVP_R_INVALID_KEY_LENGTH)    ,"invalid key length"},
 | 
			
		||||
{ERR_REASON(EVP_R_INVALID_OPERATION)     ,"invalid operation"},
 | 
			
		||||
{ERR_REASON(EVP_R_IV_TOO_LARGE)          ,"iv too large"},
 | 
			
		||||
@@ -204,6 +209,7 @@ static ERR_STRING_DATA EVP_str_reasons[]=
 | 
			
		||||
{ERR_REASON(EVP_R_TOO_LARGE)             ,"too large"},
 | 
			
		||||
{ERR_REASON(EVP_R_UNKNOWN_CIPHER)        ,"unknown cipher"},
 | 
			
		||||
{ERR_REASON(EVP_R_UNKNOWN_DIGEST)        ,"unknown digest"},
 | 
			
		||||
{ERR_REASON(EVP_R_UNKNOWN_OPTION)        ,"unknown option"},
 | 
			
		||||
{ERR_REASON(EVP_R_UNKNOWN_PBE_ALGORITHM) ,"unknown pbe algorithm"},
 | 
			
		||||
{ERR_REASON(EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS),"unsuported number of rounds"},
 | 
			
		||||
{ERR_REASON(EVP_R_UNSUPPORTED_ALGORITHM) ,"unsupported algorithm"},
 | 
			
		||||
 
 | 
			
		||||
@@ -60,7 +60,7 @@
 | 
			
		||||
#include "cryptlib.h"
 | 
			
		||||
#include <openssl/evp.h>
 | 
			
		||||
#include <openssl/objects.h>
 | 
			
		||||
#include <openssl/x509.h>
 | 
			
		||||
#include <openssl/sha.h>
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
#include <openssl/dsa.h>
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -63,7 +63,7 @@
 | 
			
		||||
 | 
			
		||||
#include <openssl/evp.h>
 | 
			
		||||
#include <openssl/objects.h>
 | 
			
		||||
#include <openssl/x509.h>
 | 
			
		||||
#include <openssl/sha.h>
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
#include <openssl/dsa.h>
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -65,7 +65,7 @@
 | 
			
		||||
 | 
			
		||||
#include <openssl/evp.h>
 | 
			
		||||
#include <openssl/objects.h>
 | 
			
		||||
#include <openssl/x509.h>
 | 
			
		||||
#include <openssl/sha.h>
 | 
			
		||||
#ifndef OPENSSL_NO_RSA
 | 
			
		||||
#include <openssl/rsa.h>
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -138,5 +138,6 @@ int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,
 | 
			
		||||
	OPENSSL_cleanse(iv, EVP_MAX_IV_LENGTH);
 | 
			
		||||
	rv = 1;
 | 
			
		||||
	err:
 | 
			
		||||
	EVP_MD_CTX_cleanup(&ctx);
 | 
			
		||||
	return rv;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -80,7 +80,7 @@ int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen,
 | 
			
		||||
	{
 | 
			
		||||
	unsigned char m[EVP_MAX_MD_SIZE];
 | 
			
		||||
	unsigned int m_len;
 | 
			
		||||
	int i=0,ok=0,v;
 | 
			
		||||
	int i = 0,ok = 0,v;
 | 
			
		||||
	EVP_MD_CTX tmp_ctx;
 | 
			
		||||
	EVP_PKEY_CTX *pkctx = NULL;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -67,7 +67,7 @@ int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
 | 
			
		||||
	{
 | 
			
		||||
	unsigned char m[EVP_MAX_MD_SIZE];
 | 
			
		||||
	unsigned int m_len;
 | 
			
		||||
	int i=-1,ok=0,v;
 | 
			
		||||
	int i = 0,ok = 0,v;
 | 
			
		||||
	EVP_MD_CTX tmp_ctx;
 | 
			
		||||
	EVP_PKEY_CTX *pkctx = NULL;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -106,22 +106,23 @@ void md4_block_data_order (MD4_CTX *c, const void *data_, size_t num)
 | 
			
		||||
 | 
			
		||||
	for (;num--;)
 | 
			
		||||
		{
 | 
			
		||||
	HOST_c2l(data,l); X( 0)=l;		HOST_c2l(data,l); X( 1)=l;
 | 
			
		||||
	(void)HOST_c2l(data,l); X( 0)=l;
 | 
			
		||||
	(void)HOST_c2l(data,l); X( 1)=l;
 | 
			
		||||
	/* Round 0 */
 | 
			
		||||
	R0(A,B,C,D,X( 0), 3,0);	HOST_c2l(data,l); X( 2)=l;
 | 
			
		||||
	R0(D,A,B,C,X( 1), 7,0);	HOST_c2l(data,l); X( 3)=l;
 | 
			
		||||
	R0(C,D,A,B,X( 2),11,0);	HOST_c2l(data,l); X( 4)=l;
 | 
			
		||||
	R0(B,C,D,A,X( 3),19,0);	HOST_c2l(data,l); X( 5)=l;
 | 
			
		||||
	R0(A,B,C,D,X( 4), 3,0);	HOST_c2l(data,l); X( 6)=l;
 | 
			
		||||
	R0(D,A,B,C,X( 5), 7,0);	HOST_c2l(data,l); X( 7)=l;
 | 
			
		||||
	R0(C,D,A,B,X( 6),11,0);	HOST_c2l(data,l); X( 8)=l;
 | 
			
		||||
	R0(B,C,D,A,X( 7),19,0);	HOST_c2l(data,l); X( 9)=l;
 | 
			
		||||
	R0(A,B,C,D,X( 8), 3,0);	HOST_c2l(data,l); X(10)=l;
 | 
			
		||||
	R0(D,A,B,C,X( 9), 7,0);	HOST_c2l(data,l); X(11)=l;
 | 
			
		||||
	R0(C,D,A,B,X(10),11,0);	HOST_c2l(data,l); X(12)=l;
 | 
			
		||||
	R0(B,C,D,A,X(11),19,0);	HOST_c2l(data,l); X(13)=l;
 | 
			
		||||
	R0(A,B,C,D,X(12), 3,0);	HOST_c2l(data,l); X(14)=l;
 | 
			
		||||
	R0(D,A,B,C,X(13), 7,0);	HOST_c2l(data,l); X(15)=l;
 | 
			
		||||
	R0(A,B,C,D,X( 0), 3,0);	(void)HOST_c2l(data,l); X( 2)=l;
 | 
			
		||||
	R0(D,A,B,C,X( 1), 7,0);	(void)HOST_c2l(data,l); X( 3)=l;
 | 
			
		||||
	R0(C,D,A,B,X( 2),11,0);	(void)HOST_c2l(data,l); X( 4)=l;
 | 
			
		||||
	R0(B,C,D,A,X( 3),19,0);	(void)HOST_c2l(data,l); X( 5)=l;
 | 
			
		||||
	R0(A,B,C,D,X( 4), 3,0);	(void)HOST_c2l(data,l); X( 6)=l;
 | 
			
		||||
	R0(D,A,B,C,X( 5), 7,0);	(void)HOST_c2l(data,l); X( 7)=l;
 | 
			
		||||
	R0(C,D,A,B,X( 6),11,0);	(void)HOST_c2l(data,l); X( 8)=l;
 | 
			
		||||
	R0(B,C,D,A,X( 7),19,0);	(void)HOST_c2l(data,l); X( 9)=l;
 | 
			
		||||
	R0(A,B,C,D,X( 8), 3,0);	(void)HOST_c2l(data,l); X(10)=l;
 | 
			
		||||
	R0(D,A,B,C,X( 9), 7,0);	(void)HOST_c2l(data,l); X(11)=l;
 | 
			
		||||
	R0(C,D,A,B,X(10),11,0);	(void)HOST_c2l(data,l); X(12)=l;
 | 
			
		||||
	R0(B,C,D,A,X(11),19,0);	(void)HOST_c2l(data,l); X(13)=l;
 | 
			
		||||
	R0(A,B,C,D,X(12), 3,0);	(void)HOST_c2l(data,l); X(14)=l;
 | 
			
		||||
	R0(D,A,B,C,X(13), 7,0);	(void)HOST_c2l(data,l); X(15)=l;
 | 
			
		||||
	R0(C,D,A,B,X(14),11,0);
 | 
			
		||||
	R0(B,C,D,A,X(15),19,0);
 | 
			
		||||
	/* Round 1 */
 | 
			
		||||
 
 | 
			
		||||
@@ -77,10 +77,10 @@ void md4_block_data_order (MD4_CTX *c, const void *p,size_t num);
 | 
			
		||||
#define HASH_FINAL		MD4_Final
 | 
			
		||||
#define	HASH_MAKE_STRING(c,s)	do {	\
 | 
			
		||||
	unsigned long ll;		\
 | 
			
		||||
	ll=(c)->A; HOST_l2c(ll,(s));	\
 | 
			
		||||
	ll=(c)->B; HOST_l2c(ll,(s));	\
 | 
			
		||||
	ll=(c)->C; HOST_l2c(ll,(s));	\
 | 
			
		||||
	ll=(c)->D; HOST_l2c(ll,(s));	\
 | 
			
		||||
	ll=(c)->A; (void)HOST_l2c(ll,(s));	\
 | 
			
		||||
	ll=(c)->B; (void)HOST_l2c(ll,(s));	\
 | 
			
		||||
	ll=(c)->C; (void)HOST_l2c(ll,(s));	\
 | 
			
		||||
	ll=(c)->D; (void)HOST_l2c(ll,(s));	\
 | 
			
		||||
	} while (0)
 | 
			
		||||
#define	HASH_BLOCK_DATA_ORDER	md4_block_data_order
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -120,7 +120,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; my $dir=$1; my $xlate;
 | 
			
		||||
die "can't locate x86_64-xlate.pl";
 | 
			
		||||
 | 
			
		||||
no warnings qw(uninitialized);
 | 
			
		||||
open STDOUT,"| $^X $xlate $flavour $output";
 | 
			
		||||
open OUT,"| \"$^X\" $xlate $flavour $output";
 | 
			
		||||
*STDOUT=*OUT;
 | 
			
		||||
 | 
			
		||||
$code .= <<EOF;
 | 
			
		||||
.text
 | 
			
		||||
 
 | 
			
		||||
@@ -86,10 +86,10 @@ void md5_block_data_order (MD5_CTX *c, const void *p,size_t num);
 | 
			
		||||
#define HASH_FINAL		MD5_Final
 | 
			
		||||
#define	HASH_MAKE_STRING(c,s)	do {	\
 | 
			
		||||
	unsigned long ll;		\
 | 
			
		||||
	ll=(c)->A; HOST_l2c(ll,(s));	\
 | 
			
		||||
	ll=(c)->B; HOST_l2c(ll,(s));	\
 | 
			
		||||
	ll=(c)->C; HOST_l2c(ll,(s));	\
 | 
			
		||||
	ll=(c)->D; HOST_l2c(ll,(s));	\
 | 
			
		||||
	ll=(c)->A; (void)HOST_l2c(ll,(s));	\
 | 
			
		||||
	ll=(c)->B; (void)HOST_l2c(ll,(s));	\
 | 
			
		||||
	ll=(c)->C; (void)HOST_l2c(ll,(s));	\
 | 
			
		||||
	ll=(c)->D; (void)HOST_l2c(ll,(s));	\
 | 
			
		||||
	} while (0)
 | 
			
		||||
#define	HASH_BLOCK_DATA_ORDER	md5_block_data_order
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -59,9 +59,9 @@
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <openssl/crypto.h>
 | 
			
		||||
#include <openssl/des.h>
 | 
			
		||||
#include <openssl/mdc2.h>
 | 
			
		||||
#include <openssl/crypto.h>
 | 
			
		||||
 | 
			
		||||
#undef c2l
 | 
			
		||||
#define c2l(c,l)	(l =((DES_LONG)(*((c)++)))    , \
 | 
			
		||||
 
 | 
			
		||||
@@ -121,10 +121,10 @@ static void (*set_debug_options_func)(long) = NULL;
 | 
			
		||||
static long (*get_debug_options_func)(void) = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t),
 | 
			
		||||
	void (*f)(void *))
 | 
			
		||||
	{
 | 
			
		||||
	/* Dummy call just to ensure OPENSSL_init() gets linked in */
 | 
			
		||||
	OPENSSL_init();
 | 
			
		||||
	if (!allow_customize)
 | 
			
		||||
		return 0;
 | 
			
		||||
@@ -363,6 +363,10 @@ void *CRYPTO_realloc_clean(void *str, int old_len, int num, const char *file,
 | 
			
		||||
 | 
			
		||||
	if (num <= 0) return NULL;
 | 
			
		||||
 | 
			
		||||
	/* We don't support shrinking the buffer. Note the memcpy that copies
 | 
			
		||||
	 * |old_len| bytes to the new buffer, below. */
 | 
			
		||||
	if (num < old_len) return NULL;
 | 
			
		||||
 | 
			
		||||
	if (realloc_debug_func != NULL)
 | 
			
		||||
		realloc_debug_func(str, NULL, num, file, line, 0);
 | 
			
		||||
	ret=malloc_ex_func(num,file,line);
 | 
			
		||||
 
 | 
			
		||||
@@ -138,7 +138,7 @@ $code.=<<___ if(!$softonly);
 | 
			
		||||
.align	32
 | 
			
		||||
.Lsoft_ghash:
 | 
			
		||||
___
 | 
			
		||||
$cdoe.=<<___ if ($flavour =~ /3[12]/);
 | 
			
		||||
$code.=<<___ if ($flavour =~ /3[12]/);
 | 
			
		||||
	llgfr	$len,$len
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
 
 | 
			
		||||
@@ -635,7 +635,7 @@ sub mmx_loop() {
 | 
			
		||||
    { my @lo  = ("mm0","mm1","mm2");
 | 
			
		||||
      my @hi  = ("mm3","mm4","mm5");
 | 
			
		||||
      my @tmp = ("mm6","mm7");
 | 
			
		||||
      my $off1=0,$off2=0,$i;
 | 
			
		||||
      my ($off1,$off2,$i) = (0,0,);
 | 
			
		||||
 | 
			
		||||
      &add	($Htbl,128);			# optimize for size
 | 
			
		||||
      &lea	("edi",&DWP(16+128,"esp"));
 | 
			
		||||
@@ -883,7 +883,7 @@ sub reduction_alg9 {	# 17/13 times faster than Intel version
 | 
			
		||||
my ($Xhi,$Xi) = @_;
 | 
			
		||||
 | 
			
		||||
	# 1st phase
 | 
			
		||||
	&movdqa		($T1,$Xi)		#
 | 
			
		||||
	&movdqa		($T1,$Xi);		#
 | 
			
		||||
	&psllq		($Xi,1);
 | 
			
		||||
	&pxor		($Xi,$T1);		#
 | 
			
		||||
	&psllq		($Xi,5);		#
 | 
			
		||||
@@ -1019,7 +1019,7 @@ my ($Xhi,$Xi) = @_;
 | 
			
		||||
	&movdqa		($Xhn,$Xn);
 | 
			
		||||
	 &pxor		($Xhi,$T1);		# "Ii+Xi", consume early
 | 
			
		||||
 | 
			
		||||
	  &movdqa	($T1,$Xi)		#&reduction_alg9($Xhi,$Xi); 1st phase
 | 
			
		||||
	  &movdqa	($T1,$Xi);		#&reduction_alg9($Xhi,$Xi); 1st phase
 | 
			
		||||
	  &psllq	($Xi,1);
 | 
			
		||||
	  &pxor		($Xi,$T1);		#
 | 
			
		||||
	  &psllq	($Xi,5);		#
 | 
			
		||||
 
 | 
			
		||||
@@ -50,7 +50,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 | 
			
		||||
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
 | 
			
		||||
die "can't locate x86_64-xlate.pl";
 | 
			
		||||
 | 
			
		||||
open STDOUT,"| $^X $xlate $flavour $output";
 | 
			
		||||
open OUT,"| \"$^X\" $xlate $flavour $output";
 | 
			
		||||
*STDOUT=*OUT;
 | 
			
		||||
 | 
			
		||||
# common register layout
 | 
			
		||||
$nlo="%rax";
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user