Compare commits
	
		
			178 Commits
		
	
	
		
			OpenSSL_0_
			...
			OpenSSL_0_
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					f71d59c70e | ||
| 
						 | 
					3309f8313c | ||
| 
						 | 
					6cc5f194a7 | ||
| 
						 | 
					096327a99a | ||
| 
						 | 
					cc10bcf25e | ||
| 
						 | 
					875ac0ec00 | ||
| 
						 | 
					bf240f063a | ||
| 
						 | 
					dd016b0570 | ||
| 
						 | 
					244788464a | ||
| 
						 | 
					a95808334e | ||
| 
						 | 
					b3cebd5acf | ||
| 
						 | 
					7b775145e4 | ||
| 
						 | 
					7183aa6b9d | ||
| 
						 | 
					eebefe35e7 | ||
| 
						 | 
					1db0bbdc76 | ||
| 
						 | 
					e643112dd8 | ||
| 
						 | 
					21c4b25959 | ||
| 
						 | 
					41cf2c3aef | ||
| 
						 | 
					0e3a930fb4 | ||
| 
						 | 
					0c214e0153 | ||
| 
						 | 
					6c61cfbe03 | ||
| 
						 | 
					2ee77d36a0 | ||
| 
						 | 
					24f441e0bb | ||
| 
						 | 
					740da44f20 | ||
| 
						 | 
					72033fde7b | ||
| 
						 | 
					9adf3fcf9a | ||
| 
						 | 
					65f7456652 | ||
| 
						 | 
					8794569a08 | ||
| 
						 | 
					f8731bc2fd | ||
| 
						 | 
					195d6bf760 | ||
| 
						 | 
					dacd94b9c8 | ||
| 
						 | 
					8070cb5f87 | ||
| 
						 | 
					f7d514f449 | ||
| 
						 | 
					6d50bce79f | ||
| 
						 | 
					3cf0a38b3e | ||
| 
						 | 
					91a1d08a4c | ||
| 
						 | 
					85e776885b | ||
| 
						 | 
					fc4015329f | ||
| 
						 | 
					6ec9ff83f3 | ||
| 
						 | 
					db45308477 | ||
| 
						 | 
					1c7c69a8a5 | ||
| 
						 | 
					24ad061037 | ||
| 
						 | 
					92f96fa721 | ||
| 
						 | 
					0d1e362363 | ||
| 
						 | 
					a0bf2c86ab | ||
| 
						 | 
					6a662a45f3 | ||
| 
						 | 
					24d0524f31 | ||
| 
						 | 
					c081817c95 | ||
| 
						 | 
					46a1f2487e | ||
| 
						 | 
					ac02a4b68a | ||
| 
						 | 
					4ba063d3c5 | ||
| 
						 | 
					e0e0818e4b | ||
| 
						 | 
					82a5049f6a | ||
| 
						 | 
					d027b75b73 | ||
| 
						 | 
					87421d3fc5 | ||
| 
						 | 
					87d14a3625 | ||
| 
						 | 
					cc0931e36b | ||
| 
						 | 
					22152d6885 | ||
| 
						 | 
					102bcbce8d | ||
| 
						 | 
					8655de423d | ||
| 
						 | 
					c4b2eb24b3 | ||
| 
						 | 
					03e3fbb702 | ||
| 
						 | 
					bc7ee385f5 | ||
| 
						 | 
					1e368ab08f | ||
| 
						 | 
					2c77c5c8db | ||
| 
						 | 
					1eb38c563f | ||
| 
						 | 
					fa657871ed | ||
| 
						 | 
					09dac71a45 | ||
| 
						 | 
					be70b3adce | ||
| 
						 | 
					6d12b1f82b | ||
| 
						 | 
					7116a41129 | ||
| 
						 | 
					7143acab25 | ||
| 
						 | 
					11d4086d8e | ||
| 
						 | 
					32cd1da62e | ||
| 
						 | 
					d430f56de6 | ||
| 
						 | 
					957ebe98fb | ||
| 
						 | 
					9d09fc8485 | ||
| 
						 | 
					8ea4531718 | ||
| 
						 | 
					881611678e | ||
| 
						 | 
					a3dc628d86 | ||
| 
						 | 
					3c159fc1a5 | ||
| 
						 | 
					6056afd223 | ||
| 
						 | 
					54db796991 | ||
| 
						 | 
					119e912a83 | ||
| 
						 | 
					f4a4a0fdc7 | ||
| 
						 | 
					9ad765173f | ||
| 
						 | 
					c8e3c1a9b5 | ||
| 
						 | 
					ae378b769a | ||
| 
						 | 
					4de4e35459 | ||
| 
						 | 
					5537a83e56 | ||
| 
						 | 
					c850d322a6 | ||
| 
						 | 
					b8be571868 | ||
| 
						 | 
					acd43bf38c | ||
| 
						 | 
					5eaf173647 | ||
| 
						 | 
					7890b562bc | ||
| 
						 | 
					7258d33794 | ||
| 
						 | 
					263979a2a3 | ||
| 
						 | 
					2c6d83354d | ||
| 
						 | 
					a188fc01fe | ||
| 
						 | 
					1948f9e042 | ||
| 
						 | 
					f7ffc3a6c9 | ||
| 
						 | 
					4d6af5c5d2 | ||
| 
						 | 
					efed63d783 | ||
| 
						 | 
					7e351bb560 | ||
| 
						 | 
					0067580321 | ||
| 
						 | 
					82e0073624 | ||
| 
						 | 
					7e541b1a7f | ||
| 
						 | 
					2ae47ddbc2 | ||
| 
						 | 
					3e8b8b8990 | ||
| 
						 | 
					05bbbe9204 | ||
| 
						 | 
					a073129293 | ||
| 
						 | 
					93fc0e0e40 | ||
| 
						 | 
					84f1c14396 | ||
| 
						 | 
					f10986bab4 | ||
| 
						 | 
					6cb5746b65 | ||
| 
						 | 
					0061aa9f32 | ||
| 
						 | 
					3926bbcf6d | ||
| 
						 | 
					b5cee977c2 | ||
| 
						 | 
					ae3b60ba99 | ||
| 
						 | 
					d4ba6424a1 | ||
| 
						 | 
					92a97e52a0 | ||
| 
						 | 
					78dcaa0609 | ||
| 
						 | 
					65b4c34d86 | ||
| 
						 | 
					d8486c312c | ||
| 
						 | 
					8d4baaf2f0 | ||
| 
						 | 
					50fb940f05 | ||
| 
						 | 
					63e3676e68 | ||
| 
						 | 
					1dac2cae68 | ||
| 
						 | 
					d886975835 | ||
| 
						 | 
					22872a5363 | ||
| 
						 | 
					82b6b541b1 | ||
| 
						 | 
					60a989a76e | ||
| 
						 | 
					18394ed50f | ||
| 
						 | 
					3416d11926 | ||
| 
						 | 
					c1f1a03d0c | ||
| 
						 | 
					278a447ee8 | ||
| 
						 | 
					8ceee689c7 | ||
| 
						 | 
					356f164f52 | ||
| 
						 | 
					203ef9988c | ||
| 
						 | 
					9f51bdae00 | ||
| 
						 | 
					59c4f46f0f | ||
| 
						 | 
					f9ab6255e7 | ||
| 
						 | 
					a89b665b9b | ||
| 
						 | 
					a7949b8da3 | ||
| 
						 | 
					b0b4adc3af | ||
| 
						 | 
					6e19895972 | ||
| 
						 | 
					d24f1cbf35 | ||
| 
						 | 
					b8febed96a | ||
| 
						 | 
					82687bb4c3 | ||
| 
						 | 
					6506b7754a | ||
| 
						 | 
					2eb8e5e62a | ||
| 
						 | 
					c713a4c04d | ||
| 
						 | 
					0cefa0f942 | ||
| 
						 | 
					834c85ef0c | ||
| 
						 | 
					0c8c8eab58 | ||
| 
						 | 
					bc06baca76 | ||
| 
						 | 
					9eeb779e8f | ||
| 
						 | 
					fe171f9c3e | ||
| 
						 | 
					5e613d5411 | ||
| 
						 | 
					56e930eb03 | ||
| 
						 | 
					4a052f0bb9 | ||
| 
						 | 
					f34e79f27b | ||
| 
						 | 
					ef1fe9094c | ||
| 
						 | 
					c25e8ee9b3 | ||
| 
						 | 
					4525a048ec | ||
| 
						 | 
					f421a52f56 | ||
| 
						 | 
					17a79eec0c | ||
| 
						 | 
					1eda14b44f | ||
| 
						 | 
					aa9b502619 | ||
| 
						 | 
					aaf45e6464 | ||
| 
						 | 
					be83c31cdd | ||
| 
						 | 
					76a41eec2b | ||
| 
						 | 
					ab9c0ec9fc | ||
| 
						 | 
					cf6a1dea19 | ||
| 
						 | 
					ea5b3f5e62 | ||
| 
						 | 
					c3c658e1c0 | ||
| 
						 | 
					5d013b6b32 | ||
| 
						 | 
					ee91323f52 | 
							
								
								
									
										25
									
								
								ACKNOWLEDGMENTS
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								ACKNOWLEDGMENTS
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
The OpenSSL project depends on volunteer efforts and financial support from
 | 
			
		||||
the end user community. That support comes in the form of donations and paid
 | 
			
		||||
sponsorships, software support contracts, paid consulting services
 | 
			
		||||
and commissioned software development.
 | 
			
		||||
 | 
			
		||||
Since all these activities support the continued development and improvement
 | 
			
		||||
of OpenSSL we consider all these clients and customers as sponsors of the
 | 
			
		||||
OpenSSL project.
 | 
			
		||||
 | 
			
		||||
We would like to identify and thank the following such sponsors for their past
 | 
			
		||||
or current significant support of the OpenSSL project:
 | 
			
		||||
 | 
			
		||||
Very significant support:
 | 
			
		||||
 | 
			
		||||
	OpenGear: www.opengear.com
 | 
			
		||||
 | 
			
		||||
Significant support:
 | 
			
		||||
 | 
			
		||||
	PSW Group: www.psw.net
 | 
			
		||||
 | 
			
		||||
Please note that we ask permission to identify sponsors and that some sponsors
 | 
			
		||||
we consider eligible for inclusion here have requested to remain anonymous.
 | 
			
		||||
 | 
			
		||||
Additional sponsorship or financial support is always welcome: for more
 | 
			
		||||
information please contact the OpenSSL Software Foundation.
 | 
			
		||||
							
								
								
									
										142
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										142
									
								
								CHANGES
									
									
									
									
									
								
							@@ -2,6 +2,148 @@
 | 
			
		||||
 OpenSSL CHANGES
 | 
			
		||||
 _______________
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8s and 0.9.8t [18 Jan 2012]
 | 
			
		||||
 | 
			
		||||
  *) Fix for DTLS DoS issue introduced by fix for CVE-2011-4109.
 | 
			
		||||
     Thanks to Antonio Martin, Enterprise Secure Access Research and
 | 
			
		||||
     Development, Cisco Systems, Inc. for discovering this bug and
 | 
			
		||||
     preparing a fix. (CVE-2012-0050)
 | 
			
		||||
     [Antonio Martin]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8r and 0.9.8s [4 Jan 2012]
 | 
			
		||||
 | 
			
		||||
  *) Nadhem Alfardan and Kenny Paterson have discovered an extension
 | 
			
		||||
     of the Vaudenay padding oracle attack on CBC mode encryption
 | 
			
		||||
     which enables an efficient plaintext recovery attack against
 | 
			
		||||
     the OpenSSL implementation of DTLS. Their attack exploits timing
 | 
			
		||||
     differences arising during decryption processing. A research
 | 
			
		||||
     paper describing this attack can be found at:
 | 
			
		||||
                  http://www.isg.rhul.ac.uk/~kp/dtls.pdf
 | 
			
		||||
     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 to Robin Seggelmann
 | 
			
		||||
     <seggelmann@fh-muenster.de> and Michael Tuexen <tuexen@fh-muenster.de>
 | 
			
		||||
     for preparing the fix. (CVE-2011-4108)
 | 
			
		||||
     [Robin Seggelmann, Michael Tuexen]
 | 
			
		||||
 | 
			
		||||
  *) Stop policy check failure freeing same buffer twice. (CVE-2011-4109)
 | 
			
		||||
     [Ben Laurie, Kasper <ekasper@google.com>]
 | 
			
		||||
 | 
			
		||||
  *) Clear bytes used for block padding of SSL 3.0 records.
 | 
			
		||||
     (CVE-2011-4576)
 | 
			
		||||
     [Adam Langley (Google)]
 | 
			
		||||
 | 
			
		||||
  *) Only allow one SGC handshake restart for SSL/TLS. Thanks to George
 | 
			
		||||
     Kadianakis <desnacked@gmail.com> for discovering this issue and
 | 
			
		||||
     Adam Langley for preparing the fix. (CVE-2011-4619)
 | 
			
		||||
     [Adam Langley (Google)]
 | 
			
		||||
 
 | 
			
		||||
  *) Prevent malformed RFC3779 data triggering an assertion failure.
 | 
			
		||||
     Thanks to Andrew Chi, BBN Technologies, for discovering the flaw
 | 
			
		||||
     and Rob Austein <sra@hactrn.net> for fixing it. (CVE-2011-4577)
 | 
			
		||||
     [Rob Austein <sra@hactrn.net>]
 | 
			
		||||
 | 
			
		||||
  *) Fix ssl_ciph.c set-up race.
 | 
			
		||||
     [Adam Langley (Google)]
 | 
			
		||||
 | 
			
		||||
  *) Fix spurious failures in ecdsatest.c.
 | 
			
		||||
     [Emilia K<>sper (Google)]
 | 
			
		||||
 | 
			
		||||
  *) Fix the BIO_f_buffer() implementation (which was mixing different
 | 
			
		||||
     interpretations of the '..._len' fields).
 | 
			
		||||
     [Adam Langley (Google)]
 | 
			
		||||
 | 
			
		||||
  *) Fix handling of BN_BLINDING: now BN_BLINDING_invert_ex (rather than
 | 
			
		||||
     BN_BLINDING_invert_ex) calls BN_BLINDING_update, ensuring that concurrent
 | 
			
		||||
     threads won't reuse the same blinding coefficients.
 | 
			
		||||
 | 
			
		||||
     This also avoids the need to obtain the CRYPTO_LOCK_RSA_BLINDING
 | 
			
		||||
     lock to call BN_BLINDING_invert_ex, and avoids one use of
 | 
			
		||||
     BN_BLINDING_update for each BN_BLINDING structure (previously,
 | 
			
		||||
     the last update always remained unused).
 | 
			
		||||
     [Emilia K<>sper (Google)]
 | 
			
		||||
 | 
			
		||||
  *) Fix SSL memory handling for (EC)DH ciphersuites, in particular
 | 
			
		||||
     for multi-threaded use of ECDH.
 | 
			
		||||
     [Adam Langley (Google)]
 | 
			
		||||
 | 
			
		||||
  *) Fix x509_name_ex_d2i memory leak on bad inputs.
 | 
			
		||||
     [Bodo Moeller]
 | 
			
		||||
 | 
			
		||||
  *) Add protection against ECDSA timing attacks as mentioned in the paper
 | 
			
		||||
     by Billy Bob Brumley and Nicola Tuveri, see:
 | 
			
		||||
 | 
			
		||||
	http://eprint.iacr.org/2011/232.pdf
 | 
			
		||||
 | 
			
		||||
     [Billy Bob Brumley and Nicola Tuveri]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8q and 0.9.8r [8 Feb 2011]
 | 
			
		||||
 | 
			
		||||
  *) Fix parsing of OCSP stapling ClientHello extension. CVE-2011-0014
 | 
			
		||||
     [Neel Mehta, Adam Langley, Bodo Moeller (Google)]
 | 
			
		||||
 | 
			
		||||
  *) Fix bug in string printing code: if *any* escaping is enabled we must
 | 
			
		||||
     escape the escape character (backslash) or the resulting string is
 | 
			
		||||
     ambiguous.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8p and 0.9.8q [2 Dec 2010]
 | 
			
		||||
 | 
			
		||||
  *) Disable code workaround for ancient and obsolete Netscape browsers
 | 
			
		||||
     and servers: an attacker can use it in a ciphersuite downgrade attack.
 | 
			
		||||
     Thanks to Martin Rex for discovering this bug. CVE-2010-4180
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Fixed J-PAKE implementation error, originally discovered by
 | 
			
		||||
     Sebastien Martini, further info and confirmation from Stefan
 | 
			
		||||
     Arentz and Feng Hao. Note that this fix is a security fix. CVE-2010-4252
 | 
			
		||||
     [Ben Laurie]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8o and 0.9.8p [16 Nov 2010]
 | 
			
		||||
 | 
			
		||||
  *) Fix extension code to avoid race conditions which can result in a buffer
 | 
			
		||||
     overrun vulnerability: resumed sessions must not be modified as they can
 | 
			
		||||
     be shared by multiple threads. CVE-2010-3864
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Fix for double free bug in ssl/s3_clnt.c CVE-2010-2939
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Don't reencode certificate when calculating signature: cache and use
 | 
			
		||||
     the original encoding instead. This makes signature verification of
 | 
			
		||||
     some broken encodings work correctly.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) ec2_GF2m_simple_mul bugfix: compute correct result if the output EC_POINT
 | 
			
		||||
     is also one of the inputs.
 | 
			
		||||
     [Emilia K<>sper <emilia.kasper@esat.kuleuven.be> (Google)]
 | 
			
		||||
 | 
			
		||||
  *) Don't repeatedly append PBE algorithms to table if they already exist.
 | 
			
		||||
     Sort table on each new add. This effectively makes the table read only
 | 
			
		||||
     after all algorithms are added and subsequent calls to PKCS12_pbe_add
 | 
			
		||||
     etc are non-op.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8n and 0.9.8o [01 Jun 2010]
 | 
			
		||||
 | 
			
		||||
  [NB: OpenSSL 0.9.8o and later 0.9.8 patch levels were released after
 | 
			
		||||
  OpenSSL 1.0.0.]
 | 
			
		||||
 | 
			
		||||
  *) Correct a typo in the CMS ASN1 module which can result in invalid memory
 | 
			
		||||
     access or freeing data twice (CVE-2010-0742)
 | 
			
		||||
     [Steve Henson, Ronald Moesbergen <intercommit@gmail.com>]
 | 
			
		||||
 | 
			
		||||
  *) Add SHA2 algorithms to SSL_library_init(). SHA2 is becoming far more
 | 
			
		||||
     common in certificates and some applications which only call
 | 
			
		||||
     SSL_library_init and not OpenSSL_add_all_algorithms() will fail.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) VMS fixes: 
 | 
			
		||||
     Reduce copying into .apps and .test in makevms.com
 | 
			
		||||
     Don't try to use blank CA certificate in CA.com
 | 
			
		||||
     Allow use of C files from original directories in maketests.com
 | 
			
		||||
     [Steven M. Schweda" <sms@antinode.info>]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8m and 0.9.8n [24 Mar 2010]
 | 
			
		||||
 | 
			
		||||
  *) When rejecting SSL/TLS records due to an incorrect version number, never
 | 
			
		||||
 
 | 
			
		||||
@@ -371,6 +371,9 @@ my %table=(
 | 
			
		||||
"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${no_asm}",
 | 
			
		||||
"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${no_asm}",
 | 
			
		||||
 | 
			
		||||
# Android: Linux but without -DTERMIO and pointers to headers and libs.
 | 
			
		||||
"android","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
 | 
			
		||||
#### *BSD [do see comment about ${BSDthreads} above!]
 | 
			
		||||
"BSD-generic32","gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"BSD-x86",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
@@ -1812,11 +1815,11 @@ EOF
 | 
			
		||||
	(system $make_command.$make_targets) == 0 or exit $?
 | 
			
		||||
		if $make_targets ne "";
 | 
			
		||||
	if ( $perl =~ m@^/@) {
 | 
			
		||||
	    &dofile("tools/c_rehash",$perl,'^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";');
 | 
			
		||||
	    &dofile("tools/c_rehash",$perl,'^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";', '^my \$prefix;$', 'my $prefix = "' . $prefix . '";');
 | 
			
		||||
	    &dofile("apps/CA.pl",$perl,'^#!/', '#!%s');
 | 
			
		||||
	} else {
 | 
			
		||||
	    # No path for Perl known ...
 | 
			
		||||
	    &dofile("tools/c_rehash",'/usr/local/bin/perl','^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";');
 | 
			
		||||
	    &dofile("tools/c_rehash",'/usr/local/bin/perl','^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";',  '^my \$prefix;$', 'my $prefix = "' . $prefix . '";');
 | 
			
		||||
	    &dofile("apps/CA.pl",'/usr/local/bin/perl','^#!/', '#!%s');
 | 
			
		||||
	}
 | 
			
		||||
	if ($depflags ne $default_depflags && !$make_depend) {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										80
									
								
								FAQ
									
									
									
									
									
								
							
							
						
						
									
										80
									
								
								FAQ
									
									
									
									
									
								
							@@ -52,6 +52,9 @@ OpenSSL  -  Frequently Asked Questions
 | 
			
		||||
* Why does the OpenSSL test suite fail in sha512t on x86 CPU?
 | 
			
		||||
* Why does compiler fail to compile sha512.c?
 | 
			
		||||
* Test suite still fails, what to do?
 | 
			
		||||
* I think I've found a bug, what should I do?
 | 
			
		||||
* I'm SURE I've found a bug, how do I report it?
 | 
			
		||||
* I've found a security issue, how do I report it?
 | 
			
		||||
 | 
			
		||||
[PROG] Questions about programming with OpenSSL
 | 
			
		||||
 | 
			
		||||
@@ -70,6 +73,7 @@ OpenSSL  -  Frequently Asked Questions
 | 
			
		||||
* I think I've detected a memory leak, is this a bug?
 | 
			
		||||
* Why does Valgrind complain about the use of uninitialized data?
 | 
			
		||||
* Why doesn't a memory BIO work when a file does?
 | 
			
		||||
* Where are the declarations and implementations of d2i_X509() etc?
 | 
			
		||||
 | 
			
		||||
===============================================================================
 | 
			
		||||
 | 
			
		||||
@@ -78,7 +82,7 @@ OpenSSL  -  Frequently Asked Questions
 | 
			
		||||
* Which is the current version of OpenSSL?
 | 
			
		||||
 | 
			
		||||
The current version is available from <URL: http://www.openssl.org>.
 | 
			
		||||
OpenSSL 0.9.8n was released on Mar 24th, 2010.
 | 
			
		||||
OpenSSL 1.0.0g was released on Jan 18th, 2012.
 | 
			
		||||
 | 
			
		||||
In addition to the current stable release, you can also access daily
 | 
			
		||||
snapshots of the OpenSSL development version at <URL:
 | 
			
		||||
@@ -94,14 +98,17 @@ explains how to install this library.
 | 
			
		||||
 | 
			
		||||
OpenSSL includes a command line utility that can be used to perform a
 | 
			
		||||
variety of cryptographic functions.  It is described in the openssl(1)
 | 
			
		||||
manpage.  Documentation for developers is currently being written.  A
 | 
			
		||||
few manual pages already are available; overviews over libcrypto and
 | 
			
		||||
manpage.  Documentation for developers is currently being written. Many
 | 
			
		||||
manual pages are available; overviews over libcrypto and
 | 
			
		||||
libssl are given in the crypto(3) and ssl(3) manpages.
 | 
			
		||||
 | 
			
		||||
The OpenSSL manpages are installed in /usr/local/ssl/man/ (or a
 | 
			
		||||
different directory if you specified one as described in INSTALL).
 | 
			
		||||
In addition, you can read the most current versions at
 | 
			
		||||
<URL: http://www.openssl.org/docs/>.
 | 
			
		||||
<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.
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
@@ -127,7 +134,7 @@ OpenSSL.  Information on the OpenSSL mailing lists is available from
 | 
			
		||||
* Where can I get a compiled version of OpenSSL?
 | 
			
		||||
 | 
			
		||||
You can finder pointers to binary distributions in
 | 
			
		||||
http://www.openssl.org/related/binaries.html .
 | 
			
		||||
<URL: http://www.openssl.org/related/binaries.html> .
 | 
			
		||||
 | 
			
		||||
Some applications that use OpenSSL are distributed in binary form.
 | 
			
		||||
When using such an application, you don't need to install OpenSSL
 | 
			
		||||
@@ -459,7 +466,7 @@ administrators.
 | 
			
		||||
Other projects do have other policies so you can for example extract the CA
 | 
			
		||||
bundle used by Mozilla and/or modssl as described in this article:
 | 
			
		||||
 | 
			
		||||
  http://www.mail-archive.com/modssl-users@modssl.org/msg16980.html
 | 
			
		||||
  <URL: http://www.mail-archive.com/modssl-users@modssl.org/msg16980.html>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
[BUILD] =======================================================================
 | 
			
		||||
@@ -501,7 +508,7 @@ when you run the test suite (using "make test").  The message returned is
 | 
			
		||||
"bc: 1 not implemented".
 | 
			
		||||
 | 
			
		||||
The best way to deal with this is to find another implementation of bc
 | 
			
		||||
and compile/install it.  GNU bc (see http://www.gnu.org/software/software.html
 | 
			
		||||
and compile/install it.  GNU bc (see <URL: http://www.gnu.org/software/software.html>
 | 
			
		||||
for download instructions) can be safely used, for example.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -512,7 +519,7 @@ that the OpenSSL bntest throws at it.  This gets triggered when you run the
 | 
			
		||||
test suite (using "make test").  The message returned is "bc: stack empty".
 | 
			
		||||
 | 
			
		||||
The best way to deal with this is to find another implementation of bc
 | 
			
		||||
and compile/install it.  GNU bc (see http://www.gnu.org/software/software.html
 | 
			
		||||
and compile/install it.  GNU bc (see <URL: http://www.gnu.org/software/software.html>
 | 
			
		||||
for download instructions) can be safely used, for example.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -705,6 +712,46 @@ never make sense, and tend to emerge when you least expect them. In order
 | 
			
		||||
to identify one, drop optimization level, e.g. by editing CFLAG line in
 | 
			
		||||
top-level Makefile, recompile and re-run the test.
 | 
			
		||||
 | 
			
		||||
* I think I've found a bug, what should I do?
 | 
			
		||||
 | 
			
		||||
If you are a new user then it is quite likely you haven't found a bug and
 | 
			
		||||
something is happening you aren't familiar with. Check this FAQ, the associated
 | 
			
		||||
documentation and the mailing lists for similar queries. If you are still
 | 
			
		||||
unsure whether it is a bug or not submit a query to the openssl-users mailing
 | 
			
		||||
list.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
* I'm SURE I've found a bug, how do I report it?
 | 
			
		||||
 | 
			
		||||
Bug reports with no security implications should be sent to the request
 | 
			
		||||
tracker. This can be done by mailing the report to <rt@openssl.org> (or its
 | 
			
		||||
alias <openssl-bugs@openssl.org>), please note that messages sent to the
 | 
			
		||||
request tracker also appear in the public openssl-dev mailing list.
 | 
			
		||||
 | 
			
		||||
The report should be in plain text. Any patches should be sent as
 | 
			
		||||
plain text attachments because some mailers corrupt patches sent inline.
 | 
			
		||||
If your issue affects multiple versions of OpenSSL check any patches apply
 | 
			
		||||
cleanly and, if possible include patches to each affected version.
 | 
			
		||||
 | 
			
		||||
The report should be given a meaningful subject line briefly summarising the
 | 
			
		||||
issue. Just "bug in OpenSSL" or "bug in OpenSSL 0.9.8n" is not very helpful.
 | 
			
		||||
 | 
			
		||||
By sending reports to the request tracker the bug can then be given a priority
 | 
			
		||||
and assigned to the appropriate maintainer. The history of discussions can be
 | 
			
		||||
accessed and if the issue has been addressed or a reason why not. If patches
 | 
			
		||||
are only sent to openssl-dev they can be mislaid if a team member has to
 | 
			
		||||
wade through months of old messages to review the discussion.
 | 
			
		||||
 | 
			
		||||
See also <URL: http://www.openssl.org/support/rt.html>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
* I've found a security issue, how do I report it?
 | 
			
		||||
 | 
			
		||||
If you think your bug has security implications then please send it to
 | 
			
		||||
openssl-security@openssl.org if you don't get a prompt reply at least 
 | 
			
		||||
acknowledging receipt then resend or mail it directly to one of the
 | 
			
		||||
more active team members (e.g. Steve).
 | 
			
		||||
 | 
			
		||||
[PROG] ========================================================================
 | 
			
		||||
 | 
			
		||||
* Is OpenSSL thread-safe?
 | 
			
		||||
@@ -717,8 +764,10 @@ file.
 | 
			
		||||
 | 
			
		||||
Multi-threaded applications must provide two callback functions to
 | 
			
		||||
OpenSSL by calling CRYPTO_set_locking_callback() and
 | 
			
		||||
CRYPTO_set_id_callback().  This is described in the threads(3)
 | 
			
		||||
manpage.
 | 
			
		||||
CRYPTO_set_id_callback(), for all versions of OpenSSL up to and
 | 
			
		||||
including 0.9.8[abc...]. As of version 1.0.0, CRYPTO_set_id_callback()
 | 
			
		||||
and associated APIs are deprecated by CRYPTO_THREADID_set_callback()
 | 
			
		||||
and friends. This is described in the threads(3) manpage.
 | 
			
		||||
 | 
			
		||||
* I've compiled a program under Windows and it crashes: why?
 | 
			
		||||
 | 
			
		||||
@@ -962,4 +1011,15 @@ is needed. This must be done by calling:
 | 
			
		||||
See the manual pages for more details.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
* Where are the declarations and implementations of d2i_X509() etc?
 | 
			
		||||
 | 
			
		||||
These are defined and implemented by macros of the form:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 DECLARE_ASN1_FUNCTIONS(X509) and IMPLEMENT_ASN1_FUNCTIONS(X509)
 | 
			
		||||
 | 
			
		||||
The implementation passes an ASN1 "template" defining the structure into an
 | 
			
		||||
ASN1 interpreter using generalised functions such as ASN1_item_d2i().
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
===============================================================================
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							@@ -12,7 +12,7 @@
 | 
			
		||||
  ---------------
 | 
			
		||||
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 1998-2008 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 * Copyright (c) 1998-2011 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										38
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								NEWS
									
									
									
									
									
								
							@@ -5,6 +5,39 @@
 | 
			
		||||
  This file gives a brief overview of the major changes between each OpenSSL
 | 
			
		||||
  release. For more details please read the CHANGES file.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8s and OpenSSL 0.9.8t:
 | 
			
		||||
 | 
			
		||||
      o Fix for DTLS DoS issue CVE-2012-0050
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8r and OpenSSL 0.9.8s:
 | 
			
		||||
 | 
			
		||||
      o Fix for DTLS plaintext recovery attack CVE-2011-4108
 | 
			
		||||
      o Fix policy check double free error CVE-2011-4109
 | 
			
		||||
      o Clear block padding bytes of SSL 3.0 records CVE-2011-4576
 | 
			
		||||
      o Only allow one SGC handshake restart for SSL/TLS CVE-2011-4619
 | 
			
		||||
      o Check for malformed RFC3779 data CVE-2011-4577
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8q and OpenSSL 0.9.8r:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2011-0014
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8p and OpenSSL 0.9.8q:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2010-4180
 | 
			
		||||
      o Fix for CVE-2010-4252
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8o and OpenSSL 0.9.8p:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2010-3864.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8n and OpenSSL 0.9.8o:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2010-0742.
 | 
			
		||||
      o Various DTLS fixes.
 | 
			
		||||
      o Recognise SHA2 certificates if only SSL algorithms added.
 | 
			
		||||
      o Fix for no-rc4 compilation.
 | 
			
		||||
      o Chil ENGINE unload workaround.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8m and OpenSSL 0.9.8n:
 | 
			
		||||
 | 
			
		||||
      o CFB cipher definition fixes.
 | 
			
		||||
@@ -164,6 +197,11 @@
 | 
			
		||||
      o Added initial support for Win64.
 | 
			
		||||
      o Added alternate pkg-config files.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7l and OpenSSL 0.9.7m:
 | 
			
		||||
 | 
			
		||||
      o FIPS 1.1.1 module linking.
 | 
			
		||||
      o Various ciphersuite selection fixes.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7k and OpenSSL 0.9.7l:
 | 
			
		||||
 | 
			
		||||
      o Introduce limits to prevent malicious key DoS  (CVE-2006-2940)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								PROBLEMS
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								PROBLEMS
									
									
									
									
									
								
							@@ -36,7 +36,9 @@ may differ on your machine.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
As long as Apple doesn't fix the problem with ld, this problem building
 | 
			
		||||
OpenSSL will remain as is.
 | 
			
		||||
OpenSSL will remain as is. Well, the problem was addressed in 0.9.8f by
 | 
			
		||||
passing -Wl,-search_paths_first, but it's unknown if the flag was
 | 
			
		||||
supported from the initial MacOS X release.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
* Parallell make leads to errors
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								README
									
									
									
									
									
								
							@@ -1,7 +1,7 @@
 | 
			
		||||
 | 
			
		||||
 OpenSSL 0.9.8n
 | 
			
		||||
 OpenSSL 0.9.8t 18 Jan 2012
 | 
			
		||||
 | 
			
		||||
 Copyright (c) 1998-2009 The OpenSSL Project
 | 
			
		||||
 Copyright (c) 1998-2011 The OpenSSL Project
 | 
			
		||||
 Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
 | 
			
		||||
 All rights reserved.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										16
									
								
								STATUS
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								STATUS
									
									
									
									
									
								
							@@ -1,10 +1,22 @@
 | 
			
		||||
 | 
			
		||||
  OpenSSL STATUS                           Last modified at
 | 
			
		||||
  ______________                           $Date: 2010/03/24 13:16:54 $
 | 
			
		||||
  ______________                           $Date: 2012/01/18 13:14:48 $
 | 
			
		||||
 | 
			
		||||
  DEVELOPMENT STATE
 | 
			
		||||
 | 
			
		||||
    o  OpenSSL 1.0.0:  Under development...
 | 
			
		||||
    o  OpenSSL 1.1.0:  Under development...
 | 
			
		||||
    o  OpenSSL 1.0.1:  Under development...
 | 
			
		||||
    o  OpenSSL 1.0.0d: Released on February   8nd, 2011
 | 
			
		||||
    o  OpenSSL 1.0.0c: Released on December   2nd, 2010
 | 
			
		||||
    o  OpenSSL 1.0.0b: Released on November  16th, 2010
 | 
			
		||||
    o  OpenSSL 1.0.0a: Released on June      1st,  2010
 | 
			
		||||
    o  OpenSSL 1.0.0:  Released on March     29th, 2010
 | 
			
		||||
    o  OpenSSL 0.9.8t: Released on January   18th, 2012
 | 
			
		||||
    o  OpenSSL 0.9.8s: Released on January    4th, 2012
 | 
			
		||||
    o  OpenSSL 0.9.8r: Released on February   8nd, 2011
 | 
			
		||||
    o  OpenSSL 0.9.8q: Released on December   2nd, 2010
 | 
			
		||||
    o  OpenSSL 0.9.8p: Released on November  16th, 2010
 | 
			
		||||
    o  OpenSSL 0.9.8o: Released on June       1st, 2010
 | 
			
		||||
    o  OpenSSL 0.9.8n: Released on March     24th, 2010
 | 
			
		||||
    o  OpenSSL 0.9.8m: Released on February  25th, 2010
 | 
			
		||||
    o  OpenSSL 0.9.8l: Released on November   5th, 2009
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										27
									
								
								TABLE
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								TABLE
									
									
									
									
									
								
							@@ -864,6 +864,33 @@ $shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
 | 
			
		||||
$ranlib       = 
 | 
			
		||||
$arflags      = -X64
 | 
			
		||||
 | 
			
		||||
*** android
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -mandroid -I$(ANDROID_DEV)/include -B$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
$lflags       = -ldl
 | 
			
		||||
$bn_ops       = BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR
 | 
			
		||||
$cpuid_obj    = 
 | 
			
		||||
$bn_obj       = 
 | 
			
		||||
$des_obj      = 
 | 
			
		||||
$aes_obj      = 
 | 
			
		||||
$bf_obj       = 
 | 
			
		||||
$md5_obj      = 
 | 
			
		||||
$sha1_obj     = 
 | 
			
		||||
$cast_obj     = 
 | 
			
		||||
$rc4_obj      = 
 | 
			
		||||
$rmd160_obj   = 
 | 
			
		||||
$rc5_obj      = 
 | 
			
		||||
$dso_scheme   = dlfcn
 | 
			
		||||
$shared_target= linux-shared
 | 
			
		||||
$shared_cflag = -fPIC
 | 
			
		||||
$shared_ldflag = 
 | 
			
		||||
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
 | 
			
		||||
$ranlib       = 
 | 
			
		||||
$arflags      = 
 | 
			
		||||
 | 
			
		||||
*** aux3-gcc
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -O2 -DTERMIO
 | 
			
		||||
 
 | 
			
		||||
@@ -114,8 +114,8 @@ $!
 | 
			
		||||
$   IF F$SEARCH(CATOP+".private"+CAKEY) .EQS. ""
 | 
			
		||||
$   THEN
 | 
			
		||||
$     READ '__INPUT' FILE -
 | 
			
		||||
	   /PROMT="CA certificate filename (or enter to create)"
 | 
			
		||||
$     IF F$SEARCH(FILE) .NES. ""
 | 
			
		||||
	   /PROMPT="CA certificate filename (or enter to create): "
 | 
			
		||||
$     IF (FILE .NES. "") .AND. (F$SEARCH(FILE) .NES. "")
 | 
			
		||||
$     THEN
 | 
			
		||||
$       COPY 'FILE' 'CATOP'.private'CAKEY'
 | 
			
		||||
$	RET=$STATUS
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										17
									
								
								apps/apps.c
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								apps/apps.c
									
									
									
									
									
								
							@@ -351,13 +351,12 @@ void program_name(char *in, char *out, int size)
 | 
			
		||||
 | 
			
		||||
int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[])
 | 
			
		||||
	{
 | 
			
		||||
	int num,len,i;
 | 
			
		||||
	int num,i;
 | 
			
		||||
	char *p;
 | 
			
		||||
 | 
			
		||||
	*argc=0;
 | 
			
		||||
	*argv=NULL;
 | 
			
		||||
 | 
			
		||||
	len=strlen(buf);
 | 
			
		||||
	i=0;
 | 
			
		||||
	if (arg->count == 0)
 | 
			
		||||
		{
 | 
			
		||||
@@ -866,10 +865,17 @@ EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin,
 | 
			
		||||
	if (format == FORMAT_ENGINE)
 | 
			
		||||
		{
 | 
			
		||||
		if (!e)
 | 
			
		||||
			BIO_printf(bio_err,"no engine specified\n");
 | 
			
		||||
			BIO_printf(err,"no engine specified\n");
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			pkey = ENGINE_load_private_key(e, file,
 | 
			
		||||
				ui_method, &cb_data);
 | 
			
		||||
			if (!pkey) 
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(err,"cannot load %s from engine\n",key_descrip);
 | 
			
		||||
				ERR_print_errors(err);
 | 
			
		||||
				}	
 | 
			
		||||
			}
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
@@ -919,8 +925,11 @@ EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin,
 | 
			
		||||
		}
 | 
			
		||||
 end:
 | 
			
		||||
	if (key != NULL) BIO_free(key);
 | 
			
		||||
	if (pkey == NULL)
 | 
			
		||||
	if (pkey == NULL) 
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(err,"unable to load %s\n", key_descrip);
 | 
			
		||||
		ERR_print_errors(err);
 | 
			
		||||
		}	
 | 
			
		||||
	return(pkey);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -408,6 +408,7 @@ static int do_generate(BIO *bio, char *genstr, char *genconf, BUF_MEM *buf)
 | 
			
		||||
 | 
			
		||||
	atyp = ASN1_generate_nconf(genstr, cnf);
 | 
			
		||||
	NCONF_free(cnf);
 | 
			
		||||
	cnf = NULL;
 | 
			
		||||
 | 
			
		||||
	if (!atyp)
 | 
			
		||||
		return -1;
 | 
			
		||||
 
 | 
			
		||||
@@ -611,7 +611,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		BIO_printf (bio_err, "-certsout file certificate output file\n");
 | 
			
		||||
		BIO_printf (bio_err, "-signer file   signer certificate file\n");
 | 
			
		||||
		BIO_printf (bio_err, "-recip  file   recipient certificate file for decryption\n");
 | 
			
		||||
		BIO_printf (bio_err, "-skeyid        use subject key identifier\n");
 | 
			
		||||
		BIO_printf (bio_err, "-keyid         use subject key identifier\n");
 | 
			
		||||
		BIO_printf (bio_err, "-in file       input file\n");
 | 
			
		||||
		BIO_printf (bio_err, "-inform arg    input format SMIME (default), PEM or DER\n");
 | 
			
		||||
		BIO_printf (bio_err, "-inkey file    input private key (if not signer or recipient)\n");
 | 
			
		||||
 
 | 
			
		||||
@@ -88,9 +88,6 @@ int MAIN(int, char **);
 | 
			
		||||
 | 
			
		||||
int MAIN(int argc, char **argv)
 | 
			
		||||
	{
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	ENGINE *e = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	DH *dh=NULL;
 | 
			
		||||
	int i,badops=0,text=0;
 | 
			
		||||
	BIO *in=NULL,*out=NULL;
 | 
			
		||||
@@ -189,7 +186,7 @@ bad:
 | 
			
		||||
	ERR_load_crypto_strings();
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
        e = setup_engine(bio_err, engine, 0);
 | 
			
		||||
        setup_engine(bio_err, engine, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	in=BIO_new(BIO_s_file());
 | 
			
		||||
 
 | 
			
		||||
@@ -149,9 +149,6 @@ int MAIN(int, char **);
 | 
			
		||||
 | 
			
		||||
int MAIN(int argc, char **argv)
 | 
			
		||||
	{
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	ENGINE *e = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	DH *dh=NULL;
 | 
			
		||||
	int i,badops=0,text=0;
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
@@ -270,7 +267,7 @@ bad:
 | 
			
		||||
	ERR_load_crypto_strings();
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
        e = setup_engine(bio_err, engine, 0);
 | 
			
		||||
        setup_engine(bio_err, engine, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (g && !num)
 | 
			
		||||
 
 | 
			
		||||
@@ -111,9 +111,6 @@ int MAIN(int, char **);
 | 
			
		||||
 | 
			
		||||
int MAIN(int argc, char **argv)
 | 
			
		||||
	{
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	ENGINE *e = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	DSA *dsa=NULL;
 | 
			
		||||
	int i,badops=0,text=0;
 | 
			
		||||
	BIO *in=NULL,*out=NULL;
 | 
			
		||||
@@ -278,7 +275,7 @@ bad:
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
        e = setup_engine(bio_err, engine, 0);
 | 
			
		||||
        setup_engine(bio_err, engine, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (need_rand)
 | 
			
		||||
@@ -357,12 +354,10 @@ bad:
 | 
			
		||||
	if (C)
 | 
			
		||||
		{
 | 
			
		||||
		unsigned char *data;
 | 
			
		||||
		int l,len,bits_p,bits_q,bits_g;
 | 
			
		||||
		int l,len,bits_p;
 | 
			
		||||
 | 
			
		||||
		len=BN_num_bytes(dsa->p);
 | 
			
		||||
		bits_p=BN_num_bits(dsa->p);
 | 
			
		||||
		bits_q=BN_num_bits(dsa->q);
 | 
			
		||||
		bits_g=BN_num_bits(dsa->g);
 | 
			
		||||
		data=(unsigned char *)OPENSSL_malloc(len+20);
 | 
			
		||||
		if (data == NULL)
 | 
			
		||||
			{
 | 
			
		||||
 
 | 
			
		||||
@@ -85,9 +85,6 @@ int MAIN(int, char **);
 | 
			
		||||
 | 
			
		||||
int MAIN(int argc, char **argv)
 | 
			
		||||
{
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	ENGINE 	*e = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	int 	ret = 1;
 | 
			
		||||
	EC_KEY 	*eckey = NULL;
 | 
			
		||||
	const EC_GROUP *group;
 | 
			
		||||
@@ -254,7 +251,7 @@ bad:
 | 
			
		||||
	ERR_load_crypto_strings();
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
        e = setup_engine(bio_err, engine, 0);
 | 
			
		||||
        setup_engine(bio_err, engine, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) 
 | 
			
		||||
 
 | 
			
		||||
@@ -129,9 +129,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	char	*infile = NULL, *outfile = NULL, *prog;
 | 
			
		||||
	BIO 	*in = NULL, *out = NULL;
 | 
			
		||||
	int 	informat, outformat, noout = 0, C = 0, ret = 1;
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	ENGINE	*e = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	char	*engine = NULL;
 | 
			
		||||
 | 
			
		||||
	BIGNUM	*ec_p = NULL, *ec_a = NULL, *ec_b = NULL,
 | 
			
		||||
@@ -340,7 +337,7 @@ bad:
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	e = setup_engine(bio_err, engine, 0);
 | 
			
		||||
	setup_engine(bio_err, engine, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (list_curves)
 | 
			
		||||
 
 | 
			
		||||
@@ -100,9 +100,6 @@ int MAIN(int, char **);
 | 
			
		||||
 | 
			
		||||
int MAIN(int argc, char **argv)
 | 
			
		||||
	{
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	ENGINE *e = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	static const char magic[]="Salted__";
 | 
			
		||||
	char mbuf[sizeof magic-1];
 | 
			
		||||
	char *strbuf=NULL;
 | 
			
		||||
@@ -311,7 +308,7 @@ bad:
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
        e = setup_engine(bio_err, engine, 0);
 | 
			
		||||
        setup_engine(bio_err, engine, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (md && (dgst=EVP_get_digestbyname(md)) == NULL)
 | 
			
		||||
 
 | 
			
		||||
@@ -89,9 +89,6 @@ int MAIN(int, char **);
 | 
			
		||||
int MAIN(int argc, char **argv)
 | 
			
		||||
	{
 | 
			
		||||
	BN_GENCB cb;
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	ENGINE *e = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	DH *dh=NULL;
 | 
			
		||||
	int ret=1,num=DEFBITS;
 | 
			
		||||
	int g=2;
 | 
			
		||||
@@ -163,7 +160,7 @@ bad:
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
        e = setup_engine(bio_err, engine, 0);
 | 
			
		||||
        setup_engine(bio_err, engine, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	out=BIO_new(BIO_s_file());
 | 
			
		||||
 
 | 
			
		||||
@@ -78,9 +78,6 @@ int MAIN(int, char **);
 | 
			
		||||
 | 
			
		||||
int MAIN(int argc, char **argv)
 | 
			
		||||
	{
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	ENGINE *e = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	DSA *dsa=NULL;
 | 
			
		||||
	int ret=1;
 | 
			
		||||
	char *outfile=NULL;
 | 
			
		||||
@@ -206,7 +203,7 @@ bad:
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
        e = setup_engine(bio_err, engine, 0);
 | 
			
		||||
        setup_engine(bio_err, engine, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if(!app_passwd(bio_err, NULL, passargout, NULL, &passout)) {
 | 
			
		||||
 
 | 
			
		||||
@@ -89,9 +89,6 @@ int MAIN(int, char **);
 | 
			
		||||
int MAIN(int argc, char **argv)
 | 
			
		||||
	{
 | 
			
		||||
	BN_GENCB cb;
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	ENGINE *e = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	int ret=1;
 | 
			
		||||
	int i,num=DEFBITS;
 | 
			
		||||
	long l;
 | 
			
		||||
@@ -235,7 +232,7 @@ bad:
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
        e = setup_engine(bio_err, engine, 0);
 | 
			
		||||
        setup_engine(bio_err, engine, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (outfile == NULL)
 | 
			
		||||
 
 | 
			
		||||
@@ -141,7 +141,7 @@ localityName			= Locality Name (eg, city)
 | 
			
		||||
organizationalUnitName		= Organizational Unit Name (eg, section)
 | 
			
		||||
#organizationalUnitName_default	=
 | 
			
		||||
 | 
			
		||||
commonName			= Common Name (eg, YOUR name)
 | 
			
		||||
commonName			= Common Name (e.g. server FQDN or YOUR name)
 | 
			
		||||
commonName_max			= 64
 | 
			
		||||
 | 
			
		||||
emailAddress			= Email Address
 | 
			
		||||
 
 | 
			
		||||
@@ -141,7 +141,7 @@ localityName			= Locality Name (eg, city)
 | 
			
		||||
organizationalUnitName		= Organizational Unit Name (eg, section)
 | 
			
		||||
#organizationalUnitName_default	=
 | 
			
		||||
 | 
			
		||||
commonName			= Common Name (eg, YOUR name)
 | 
			
		||||
commonName			= Common Name (e.g. server FQDN or YOUR name)
 | 
			
		||||
commonName_max			= 64
 | 
			
		||||
 | 
			
		||||
emailAddress			= Email Address
 | 
			
		||||
 
 | 
			
		||||
@@ -659,7 +659,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
    if (!twopass) BUF_strlcpy(macpass, pass, sizeof macpass);
 | 
			
		||||
 | 
			
		||||
    if (options & INFO) BIO_printf (bio_err, "MAC Iteration %ld\n", p12->mac->iter ? ASN1_INTEGER_get (p12->mac->iter) : 1);
 | 
			
		||||
    if ((options & INFO) && p12->mac) BIO_printf (bio_err, "MAC Iteration %ld\n", p12->mac->iter ? ASN1_INTEGER_get (p12->mac->iter) : 1);
 | 
			
		||||
    if(macver) {
 | 
			
		||||
#ifdef CRYPTO_MDEBUG
 | 
			
		||||
    CRYPTO_push_info("verify MAC");
 | 
			
		||||
 
 | 
			
		||||
@@ -82,9 +82,6 @@ int MAIN(int, char **);
 | 
			
		||||
 | 
			
		||||
int MAIN(int argc, char **argv)
 | 
			
		||||
	{
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	ENGINE *e = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	PKCS7 *p7=NULL;
 | 
			
		||||
	int i,badops=0;
 | 
			
		||||
	BIO *in=NULL,*out=NULL;
 | 
			
		||||
@@ -180,7 +177,7 @@ bad:
 | 
			
		||||
	ERR_load_crypto_strings();
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
        e = setup_engine(bio_err, engine, 0);
 | 
			
		||||
        setup_engine(bio_err, engine, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	in=BIO_new(BIO_s_file());
 | 
			
		||||
 
 | 
			
		||||
@@ -77,9 +77,6 @@ int MAIN(int, char **);
 | 
			
		||||
 | 
			
		||||
int MAIN(int argc, char **argv)
 | 
			
		||||
	{
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	ENGINE *e = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	int i, r, ret = 1;
 | 
			
		||||
	int badopt;
 | 
			
		||||
	char *outfile = NULL;
 | 
			
		||||
@@ -178,7 +175,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
        e = setup_engine(bio_err, engine, 0);
 | 
			
		||||
        setup_engine(bio_err, engine, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	app_RAND_load_file(NULL, bio_err, (inrand != NULL));
 | 
			
		||||
 
 | 
			
		||||
@@ -2075,12 +2075,14 @@ static int www_body(char *hostname, int s, unsigned char *context)
 | 
			
		||||
	{
 | 
			
		||||
	char *buf=NULL;
 | 
			
		||||
	int ret=1;
 | 
			
		||||
	int i,j,k,blank,dot;
 | 
			
		||||
	int i,j,k,dot;
 | 
			
		||||
	struct stat st_buf;
 | 
			
		||||
	SSL *con;
 | 
			
		||||
	SSL_CIPHER *c;
 | 
			
		||||
	BIO *io,*ssl_bio,*sbio;
 | 
			
		||||
#ifdef RENEG
 | 
			
		||||
	long total_bytes;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	buf=OPENSSL_malloc(bufsize);
 | 
			
		||||
	if (buf == NULL) return(0);
 | 
			
		||||
@@ -2151,7 +2153,6 @@ static int www_body(char *hostname, int s, unsigned char *context)
 | 
			
		||||
		SSL_set_msg_callback_arg(con, bio_s_out);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	blank=0;
 | 
			
		||||
	for (;;)
 | 
			
		||||
		{
 | 
			
		||||
		if (hack)
 | 
			
		||||
@@ -2388,7 +2389,9 @@ static int www_body(char *hostname, int s, unsigned char *context)
 | 
			
		||||
                                        BIO_puts(io,"HTTP/1.0 200 ok\r\nContent-type: text/plain\r\n\r\n");
 | 
			
		||||
                                }
 | 
			
		||||
			/* send the file */
 | 
			
		||||
#ifdef RENEG
 | 
			
		||||
			total_bytes=0;
 | 
			
		||||
#endif
 | 
			
		||||
			for (;;)
 | 
			
		||||
				{
 | 
			
		||||
				i=BIO_read(file,buf,bufsize);
 | 
			
		||||
 
 | 
			
		||||
@@ -329,7 +329,7 @@ static int init_server_long(int *sock, int port, char *ip, int type)
 | 
			
		||||
	{
 | 
			
		||||
	int ret=0;
 | 
			
		||||
	struct sockaddr_in server;
 | 
			
		||||
	int s= -1,i;
 | 
			
		||||
	int s= -1;
 | 
			
		||||
 | 
			
		||||
	if (!ssl_sock_init()) return(0);
 | 
			
		||||
 | 
			
		||||
@@ -368,7 +368,6 @@ static int init_server_long(int *sock, int port, char *ip, int type)
 | 
			
		||||
		}
 | 
			
		||||
	/* Make it 128 for linux */
 | 
			
		||||
	if (type==SOCK_STREAM && listen(s,128) == -1) goto err;
 | 
			
		||||
	i=0;
 | 
			
		||||
	*sock=s;
 | 
			
		||||
	ret=1;
 | 
			
		||||
err:
 | 
			
		||||
@@ -386,7 +385,7 @@ static int init_server(int *sock, int port, int type)
 | 
			
		||||
 | 
			
		||||
static int do_accept(int acc_sock, int *sock, char **host)
 | 
			
		||||
	{
 | 
			
		||||
	int ret,i;
 | 
			
		||||
	int ret;
 | 
			
		||||
	struct hostent *h1,*h2;
 | 
			
		||||
	static struct sockaddr_in from;
 | 
			
		||||
	int len;
 | 
			
		||||
@@ -409,6 +408,7 @@ redoit:
 | 
			
		||||
	if (ret == INVALID_SOCKET)
 | 
			
		||||
		{
 | 
			
		||||
#if defined(OPENSSL_SYS_WINDOWS) || (defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK))
 | 
			
		||||
		int i;
 | 
			
		||||
		i=WSAGetLastError();
 | 
			
		||||
		BIO_printf(bio_err,"accept error %d\n",i);
 | 
			
		||||
#else
 | 
			
		||||
@@ -463,7 +463,6 @@ redoit:
 | 
			
		||||
			BIO_printf(bio_err,"gethostbyname failure\n");
 | 
			
		||||
			return(0);
 | 
			
		||||
			}
 | 
			
		||||
		i=0;
 | 
			
		||||
		if (h2->h_addrtype != AF_INET)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,"gethostbyname addr is not AF_INET\n");
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								apps/speed.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								apps/speed.c
									
									
									
									
									
								
							@@ -500,9 +500,6 @@ int MAIN(int, char **);
 | 
			
		||||
 | 
			
		||||
int MAIN(int argc, char **argv)
 | 
			
		||||
	{
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	ENGINE *e = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	unsigned char *buf=NULL,*buf2=NULL;
 | 
			
		||||
	int mret=1;
 | 
			
		||||
	long count=0,save_count=0;
 | 
			
		||||
@@ -593,7 +590,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	unsigned char DES_iv[8];
 | 
			
		||||
	unsigned char iv[2*MAX_BLOCK_SIZE/8];
 | 
			
		||||
#ifndef OPENSSL_NO_DES
 | 
			
		||||
	DES_cblock *buf_as_des_cblock = NULL;
 | 
			
		||||
	static DES_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0};
 | 
			
		||||
	static DES_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12};
 | 
			
		||||
	static DES_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34};
 | 
			
		||||
@@ -806,9 +802,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		BIO_printf(bio_err,"out of memory\n");
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
#ifndef OPENSSL_NO_DES
 | 
			
		||||
	buf_as_des_cblock = (DES_cblock *)buf;
 | 
			
		||||
#endif
 | 
			
		||||
	if ((buf2=(unsigned char *)OPENSSL_malloc((int)BUFSIZE)) == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,"out of memory\n");
 | 
			
		||||
@@ -883,7 +876,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
				BIO_printf(bio_err,"no engine given\n");
 | 
			
		||||
				goto end;
 | 
			
		||||
				}
 | 
			
		||||
                        e = setup_engine(bio_err, *argv, 0);
 | 
			
		||||
                        setup_engine(bio_err, *argv, 0);
 | 
			
		||||
			/* j will be increased again further down.  We just
 | 
			
		||||
			   don't want speed to confuse an engine with an
 | 
			
		||||
			   algorithm, especially when none is given (which
 | 
			
		||||
@@ -1388,7 +1381,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		count*=2;
 | 
			
		||||
		Time_F(START);
 | 
			
		||||
		for (it=count; it; it--)
 | 
			
		||||
			DES_ecb_encrypt(buf_as_des_cblock,buf_as_des_cblock,
 | 
			
		||||
			DES_ecb_encrypt((DES_cblock *)buf,
 | 
			
		||||
				(DES_cblock *)buf,
 | 
			
		||||
				&sch,DES_ENCRYPT);
 | 
			
		||||
		d=Time_F(STOP);
 | 
			
		||||
		} while (d <3);
 | 
			
		||||
 
 | 
			
		||||
@@ -539,7 +539,6 @@ bad:
 | 
			
		||||
	if (reqfile)
 | 
			
		||||
		{
 | 
			
		||||
		EVP_PKEY *pkey;
 | 
			
		||||
		X509_CINF *ci;
 | 
			
		||||
		BIO *in;
 | 
			
		||||
 | 
			
		||||
		if (!sign_flag && !CA_flag)
 | 
			
		||||
@@ -607,7 +606,6 @@ bad:
 | 
			
		||||
		print_name(bio_err, "subject=", X509_REQ_get_subject_name(req), nmflag);
 | 
			
		||||
 | 
			
		||||
		if ((x=X509_new()) == NULL) goto end;
 | 
			
		||||
		ci=x->cert_info;
 | 
			
		||||
 | 
			
		||||
		if (sno == NULL)
 | 
			
		||||
			{
 | 
			
		||||
@@ -971,7 +969,7 @@ bad:
 | 
			
		||||
				else
 | 
			
		||||
					{
 | 
			
		||||
					pk=load_key(bio_err,
 | 
			
		||||
						keyfile, FORMAT_PEM, 0,
 | 
			
		||||
						keyfile, keyformat, 0,
 | 
			
		||||
						passin, e, "request key");
 | 
			
		||||
					if (pk == NULL) goto end;
 | 
			
		||||
					}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								config
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								config
									
									
									
									
									
								
							@@ -790,6 +790,10 @@ esac
 | 
			
		||||
#  options="$options -DATALLA"
 | 
			
		||||
#fi
 | 
			
		||||
 | 
			
		||||
($CC -Wa,--help -c -o /dev/null -x assembler /dev/null 2>&1 | \
 | 
			
		||||
 grep \\--noexecstack) 2>&1 > /dev/null && \
 | 
			
		||||
  options="$options -Wa,--noexecstack"
 | 
			
		||||
 | 
			
		||||
# gcc < 2.8 does not support -march=ultrasparc
 | 
			
		||||
if [ "$OUT" = solaris-sparcv9-gcc -a $GCCVER -lt 28 ]
 | 
			
		||||
then
 | 
			
		||||
 
 | 
			
		||||
@@ -85,9 +85,9 @@ int AES_wrap_key(AES_KEY *key, const unsigned char *iv,
 | 
			
		||||
			A[7] ^= (unsigned char)(t & 0xff);
 | 
			
		||||
			if (t > 0xff)	
 | 
			
		||||
				{
 | 
			
		||||
				A[6] ^= (unsigned char)((t & 0xff) >> 8);
 | 
			
		||||
				A[5] ^= (unsigned char)((t & 0xff) >> 16);
 | 
			
		||||
				A[4] ^= (unsigned char)((t & 0xff) >> 24);
 | 
			
		||||
				A[6] ^= (unsigned char)((t >> 8) & 0xff);
 | 
			
		||||
				A[5] ^= (unsigned char)((t >> 16) & 0xff);
 | 
			
		||||
				A[4] ^= (unsigned char)((t >> 24) & 0xff);
 | 
			
		||||
				}
 | 
			
		||||
			memcpy(R, B + 8, 8);
 | 
			
		||||
			}
 | 
			
		||||
@@ -119,9 +119,9 @@ int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
 | 
			
		||||
			A[7] ^= (unsigned char)(t & 0xff);
 | 
			
		||||
			if (t > 0xff)	
 | 
			
		||||
				{
 | 
			
		||||
				A[6] ^= (unsigned char)((t & 0xff) >> 8);
 | 
			
		||||
				A[5] ^= (unsigned char)((t & 0xff) >> 16);
 | 
			
		||||
				A[4] ^= (unsigned char)((t & 0xff) >> 24);
 | 
			
		||||
				A[6] ^= (unsigned char)((t >> 8) & 0xff);
 | 
			
		||||
				A[5] ^= (unsigned char)((t >> 16) & 0xff);
 | 
			
		||||
				A[4] ^= (unsigned char)((t >> 24) & 0xff);
 | 
			
		||||
				}
 | 
			
		||||
			memcpy(B + 8, R, 8);
 | 
			
		||||
			AES_decrypt(B, B, key);
 | 
			
		||||
 
 | 
			
		||||
@@ -751,7 +751,19 @@ $code.=<<___;
 | 
			
		||||
AES_set_encrypt_key:
 | 
			
		||||
	push	%rbx
 | 
			
		||||
	push	%rbp
 | 
			
		||||
	sub	\$8,%rsp
 | 
			
		||||
 | 
			
		||||
	call	_x86_64_AES_set_encrypt_key
 | 
			
		||||
 | 
			
		||||
	mov	8(%rsp),%rbp
 | 
			
		||||
	mov	16(%rsp),%rbx
 | 
			
		||||
	add	\$24,%rsp
 | 
			
		||||
	ret
 | 
			
		||||
.size	AES_set_encrypt_key,.-AES_set_encrypt_key
 | 
			
		||||
 | 
			
		||||
.type	_x86_64_AES_set_encrypt_key,\@abi-omnipotent
 | 
			
		||||
.align	16
 | 
			
		||||
_x86_64_AES_set_encrypt_key:
 | 
			
		||||
	mov	%esi,%ecx			# %ecx=bits
 | 
			
		||||
	mov	%rdi,%rsi			# %rsi=userKey
 | 
			
		||||
	mov	%rdx,%rdi			# %rdi=key
 | 
			
		||||
@@ -938,10 +950,8 @@ $code.=<<___;
 | 
			
		||||
.Lbadpointer:
 | 
			
		||||
	mov	\$-1,%rax
 | 
			
		||||
.Lexit:
 | 
			
		||||
	pop	%rbp
 | 
			
		||||
	pop	%rbx
 | 
			
		||||
	ret
 | 
			
		||||
.size	AES_set_encrypt_key,.-AES_set_encrypt_key
 | 
			
		||||
	.byte	0xf3,0xc3		# rep ret
 | 
			
		||||
.size	_x86_64_AES_set_encrypt_key,.-_x86_64_AES_set_encrypt_key
 | 
			
		||||
___
 | 
			
		||||
 | 
			
		||||
sub deckey()
 | 
			
		||||
@@ -973,15 +983,14 @@ $code.=<<___;
 | 
			
		||||
.type	AES_set_decrypt_key,\@function,3
 | 
			
		||||
.align	16
 | 
			
		||||
AES_set_decrypt_key:
 | 
			
		||||
	push	%rdx
 | 
			
		||||
	call	AES_set_encrypt_key
 | 
			
		||||
	cmp	\$0,%eax
 | 
			
		||||
	je	.Lproceed
 | 
			
		||||
	lea	24(%rsp),%rsp
 | 
			
		||||
	ret
 | 
			
		||||
.Lproceed:
 | 
			
		||||
	push	%rbx
 | 
			
		||||
	push	%rbp
 | 
			
		||||
	push	%rdx			# save key schedule
 | 
			
		||||
 | 
			
		||||
	call	_x86_64_AES_set_encrypt_key
 | 
			
		||||
	mov	(%rsp),%r8		# restore key schedule
 | 
			
		||||
	mov	%rbx,(%rsp)
 | 
			
		||||
	cmp	\$0,%eax
 | 
			
		||||
	jne	.Labort
 | 
			
		||||
 | 
			
		||||
	mov	240(%r8),%ecx		# pull number of rounds
 | 
			
		||||
	xor	%rdi,%rdi
 | 
			
		||||
@@ -1023,7 +1032,10 @@ $code.=<<___;
 | 
			
		||||
	jnz	.Lpermute
 | 
			
		||||
 | 
			
		||||
	xor	%rax,%rax
 | 
			
		||||
	pop	%rbx
 | 
			
		||||
.Labort:
 | 
			
		||||
	mov	8(%rsp),%rbp
 | 
			
		||||
	mov	16(%rsp),%rbx
 | 
			
		||||
	add	\$24,%rsp
 | 
			
		||||
	ret
 | 
			
		||||
.size	AES_set_decrypt_key,.-AES_set_decrypt_key
 | 
			
		||||
___
 | 
			
		||||
 
 | 
			
		||||
@@ -273,7 +273,7 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
 | 
			
		||||
	{
 | 
			
		||||
	ASN1_INTEGER *ret=NULL;
 | 
			
		||||
	const unsigned char *p;
 | 
			
		||||
	unsigned char *to,*s;
 | 
			
		||||
	unsigned char *s;
 | 
			
		||||
	long len;
 | 
			
		||||
	int inf,tag,xclass;
 | 
			
		||||
	int i;
 | 
			
		||||
@@ -308,7 +308,6 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
 | 
			
		||||
		i=ERR_R_MALLOC_FAILURE;
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
	to=s;
 | 
			
		||||
	ret->type=V_ASN1_INTEGER;
 | 
			
		||||
	if(len) {
 | 
			
		||||
		if ((*p == 0) && (len != 1))
 | 
			
		||||
 
 | 
			
		||||
@@ -139,7 +139,7 @@ int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
 | 
			
		||||
				ASN1err(ASN1_F_A2D_ASN1_OBJECT,ASN1_R_INVALID_DIGIT);
 | 
			
		||||
				goto err;
 | 
			
		||||
				}
 | 
			
		||||
			if (!use_bn && l > (ULONG_MAX / 10L))
 | 
			
		||||
			if (!use_bn && l >= ((ULONG_MAX - 80) / 10L))
 | 
			
		||||
				{
 | 
			
		||||
				use_bn = 1;
 | 
			
		||||
				if (!bl)
 | 
			
		||||
@@ -294,7 +294,7 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
 | 
			
		||||
	/* Sanity check OID encoding: can't have leading 0x80 in
 | 
			
		||||
	 * subidentifiers, see: X.690 8.19.2
 | 
			
		||||
	 */
 | 
			
		||||
	for (i = 0, p = *pp + 1; i < len - 1; i++, p++)
 | 
			
		||||
	for (i = 0, p = *pp; i < len; i++, p++)
 | 
			
		||||
		{
 | 
			
		||||
		if (*p == 0x80 && (!i || !(p[-1] & 0x80)))
 | 
			
		||||
			{
 | 
			
		||||
 
 | 
			
		||||
@@ -74,6 +74,11 @@
 | 
			
		||||
 | 
			
		||||
#define CHARTYPE_BS_ESC		(ASN1_STRFLGS_ESC_2253 | CHARTYPE_FIRST_ESC_2253 | CHARTYPE_LAST_ESC_2253)
 | 
			
		||||
 | 
			
		||||
#define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \
 | 
			
		||||
		  ASN1_STRFLGS_ESC_QUOTE | \
 | 
			
		||||
		  ASN1_STRFLGS_ESC_CTRL | \
 | 
			
		||||
		  ASN1_STRFLGS_ESC_MSB)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Three IO functions for sending data to memory, a BIO and
 | 
			
		||||
 * and a FILE pointer.
 | 
			
		||||
@@ -148,6 +153,13 @@ static int do_esc_char(unsigned long c, unsigned char flags, char *do_quotes, ch
 | 
			
		||||
		if(!io_ch(arg, tmphex, 3)) return -1;
 | 
			
		||||
		return 3;
 | 
			
		||||
	}
 | 
			
		||||
	/* If we get this far and do any escaping at all must escape 
 | 
			
		||||
	 * the escape character itself: backslash.
 | 
			
		||||
	 */
 | 
			
		||||
	if (chtmp == '\\' && flags & ESC_FLAGS) {
 | 
			
		||||
		if(!io_ch(arg, "\\\\", 2)) return -1;
 | 
			
		||||
		return 2;
 | 
			
		||||
	}
 | 
			
		||||
	if(!io_ch(arg, &chtmp, 1)) return -1;
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
@@ -292,11 +304,6 @@ static const signed char tag2nbyte[] = {
 | 
			
		||||
	4, -1, 2		/* 28-30 */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \
 | 
			
		||||
		  ASN1_STRFLGS_ESC_QUOTE | \
 | 
			
		||||
		  ASN1_STRFLGS_ESC_CTRL | \
 | 
			
		||||
		  ASN1_STRFLGS_ESC_MSB)
 | 
			
		||||
 | 
			
		||||
/* This is the main function, print out an
 | 
			
		||||
 * ASN1_STRING taking note of various escape
 | 
			
		||||
 * and display options. Returns number of
 | 
			
		||||
 
 | 
			
		||||
@@ -96,7 +96,7 @@ unsigned long ASN1_STRING_get_default_mask(void)
 | 
			
		||||
 * default:   the default value, Printable, T61, BMP.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
int ASN1_STRING_set_default_mask_asc(char *p)
 | 
			
		||||
int ASN1_STRING_set_default_mask_asc(const char *p)
 | 
			
		||||
{
 | 
			
		||||
	unsigned long mask;
 | 
			
		||||
	char *end;
 | 
			
		||||
 
 | 
			
		||||
@@ -1051,7 +1051,7 @@ ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
 | 
			
		||||
ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct);
 | 
			
		||||
 | 
			
		||||
void ASN1_STRING_set_default_mask(unsigned long mask);
 | 
			
		||||
int ASN1_STRING_set_default_mask_asc(char *p);
 | 
			
		||||
int ASN1_STRING_set_default_mask_asc(const char *p);
 | 
			
		||||
unsigned long ASN1_STRING_get_default_mask(void);
 | 
			
		||||
int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
 | 
			
		||||
					int inform, unsigned long mask);
 | 
			
		||||
 
 | 
			
		||||
@@ -242,7 +242,7 @@ RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,
 | 
			
		||||
		 int sgckey)
 | 
			
		||||
	{
 | 
			
		||||
	RSA *ret=NULL;
 | 
			
		||||
	const unsigned char *p, *kp;
 | 
			
		||||
	const unsigned char *p;
 | 
			
		||||
	NETSCAPE_ENCRYPTED_PKEY *enckey = NULL;
 | 
			
		||||
 | 
			
		||||
	p = *pp;
 | 
			
		||||
@@ -265,7 +265,6 @@ RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,
 | 
			
		||||
		ASN1err(ASN1_F_D2I_RSA_NET,ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM);
 | 
			
		||||
		goto err;
 | 
			
		||||
	}
 | 
			
		||||
	kp = enckey->enckey->digest->data;
 | 
			
		||||
	if (cb == NULL)
 | 
			
		||||
		cb=EVP_read_pw_string;
 | 
			
		||||
	if ((ret=d2i_RSA_NET_2(a, enckey->enckey->digest,cb, sgckey)) == NULL) goto err;
 | 
			
		||||
 
 | 
			
		||||
@@ -87,7 +87,7 @@ int X509_CRL_print(BIO *out, X509_CRL *x)
 | 
			
		||||
	STACK_OF(X509_REVOKED) *rev;
 | 
			
		||||
	X509_REVOKED *r;
 | 
			
		||||
	long l;
 | 
			
		||||
	int i, n;
 | 
			
		||||
	int i;
 | 
			
		||||
	char *p;
 | 
			
		||||
 | 
			
		||||
	BIO_printf(out, "Certificate Revocation List (CRL):\n");
 | 
			
		||||
@@ -107,7 +107,6 @@ int X509_CRL_print(BIO *out, X509_CRL *x)
 | 
			
		||||
	else BIO_printf(out,"NONE");
 | 
			
		||||
	BIO_printf(out,"\n");
 | 
			
		||||
 | 
			
		||||
	n=X509_CRL_get_ext_count(x);
 | 
			
		||||
	X509V3_extensions_print(out, "CRL extensions",
 | 
			
		||||
						x->crl->extensions, 0, 8);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -166,7 +166,7 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
 | 
			
		||||
	int i;
 | 
			
		||||
	int otag;
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
	ASN1_VALUE *pchval, **pchptr, *ptmpval;
 | 
			
		||||
	ASN1_VALUE **pchptr, *ptmpval;
 | 
			
		||||
	if (!pval)
 | 
			
		||||
		return 0;
 | 
			
		||||
	if (aux && aux->asn1_cb)
 | 
			
		||||
@@ -317,7 +317,6 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
		/* CHOICE type, try each possibility in turn */
 | 
			
		||||
		pchval = NULL;
 | 
			
		||||
		p = *in;
 | 
			
		||||
		for (i = 0, tt=it->templates; i < it->tcount; i++, tt++)
 | 
			
		||||
			{
 | 
			
		||||
 
 | 
			
		||||
@@ -196,7 +196,9 @@ static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long len
 | 
			
		||||
	*val = nm.a;
 | 
			
		||||
	*in = p;
 | 
			
		||||
	return ret;
 | 
			
		||||
	err:
 | 
			
		||||
err:
 | 
			
		||||
        if (nm.x != NULL)
 | 
			
		||||
		X509_NAME_free(nm.x);
 | 
			
		||||
	ASN1err(ASN1_F_X509_NAME_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -63,7 +63,7 @@
 | 
			
		||||
#include <openssl/x509.h>
 | 
			
		||||
#include <openssl/x509v3.h>
 | 
			
		||||
 | 
			
		||||
ASN1_SEQUENCE(X509_CINF) = {
 | 
			
		||||
ASN1_SEQUENCE_enc(X509_CINF, enc, 0) = {
 | 
			
		||||
	ASN1_EXP_OPT(X509_CINF, version, ASN1_INTEGER, 0),
 | 
			
		||||
	ASN1_SIMPLE(X509_CINF, serialNumber, ASN1_INTEGER),
 | 
			
		||||
	ASN1_SIMPLE(X509_CINF, signature, X509_ALGOR),
 | 
			
		||||
@@ -74,7 +74,7 @@ ASN1_SEQUENCE(X509_CINF) = {
 | 
			
		||||
	ASN1_IMP_OPT(X509_CINF, issuerUID, ASN1_BIT_STRING, 1),
 | 
			
		||||
	ASN1_IMP_OPT(X509_CINF, subjectUID, ASN1_BIT_STRING, 2),
 | 
			
		||||
	ASN1_EXP_SEQUENCE_OF_OPT(X509_CINF, extensions, X509_EXTENSION, 3)
 | 
			
		||||
} ASN1_SEQUENCE_END(X509_CINF)
 | 
			
		||||
} ASN1_SEQUENCE_END_enc(X509_CINF, X509_CINF)
 | 
			
		||||
 | 
			
		||||
IMPLEMENT_ASN1_FUNCTIONS(X509_CINF)
 | 
			
		||||
/* X509 top level structure needs a bit of customisation */
 | 
			
		||||
 
 | 
			
		||||
@@ -659,7 +659,14 @@ again:
 | 
			
		||||
#ifdef SO_REUSEADDR
 | 
			
		||||
		err_num=get_last_socket_error();
 | 
			
		||||
		if ((bind_mode == BIO_BIND_REUSEADDR_IF_UNUSED) &&
 | 
			
		||||
#ifdef OPENSSL_SYS_WINDOWS
 | 
			
		||||
			/* Some versions of Windows define EADDRINUSE to
 | 
			
		||||
			 * a dummy value.
 | 
			
		||||
			 */
 | 
			
		||||
			(err_num == WSAEADDRINUSE))
 | 
			
		||||
#else
 | 
			
		||||
			(err_num == EADDRINUSE))
 | 
			
		||||
#endif
 | 
			
		||||
			{
 | 
			
		||||
			memcpy((char *)&client,(char *)&server,sizeof(server));
 | 
			
		||||
			if (strcmp(h,"*") == 0)
 | 
			
		||||
 
 | 
			
		||||
@@ -209,7 +209,7 @@ start:
 | 
			
		||||
	/* add to buffer and return */
 | 
			
		||||
	if (i >= inl)
 | 
			
		||||
		{
 | 
			
		||||
		memcpy(&(ctx->obuf[ctx->obuf_len]),in,inl);
 | 
			
		||||
		memcpy(&(ctx->obuf[ctx->obuf_off+ctx->obuf_len]),in,inl);
 | 
			
		||||
		ctx->obuf_len+=inl;
 | 
			
		||||
		return(num+inl);
 | 
			
		||||
		}
 | 
			
		||||
@@ -219,7 +219,7 @@ start:
 | 
			
		||||
		{
 | 
			
		||||
		if (i > 0) /* lets fill it up if we can */
 | 
			
		||||
			{
 | 
			
		||||
			memcpy(&(ctx->obuf[ctx->obuf_len]),in,i);
 | 
			
		||||
			memcpy(&(ctx->obuf[ctx->obuf_off+ctx->obuf_len]),in,i);
 | 
			
		||||
			in+=i;
 | 
			
		||||
			inl-=i;
 | 
			
		||||
			num+=i;
 | 
			
		||||
@@ -294,9 +294,9 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
	case BIO_C_GET_BUFF_NUM_LINES:
 | 
			
		||||
		ret=0;
 | 
			
		||||
		p1=ctx->ibuf;
 | 
			
		||||
		for (i=ctx->ibuf_off; i<ctx->ibuf_len; i++)
 | 
			
		||||
		for (i=0; i<ctx->ibuf_len; i++)
 | 
			
		||||
			{
 | 
			
		||||
			if (p1[i] == '\n') ret++;
 | 
			
		||||
			if (p1[ctx->ibuf_off + i] == '\n') ret++;
 | 
			
		||||
			}
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_CTRL_WPENDING:
 | 
			
		||||
@@ -399,17 +399,18 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
		for (;;)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_clear_retry_flags(b);
 | 
			
		||||
			if (ctx->obuf_len > ctx->obuf_off)
 | 
			
		||||
			if (ctx->obuf_len > 0)
 | 
			
		||||
				{
 | 
			
		||||
				r=BIO_write(b->next_bio,
 | 
			
		||||
					&(ctx->obuf[ctx->obuf_off]),
 | 
			
		||||
					ctx->obuf_len-ctx->obuf_off);
 | 
			
		||||
					ctx->obuf_len);
 | 
			
		||||
#if 0
 | 
			
		||||
fprintf(stderr,"FLUSH [%3d] %3d -> %3d\n",ctx->obuf_off,ctx->obuf_len-ctx->obuf_off,r);
 | 
			
		||||
fprintf(stderr,"FLUSH [%3d] %3d -> %3d\n",ctx->obuf_off,ctx->obuf_len,r);
 | 
			
		||||
#endif
 | 
			
		||||
				BIO_copy_next_retry(b);
 | 
			
		||||
				if (r <= 0) return((long)r);
 | 
			
		||||
				ctx->obuf_off+=r;
 | 
			
		||||
				ctx->obuf_len-=r;
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				{
 | 
			
		||||
 
 | 
			
		||||
@@ -125,7 +125,6 @@ static int nbiof_free(BIO *a)
 | 
			
		||||
	
 | 
			
		||||
static int nbiof_read(BIO *b, char *out, int outl)
 | 
			
		||||
	{
 | 
			
		||||
	NBIO_TEST *nt;
 | 
			
		||||
	int ret=0;
 | 
			
		||||
#if 1
 | 
			
		||||
	int num;
 | 
			
		||||
@@ -134,7 +133,6 @@ static int nbiof_read(BIO *b, char *out, int outl)
 | 
			
		||||
 | 
			
		||||
	if (out == NULL) return(0);
 | 
			
		||||
	if (b->next_bio == NULL) return(0);
 | 
			
		||||
	nt=(NBIO_TEST *)b->ptr;
 | 
			
		||||
 | 
			
		||||
	BIO_clear_retry_flags(b);
 | 
			
		||||
#if 1
 | 
			
		||||
 
 | 
			
		||||
@@ -321,6 +321,15 @@ DECLARE_STACK_OF(BIO)
 | 
			
		||||
 | 
			
		||||
typedef struct bio_f_buffer_ctx_struct
 | 
			
		||||
	{
 | 
			
		||||
	/* Buffers are setup like this:
 | 
			
		||||
	 *
 | 
			
		||||
	 * <---------------------- size ----------------------->
 | 
			
		||||
	 * +---------------------------------------------------+
 | 
			
		||||
	 * | consumed | remaining          | free space        |
 | 
			
		||||
	 * +---------------------------------------------------+
 | 
			
		||||
	 * <-- off --><------- len ------->
 | 
			
		||||
	 */
 | 
			
		||||
 | 
			
		||||
	/* BIO *bio; */ /* this is now in the BIO struct */
 | 
			
		||||
	int ibuf_size;	/* how big is the input buffer */
 | 
			
		||||
	int obuf_size;	/* how big is the output buffer */
 | 
			
		||||
 
 | 
			
		||||
@@ -110,7 +110,7 @@ int BIO_set(BIO *bio, BIO_METHOD *method)
 | 
			
		||||
 | 
			
		||||
int BIO_free(BIO *a)
 | 
			
		||||
	{
 | 
			
		||||
	int ret=0,i;
 | 
			
		||||
	int i;
 | 
			
		||||
 | 
			
		||||
	if (a == NULL) return(0);
 | 
			
		||||
 | 
			
		||||
@@ -133,7 +133,7 @@ int BIO_free(BIO *a)
 | 
			
		||||
	CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data);
 | 
			
		||||
 | 
			
		||||
	if ((a->method == NULL) || (a->method->destroy == NULL)) return(1);
 | 
			
		||||
	ret=a->method->destroy(a);
 | 
			
		||||
	a->method->destroy(a);
 | 
			
		||||
	OPENSSL_free(a);
 | 
			
		||||
	return(1);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -340,7 +340,6 @@ static int acpt_write(BIO *b, const char *in, int inl)
 | 
			
		||||
 | 
			
		||||
static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
	{
 | 
			
		||||
	BIO *dbio;
 | 
			
		||||
	int *ip;
 | 
			
		||||
	long ret=1;
 | 
			
		||||
	BIO_ACCEPT *data;
 | 
			
		||||
@@ -437,8 +436,8 @@ static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
		ret=(long)data->bind_mode;
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_CTRL_DUP:
 | 
			
		||||
		dbio=(BIO *)ptr;
 | 
			
		||||
/*		if (data->param_port) EAY EAY
 | 
			
		||||
/*		dbio=(BIO *)ptr;
 | 
			
		||||
		if (data->param_port) EAY EAY
 | 
			
		||||
			BIO_set_port(dbio,data->param_port);
 | 
			
		||||
		if (data->param_hostname)
 | 
			
		||||
			BIO_set_hostname(dbio,data->param_hostname);
 | 
			
		||||
 
 | 
			
		||||
@@ -57,7 +57,6 @@
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_DGRAM
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
@@ -65,6 +64,7 @@
 | 
			
		||||
#include "cryptlib.h"
 | 
			
		||||
 | 
			
		||||
#include <openssl/bio.h>
 | 
			
		||||
#ifndef OPENSSL_NO_DGRAM
 | 
			
		||||
 | 
			
		||||
#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS)
 | 
			
		||||
#include <sys/timeb.h>
 | 
			
		||||
@@ -288,7 +288,6 @@ static int dgram_read(BIO *b, char *out, int outl)
 | 
			
		||||
		 */
 | 
			
		||||
		dgram_adjust_rcv_timeout(b);
 | 
			
		||||
		ret=recvfrom(b->num,out,outl,0,&peer,(void *)&peerlen);
 | 
			
		||||
		dgram_reset_rcv_timeout(b);
 | 
			
		||||
 | 
			
		||||
		if ( ! data->connected  && ret >= 0)
 | 
			
		||||
			BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, &peer);
 | 
			
		||||
@@ -302,6 +301,8 @@ static int dgram_read(BIO *b, char *out, int outl)
 | 
			
		||||
				data->_errno = get_last_socket_error();
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		dgram_reset_rcv_timeout(b);
 | 
			
		||||
		}
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
@@ -654,9 +655,13 @@ static int BIO_dgram_should_retry(int i)
 | 
			
		||||
		{
 | 
			
		||||
		err=get_last_socket_error();
 | 
			
		||||
 | 
			
		||||
#if defined(OPENSSL_SYS_WINDOWS) && 0 /* more microsoft stupidity? perhaps not? Ben 4/1/99 */
 | 
			
		||||
		if ((i == -1) && (err == 0))
 | 
			
		||||
			return(1);
 | 
			
		||||
#if defined(OPENSSL_SYS_WINDOWS)
 | 
			
		||||
	/* If the socket return value (i) is -1
 | 
			
		||||
	 * and err is unexpectedly 0 at this point,
 | 
			
		||||
	 * the error code was overwritten by
 | 
			
		||||
	 * another system call before this error
 | 
			
		||||
	 * handling is called.
 | 
			
		||||
	 */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		return(BIO_dgram_non_fatal_error(err));
 | 
			
		||||
@@ -719,7 +724,6 @@ int BIO_dgram_non_fatal_error(int err)
 | 
			
		||||
		}
 | 
			
		||||
	return(0);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static void get_current_time(struct timeval *t)
 | 
			
		||||
	{
 | 
			
		||||
@@ -737,3 +741,5 @@ static void get_current_time(struct timeval *t)
 | 
			
		||||
	gettimeofday(t, NULL);
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -172,15 +172,6 @@ static long sock_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
 | 
			
		||||
	switch (cmd)
 | 
			
		||||
		{
 | 
			
		||||
	case BIO_CTRL_RESET:
 | 
			
		||||
		num=0;
 | 
			
		||||
	case BIO_C_FILE_SEEK:
 | 
			
		||||
		ret=0;
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_C_FILE_TELL:
 | 
			
		||||
	case BIO_CTRL_INFO:
 | 
			
		||||
		ret=0;
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_C_SET_FD:
 | 
			
		||||
		sock_free(b);
 | 
			
		||||
		b->num= *((int *)ptr);
 | 
			
		||||
@@ -203,10 +194,6 @@ static long sock_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
	case BIO_CTRL_SET_CLOSE:
 | 
			
		||||
		b->shutdown=(int)num;
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_CTRL_PENDING:
 | 
			
		||||
	case BIO_CTRL_WPENDING:
 | 
			
		||||
		ret=0;
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_CTRL_DUP:
 | 
			
		||||
	case BIO_CTRL_FLUSH:
 | 
			
		||||
		ret=1;
 | 
			
		||||
 
 | 
			
		||||
@@ -539,8 +539,10 @@ $sbit=$num;
 | 
			
		||||
	&jle	(&label("sqradd"));
 | 
			
		||||
 | 
			
		||||
	&mov	($carry,"edx");
 | 
			
		||||
	&lea	("edx",&DWP(0,$sbit,"edx",2));
 | 
			
		||||
	&add	("edx","edx");
 | 
			
		||||
	&shr	($carry,31);
 | 
			
		||||
	&add	("edx",$sbit);
 | 
			
		||||
	&adc	($carry,0);
 | 
			
		||||
&set_label("sqrlast");
 | 
			
		||||
	&mov	($word,$_n0);
 | 
			
		||||
	&mov	($inp,$_np);
 | 
			
		||||
 
 | 
			
		||||
@@ -1039,7 +1039,7 @@ sub data {
 | 
			
		||||
	addze	r11,r0
 | 
			
		||||
					#mul_add_c(a[3],b[2],c3,c1,c2);
 | 
			
		||||
	$LD	r6,`3*$BNSZ`(r4)
 | 
			
		||||
	$LD	r7,`2*$BNSZ`(r4)
 | 
			
		||||
	$LD	r7,`2*$BNSZ`(r5)
 | 
			
		||||
	$UMULL	r8,r6,r7
 | 
			
		||||
	$UMULH	r9,r6,r7
 | 
			
		||||
	addc	r12,r8,r12
 | 
			
		||||
 
 | 
			
		||||
@@ -123,7 +123,7 @@ struct bn_blinding_st
 | 
			
		||||
	BIGNUM *mod; /* just a reference */
 | 
			
		||||
	unsigned long thread_id; /* added in OpenSSL 0.9.6j and 0.9.7b;
 | 
			
		||||
				  * used only by crypto/rsa/rsa_eay.c, rsa_lib.c */
 | 
			
		||||
	unsigned int  counter;
 | 
			
		||||
	int counter;
 | 
			
		||||
	unsigned long flags;
 | 
			
		||||
	BN_MONT_CTX *m_ctx;
 | 
			
		||||
	int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
 | 
			
		||||
@@ -157,7 +157,10 @@ BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, /* const */ BIGN
 | 
			
		||||
	if (BN_get_flags(mod, BN_FLG_CONSTTIME) != 0)
 | 
			
		||||
		BN_set_flags(ret->mod, BN_FLG_CONSTTIME);
 | 
			
		||||
 | 
			
		||||
	ret->counter = BN_BLINDING_COUNTER;
 | 
			
		||||
	/* Set the counter to the special value -1
 | 
			
		||||
	 * to indicate that this is never-used fresh blinding
 | 
			
		||||
	 * that does not need updating before first use. */
 | 
			
		||||
	ret->counter = -1;
 | 
			
		||||
	return(ret);
 | 
			
		||||
err:
 | 
			
		||||
	if (ret != NULL) BN_BLINDING_free(ret);
 | 
			
		||||
@@ -186,7 +189,10 @@ int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx)
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (--(b->counter) == 0 && b->e != NULL &&
 | 
			
		||||
	if (b->counter == -1)
 | 
			
		||||
		b->counter = 0;
 | 
			
		||||
 | 
			
		||||
	if (++b->counter == BN_BLINDING_COUNTER && b->e != NULL &&
 | 
			
		||||
		!(b->flags & BN_BLINDING_NO_RECREATE))
 | 
			
		||||
		{
 | 
			
		||||
		/* re-create blinding parameters */
 | 
			
		||||
@@ -201,8 +207,8 @@ int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx)
 | 
			
		||||
 | 
			
		||||
	ret=1;
 | 
			
		||||
err:
 | 
			
		||||
	if (b->counter == 0)
 | 
			
		||||
		b->counter = BN_BLINDING_COUNTER;
 | 
			
		||||
	if (b->counter == BN_BLINDING_COUNTER)
 | 
			
		||||
		b->counter = 0;
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -223,6 +229,12 @@ int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx)
 | 
			
		||||
		return(0);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (b->counter == -1)
 | 
			
		||||
		/* Fresh blinding, doesn't need updating. */
 | 
			
		||||
		b->counter = 0;
 | 
			
		||||
	else if (!BN_BLINDING_update(b,ctx))
 | 
			
		||||
		return(0);
 | 
			
		||||
 | 
			
		||||
	if (r != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		if (!BN_copy(r, b->Ai)) ret=0;
 | 
			
		||||
@@ -243,22 +255,19 @@ int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *ct
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
	bn_check_top(n);
 | 
			
		||||
	if ((b->A == NULL) || (b->Ai == NULL))
 | 
			
		||||
		{
 | 
			
		||||
		BNerr(BN_F_BN_BLINDING_INVERT_EX,BN_R_NOT_INITIALIZED);
 | 
			
		||||
		return(0);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (r != NULL)
 | 
			
		||||
		ret = BN_mod_mul(n, n, r, b->mod, ctx);
 | 
			
		||||
	else
 | 
			
		||||
		ret = BN_mod_mul(n, n, b->Ai, b->mod, ctx);
 | 
			
		||||
 | 
			
		||||
	if (ret >= 0)
 | 
			
		||||
		{
 | 
			
		||||
		if (!BN_BLINDING_update(b,ctx))
 | 
			
		||||
		if (b->Ai == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			BNerr(BN_F_BN_BLINDING_INVERT_EX,BN_R_NOT_INITIALIZED);
 | 
			
		||||
			return(0);
 | 
			
		||||
			}
 | 
			
		||||
		ret = BN_mod_mul(n, n, b->Ai, b->mod, ctx);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	bn_check_top(n);
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -301,7 +301,8 @@ int BN_mod_exp2_mont(BIGNUM *rr, const BIGNUM *a1, const BIGNUM *p1,
 | 
			
		||||
			r_is_one = 0;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	BN_from_montgomery(rr,r,mont,ctx);
 | 
			
		||||
	if (!BN_from_montgomery(rr,r,mont,ctx))
 | 
			
		||||
		goto err;
 | 
			
		||||
	ret=1;
 | 
			
		||||
err:
 | 
			
		||||
	if ((in_mont == NULL) && (mont != NULL)) BN_MONT_CTX_free(mont);
 | 
			
		||||
 
 | 
			
		||||
@@ -607,6 +607,7 @@ int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
 | 
			
		||||
		{
 | 
			
		||||
		while (!BN_is_odd(u))
 | 
			
		||||
			{
 | 
			
		||||
			if (BN_is_zero(u)) goto err;
 | 
			
		||||
			if (!BN_rshift1(u, u)) goto err;
 | 
			
		||||
			if (BN_is_odd(b))
 | 
			
		||||
				{
 | 
			
		||||
 
 | 
			
		||||
@@ -551,7 +551,7 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
 | 
			
		||||
	     int tna, int tnb, BN_ULONG *t)
 | 
			
		||||
	{
 | 
			
		||||
	int i,j,n2=n*2;
 | 
			
		||||
	int c1,c2,neg,zero;
 | 
			
		||||
	int c1,c2,neg;
 | 
			
		||||
	BN_ULONG ln,lo,*p;
 | 
			
		||||
 | 
			
		||||
# ifdef BN_COUNT
 | 
			
		||||
@@ -567,7 +567,7 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
 | 
			
		||||
	/* r=(a[0]-a[1])*(b[1]-b[0]) */
 | 
			
		||||
	c1=bn_cmp_part_words(a,&(a[n]),tna,n-tna);
 | 
			
		||||
	c2=bn_cmp_part_words(&(b[n]),b,tnb,tnb-n);
 | 
			
		||||
	zero=neg=0;
 | 
			
		||||
	neg=0;
 | 
			
		||||
	switch (c1*3+c2)
 | 
			
		||||
		{
 | 
			
		||||
	case -4:
 | 
			
		||||
@@ -575,7 +575,6 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
 | 
			
		||||
		bn_sub_part_words(&(t[n]),b,      &(b[n]),tnb,n-tnb); /* - */
 | 
			
		||||
		break;
 | 
			
		||||
	case -3:
 | 
			
		||||
		zero=1;
 | 
			
		||||
		/* break; */
 | 
			
		||||
	case -2:
 | 
			
		||||
		bn_sub_part_words(t,      &(a[n]),a,      tna,tna-n); /* - */
 | 
			
		||||
@@ -585,7 +584,6 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
 | 
			
		||||
	case -1:
 | 
			
		||||
	case 0:
 | 
			
		||||
	case 1:
 | 
			
		||||
		zero=1;
 | 
			
		||||
		/* break; */
 | 
			
		||||
	case 2:
 | 
			
		||||
		bn_sub_part_words(t,      a,      &(a[n]),tna,n-tna); /* + */
 | 
			
		||||
@@ -593,7 +591,6 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
 | 
			
		||||
		neg=1;
 | 
			
		||||
		break;
 | 
			
		||||
	case 3:
 | 
			
		||||
		zero=1;
 | 
			
		||||
		/* break; */
 | 
			
		||||
	case 4:
 | 
			
		||||
		bn_sub_part_words(t,      a,      &(a[n]),tna,n-tna);
 | 
			
		||||
@@ -1012,7 +1009,6 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
 | 
			
		||||
		{
 | 
			
		||||
		if (i >= -1 && i <= 1)
 | 
			
		||||
			{
 | 
			
		||||
			int sav_j =0;
 | 
			
		||||
			/* Find out the power of two lower or equal
 | 
			
		||||
			   to the longest of the two numbers */
 | 
			
		||||
			if (i >= 0)
 | 
			
		||||
@@ -1023,7 +1019,6 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
 | 
			
		||||
				{
 | 
			
		||||
				j = BN_num_bits_word((BN_ULONG)bl);
 | 
			
		||||
				}
 | 
			
		||||
			sav_j = j;
 | 
			
		||||
			j = 1<<(j-1);
 | 
			
		||||
			assert(j <= al || j <= bl);
 | 
			
		||||
			k = j+j;
 | 
			
		||||
 
 | 
			
		||||
@@ -130,8 +130,8 @@ ASN1_NDEF_SEQUENCE(CMS_SignedData) = {
 | 
			
		||||
} ASN1_NDEF_SEQUENCE_END(CMS_SignedData)
 | 
			
		||||
 | 
			
		||||
ASN1_SEQUENCE(CMS_OriginatorInfo) = {
 | 
			
		||||
	ASN1_IMP_SET_OF_OPT(CMS_SignedData, certificates, CMS_CertificateChoices, 0),
 | 
			
		||||
	ASN1_IMP_SET_OF_OPT(CMS_SignedData, crls, CMS_RevocationInfoChoice, 1)
 | 
			
		||||
	ASN1_IMP_SET_OF_OPT(CMS_OriginatorInfo, certificates, CMS_CertificateChoices, 0),
 | 
			
		||||
	ASN1_IMP_SET_OF_OPT(CMS_OriginatorInfo, crls, CMS_RevocationInfoChoice, 1)
 | 
			
		||||
} ASN1_SEQUENCE_END(CMS_OriginatorInfo)
 | 
			
		||||
 | 
			
		||||
ASN1_NDEF_SEQUENCE(CMS_EncryptedContentInfo) = {
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@ static int rle_expand_block(COMP_CTX *ctx, unsigned char *out,
 | 
			
		||||
	{
 | 
			
		||||
	int i;
 | 
			
		||||
 | 
			
		||||
	if (olen < (ilen-1))
 | 
			
		||||
	if (ilen == 0 || olen < (ilen-1))
 | 
			
		||||
		{
 | 
			
		||||
		/* ZZZZZZZZZZZZZZZZZZZZZZ */
 | 
			
		||||
		return(-1);
 | 
			
		||||
@@ -59,4 +59,3 @@ static int rle_expand_block(COMP_CTX *ctx, unsigned char *out,
 | 
			
		||||
		}
 | 
			
		||||
	return(ilen-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -64,6 +64,7 @@
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <openssl/conf.h>
 | 
			
		||||
#include <openssl/conf_api.h>
 | 
			
		||||
 
 | 
			
		||||
@@ -213,13 +213,14 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
 | 
			
		||||
	int bufnum=0,i,ii;
 | 
			
		||||
	BUF_MEM *buff=NULL;
 | 
			
		||||
	char *s,*p,*end;
 | 
			
		||||
	int again,n;
 | 
			
		||||
	int again;
 | 
			
		||||
	long eline=0;
 | 
			
		||||
	char btmp[DECIMAL_SIZE(eline)+1];
 | 
			
		||||
	CONF_VALUE *v=NULL,*tv;
 | 
			
		||||
	CONF_VALUE *sv=NULL;
 | 
			
		||||
	char *section=NULL,*buf;
 | 
			
		||||
	STACK_OF(CONF_VALUE) *section_sk=NULL,*ts;
 | 
			
		||||
/*	STACK_OF(CONF_VALUE) *section_sk=NULL;*/
 | 
			
		||||
/*	STACK_OF(CONF_VALUE) *ts=NULL;*/
 | 
			
		||||
	char *start,*psection,*pname;
 | 
			
		||||
	void *h = (void *)(conf->data);
 | 
			
		||||
 | 
			
		||||
@@ -250,7 +251,7 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
 | 
			
		||||
					CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
	section_sk=(STACK_OF(CONF_VALUE) *)sv->value;
 | 
			
		||||
/*	section_sk=(STACK_OF(CONF_VALUE) *)sv->value;*/
 | 
			
		||||
 | 
			
		||||
	bufnum=0;
 | 
			
		||||
	again=0;
 | 
			
		||||
@@ -309,7 +310,6 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
 | 
			
		||||
		buf=buff->data;
 | 
			
		||||
 | 
			
		||||
		clear_comments(conf, buf);
 | 
			
		||||
		n=strlen(buf);
 | 
			
		||||
		s=eat_ws(conf, buf);
 | 
			
		||||
		if (IS_EOF(conf,*s)) continue; /* blank line */
 | 
			
		||||
		if (*s == '[')
 | 
			
		||||
@@ -343,7 +343,7 @@ again:
 | 
			
		||||
					CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
 | 
			
		||||
				goto err;
 | 
			
		||||
				}
 | 
			
		||||
			section_sk=(STACK_OF(CONF_VALUE) *)sv->value;
 | 
			
		||||
/*			section_sk=(STACK_OF(CONF_VALUE) *)sv->value;*/
 | 
			
		||||
			continue;
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
@@ -406,12 +406,12 @@ again:
 | 
			
		||||
					   CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
 | 
			
		||||
					goto err;
 | 
			
		||||
					}
 | 
			
		||||
				ts=(STACK_OF(CONF_VALUE) *)tv->value;
 | 
			
		||||
/*				ts=(STACK_OF(CONF_VALUE) *)tv->value;*/
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				{
 | 
			
		||||
				tv=sv;
 | 
			
		||||
				ts=section_sk;
 | 
			
		||||
/*				ts=section_sk;*/
 | 
			
		||||
				}
 | 
			
		||||
#if 1
 | 
			
		||||
			if (_CONF_add_string(conf, tv, v) == 0)
 | 
			
		||||
@@ -465,9 +465,6 @@ err:
 | 
			
		||||
 | 
			
		||||
static void clear_comments(CONF *conf, char *p)
 | 
			
		||||
	{
 | 
			
		||||
	char *to;
 | 
			
		||||
 | 
			
		||||
	to=p;
 | 
			
		||||
	for (;;)
 | 
			
		||||
		{
 | 
			
		||||
		if (IS_FCOMMENT(conf,*p))
 | 
			
		||||
 
 | 
			
		||||
@@ -396,7 +396,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
 | 
			
		||||
	case DLL_THREAD_ATTACH:
 | 
			
		||||
		break;
 | 
			
		||||
	case DLL_THREAD_DETACH:
 | 
			
		||||
		ERR_remove_state(0);
 | 
			
		||||
		break;
 | 
			
		||||
	case DLL_PROCESS_DETACH:
 | 
			
		||||
		break;
 | 
			
		||||
 
 | 
			
		||||
@@ -1026,7 +1026,7 @@ $     IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
 | 
			
		||||
	 THEN CC = "CC/DECC"
 | 
			
		||||
$     CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + -
 | 
			
		||||
           "/NOLIST/PREFIX=ALL" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[],SYS$DISK:[.''ARCH'],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS],SYS$DISK:[.EVP])" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[],SYS$DISK:[._''ARCH'],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS],SYS$DISK:[.EVP])" + -
 | 
			
		||||
	   CCEXTRAFLAGS
 | 
			
		||||
$!
 | 
			
		||||
$!    Define The Linker Options File Name.
 | 
			
		||||
@@ -1060,7 +1060,7 @@ $	EXIT
 | 
			
		||||
$     ENDIF
 | 
			
		||||
$     IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC"
 | 
			
		||||
$     CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[],SYS$DISK:[.''ARCH'],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS])" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[],SYS$DISK:[._''ARCH'],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS])" + -
 | 
			
		||||
	   CCEXTRAFLAGS
 | 
			
		||||
$     CCDEFS = """VAXC""," + CCDEFS
 | 
			
		||||
$!
 | 
			
		||||
@@ -1092,7 +1092,7 @@ $!
 | 
			
		||||
$!    Use GNU C...
 | 
			
		||||
$!
 | 
			
		||||
$     CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[],SYS$DISK:[.''ARCH'],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS])" + -
 | 
			
		||||
	   "/INCLUDE=(SYS$DISK:[],SYS$DISK:[._''ARCH'],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS])" + -
 | 
			
		||||
	   CCEXTRAFLAGS
 | 
			
		||||
$!
 | 
			
		||||
$!    Define The Linker Options File Name.
 | 
			
		||||
 
 | 
			
		||||
@@ -588,15 +588,15 @@ int OPENSSL_isservice(void);
 | 
			
		||||
 | 
			
		||||
#endif /* def OPENSSL_FIPS */
 | 
			
		||||
 | 
			
		||||
#define OPENSSL_HAVE_INIT	1
 | 
			
		||||
void OPENSSL_init(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.
 | 
			
		||||
 */
 | 
			
		||||
void ERR_load_CRYPTO_strings(void);
 | 
			
		||||
 | 
			
		||||
#define OPENSSL_HAVE_INIT	1
 | 
			
		||||
void OPENSSL_init(void);
 | 
			
		||||
 | 
			
		||||
/* Error codes for the CRYPTO functions. */
 | 
			
		||||
 | 
			
		||||
/* Function codes. */
 | 
			
		||||
 
 | 
			
		||||
@@ -122,10 +122,10 @@ struct desparams {
 | 
			
		||||
/*
 | 
			
		||||
 * Encrypt an arbitrary sized buffer
 | 
			
		||||
 */
 | 
			
		||||
#define	DESIOCBLOCK	_IOWR(d, 6, struct desparams)
 | 
			
		||||
#define	DESIOCBLOCK	_IOWR('d', 6, struct desparams)
 | 
			
		||||
 | 
			
		||||
/* 
 | 
			
		||||
 * Encrypt of small amount of data, quickly
 | 
			
		||||
 */
 | 
			
		||||
#define DESIOCQUICK	_IOWR(d, 7, struct desparams) 
 | 
			
		||||
#define DESIOCQUICK	_IOWR('d', 7, struct desparams) 
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -110,7 +110,7 @@ static int dsa_builtin_paramgen(DSA *ret, int bits,
 | 
			
		||||
	BIGNUM *r0,*W,*X,*c,*test;
 | 
			
		||||
	BIGNUM *g=NULL,*q=NULL,*p=NULL;
 | 
			
		||||
	BN_MONT_CTX *mont=NULL;
 | 
			
		||||
	int k,n=0,i,b,m=0;
 | 
			
		||||
	int k,n=0,i,m=0;
 | 
			
		||||
	int counter=0;
 | 
			
		||||
	int r=0;
 | 
			
		||||
	BN_CTX *ctx=NULL;
 | 
			
		||||
@@ -211,7 +211,6 @@ static int dsa_builtin_paramgen(DSA *ret, int bits,
 | 
			
		||||
		/* "offset = 2" */
 | 
			
		||||
 | 
			
		||||
		n=(bits-1)/160;
 | 
			
		||||
		b=(bits-1)-n*160;
 | 
			
		||||
 | 
			
		||||
		for (;;)
 | 
			
		||||
			{
 | 
			
		||||
 
 | 
			
		||||
@@ -178,7 +178,8 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
 | 
			
		||||
	if (!BN_mod_mul(&xr,dsa->priv_key,r,dsa->q,ctx)) goto err;/* s = xr */
 | 
			
		||||
	if (!BN_add(s, &xr, &m)) goto err;		/* s = m + xr */
 | 
			
		||||
	if (BN_cmp(s,dsa->q) > 0)
 | 
			
		||||
		BN_sub(s,s,dsa->q);
 | 
			
		||||
		if (!BN_sub(s,s,dsa->q))
 | 
			
		||||
			goto err;
 | 
			
		||||
	if (!BN_mod_mul(s,s,kinv,dsa->q,ctx)) goto err;
 | 
			
		||||
 | 
			
		||||
	ret=DSA_SIG_new();
 | 
			
		||||
 
 | 
			
		||||
@@ -318,6 +318,7 @@ int ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
	size_t i;
 | 
			
		||||
	EC_POINT *p=NULL;
 | 
			
		||||
	EC_POINT *acc = NULL;
 | 
			
		||||
 | 
			
		||||
	if (ctx == NULL)
 | 
			
		||||
		{
 | 
			
		||||
@@ -337,15 +338,16 @@ int ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if ((p = EC_POINT_new(group)) == NULL) goto err;
 | 
			
		||||
	if ((acc = EC_POINT_new(group)) == NULL) goto err;
 | 
			
		||||
 | 
			
		||||
	if (!EC_POINT_set_to_infinity(group, r)) goto err;
 | 
			
		||||
	if (!EC_POINT_set_to_infinity(group, acc)) goto err;
 | 
			
		||||
 | 
			
		||||
	if (scalar)
 | 
			
		||||
		{
 | 
			
		||||
		if (!ec_GF2m_montgomery_point_multiply(group, p, scalar, group->generator, ctx)) goto err;
 | 
			
		||||
		if (BN_is_negative(scalar)) 
 | 
			
		||||
		if (BN_is_negative(scalar))
 | 
			
		||||
			if (!group->meth->invert(group, p, ctx)) goto err;
 | 
			
		||||
		if (!group->meth->add(group, r, r, p, ctx)) goto err;
 | 
			
		||||
		if (!group->meth->add(group, acc, acc, p, ctx)) goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < num; i++)
 | 
			
		||||
@@ -353,13 +355,16 @@ int ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
 | 
			
		||||
		if (!ec_GF2m_montgomery_point_multiply(group, p, scalars[i], points[i], ctx)) goto err;
 | 
			
		||||
		if (BN_is_negative(scalars[i]))
 | 
			
		||||
			if (!group->meth->invert(group, p, ctx)) goto err;
 | 
			
		||||
		if (!group->meth->add(group, r, r, p, ctx)) goto err;
 | 
			
		||||
		if (!group->meth->add(group, acc, acc, p, ctx)) goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (!EC_POINT_copy(r, acc)) goto err;
 | 
			
		||||
 | 
			
		||||
	ret = 1;
 | 
			
		||||
 | 
			
		||||
  err:
 | 
			
		||||
	if (p) EC_POINT_free(p);
 | 
			
		||||
	if (acc) EC_POINT_free(acc);
 | 
			
		||||
	if (new_ctx != NULL)
 | 
			
		||||
		BN_CTX_free(new_ctx);
 | 
			
		||||
	return ret;
 | 
			
		||||
 
 | 
			
		||||
@@ -821,7 +821,7 @@ int ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_
 | 
			
		||||
	field_sqr = group->meth->field_sqr;	
 | 
			
		||||
 | 
			
		||||
	/* only support affine coordinates */
 | 
			
		||||
	if (!point->Z_is_one) goto err;
 | 
			
		||||
	if (!point->Z_is_one) return -1;
 | 
			
		||||
 | 
			
		||||
	if (ctx == NULL)
 | 
			
		||||
		{
 | 
			
		||||
@@ -871,6 +871,9 @@ int ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT
 | 
			
		||||
		{
 | 
			
		||||
		return EC_POINT_is_at_infinity(group, b) ? 0 : 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (EC_POINT_is_at_infinity(group, b))
 | 
			
		||||
		return 1;
 | 
			
		||||
	
 | 
			
		||||
	if (a->Z_is_one && b->Z_is_one)
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -304,7 +304,13 @@ int EC_KEY_check_key(const EC_KEY *eckey)
 | 
			
		||||
		ECerr(EC_F_EC_KEY_CHECK_KEY, ERR_R_PASSED_NULL_PARAMETER);
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	if (EC_POINT_is_at_infinity(eckey->group, eckey->pub_key))
 | 
			
		||||
		{
 | 
			
		||||
		ECerr(EC_F_EC_KEY_CHECK_KEY, EC_R_POINT_AT_INFINITY);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if ((ctx = BN_CTX_new()) == NULL)
 | 
			
		||||
		goto err;
 | 
			
		||||
	if ((point = EC_POINT_new(eckey->group)) == NULL)
 | 
			
		||||
 
 | 
			
		||||
@@ -169,11 +169,13 @@ static void ec_pre_comp_clear_free(void *pre_)
 | 
			
		||||
		EC_POINT **p;
 | 
			
		||||
 | 
			
		||||
		for (p = pre->points; *p != NULL; p++)
 | 
			
		||||
			{
 | 
			
		||||
			EC_POINT_clear_free(*p);
 | 
			
		||||
		OPENSSL_cleanse(pre->points, sizeof pre->points);
 | 
			
		||||
			OPENSSL_cleanse(p, sizeof *p);
 | 
			
		||||
			}
 | 
			
		||||
		OPENSSL_free(pre->points);
 | 
			
		||||
		}
 | 
			
		||||
	OPENSSL_cleanse(pre, sizeof pre);
 | 
			
		||||
	OPENSSL_cleanse(pre, sizeof *pre);
 | 
			
		||||
	OPENSSL_free(pre);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1406,6 +1406,9 @@ int ec_GFp_simple_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *
 | 
			
		||||
		{
 | 
			
		||||
		return EC_POINT_is_at_infinity(group, b) ? 0 : 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (EC_POINT_is_at_infinity(group, b))
 | 
			
		||||
		return 1;
 | 
			
		||||
	
 | 
			
		||||
	if (a->Z_is_one && b->Z_is_one)
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -96,7 +96,6 @@ const ECDH_METHOD *ECDH_get_default_method(void)
 | 
			
		||||
 | 
			
		||||
int ECDH_set_method(EC_KEY *eckey, const ECDH_METHOD *meth)
 | 
			
		||||
	{
 | 
			
		||||
	const ECDH_METHOD *mtmp;
 | 
			
		||||
	ECDH_DATA *ecdh;
 | 
			
		||||
 | 
			
		||||
	ecdh = ecdh_check(eckey);
 | 
			
		||||
@@ -104,11 +103,6 @@ int ECDH_set_method(EC_KEY *eckey, const ECDH_METHOD *meth)
 | 
			
		||||
	if (ecdh == NULL)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
        mtmp = ecdh->meth;
 | 
			
		||||
#if 0
 | 
			
		||||
        if (mtmp->finish)
 | 
			
		||||
		mtmp->finish(eckey);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	if (ecdh->engine)
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -168,10 +168,9 @@ int fbytes(unsigned char *buf, int num)
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
	fbytes_counter ++;
 | 
			
		||||
	ret = BN_bn2bin(tmp, buf);	
 | 
			
		||||
	if (ret == 0 || ret != num)
 | 
			
		||||
	if (num != BN_num_bytes(tmp) || !BN_bn2bin(tmp, buf))
 | 
			
		||||
		ret = 0;
 | 
			
		||||
	else
 | 
			
		||||
	else 
 | 
			
		||||
		ret = 1;
 | 
			
		||||
	if (tmp)
 | 
			
		||||
		BN_free(tmp);
 | 
			
		||||
@@ -287,9 +286,13 @@ int test_builtin(BIO *out)
 | 
			
		||||
	size_t		crv_len = 0, n = 0;
 | 
			
		||||
	EC_KEY		*eckey = NULL, *wrong_eckey = NULL;
 | 
			
		||||
	EC_GROUP	*group;
 | 
			
		||||
	ECDSA_SIG	*ecdsa_sig = NULL;
 | 
			
		||||
	unsigned char	digest[20], wrong_digest[20];
 | 
			
		||||
	unsigned char	*signature = NULL; 
 | 
			
		||||
	unsigned int	sig_len;
 | 
			
		||||
	unsigned char	*signature = NULL;
 | 
			
		||||
	const unsigned char	*sig_ptr;
 | 
			
		||||
	unsigned char	*sig_ptr2;
 | 
			
		||||
	unsigned char	*raw_buf = NULL;
 | 
			
		||||
	unsigned int	sig_len, degree, r_len, s_len, bn_len, buf_len;
 | 
			
		||||
	int		nid, ret =  0;
 | 
			
		||||
	
 | 
			
		||||
	/* fill digest values with some random data */
 | 
			
		||||
@@ -339,7 +342,8 @@ int test_builtin(BIO *out)
 | 
			
		||||
		if (EC_KEY_set_group(eckey, group) == 0)
 | 
			
		||||
			goto builtin_err;
 | 
			
		||||
		EC_GROUP_free(group);
 | 
			
		||||
		if (EC_GROUP_get_degree(EC_KEY_get0_group(eckey)) < 160)
 | 
			
		||||
		degree = EC_GROUP_get_degree(EC_KEY_get0_group(eckey));
 | 
			
		||||
		if (degree < 160)
 | 
			
		||||
			/* drop the curve */ 
 | 
			
		||||
			{
 | 
			
		||||
			EC_KEY_free(eckey);
 | 
			
		||||
@@ -415,26 +419,89 @@ int test_builtin(BIO *out)
 | 
			
		||||
			}
 | 
			
		||||
		BIO_printf(out, ".");
 | 
			
		||||
		(void)BIO_flush(out);
 | 
			
		||||
		/* modify a single byte of the signature */
 | 
			
		||||
		offset = signature[10] % sig_len;
 | 
			
		||||
		dirt   = signature[11];
 | 
			
		||||
		signature[offset] ^= dirt ? dirt : 1; 
 | 
			
		||||
		/* wrong length */
 | 
			
		||||
		if (ECDSA_verify(0, digest, 20, signature, sig_len - 1,
 | 
			
		||||
			eckey) == 1)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(out, " failed\n");
 | 
			
		||||
			goto builtin_err;
 | 
			
		||||
			}
 | 
			
		||||
		BIO_printf(out, ".");
 | 
			
		||||
		(void)BIO_flush(out);
 | 
			
		||||
 | 
			
		||||
		/* Modify a single byte of the signature: to ensure we don't
 | 
			
		||||
		 * garble the ASN1 structure, we read the raw signature and
 | 
			
		||||
		 * modify a byte in one of the bignums directly. */
 | 
			
		||||
		sig_ptr = signature;
 | 
			
		||||
		if ((ecdsa_sig = d2i_ECDSA_SIG(NULL, &sig_ptr, sig_len)) == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(out, " failed\n");
 | 
			
		||||
			goto builtin_err;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		/* Store the two BIGNUMs in raw_buf. */
 | 
			
		||||
		r_len = BN_num_bytes(ecdsa_sig->r);
 | 
			
		||||
		s_len = BN_num_bytes(ecdsa_sig->s);
 | 
			
		||||
		bn_len = (degree + 7) / 8;
 | 
			
		||||
		if ((r_len > bn_len) || (s_len > bn_len))
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(out, " failed\n");
 | 
			
		||||
			goto builtin_err;
 | 
			
		||||
			}
 | 
			
		||||
		buf_len = 2 * bn_len;
 | 
			
		||||
		if ((raw_buf = OPENSSL_malloc(buf_len)) == NULL)
 | 
			
		||||
			goto builtin_err;
 | 
			
		||||
		/* Pad the bignums with leading zeroes. */
 | 
			
		||||
		memset(raw_buf, 0, buf_len);
 | 
			
		||||
		BN_bn2bin(ecdsa_sig->r, raw_buf + bn_len - r_len);
 | 
			
		||||
		BN_bn2bin(ecdsa_sig->s, raw_buf + buf_len - s_len);
 | 
			
		||||
 | 
			
		||||
		/* Modify a single byte in the buffer. */
 | 
			
		||||
		offset = raw_buf[10] % buf_len;
 | 
			
		||||
		dirt   = raw_buf[11] ? raw_buf[11] : 1;
 | 
			
		||||
		raw_buf[offset] ^= dirt;
 | 
			
		||||
		/* Now read the BIGNUMs back in from raw_buf. */
 | 
			
		||||
		if ((BN_bin2bn(raw_buf, bn_len, ecdsa_sig->r) == NULL) ||
 | 
			
		||||
			(BN_bin2bn(raw_buf + bn_len, bn_len, ecdsa_sig->s) == NULL))
 | 
			
		||||
			goto builtin_err;
 | 
			
		||||
 | 
			
		||||
		sig_ptr2 = signature;
 | 
			
		||||
		sig_len = i2d_ECDSA_SIG(ecdsa_sig, &sig_ptr2);
 | 
			
		||||
		if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) == 1)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(out, " failed\n");
 | 
			
		||||
			goto builtin_err;
 | 
			
		||||
			}
 | 
			
		||||
		/* Sanity check: undo the modification and verify signature. */
 | 
			
		||||
		raw_buf[offset] ^= dirt;
 | 
			
		||||
		if ((BN_bin2bn(raw_buf, bn_len, ecdsa_sig->r) == NULL) ||
 | 
			
		||||
			(BN_bin2bn(raw_buf + bn_len, bn_len, ecdsa_sig->s) == NULL))
 | 
			
		||||
			goto builtin_err;
 | 
			
		||||
 | 
			
		||||
		sig_ptr2 = signature;
 | 
			
		||||
		sig_len = i2d_ECDSA_SIG(ecdsa_sig, &sig_ptr2);
 | 
			
		||||
		if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) != 1)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(out, " failed\n");
 | 
			
		||||
			goto builtin_err;
 | 
			
		||||
			}
 | 
			
		||||
		BIO_printf(out, ".");
 | 
			
		||||
		(void)BIO_flush(out);
 | 
			
		||||
		
 | 
			
		||||
		BIO_printf(out, " ok\n");
 | 
			
		||||
		/* cleanup */
 | 
			
		||||
		/* clean bogus errors */
 | 
			
		||||
		ERR_clear_error();
 | 
			
		||||
		OPENSSL_free(signature);
 | 
			
		||||
		signature = NULL;
 | 
			
		||||
		EC_KEY_free(eckey);
 | 
			
		||||
		eckey = NULL;
 | 
			
		||||
		EC_KEY_free(wrong_eckey);
 | 
			
		||||
		wrong_eckey = NULL;
 | 
			
		||||
		ECDSA_SIG_free(ecdsa_sig);
 | 
			
		||||
		ecdsa_sig = NULL;
 | 
			
		||||
		OPENSSL_free(raw_buf);
 | 
			
		||||
		raw_buf = NULL;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	ret = 1;	
 | 
			
		||||
@@ -443,8 +510,12 @@ builtin_err:
 | 
			
		||||
		EC_KEY_free(eckey);
 | 
			
		||||
	if (wrong_eckey)
 | 
			
		||||
		EC_KEY_free(wrong_eckey);
 | 
			
		||||
	if (ecdsa_sig)
 | 
			
		||||
		ECDSA_SIG_free(ecdsa_sig);
 | 
			
		||||
	if (signature)
 | 
			
		||||
		OPENSSL_free(signature);
 | 
			
		||||
	if (raw_buf)
 | 
			
		||||
		OPENSSL_free(raw_buf);
 | 
			
		||||
	if (curves)
 | 
			
		||||
		OPENSSL_free(curves);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -83,7 +83,6 @@ const ECDSA_METHOD *ECDSA_get_default_method(void)
 | 
			
		||||
 | 
			
		||||
int ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth)
 | 
			
		||||
{
 | 
			
		||||
        const ECDSA_METHOD *mtmp;
 | 
			
		||||
	ECDSA_DATA *ecdsa;
 | 
			
		||||
 | 
			
		||||
	ecdsa = ecdsa_check(eckey);
 | 
			
		||||
@@ -91,7 +90,6 @@ int ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth)
 | 
			
		||||
	if (ecdsa == NULL)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
        mtmp = ecdsa->meth;
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	if (ecdsa->engine)
 | 
			
		||||
	{
 | 
			
		||||
 
 | 
			
		||||
@@ -144,6 +144,14 @@ static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp,
 | 
			
		||||
			}
 | 
			
		||||
		while (BN_is_zero(k));
 | 
			
		||||
 | 
			
		||||
		/* We do not want timing information to leak the length of k,
 | 
			
		||||
		 * so we compute G*k using an equivalent scalar of fixed
 | 
			
		||||
		 * bit-length. */
 | 
			
		||||
 | 
			
		||||
		if (!BN_add(k, k, order)) goto err;
 | 
			
		||||
		if (BN_num_bits(k) <= BN_num_bits(order))
 | 
			
		||||
			if (!BN_add(k, k, order)) goto err;
 | 
			
		||||
 | 
			
		||||
		/* compute r the x-coordinate of generator * k */
 | 
			
		||||
		if (!EC_POINT_mul(group, tmp_point, k, NULL, NULL, ctx))
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -412,6 +412,7 @@ ENGINE *ENGINE_by_id(const char *id)
 | 
			
		||||
		return iterator;
 | 
			
		||||
		}
 | 
			
		||||
notfound:
 | 
			
		||||
	ENGINE_free(iterator);
 | 
			
		||||
	ENGINEerr(ENGINE_F_ENGINE_BY_ID,ENGINE_R_NO_SUCH_ENGINE);
 | 
			
		||||
	ERR_add_error_data(2, "id=", id);
 | 
			
		||||
	return NULL;
 | 
			
		||||
 
 | 
			
		||||
@@ -79,14 +79,20 @@ void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u),
 | 
			
		||||
		ERR_error_string_n(l, buf, sizeof buf);
 | 
			
		||||
		BIO_snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", es, buf,
 | 
			
		||||
			file, line, (flags & ERR_TXT_STRING) ? data : "");
 | 
			
		||||
		cb(buf2, strlen(buf2), u);
 | 
			
		||||
		if (cb(buf2, strlen(buf2), u) <= 0)
 | 
			
		||||
			break; /* abort outputting the error report */
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_FP_API
 | 
			
		||||
static int print_fp(const char *str, size_t len, void *fp)
 | 
			
		||||
	{
 | 
			
		||||
	return fwrite(str, 1, len, fp);
 | 
			
		||||
	BIO bio;
 | 
			
		||||
 | 
			
		||||
	BIO_set(&bio,BIO_s_file());
 | 
			
		||||
	BIO_set_fp(&bio,fp,BIO_NOCLOSE);
 | 
			
		||||
 | 
			
		||||
	return BIO_printf(&bio, "%s", str);
 | 
			
		||||
	}
 | 
			
		||||
void ERR_print_errors_fp(FILE *fp)
 | 
			
		||||
	{
 | 
			
		||||
 
 | 
			
		||||
@@ -64,7 +64,7 @@
 | 
			
		||||
 | 
			
		||||
static int b64_write(BIO *h, const char *buf, int num);
 | 
			
		||||
static int b64_read(BIO *h, char *buf, int size);
 | 
			
		||||
/*static int b64_puts(BIO *h, const char *str); */
 | 
			
		||||
static int b64_puts(BIO *h, const char *str);
 | 
			
		||||
/*static int b64_gets(BIO *h, char *str, int size); */
 | 
			
		||||
static long b64_ctrl(BIO *h, int cmd, long arg1, void *arg2);
 | 
			
		||||
static int b64_new(BIO *h);
 | 
			
		||||
@@ -96,7 +96,7 @@ static BIO_METHOD methods_b64=
 | 
			
		||||
	BIO_TYPE_BASE64,"base64 encoding",
 | 
			
		||||
	b64_write,
 | 
			
		||||
	b64_read,
 | 
			
		||||
	NULL, /* b64_puts, */
 | 
			
		||||
	b64_puts,
 | 
			
		||||
	NULL, /* b64_gets, */
 | 
			
		||||
	b64_ctrl,
 | 
			
		||||
	b64_new,
 | 
			
		||||
@@ -127,6 +127,7 @@ static int b64_new(BIO *bi)
 | 
			
		||||
	bi->init=1;
 | 
			
		||||
	bi->ptr=(char *)ctx;
 | 
			
		||||
	bi->flags=0;
 | 
			
		||||
	bi->num = 0;
 | 
			
		||||
	return(1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -151,6 +152,8 @@ static int b64_read(BIO *b, char *out, int outl)
 | 
			
		||||
 | 
			
		||||
	if ((ctx == NULL) || (b->next_bio == NULL)) return(0);
 | 
			
		||||
 | 
			
		||||
	BIO_clear_retry_flags(b);
 | 
			
		||||
 | 
			
		||||
	if (ctx->encode != B64_DECODE)
 | 
			
		||||
		{
 | 
			
		||||
		ctx->encode=B64_DECODE;
 | 
			
		||||
@@ -163,6 +166,7 @@ static int b64_read(BIO *b, char *out, int outl)
 | 
			
		||||
	/* First check if there are bytes decoded/encoded */
 | 
			
		||||
	if (ctx->buf_len > 0)
 | 
			
		||||
		{
 | 
			
		||||
		OPENSSL_assert(ctx->buf_len >= ctx->buf_off);
 | 
			
		||||
		i=ctx->buf_len-ctx->buf_off;
 | 
			
		||||
		if (i > outl) i=outl;
 | 
			
		||||
		OPENSSL_assert(ctx->buf_off+i < (int)sizeof(ctx->buf));
 | 
			
		||||
@@ -184,7 +188,6 @@ static int b64_read(BIO *b, char *out, int outl)
 | 
			
		||||
	ret_code=0;
 | 
			
		||||
	while (outl > 0)
 | 
			
		||||
		{
 | 
			
		||||
 | 
			
		||||
		if (ctx->cont <= 0)
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
@@ -195,7 +198,7 @@ static int b64_read(BIO *b, char *out, int outl)
 | 
			
		||||
			{
 | 
			
		||||
			ret_code=i;
 | 
			
		||||
 | 
			
		||||
			/* Should be continue next time we are called? */
 | 
			
		||||
			/* Should we continue next time we are called? */
 | 
			
		||||
			if (!BIO_should_retry(b->next_bio))
 | 
			
		||||
				{
 | 
			
		||||
				ctx->cont=i;
 | 
			
		||||
@@ -285,19 +288,27 @@ static int b64_read(BIO *b, char *out, int outl)
 | 
			
		||||
				continue;
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				ctx->tmp_len=0;
 | 
			
		||||
			}
 | 
			
		||||
		/* If buffer isn't full and we can retry then
 | 
			
		||||
		 * restart to read in more data.
 | 
			
		||||
		 */
 | 
			
		||||
		}
 | 
			
		||||
		else if ((i < B64_BLOCK_SIZE) && (ctx->cont > 0))
 | 
			
		||||
		{
 | 
			
		||||
			/* If buffer isn't full and we can retry then
 | 
			
		||||
			 * restart to read in more data.
 | 
			
		||||
			 */
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (BIO_get_flags(b) & BIO_FLAGS_BASE64_NO_NL)
 | 
			
		||||
			{
 | 
			
		||||
			int z,jj;
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
			jj=(i>>2)<<2;
 | 
			
		||||
#else
 | 
			
		||||
			jj = i & ~3; /* process per 4 */
 | 
			
		||||
#endif
 | 
			
		||||
			z=EVP_DecodeBlock((unsigned char *)ctx->buf,
 | 
			
		||||
				(unsigned char *)ctx->tmp,jj);
 | 
			
		||||
			if (jj > 2)
 | 
			
		||||
@@ -313,18 +324,15 @@ static int b64_read(BIO *b, char *out, int outl)
 | 
			
		||||
			 * number consumed */
 | 
			
		||||
			if (jj != i)
 | 
			
		||||
				{
 | 
			
		||||
				memcpy((unsigned char *)ctx->tmp,
 | 
			
		||||
					(unsigned char *)&(ctx->tmp[jj]),i-jj);
 | 
			
		||||
				memmove(ctx->tmp, &ctx->tmp[jj], i-jj);
 | 
			
		||||
				ctx->tmp_len=i-jj;
 | 
			
		||||
				}
 | 
			
		||||
			ctx->buf_len=0;
 | 
			
		||||
			if (z > 0)
 | 
			
		||||
				{
 | 
			
		||||
				ctx->buf_len=z;
 | 
			
		||||
				i=1;
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				i=z;
 | 
			
		||||
			i=z;
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
@@ -357,14 +365,16 @@ static int b64_read(BIO *b, char *out, int outl)
 | 
			
		||||
		outl-=i;
 | 
			
		||||
		out+=i;
 | 
			
		||||
		}
 | 
			
		||||
	BIO_clear_retry_flags(b);
 | 
			
		||||
	/* BIO_clear_retry_flags(b); */
 | 
			
		||||
	BIO_copy_next_retry(b);
 | 
			
		||||
	return((ret == 0)?ret_code:ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int b64_write(BIO *b, const char *in, int inl)
 | 
			
		||||
	{
 | 
			
		||||
	int ret=inl,n,i;
 | 
			
		||||
	int ret=0;
 | 
			
		||||
	int n;
 | 
			
		||||
	int i;
 | 
			
		||||
	BIO_B64_CTX *ctx;
 | 
			
		||||
 | 
			
		||||
	ctx=(BIO_B64_CTX *)b->ptr;
 | 
			
		||||
@@ -379,6 +389,9 @@ static int b64_write(BIO *b, const char *in, int inl)
 | 
			
		||||
		EVP_EncodeInit(&(ctx->base64));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	OPENSSL_assert(ctx->buf_off < (int)sizeof(ctx->buf));
 | 
			
		||||
	OPENSSL_assert(ctx->buf_len <= (int)sizeof(ctx->buf));
 | 
			
		||||
	OPENSSL_assert(ctx->buf_len >= ctx->buf_off);
 | 
			
		||||
	n=ctx->buf_len-ctx->buf_off;
 | 
			
		||||
	while (n > 0)
 | 
			
		||||
		{
 | 
			
		||||
@@ -388,7 +401,10 @@ static int b64_write(BIO *b, const char *in, int inl)
 | 
			
		||||
			BIO_copy_next_retry(b);
 | 
			
		||||
			return(i);
 | 
			
		||||
			}
 | 
			
		||||
		OPENSSL_assert(i <= n);
 | 
			
		||||
		ctx->buf_off+=i;
 | 
			
		||||
		OPENSSL_assert(ctx->buf_off <= (int)sizeof(ctx->buf));
 | 
			
		||||
		OPENSSL_assert(ctx->buf_len >= ctx->buf_off);
 | 
			
		||||
		n-=i;
 | 
			
		||||
		}
 | 
			
		||||
	/* at this point all pending data has been written */
 | 
			
		||||
@@ -405,18 +421,19 @@ static int b64_write(BIO *b, const char *in, int inl)
 | 
			
		||||
			{
 | 
			
		||||
			if (ctx->tmp_len > 0)
 | 
			
		||||
				{
 | 
			
		||||
				OPENSSL_assert(ctx->tmp_len <= 3);
 | 
			
		||||
				n=3-ctx->tmp_len;
 | 
			
		||||
				/* There's a teoretical possibility for this */
 | 
			
		||||
				/* There's a theoretical possibility for this */
 | 
			
		||||
				if (n > inl) 
 | 
			
		||||
					n=inl;
 | 
			
		||||
				memcpy(&(ctx->tmp[ctx->tmp_len]),in,n);
 | 
			
		||||
				ctx->tmp_len+=n;
 | 
			
		||||
				ret += n;
 | 
			
		||||
				if (ctx->tmp_len < 3)
 | 
			
		||||
					break;
 | 
			
		||||
				ctx->buf_len=EVP_EncodeBlock(
 | 
			
		||||
					(unsigned char *)ctx->buf,
 | 
			
		||||
					(unsigned char *)ctx->tmp,
 | 
			
		||||
					ctx->tmp_len);
 | 
			
		||||
				ctx->buf_len=EVP_EncodeBlock((unsigned char *)ctx->buf,(unsigned char *)ctx->tmp,ctx->tmp_len);
 | 
			
		||||
				OPENSSL_assert(ctx->buf_len <= (int)sizeof(ctx->buf));
 | 
			
		||||
				OPENSSL_assert(ctx->buf_len >= ctx->buf_off);
 | 
			
		||||
				/* Since we're now done using the temporary
 | 
			
		||||
				   buffer, the length should be 0'd */
 | 
			
		||||
				ctx->tmp_len=0;
 | 
			
		||||
@@ -425,14 +442,16 @@ static int b64_write(BIO *b, const char *in, int inl)
 | 
			
		||||
				{
 | 
			
		||||
				if (n < 3)
 | 
			
		||||
					{
 | 
			
		||||
					memcpy(&(ctx->tmp[0]),in,n);
 | 
			
		||||
					memcpy(ctx->tmp,in,n);
 | 
			
		||||
					ctx->tmp_len=n;
 | 
			
		||||
					ret += n;
 | 
			
		||||
					break;
 | 
			
		||||
					}
 | 
			
		||||
				n-=n%3;
 | 
			
		||||
				ctx->buf_len=EVP_EncodeBlock(
 | 
			
		||||
					(unsigned char *)ctx->buf,
 | 
			
		||||
					(unsigned char *)in,n);
 | 
			
		||||
				ctx->buf_len=EVP_EncodeBlock((unsigned char *)ctx->buf,(const unsigned char *)in,n);
 | 
			
		||||
				OPENSSL_assert(ctx->buf_len <= (int)sizeof(ctx->buf));
 | 
			
		||||
				OPENSSL_assert(ctx->buf_len >= ctx->buf_off);
 | 
			
		||||
				ret += n;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
@@ -440,6 +459,9 @@ static int b64_write(BIO *b, const char *in, int inl)
 | 
			
		||||
			EVP_EncodeUpdate(&(ctx->base64),
 | 
			
		||||
				(unsigned char *)ctx->buf,&ctx->buf_len,
 | 
			
		||||
				(unsigned char *)in,n);
 | 
			
		||||
			OPENSSL_assert(ctx->buf_len <= (int)sizeof(ctx->buf));
 | 
			
		||||
			OPENSSL_assert(ctx->buf_len >= ctx->buf_off);
 | 
			
		||||
			ret += n;
 | 
			
		||||
			}
 | 
			
		||||
		inl-=n;
 | 
			
		||||
		in+=n;
 | 
			
		||||
@@ -454,8 +476,11 @@ static int b64_write(BIO *b, const char *in, int inl)
 | 
			
		||||
				BIO_copy_next_retry(b);
 | 
			
		||||
				return((ret == 0)?i:ret);
 | 
			
		||||
				}
 | 
			
		||||
			OPENSSL_assert(i <= n);
 | 
			
		||||
			n-=i;
 | 
			
		||||
			ctx->buf_off+=i;
 | 
			
		||||
			OPENSSL_assert(ctx->buf_off <= (int)sizeof(ctx->buf));
 | 
			
		||||
			OPENSSL_assert(ctx->buf_len >= ctx->buf_off);
 | 
			
		||||
			}
 | 
			
		||||
		ctx->buf_len=0;
 | 
			
		||||
		ctx->buf_off=0;
 | 
			
		||||
@@ -486,6 +511,7 @@ static long b64_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
			ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_CTRL_WPENDING: /* More to write in buffer */
 | 
			
		||||
		OPENSSL_assert(ctx->buf_len >= ctx->buf_off);
 | 
			
		||||
		ret=ctx->buf_len-ctx->buf_off;
 | 
			
		||||
		if ((ret == 0) && (ctx->encode != B64_NONE)
 | 
			
		||||
			&& (ctx->base64.num != 0))
 | 
			
		||||
@@ -494,6 +520,7 @@ static long b64_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
			ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_CTRL_PENDING: /* More to read in buffer */
 | 
			
		||||
		OPENSSL_assert(ctx->buf_len >= ctx->buf_off);
 | 
			
		||||
		ret=ctx->buf_len-ctx->buf_off;
 | 
			
		||||
		if (ret <= 0)
 | 
			
		||||
			ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
 | 
			
		||||
@@ -565,3 +592,7 @@ static long b64_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int b64_puts(BIO *b, const char *str)
 | 
			
		||||
	{
 | 
			
		||||
	return b64_write(b,str,strlen(str));
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -279,6 +279,7 @@ skip_to_init:
 | 
			
		||||
			case EVP_CIPH_OFB_MODE:
 | 
			
		||||
 | 
			
		||||
			ctx->num = 0;
 | 
			
		||||
			/* fall-through */
 | 
			
		||||
 | 
			
		||||
			case EVP_CIPH_CBC_MODE:
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -235,7 +235,7 @@ void EVP_DecodeInit(EVP_ENCODE_CTX *ctx)
 | 
			
		||||
int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
 | 
			
		||||
	     const unsigned char *in, int inl)
 | 
			
		||||
	{
 | 
			
		||||
	int seof= -1,eof=0,rv= -1,ret=0,i,v,tmp,n,ln,tmp2,exp_nl;
 | 
			
		||||
	int seof= -1,eof=0,rv= -1,ret=0,i,v,tmp,n,ln,exp_nl;
 | 
			
		||||
	unsigned char *d;
 | 
			
		||||
 | 
			
		||||
	n=ctx->num;
 | 
			
		||||
@@ -319,7 +319,6 @@ int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
 | 
			
		||||
			 * lines.  We process the line and then need to
 | 
			
		||||
			 * accept the '\n' */
 | 
			
		||||
			if ((v != B64_EOF) && (n >= 64)) exp_nl=1;
 | 
			
		||||
			tmp2=v;
 | 
			
		||||
			if (n > 0)
 | 
			
		||||
				{
 | 
			
		||||
				v=EVP_DecodeBlock(out,d,n);
 | 
			
		||||
 
 | 
			
		||||
@@ -116,17 +116,50 @@ static int pbe_cmp(const char * const *a, const char * const *b)
 | 
			
		||||
int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md,
 | 
			
		||||
	     EVP_PBE_KEYGEN *keygen)
 | 
			
		||||
{
 | 
			
		||||
	EVP_PBE_CTL *pbe_tmp;
 | 
			
		||||
	if (!pbe_algs) pbe_algs = sk_new(pbe_cmp);
 | 
			
		||||
	if (!(pbe_tmp = (EVP_PBE_CTL*) OPENSSL_malloc (sizeof(EVP_PBE_CTL)))) {
 | 
			
		||||
		EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
	pbe_tmp->pbe_nid = nid;
 | 
			
		||||
	EVP_PBE_CTL *pbe_tmp = NULL, pbelu;
 | 
			
		||||
	int i;
 | 
			
		||||
	if (!pbe_algs)
 | 
			
		||||
		{
 | 
			
		||||
		pbe_algs = sk_new(pbe_cmp);
 | 
			
		||||
		if (!pbe_algs)
 | 
			
		||||
			{
 | 
			
		||||
			EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
			return 0;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		/* Check if already present */
 | 
			
		||||
		pbelu.pbe_nid = nid;
 | 
			
		||||
		i = sk_find(pbe_algs, (char *)&pbelu);
 | 
			
		||||
		if (i >= 0)
 | 
			
		||||
			{
 | 
			
		||||
			pbe_tmp = (EVP_PBE_CTL *)sk_value(pbe_algs, i);
 | 
			
		||||
			/* If everything identical leave alone */
 | 
			
		||||
			if (pbe_tmp->cipher == cipher
 | 
			
		||||
				&& pbe_tmp->md == md
 | 
			
		||||
				&& pbe_tmp->keygen == keygen)
 | 
			
		||||
				return 1;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (!pbe_tmp)
 | 
			
		||||
		{
 | 
			
		||||
		pbe_tmp = OPENSSL_malloc (sizeof(EVP_PBE_CTL));
 | 
			
		||||
		if (!pbe_tmp)
 | 
			
		||||
			{
 | 
			
		||||
			EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
			return 0;
 | 
			
		||||
			}
 | 
			
		||||
		/* If adding a new PBE, set nid, append and sort */
 | 
			
		||||
		pbe_tmp->pbe_nid = nid;
 | 
			
		||||
		sk_push (pbe_algs, (char *)pbe_tmp);
 | 
			
		||||
		sk_sort(pbe_algs);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
	pbe_tmp->cipher = cipher;
 | 
			
		||||
	pbe_tmp->md = md;
 | 
			
		||||
	pbe_tmp->keygen = keygen;
 | 
			
		||||
	sk_push (pbe_algs, (char *)pbe_tmp);
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -435,6 +435,7 @@ int main(int argc,char **argv)
 | 
			
		||||
	    EXIT(3);
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
	fclose(f);
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
    ENGINE_cleanup();
 | 
			
		||||
 
 | 
			
		||||
@@ -81,7 +81,7 @@ int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen,
 | 
			
		||||
	unsigned char m[EVP_MAX_MD_SIZE];
 | 
			
		||||
	unsigned int m_len;
 | 
			
		||||
	int i,ok=0,v;
 | 
			
		||||
	MS_STATIC EVP_MD_CTX tmp_ctx;
 | 
			
		||||
	EVP_MD_CTX tmp_ctx;
 | 
			
		||||
 | 
			
		||||
	*siglen=0;
 | 
			
		||||
	for (i=0; i<4; i++)
 | 
			
		||||
 
 | 
			
		||||
@@ -68,7 +68,7 @@ int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
 | 
			
		||||
	unsigned char m[EVP_MAX_MD_SIZE];
 | 
			
		||||
	unsigned int m_len;
 | 
			
		||||
	int i,ok=0,v;
 | 
			
		||||
	MS_STATIC EVP_MD_CTX tmp_ctx;
 | 
			
		||||
	EVP_MD_CTX tmp_ctx;
 | 
			
		||||
 | 
			
		||||
	for (i=0; i<4; i++)
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -130,12 +130,9 @@ void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len)
 | 
			
		||||
 | 
			
		||||
void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len)
 | 
			
		||||
	{
 | 
			
		||||
	int j;
 | 
			
		||||
	unsigned int i;
 | 
			
		||||
	unsigned char buf[EVP_MAX_MD_SIZE];
 | 
			
		||||
 | 
			
		||||
	j=EVP_MD_block_size(ctx->md);
 | 
			
		||||
 | 
			
		||||
	EVP_DigestFinal_ex(&ctx->md_ctx,buf,&i);
 | 
			
		||||
	EVP_MD_CTX_copy_ex(&ctx->md_ctx,&ctx->o_ctx);
 | 
			
		||||
	EVP_DigestUpdate(&ctx->md_ctx,buf,i);
 | 
			
		||||
 
 | 
			
		||||
@@ -283,23 +283,53 @@ int JPAKE_STEP1_generate(JPAKE_STEP1 *send, JPAKE_CTX *ctx)
 | 
			
		||||
    return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
/* g^x is a legal value */
 | 
			
		||||
static int is_legal(const BIGNUM *gx, const JPAKE_CTX *ctx)
 | 
			
		||||
    {
 | 
			
		||||
    BIGNUM *t;
 | 
			
		||||
    int res;
 | 
			
		||||
    
 | 
			
		||||
    if(BN_is_negative(gx) || BN_is_zero(gx) || BN_cmp(gx, ctx->p.p) >= 0)
 | 
			
		||||
	return 0;
 | 
			
		||||
 | 
			
		||||
    t = BN_new();
 | 
			
		||||
    BN_mod_exp(t, gx, ctx->p.q, ctx->p.p, ctx->ctx);
 | 
			
		||||
    res = BN_is_one(t);
 | 
			
		||||
    BN_free(t);
 | 
			
		||||
 | 
			
		||||
    return res;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
int JPAKE_STEP1_process(JPAKE_CTX *ctx, const JPAKE_STEP1 *received)
 | 
			
		||||
    {
 | 
			
		||||
   /* verify their ZKP(xc) */
 | 
			
		||||
    if(!is_legal(received->p1.gx, ctx))
 | 
			
		||||
	{
 | 
			
		||||
	JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_G_TO_THE_X3_IS_NOT_LEGAL);
 | 
			
		||||
	return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    if(!is_legal(received->p2.gx, ctx))
 | 
			
		||||
	{
 | 
			
		||||
	JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_G_TO_THE_X4_IS_NOT_LEGAL);
 | 
			
		||||
	return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /* verify their ZKP(xc) */
 | 
			
		||||
    if(!verify_zkp(&received->p1, ctx->p.g, ctx))
 | 
			
		||||
	{
 | 
			
		||||
	JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_VERIFY_X3_FAILED);
 | 
			
		||||
	return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
   /* verify their ZKP(xd) */
 | 
			
		||||
    /* verify their ZKP(xd) */
 | 
			
		||||
    if(!verify_zkp(&received->p2, ctx->p.g, ctx))
 | 
			
		||||
	{
 | 
			
		||||
	JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_VERIFY_X4_FAILED);
 | 
			
		||||
	return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
   /* g^xd != 1 */
 | 
			
		||||
    /* g^xd != 1 */
 | 
			
		||||
    if(BN_is_one(received->p2.gx))
 | 
			
		||||
	{
 | 
			
		||||
	JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_G_TO_THE_X4_IS_ONE);
 | 
			
		||||
 
 | 
			
		||||
@@ -115,6 +115,8 @@ void ERR_load_JPAKE_strings(void);
 | 
			
		||||
#define JPAKE_F_VERIFY_ZKP				 100
 | 
			
		||||
 | 
			
		||||
/* Reason codes. */
 | 
			
		||||
#define JPAKE_R_G_TO_THE_X3_IS_NOT_LEGAL		 108
 | 
			
		||||
#define JPAKE_R_G_TO_THE_X4_IS_NOT_LEGAL		 109
 | 
			
		||||
#define JPAKE_R_G_TO_THE_X4_IS_ONE			 105
 | 
			
		||||
#define JPAKE_R_HASH_OF_HASH_OF_KEY_MISMATCH		 106
 | 
			
		||||
#define JPAKE_R_HASH_OF_KEY_MISMATCH			 107
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/* crypto/jpake/jpake_err.c */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 1999-2008 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 * Copyright (c) 1999-2010 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
@@ -80,6 +80,8 @@ static ERR_STRING_DATA JPAKE_str_functs[]=
 | 
			
		||||
 | 
			
		||||
static ERR_STRING_DATA JPAKE_str_reasons[]=
 | 
			
		||||
	{
 | 
			
		||||
{ERR_REASON(JPAKE_R_G_TO_THE_X3_IS_NOT_LEGAL),"g to the x3 is not legal"},
 | 
			
		||||
{ERR_REASON(JPAKE_R_G_TO_THE_X4_IS_NOT_LEGAL),"g to the x4 is not legal"},
 | 
			
		||||
{ERR_REASON(JPAKE_R_G_TO_THE_X4_IS_ONE)  ,"g to the x4 is one"},
 | 
			
		||||
{ERR_REASON(JPAKE_R_HASH_OF_HASH_OF_KEY_MISMATCH),"hash of hash of key mismatch"},
 | 
			
		||||
{ERR_REASON(JPAKE_R_HASH_OF_KEY_MISMATCH),"hash of key mismatch"},
 | 
			
		||||
 
 | 
			
		||||
@@ -242,7 +242,7 @@
 | 
			
		||||
# if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
 | 
			
		||||
#  if defined(__s390x__)
 | 
			
		||||
#   define HOST_c2l(c,l)	({ asm ("lrv	%0,%1"			\
 | 
			
		||||
				   :"=d"(l) :"m"(*(const unsigned int *)(c));\
 | 
			
		||||
				   :"=d"(l) :"m"(*(const unsigned int *)(c)));\
 | 
			
		||||
				   (c)+=4; (l);				})
 | 
			
		||||
#   define HOST_l2c(l,c)	({ asm ("strv	%1,%0"			\
 | 
			
		||||
				   :"=m"(*(unsigned int *)(c)) :"d"(l));\
 | 
			
		||||
 
 | 
			
		||||
@@ -58,11 +58,16 @@
 | 
			
		||||
 | 
			
		||||
#include <e_os.h>
 | 
			
		||||
#include <openssl/err.h>
 | 
			
		||||
 | 
			
		||||
/* Internal only functions: only ever used here */
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
extern	void int_ERR_lib_init(void);
 | 
			
		||||
# ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
extern	void int_EVP_MD_init_engine_callbacks(void );
 | 
			
		||||
extern	void int_EVP_CIPHER_init_engine_callbacks(void );
 | 
			
		||||
extern	void int_RAND_init_engine_callbacks(void );
 | 
			
		||||
# endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* Perform any essential OpenSSL initialization operations.
 | 
			
		||||
 * Currently only sets FIPS callbacks
 | 
			
		||||
 
 | 
			
		||||
@@ -371,11 +371,12 @@ int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		case OHS_ASN1_HEADER:
 | 
			
		||||
		/* Now reading ASN1 header: can read at least 6 bytes which
 | 
			
		||||
		 * is more than enough for any valid ASN1 SEQUENCE header
 | 
			
		||||
		/* Now reading ASN1 header: can read at least 2 bytes which
 | 
			
		||||
		 * is enough for ASN1 SEQUENCE header and either length field
 | 
			
		||||
		 * or at least the length of the length field.
 | 
			
		||||
		 */
 | 
			
		||||
		n = BIO_get_mem_data(rctx->mem, &p);
 | 
			
		||||
		if (n < 6)
 | 
			
		||||
		if (n < 2)
 | 
			
		||||
			goto next_io;
 | 
			
		||||
 | 
			
		||||
		/* Check it is an ASN1 SEQUENCE */
 | 
			
		||||
@@ -388,6 +389,11 @@ int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx)
 | 
			
		||||
		/* Check out length field */
 | 
			
		||||
		if (*p & 0x80)
 | 
			
		||||
			{
 | 
			
		||||
			/* If MSB set on initial length octet we can now
 | 
			
		||||
			 * always read 6 octets: make sure we have them.
 | 
			
		||||
			 */
 | 
			
		||||
			if (n < 6)
 | 
			
		||||
				goto next_io;
 | 
			
		||||
			n = *p & 0x7F;
 | 
			
		||||
			/* Not NDEF or excessive length */
 | 
			
		||||
			if (!n || (n > 4))
 | 
			
		||||
 
 | 
			
		||||
@@ -169,14 +169,14 @@ int OCSP_parse_url(char *url, char **phost, char **pport, char **ppath, int *pss
 | 
			
		||||
 | 
			
		||||
	char *host, *port;
 | 
			
		||||
 | 
			
		||||
	/* dup the buffer since we are going to mess with it */
 | 
			
		||||
	buf = BUF_strdup(url);
 | 
			
		||||
	if (!buf) goto mem_err;
 | 
			
		||||
 | 
			
		||||
	*phost = NULL;
 | 
			
		||||
	*pport = NULL;
 | 
			
		||||
	*ppath = NULL;
 | 
			
		||||
 | 
			
		||||
	/* dup the buffer since we are going to mess with it */
 | 
			
		||||
	buf = BUF_strdup(url);
 | 
			
		||||
	if (!buf) goto mem_err;
 | 
			
		||||
 | 
			
		||||
	/* Check for initial colon */
 | 
			
		||||
	p = strchr(buf, ':');
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -182,7 +182,6 @@ int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags)
 | 
			
		||||
        {
 | 
			
		||||
	int i, ret = 0;
 | 
			
		||||
	long l;
 | 
			
		||||
	unsigned char *p;
 | 
			
		||||
	OCSP_CERTID *cid = NULL;
 | 
			
		||||
	OCSP_BASICRESP *br = NULL;
 | 
			
		||||
	OCSP_RESPID *rid = NULL;
 | 
			
		||||
@@ -207,7 +206,6 @@ int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags)
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	p = ASN1_STRING_data(rb->response);
 | 
			
		||||
	i = ASN1_STRING_length(rb->response);
 | 
			
		||||
	if (!(br = OCSP_response_get1_basic(o))) goto err;
 | 
			
		||||
	rd = br->tbsResponseData;
 | 
			
		||||
 
 | 
			
		||||
@@ -25,11 +25,11 @@
 | 
			
		||||
 * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
 | 
			
		||||
 *  major minor fix final patch/beta)
 | 
			
		||||
 */
 | 
			
		||||
#define OPENSSL_VERSION_NUMBER	0x009080efL
 | 
			
		||||
#define OPENSSL_VERSION_NUMBER	0x0090814fL
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
#define OPENSSL_VERSION_TEXT	"OpenSSL 0.9.8n-fips 24 Mar 2010"
 | 
			
		||||
#define OPENSSL_VERSION_TEXT	"OpenSSL 0.9.8t-fips 18 Jan 2012"
 | 
			
		||||
#else
 | 
			
		||||
#define OPENSSL_VERSION_TEXT	"OpenSSL 0.9.8n 24 Mar 2010"
 | 
			
		||||
#define OPENSSL_VERSION_TEXT	"OpenSSL 0.9.8t 18 Jan 2012"
 | 
			
		||||
#endif
 | 
			
		||||
#define OPENSSL_VERSION_PTEXT	" part of " OPENSSL_VERSION_TEXT
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -434,7 +434,6 @@ int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *plen,
 | 
			
		||||
 | 
			
		||||
int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher)
 | 
			
		||||
	{
 | 
			
		||||
	int o;
 | 
			
		||||
	const EVP_CIPHER *enc=NULL;
 | 
			
		||||
	char *p,c;
 | 
			
		||||
	char **header_pp = &header;
 | 
			
		||||
@@ -474,7 +473,6 @@ int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher)
 | 
			
		||||
		header++;
 | 
			
		||||
		}
 | 
			
		||||
	*header='\0';
 | 
			
		||||
	o=OBJ_sn2nid(p);
 | 
			
		||||
	cipher->cipher=enc=EVP_get_cipherbyname(p);
 | 
			
		||||
	*header=c;
 | 
			
		||||
	header++;
 | 
			
		||||
 
 | 
			
		||||
@@ -158,7 +158,6 @@ sub cbc
 | 
			
		||||
	&jmp_ptr($count);
 | 
			
		||||
 | 
			
		||||
&set_label("ej7");
 | 
			
		||||
	&xor("edx",		"edx") if $ppro; # ppro friendly
 | 
			
		||||
	&movb(&HB("edx"),	&BP(6,$in,"",0));
 | 
			
		||||
	&shl("edx",8);
 | 
			
		||||
&set_label("ej6");
 | 
			
		||||
@@ -170,7 +169,6 @@ sub cbc
 | 
			
		||||
	&jmp(&label("ejend"));
 | 
			
		||||
&set_label("ej3");
 | 
			
		||||
	&movb(&HB("ecx"),	&BP(2,$in,"",0));
 | 
			
		||||
	&xor("ecx",		"ecx") if $ppro; # ppro friendly
 | 
			
		||||
	&shl("ecx",8);
 | 
			
		||||
&set_label("ej2");
 | 
			
		||||
	&movb(&HB("ecx"),	&BP(1,$in,"",0));
 | 
			
		||||
 
 | 
			
		||||
@@ -110,6 +110,7 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
 | 
			
		||||
	unsigned char *B, *D, *I, *p, *Ai;
 | 
			
		||||
	int Slen, Plen, Ilen, Ijlen;
 | 
			
		||||
	int i, j, u, v;
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
	BIGNUM *Ij, *Bpl1;	/* These hold Ij and B + 1 */
 | 
			
		||||
	EVP_MD_CTX ctx;
 | 
			
		||||
#ifdef  DEBUG_KEYGEN
 | 
			
		||||
@@ -145,10 +146,8 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
 | 
			
		||||
	I = OPENSSL_malloc (Ilen);
 | 
			
		||||
	Ij = BN_new();
 | 
			
		||||
	Bpl1 = BN_new();
 | 
			
		||||
	if (!D || !Ai || !B || !I || !Ij || !Bpl1) {
 | 
			
		||||
		PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
	if (!D || !Ai || !B || !I || !Ij || !Bpl1)
 | 
			
		||||
		goto err;
 | 
			
		||||
	for (i = 0; i < v; i++) D[i] = id;
 | 
			
		||||
	p = I;
 | 
			
		||||
	for (i = 0; i < Slen; i++) *p++ = salt[i % saltlen];
 | 
			
		||||
@@ -165,28 +164,22 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
 | 
			
		||||
		}
 | 
			
		||||
		memcpy (out, Ai, min (n, u));
 | 
			
		||||
		if (u >= n) {
 | 
			
		||||
			OPENSSL_free (Ai);
 | 
			
		||||
			OPENSSL_free (B);
 | 
			
		||||
			OPENSSL_free (D);
 | 
			
		||||
			OPENSSL_free (I);
 | 
			
		||||
			BN_free (Ij);
 | 
			
		||||
			BN_free (Bpl1);
 | 
			
		||||
			EVP_MD_CTX_cleanup(&ctx);
 | 
			
		||||
#ifdef DEBUG_KEYGEN
 | 
			
		||||
			fprintf(stderr, "Output KEY (length %d)\n", tmpn);
 | 
			
		||||
			h__dump(tmpout, tmpn);
 | 
			
		||||
#endif
 | 
			
		||||
			return 1;	
 | 
			
		||||
			ret = 1;
 | 
			
		||||
			goto end;
 | 
			
		||||
		}
 | 
			
		||||
		n -= u;
 | 
			
		||||
		out += u;
 | 
			
		||||
		for (j = 0; j < v; j++) B[j] = Ai[j % u];
 | 
			
		||||
		/* Work out B + 1 first then can use B as tmp space */
 | 
			
		||||
		BN_bin2bn (B, v, Bpl1);
 | 
			
		||||
		BN_add_word (Bpl1, 1);
 | 
			
		||||
		if (!BN_bin2bn (B, v, Bpl1)) goto err;
 | 
			
		||||
		if (!BN_add_word (Bpl1, 1)) goto err;
 | 
			
		||||
		for (j = 0; j < Ilen ; j+=v) {
 | 
			
		||||
			BN_bin2bn (I + j, v, Ij);
 | 
			
		||||
			BN_add (Ij, Ij, Bpl1);
 | 
			
		||||
			if (!BN_bin2bn (I + j, v, Ij)) goto err;
 | 
			
		||||
			if (!BN_add (Ij, Ij, Bpl1)) goto err;
 | 
			
		||||
			BN_bn2bin (Ij, B);
 | 
			
		||||
			Ijlen = BN_num_bytes (Ij);
 | 
			
		||||
			/* If more than 2^(v*8) - 1 cut off MSB */
 | 
			
		||||
@@ -202,6 +195,19 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
 | 
			
		||||
			} else BN_bn2bin (Ij, I + j);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
err:
 | 
			
		||||
	PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
 | 
			
		||||
end:
 | 
			
		||||
	OPENSSL_free (Ai);
 | 
			
		||||
	OPENSSL_free (B);
 | 
			
		||||
	OPENSSL_free (D);
 | 
			
		||||
	OPENSSL_free (I);
 | 
			
		||||
	BN_free (Ij);
 | 
			
		||||
	BN_free (Bpl1);
 | 
			
		||||
	EVP_MD_CTX_cleanup(&ctx);
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
#ifdef DEBUG_KEYGEN
 | 
			
		||||
void h__dump (unsigned char *p, int len)
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user