Compare commits
	
		
			150 Commits
		
	
	
		
			OpenSSL-fi
			...
			OpenSSL_0_
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					bfa33c7e91 | ||
| 
						 | 
					2808478899 | ||
| 
						 | 
					98d2eee05e | ||
| 
						 | 
					13e8459dea | ||
| 
						 | 
					8c447031ad | ||
| 
						 | 
					4875e097f1 | ||
| 
						 | 
					9083142ace | ||
| 
						 | 
					9f2f46ba02 | ||
| 
						 | 
					d761421e1d | ||
| 
						 | 
					2339c5d722 | ||
| 
						 | 
					dd00266757 | ||
| 
						 | 
					bb99ce5f80 | ||
| 
						 | 
					49f42ec0f6 | ||
| 
						 | 
					91d509f0d9 | ||
| 
						 | 
					d5e858c55f | ||
| 
						 | 
					fb8fcce2ac | ||
| 
						 | 
					d4736ae701 | ||
| 
						 | 
					3e1158522a | ||
| 
						 | 
					57191f86d9 | ||
| 
						 | 
					0a89c575de | ||
| 
						 | 
					4c860910df | ||
| 
						 | 
					0fc3d51b7d | ||
| 
						 | 
					c4b0d7879e | ||
| 
						 | 
					aab1ec3f36 | ||
| 
						 | 
					fbfa11fb29 | ||
| 
						 | 
					284498fcef | ||
| 
						 | 
					07d9808496 | ||
| 
						 | 
					4ab0088bfe | ||
| 
						 | 
					3bd1690bfb | ||
| 
						 | 
					29f4b05954 | ||
| 
						 | 
					48ca0c99b2 | ||
| 
						 | 
					015052cf7b | ||
| 
						 | 
					9ce3ee47ba | ||
| 
						 | 
					2e3fd54337 | ||
| 
						 | 
					625782f7ee | ||
| 
						 | 
					1c90899eef | ||
| 
						 | 
					4f2b7d48b1 | ||
| 
						 | 
					458c3900e1 | ||
| 
						 | 
					ba75b4e750 | ||
| 
						 | 
					ab011d51be | ||
| 
						 | 
					898d9b1a87 | ||
| 
						 | 
					4f9a9d2b79 | ||
| 
						 | 
					346f2f93e1 | ||
| 
						 | 
					25b0e072dd | ||
| 
						 | 
					dc13c882fb | ||
| 
						 | 
					12a52467c8 | ||
| 
						 | 
					22e6c73dcc | ||
| 
						 | 
					53b9696f3f | ||
| 
						 | 
					7e4fe4662b | ||
| 
						 | 
					18fd413f37 | ||
| 
						 | 
					80ed5f84de | ||
| 
						 | 
					b48111df7c | ||
| 
						 | 
					73e3edd70d | ||
| 
						 | 
					d4cfbdf2c0 | ||
| 
						 | 
					294f03a812 | ||
| 
						 | 
					272f9f3d27 | ||
| 
						 | 
					927a28ba3b | ||
| 
						 | 
					a938c4284e | ||
| 
						 | 
					7a44a0cee7 | ||
| 
						 | 
					82430309ac | ||
| 
						 | 
					c2079de880 | ||
| 
						 | 
					967ead7269 | ||
| 
						 | 
					c9255df519 | ||
| 
						 | 
					27c824a1c9 | ||
| 
						 | 
					5b96d1ccf9 | ||
| 
						 | 
					29c0866b38 | ||
| 
						 | 
					0214ea0dfe | ||
| 
						 | 
					80355002a1 | ||
| 
						 | 
					0e36825228 | ||
| 
						 | 
					95a8f1469f | ||
| 
						 | 
					afdbadc704 | ||
| 
						 | 
					004cc26abf | ||
| 
						 | 
					35a924c576 | ||
| 
						 | 
					99279ac97a | ||
| 
						 | 
					87605ca1e2 | ||
| 
						 | 
					7cc586f117 | ||
| 
						 | 
					c263a6092c | ||
| 
						 | 
					f92fd85400 | ||
| 
						 | 
					e71520ddd6 | ||
| 
						 | 
					275f34b5d2 | ||
| 
						 | 
					50fbb6ed36 | ||
| 
						 | 
					34fdacbd35 | ||
| 
						 | 
					77f2d20dbc | ||
| 
						 | 
					0dbfbf26cb | ||
| 
						 | 
					2863a6878f | ||
| 
						 | 
					ae46e91e4d | ||
| 
						 | 
					865a90eb4f | ||
| 
						 | 
					0269c4507c | ||
| 
						 | 
					a5d3574984 | ||
| 
						 | 
					1040deb0c5 | ||
| 
						 | 
					05ea800faf | ||
| 
						 | 
					341f87862c | ||
| 
						 | 
					f805d30769 | ||
| 
						 | 
					4fb9472cc2 | ||
| 
						 | 
					a8098740c6 | ||
| 
						 | 
					e3af0d041e | ||
| 
						 | 
					28cfda9f30 | ||
| 
						 | 
					a313e23fff | ||
| 
						 | 
					4d2a292e8a | ||
| 
						 | 
					5a84b7fc2d | ||
| 
						 | 
					d8e660a6dc | ||
| 
						 | 
					761f3b403b | ||
| 
						 | 
					4570d29404 | ||
| 
						 | 
					14346b3456 | ||
| 
						 | 
					769f58aaaa | ||
| 
						 | 
					a166e96d16 | ||
| 
						 | 
					8dd8ce1dc3 | ||
| 
						 | 
					4c5979a107 | ||
| 
						 | 
					649ab2dcfa | ||
| 
						 | 
					71fc9b37ae | ||
| 
						 | 
					283aedf498 | ||
| 
						 | 
					1a56614af2 | ||
| 
						 | 
					693c33e407 | ||
| 
						 | 
					d9a9aa027d | ||
| 
						 | 
					b22250bb67 | ||
| 
						 | 
					d446120527 | ||
| 
						 | 
					bb9d68489c | ||
| 
						 | 
					affaea59fe | ||
| 
						 | 
					81fc4c93ef | ||
| 
						 | 
					8957121c14 | ||
| 
						 | 
					50241bc84e | ||
| 
						 | 
					e7f077f1ba | ||
| 
						 | 
					c3b82c7610 | ||
| 
						 | 
					2c12e7f6f5 | ||
| 
						 | 
					8db10d9ac4 | ||
| 
						 | 
					c3cc4662af | ||
| 
						 | 
					22892f9803 | ||
| 
						 | 
					27eb115fb6 | ||
| 
						 | 
					51a596ef4f | ||
| 
						 | 
					97de8bd1e0 | ||
| 
						 | 
					1cb7e5be5b | ||
| 
						 | 
					84dd04e761 | ||
| 
						 | 
					2ac061e487 | ||
| 
						 | 
					7cdb81582c | ||
| 
						 | 
					8f33b40302 | ||
| 
						 | 
					e600614ef5 | ||
| 
						 | 
					02581dea1f | ||
| 
						 | 
					40ad08bcc2 | ||
| 
						 | 
					9c4456a13f | ||
| 
						 | 
					f4d0392faa | ||
| 
						 | 
					45ba6cfe03 | ||
| 
						 | 
					4f23a0c797 | ||
| 
						 | 
					f6c32bbf2b | ||
| 
						 | 
					d040c951f0 | ||
| 
						 | 
					69abfb0e33 | ||
| 
						 | 
					9a1daf8482 | ||
| 
						 | 
					9de6dc3af3 | ||
| 
						 | 
					248834dcaa | ||
| 
						 | 
					11a7da7c9f | ||
| 
						 | 
					9fea0b9937 | 
							
								
								
									
										149
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										149
									
								
								CHANGES
									
									
									
									
									
								
							@@ -2,7 +2,154 @@
 | 
				
			|||||||
 OpenSSL CHANGES
 | 
					 OpenSSL CHANGES
 | 
				
			||||||
 _______________
 | 
					 _______________
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 Changes between 0.9.8e and 0.9.8f  [xx XXX xxxx]
 | 
					 Changes between 0.9.8f and 0.9.8g  [19 Oct 2007]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  *) Fix various bugs:
 | 
				
			||||||
 | 
					     + Binary incompatibility of ssl_ctx_st structure
 | 
				
			||||||
 | 
					     + DTLS interoperation with non-compliant servers
 | 
				
			||||||
 | 
					     + Don't call get_session_cb() without proposed session
 | 
				
			||||||
 | 
					     + Fix ia64 assembler code
 | 
				
			||||||
 | 
					     [Andy Polyakov, Steve Henson]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 Changes between 0.9.8e and 0.9.8f  [11 Oct 2007]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  *) DTLS Handshake overhaul. There were longstanding issues with
 | 
				
			||||||
 | 
					     OpenSSL DTLS implementation, which were making it impossible for
 | 
				
			||||||
 | 
					     RFC 4347 compliant client to communicate with OpenSSL server.
 | 
				
			||||||
 | 
					     Unfortunately just fixing these incompatibilities would "cut off"
 | 
				
			||||||
 | 
					     pre-0.9.8f clients. To allow for hassle free upgrade post-0.9.8e
 | 
				
			||||||
 | 
					     server keeps tolerating non RFC compliant syntax. The opposite is
 | 
				
			||||||
 | 
					     not true, 0.9.8f client can not communicate with earlier server.
 | 
				
			||||||
 | 
					     This update even addresses CVE-2007-4995.
 | 
				
			||||||
 | 
					     [Andy Polyakov]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  *) Changes to avoid need for function casts in OpenSSL: some compilers
 | 
				
			||||||
 | 
					     (gcc 4.2 and later) reject their use.
 | 
				
			||||||
 | 
					     [Kurt Roeckx <kurt@roeckx.be>, Peter Hartley <pdh@utter.chaos.org.uk>,
 | 
				
			||||||
 | 
					      Steve Henson]
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  *) Add RFC4507 support to OpenSSL. This includes the corrections in
 | 
				
			||||||
 | 
					     RFC4507bis. The encrypted ticket format is an encrypted encoded
 | 
				
			||||||
 | 
					     SSL_SESSION structure, that way new session features are automatically
 | 
				
			||||||
 | 
					     supported.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     If a client application caches session in an SSL_SESSION structure
 | 
				
			||||||
 | 
					     support is transparent because tickets are now stored in the encoded
 | 
				
			||||||
 | 
					     SSL_SESSION.
 | 
				
			||||||
 | 
					     
 | 
				
			||||||
 | 
					     The SSL_CTX structure automatically generates keys for ticket
 | 
				
			||||||
 | 
					     protection in servers so again support should be possible
 | 
				
			||||||
 | 
					     with no application modification.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     If a client or server wishes to disable RFC4507 support then the option
 | 
				
			||||||
 | 
					     SSL_OP_NO_TICKET can be set.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     Add a TLS extension debugging callback to allow the contents of any client
 | 
				
			||||||
 | 
					     or server extensions to be examined.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     This work was sponsored by Google.
 | 
				
			||||||
 | 
					     [Steve Henson]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  *) Add initial support for TLS extensions, specifically for the server_name
 | 
				
			||||||
 | 
					     extension so far.  The SSL_SESSION, SSL_CTX, and SSL data structures now
 | 
				
			||||||
 | 
					     have new members for a host name.  The SSL data structure has an
 | 
				
			||||||
 | 
					     additional member SSL_CTX *initial_ctx so that new sessions can be
 | 
				
			||||||
 | 
					     stored in that context to allow for session resumption, even after the
 | 
				
			||||||
 | 
					     SSL has been switched to a new SSL_CTX in reaction to a client's
 | 
				
			||||||
 | 
					     server_name extension.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     New functions (subject to change):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					         SSL_get_servername()
 | 
				
			||||||
 | 
					         SSL_get_servername_type()
 | 
				
			||||||
 | 
					         SSL_set_SSL_CTX()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     New CTRL codes and macros (subject to change):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					         SSL_CTRL_SET_TLSEXT_SERVERNAME_CB
 | 
				
			||||||
 | 
					                                 - SSL_CTX_set_tlsext_servername_callback()
 | 
				
			||||||
 | 
					         SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG
 | 
				
			||||||
 | 
					                                      - SSL_CTX_set_tlsext_servername_arg()
 | 
				
			||||||
 | 
					         SSL_CTRL_SET_TLSEXT_HOSTNAME           - SSL_set_tlsext_host_name()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     openssl s_client has a new '-servername ...' option.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     openssl s_server has new options '-servername_host ...', '-cert2 ...',
 | 
				
			||||||
 | 
					     '-key2 ...', '-servername_fatal' (subject to change).  This allows
 | 
				
			||||||
 | 
					     testing the HostName extension for a specific single host name ('-cert'
 | 
				
			||||||
 | 
					     and '-key' remain fallbacks for handshakes without HostName
 | 
				
			||||||
 | 
					     negotiation).  If the unrecogninzed_name alert has to be sent, this by
 | 
				
			||||||
 | 
					     default is a warning; it becomes fatal with the '-servername_fatal'
 | 
				
			||||||
 | 
					     option.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     [Peter Sylvester,  Remy Allais, Christophe Renou, Steve Henson]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  *) Add AES and SSE2 assembly language support to VC++ build.
 | 
				
			||||||
 | 
					     [Steve Henson]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  *) Mitigate attack on final subtraction in Montgomery reduction.
 | 
				
			||||||
 | 
					     [Andy Polyakov]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  *) Fix crypto/ec/ec_mult.c to work properly with scalars of value 0
 | 
				
			||||||
 | 
					     (which previously caused an internal error).
 | 
				
			||||||
 | 
					     [Bodo Moeller]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  *) Squeeze another 10% out of IGE mode when in != out.
 | 
				
			||||||
 | 
					     [Ben Laurie]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  *) AES IGE mode speedup.
 | 
				
			||||||
 | 
					     [Dean Gaudet (Google)]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  *) Add the Korean symmetric 128-bit cipher SEED (see
 | 
				
			||||||
 | 
					     http://www.kisa.or.kr/kisa/seed/jsp/seed_eng.jsp) and
 | 
				
			||||||
 | 
					     add SEED ciphersuites from RFC 4162:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        TLS_RSA_WITH_SEED_CBC_SHA      =  "SEED-SHA"
 | 
				
			||||||
 | 
					        TLS_DHE_DSS_WITH_SEED_CBC_SHA  =  "DHE-DSS-SEED-SHA"
 | 
				
			||||||
 | 
					        TLS_DHE_RSA_WITH_SEED_CBC_SHA  =  "DHE-RSA-SEED-SHA"
 | 
				
			||||||
 | 
					        TLS_DH_anon_WITH_SEED_CBC_SHA  =  "ADH-SEED-SHA"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     To minimize changes between patchlevels in the OpenSSL 0.9.8
 | 
				
			||||||
 | 
					     series, SEED remains excluded from compilation unless OpenSSL
 | 
				
			||||||
 | 
					     is configured with 'enable-seed'.
 | 
				
			||||||
 | 
					     [KISA, Bodo Moeller]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  *) Mitigate branch prediction attacks, which can be practical if a
 | 
				
			||||||
 | 
					     single processor is shared, allowing a spy process to extract
 | 
				
			||||||
 | 
					     information.  For detailed background information, see
 | 
				
			||||||
 | 
					     http://eprint.iacr.org/2007/039 (O. Aciicmez, S. Gueron,
 | 
				
			||||||
 | 
					     J.-P. Seifert, "New Branch Prediction Vulnerabilities in OpenSSL
 | 
				
			||||||
 | 
					     and Necessary Software Countermeasures").  The core of the change
 | 
				
			||||||
 | 
					     are new versions BN_div_no_branch() and
 | 
				
			||||||
 | 
					     BN_mod_inverse_no_branch() of BN_div() and BN_mod_inverse(),
 | 
				
			||||||
 | 
					     respectively, which are slower, but avoid the security-relevant
 | 
				
			||||||
 | 
					     conditional branches.  These are automatically called by BN_div()
 | 
				
			||||||
 | 
					     and BN_mod_inverse() if the flag BN_FLG_CONSTTIME is set for one
 | 
				
			||||||
 | 
					     of the input BIGNUMs.  Also, BN_is_bit_set() has been changed to
 | 
				
			||||||
 | 
					     remove a conditional branch.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     BN_FLG_CONSTTIME is the new name for the previous
 | 
				
			||||||
 | 
					     BN_FLG_EXP_CONSTTIME flag, since it now affects more than just
 | 
				
			||||||
 | 
					     modular exponentiation.  (Since OpenSSL 0.9.7h, setting this flag
 | 
				
			||||||
 | 
					     in the exponent causes BN_mod_exp_mont() to use the alternative
 | 
				
			||||||
 | 
					     implementation in BN_mod_exp_mont_consttime().)  The old name
 | 
				
			||||||
 | 
					     remains as a deprecated alias.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     Similary, RSA_FLAG_NO_EXP_CONSTTIME is replaced by a more general
 | 
				
			||||||
 | 
					     RSA_FLAG_NO_CONSTTIME flag since the RSA implementation now uses
 | 
				
			||||||
 | 
					     constant-time implementations for more than just exponentiation.
 | 
				
			||||||
 | 
					     Here too the old name is kept as a deprecated alias.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     BN_BLINDING_new() will now use BN_dup() for the modulus so that
 | 
				
			||||||
 | 
					     the BN_BLINDING structure gets an independent copy of the
 | 
				
			||||||
 | 
					     modulus.  This means that the previous "BIGNUM *m" argument to
 | 
				
			||||||
 | 
					     BN_BLINDING_new() and to BN_BLINDING_create_param() now
 | 
				
			||||||
 | 
					     essentially becomes "const BIGNUM *m", although we can't actually
 | 
				
			||||||
 | 
					     change this in the header file before 0.9.9.  It allows
 | 
				
			||||||
 | 
					     RSA_setup_blinding() to use BN_with_flags() on the modulus to
 | 
				
			||||||
 | 
					     enable BN_FLG_CONSTTIME.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     [Matthew D Wood (Intel Corp)]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  *) In the SSL/TLS server implementation, be strict about session ID
 | 
					  *) In the SSL/TLS server implementation, be strict about session ID
 | 
				
			||||||
     context matching (which matters if an application uses a single
 | 
					     context matching (which matters if an application uses a single
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										82
									
								
								Configure
									
									
									
									
									
								
							
							
						
						
									
										82
									
								
								Configure
									
									
									
									
									
								
							@@ -155,7 +155,7 @@ my %table=(
 | 
				
			|||||||
"debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
 | 
					"debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
 | 
				
			||||||
"debug-bodo",	"gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -march=i486 -pedantic -Wshadow -Wall::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
 | 
					"debug-bodo",	"gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -march=i486 -pedantic -Wshadow -Wall::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
 | 
				
			||||||
"debug-ulf", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DBN_DEBUG_RAND -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations:::CYGWIN32:::${no_asm}:win32:cygwin-shared:::.dll",
 | 
					"debug-ulf", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DBN_DEBUG_RAND -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations:::CYGWIN32:::${no_asm}:win32:cygwin-shared:::.dll",
 | 
				
			||||||
"debug-steve",	"gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -march=i486 -pedantic -Wno-long-long -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared",
 | 
					"debug-steve",	"gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -m32 -g -pedantic -Wno-long-long -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared",
 | 
				
			||||||
"debug-steve-linux-pseudo64",	"gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DOPENSSL_NO_ASM -g -mcpu=i486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:SIXTY_FOUR_BIT:${no_asm}:dlfcn:linux-shared",
 | 
					"debug-steve-linux-pseudo64",	"gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DOPENSSL_NO_ASM -g -mcpu=i486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:SIXTY_FOUR_BIT:${no_asm}:dlfcn:linux-shared",
 | 
				
			||||||
"debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
					"debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
				
			||||||
"debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
					"debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
				
			||||||
@@ -231,10 +231,10 @@ my %table=(
 | 
				
			|||||||
# Only N32 and N64 ABIs are supported. If you need O32 ABI build, invoke
 | 
					# Only N32 and N64 ABIs are supported. If you need O32 ABI build, invoke
 | 
				
			||||||
# './Configure irix-cc -o32' manually.
 | 
					# './Configure irix-cc -o32' manually.
 | 
				
			||||||
"irix-mips3-gcc","gcc:-mabi=n32 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT::bn-mips3.o::::::::::dlfcn:irix-shared::-mabi=n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
					"irix-mips3-gcc","gcc:-mabi=n32 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT::bn-mips3.o::::::::::dlfcn:irix-shared::-mabi=n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
				
			||||||
"irix-mips3-cc", "cc:-n32 -mips3 -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT::bn-mips3.o::::::::::dlfcn:irix-shared::-n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
					"irix-mips3-cc", "cc:-n32 -mips3 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT::bn-mips3.o::::::::::dlfcn:irix-shared::-n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
				
			||||||
# N64 ABI builds.
 | 
					# N64 ABI builds.
 | 
				
			||||||
"irix64-mips4-gcc","gcc:-mabi=64 -mips4 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG::bn-mips3.o::::::::::dlfcn:irix-shared::-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
					"irix64-mips4-gcc","gcc:-mabi=64 -mips4 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG::bn-mips3.o::::::::::dlfcn:irix-shared::-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
				
			||||||
"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG::bn-mips3.o::::::::::dlfcn:irix-shared::-64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
					"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG::bn-mips3.o::::::::::dlfcn:irix-shared::-64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### Unified HP-UX ANSI C configs.
 | 
					#### Unified HP-UX ANSI C configs.
 | 
				
			||||||
# Special notes:
 | 
					# Special notes:
 | 
				
			||||||
@@ -334,7 +334,7 @@ my %table=(
 | 
				
			|||||||
# -Wa,-Av8plus should do the trick no matter what.
 | 
					# -Wa,-Av8plus should do the trick no matter what.
 | 
				
			||||||
"linux-sparcv9","gcc:-m32 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc.o fcrypt_b.o:::md5-sparcv8plus.o::::::dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
					"linux-sparcv9","gcc:-m32 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc.o fcrypt_b.o:::md5-sparcv8plus.o::::::dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
				
			||||||
# GCC 3.1 is a requirement
 | 
					# GCC 3.1 is a requirement
 | 
				
			||||||
"linux64-sparcv9","gcc:-m64 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:ULTRASPARC:-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::des_enc-sparc.o fcrypt_b.o:::md5-sparcv9.o::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
					"linux64-sparcv9","gcc:-m64 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:ULTRASPARC:-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::::md5-sparcv9.o::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
				
			||||||
#### Alpha Linux with GNU C and Compaq C setups
 | 
					#### Alpha Linux with GNU C and Compaq C setups
 | 
				
			||||||
# Special notes:
 | 
					# Special notes:
 | 
				
			||||||
# - linux-alpha+bwx-gcc is ment to be used from ./config only. If you
 | 
					# - linux-alpha+bwx-gcc is ment to be used from ./config only. If you
 | 
				
			||||||
@@ -402,12 +402,12 @@ my %table=(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#### IBM's AIX.
 | 
					#### IBM's AIX.
 | 
				
			||||||
"aix3-cc",  "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::",
 | 
					"aix3-cc",  "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::",
 | 
				
			||||||
"aix-gcc",  "gcc:-O -DB_ENDIAN::-D_THREAD_SAFE:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:",
 | 
					"aix-gcc",  "gcc:-O -DB_ENDIAN::-D_THREAD_SAFE:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
 | 
				
			||||||
"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-D_THREAD_SAFE:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn::::::-X64",
 | 
					"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-D_THREAD_SAFE:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-maix64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64",
 | 
				
			||||||
# Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE
 | 
					# Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE
 | 
				
			||||||
# at build time. $OBJECT_MODE is respected at ./config stage!
 | 
					# at build time. $OBJECT_MODE is respected at ./config stage!
 | 
				
			||||||
"aix-cc",   "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384::-qthreaded:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared::-q32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
 | 
					"aix-cc",   "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared::-q32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
 | 
				
			||||||
"aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384::-qthreaded:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-q64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64",
 | 
					"aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-q64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Cray T90 and similar (SDSC)
 | 
					# Cray T90 and similar (SDSC)
 | 
				
			||||||
@@ -499,8 +499,10 @@ my %table=(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
##### MacOS X (a.k.a. Rhapsody or Darwin) setup
 | 
					##### MacOS X (a.k.a. Rhapsody or Darwin) setup
 | 
				
			||||||
"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::",
 | 
					"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::",
 | 
				
			||||||
"darwin-ppc-cc","cc:-O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::osx_ppc32.o::::::::::dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
					"darwin-ppc-cc","cc:-arch ppc -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::osx_ppc32.o::::::::::dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
				
			||||||
"darwin-i386-cc","cc:-O3 -fomit-frame-pointer -fno-common::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
					"darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:ppccpuid_osx64.o:osx_ppc64.o osx_ppc64-mont.o:::::sha1-ppc_osx64.o sha256-ppc_osx64.o sha512-ppc_osx64.o:::::::dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
				
			||||||
 | 
					"darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -fno-common::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
				
			||||||
 | 
					"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -fomit-frame-pointer -DL_ENDIAN -DMD32_REG_T=int -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
				
			||||||
"debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::osx_ppc32.o::::::::::dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
					"debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::osx_ppc32.o::::::::::dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
##### A/UX
 | 
					##### A/UX
 | 
				
			||||||
@@ -600,12 +602,14 @@ my $perl;
 | 
				
			|||||||
# All of the following is disabled by default (RC5 was enabled before 0.9.8):
 | 
					# All of the following is disabled by default (RC5 was enabled before 0.9.8):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
my %disabled = ( # "what"         => "comment"
 | 
					my %disabled = ( # "what"         => "comment"
 | 
				
			||||||
		 "camellia"	  => "default",
 | 
					                 "camellia"       => "default",
 | 
				
			||||||
		 "gmp"		  => "default",
 | 
					                 "gmp"            => "default",
 | 
				
			||||||
                 "mdc2"           => "default",
 | 
					                 "mdc2"           => "default",
 | 
				
			||||||
                 "rc5"            => "default",
 | 
					                 "rc5"            => "default",
 | 
				
			||||||
		 "rfc3779"	  => "default",
 | 
					                 "rfc3779"        => "default",
 | 
				
			||||||
 | 
					                 "seed"           => "default",
 | 
				
			||||||
                 "shared"         => "default",
 | 
					                 "shared"         => "default",
 | 
				
			||||||
 | 
					                 "tlsext"         => "default",
 | 
				
			||||||
                 "zlib"           => "default",
 | 
					                 "zlib"           => "default",
 | 
				
			||||||
                 "zlib-dynamic"   => "default"
 | 
					                 "zlib-dynamic"   => "default"
 | 
				
			||||||
               );
 | 
					               );
 | 
				
			||||||
@@ -615,7 +619,7 @@ my %disabled = ( # "what"         => "comment"
 | 
				
			|||||||
# For symmetry, "disable-..." is a synonym for "no-...".
 | 
					# For symmetry, "disable-..." is a synonym for "no-...".
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This is what $depflags will look like with the above default:
 | 
					# This is what $depflags will look like with the above default:
 | 
				
			||||||
my $default_depflags = "-DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_GMP -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 ";
 | 
					my $default_depflags = "-DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_GMP -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SEED -DOPENSSL_NO_TLSEXT ";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
my $no_sse2=0;
 | 
					my $no_sse2=0;
 | 
				
			||||||
@@ -837,6 +841,10 @@ if (defined($disabled{"md5"}) || defined($disabled{"sha"})
 | 
				
			|||||||
	$disabled{"tls1"} = "forced";
 | 
						$disabled{"tls1"} = "forced";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (defined($disabled{"tls1"}))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						$disabled{"tlsext"} = "forced";
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ($target eq "TABLE") {
 | 
					if ($target eq "TABLE") {
 | 
				
			||||||
	foreach $target (sort keys %table) {
 | 
						foreach $target (sort keys %table) {
 | 
				
			||||||
@@ -967,6 +975,11 @@ my $shared_extension = $fields[$idx_shared_extension];
 | 
				
			|||||||
my $ranlib = $fields[$idx_ranlib];
 | 
					my $ranlib = $fields[$idx_ranlib];
 | 
				
			||||||
my $arflags = $fields[$idx_arflags];
 | 
					my $arflags = $fields[$idx_arflags];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# '%' in $lflags is used to split flags to "pre-" and post-flags
 | 
				
			||||||
 | 
					my ($prelflags,$postlflags)=split('%',$lflags);
 | 
				
			||||||
 | 
					if (defined($postlflags))	{ $lflags=$postlflags;  }
 | 
				
			||||||
 | 
					else				{ $lflags=$prelflags; undef $prelflags; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
my $no_shared_warn=0;
 | 
					my $no_shared_warn=0;
 | 
				
			||||||
my $no_user_cflags=0;
 | 
					my $no_user_cflags=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1149,12 +1162,18 @@ if (!$IsMK1MF)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$cpuid_obj.=" uplink.o uplink-cof.o" if ($cflags =~ /\-DOPENSSL_USE_APPLINK/);
 | 
					$cpuid_obj.=" uplink.o uplink-cof.o" if ($cflags =~ /\-DOPENSSL_USE_APPLINK/);
 | 
				
			||||||
# Compiler fix-ups
 | 
					
 | 
				
			||||||
if ($target =~ /icc$/)
 | 
					#
 | 
				
			||||||
 | 
					# Platform fix-ups
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					if ($target =~ /\-icc$/)	# Intel C compiler
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	my($iccver)=`$cc -V 2>&1`;
 | 
						my $iccver=0;
 | 
				
			||||||
	if ($iccver =~ /Version ([0-9]+)\./)	{ $iccver=$1; }
 | 
						if (open(FD,"$cc -V 2>&1 |"))
 | 
				
			||||||
	else					{ $iccver=0;  }
 | 
							{
 | 
				
			||||||
 | 
							while(<FD>) { $iccver=$1 if (/Version ([0-9]+)\./); }
 | 
				
			||||||
 | 
							close(FD);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	if ($iccver>=8)
 | 
						if ($iccver>=8)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		# Eliminate unnecessary dependency from libirc.a. This is
 | 
							# Eliminate unnecessary dependency from libirc.a. This is
 | 
				
			||||||
@@ -1162,6 +1181,28 @@ if ($target =~ /icc$/)
 | 
				
			|||||||
		# apps/openssl can end up in endless loop upon startup...
 | 
							# apps/openssl can end up in endless loop upon startup...
 | 
				
			||||||
		$cflags.=" -Dmemcpy=__builtin_memcpy -Dmemset=__builtin_memset";
 | 
							$cflags.=" -Dmemcpy=__builtin_memcpy -Dmemset=__builtin_memset";
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						if ($iccver>=9)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							$cflags.=" -i-static";
 | 
				
			||||||
 | 
							$cflags=~s/\-no_cpprt/-no-cpprt/;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						if ($iccver>=10)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							$cflags=~s/\-i\-static/-static-intel/;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Unlike other OSes (like Solaris, Linux, Tru64, IRIX) BSD run-time
 | 
				
			||||||
 | 
					# linkers (tested OpenBSD, NetBSD and FreeBSD) "demand" RPATH set on
 | 
				
			||||||
 | 
					# .so objects. Apparently application RPATH is not global and does
 | 
				
			||||||
 | 
					# not apply to .so linked with other .so. Problem manifests itself
 | 
				
			||||||
 | 
					# when libssl.so fails to load libcrypto.so. One can argue that we
 | 
				
			||||||
 | 
					# should engrave this into Makefile.shared rules or into BSD-* config
 | 
				
			||||||
 | 
					# lines above. Meanwhile let's try to be cautious and pass -rpath to
 | 
				
			||||||
 | 
					# linker only when --prefix is not /usr.
 | 
				
			||||||
 | 
					if ($target =~ /^BSD\-/)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						$shared_ldflag.=" -Wl,-rpath,\$(LIBRPATH)" if ($prefix !~ m|^/usr[/]*$|);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ($sys_id ne "")
 | 
					if ($sys_id ne "")
 | 
				
			||||||
@@ -1198,7 +1239,7 @@ if ($sha1_obj =~ /\.o$/)
 | 
				
			|||||||
	$cflags.=" -DSHA1_ASM"   if ($sha1_obj =~ /sx86/ || $sha1_obj =~ /sha1/);
 | 
						$cflags.=" -DSHA1_ASM"   if ($sha1_obj =~ /sx86/ || $sha1_obj =~ /sha1/);
 | 
				
			||||||
	$cflags.=" -DSHA256_ASM" if ($sha1_obj =~ /sha256/);
 | 
						$cflags.=" -DSHA256_ASM" if ($sha1_obj =~ /sha256/);
 | 
				
			||||||
	$cflags.=" -DSHA512_ASM" if ($sha1_obj =~ /sha512/);
 | 
						$cflags.=" -DSHA512_ASM" if ($sha1_obj =~ /sha512/);
 | 
				
			||||||
	if ($sha1_obj =~ /x86/)
 | 
						if ($sha1_obj =~ /sse2/)
 | 
				
			||||||
	    {	if ($no_sse2)
 | 
						    {	if ($no_sse2)
 | 
				
			||||||
		{   $sha1_obj =~ s/\S*sse2\S+//;        }
 | 
							{   $sha1_obj =~ s/\S*sse2\S+//;        }
 | 
				
			||||||
		elsif ($cflags !~ /OPENSSL_IA32_SSE2/)
 | 
							elsif ($cflags !~ /OPENSSL_IA32_SSE2/)
 | 
				
			||||||
@@ -1293,6 +1334,7 @@ while (<IN>)
 | 
				
			|||||||
	s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $cc eq "gcc";
 | 
						s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $cc eq "gcc";
 | 
				
			||||||
	s/^CFLAG=.*$/CFLAG= $cflags/;
 | 
						s/^CFLAG=.*$/CFLAG= $cflags/;
 | 
				
			||||||
	s/^DEPFLAG=.*$/DEPFLAG= $depflags/;
 | 
						s/^DEPFLAG=.*$/DEPFLAG= $depflags/;
 | 
				
			||||||
 | 
						s/^PEX_LIBS=.*$/PEX_LIBS= $prelflags/;
 | 
				
			||||||
	s/^EX_LIBS=.*$/EX_LIBS= $lflags/;
 | 
						s/^EX_LIBS=.*$/EX_LIBS= $lflags/;
 | 
				
			||||||
	s/^EXE_EXT=.*$/EXE_EXT= $exe_ext/;
 | 
						s/^EXE_EXT=.*$/EXE_EXT= $exe_ext/;
 | 
				
			||||||
	s/^CPUID_OBJ=.*$/CPUID_OBJ= $cpuid_obj/;
 | 
						s/^CPUID_OBJ=.*$/CPUID_OBJ= $cpuid_obj/;
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										13
									
								
								FAQ
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								FAQ
									
									
									
									
									
								
							@@ -66,6 +66,7 @@ OpenSSL  -  Frequently Asked Questions
 | 
				
			|||||||
* Why doesn't my server application receive a client certificate?
 | 
					* Why doesn't my server application receive a client certificate?
 | 
				
			||||||
* Why does compilation fail due to an undefined symbol NID_uniqueIdentifier?
 | 
					* Why does compilation fail due to an undefined symbol NID_uniqueIdentifier?
 | 
				
			||||||
* I think I've detected a memory leak, is this a bug?
 | 
					* I think I've detected a memory leak, is this a bug?
 | 
				
			||||||
 | 
					* Why does Valgrind complain about the use of uninitialized data?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
===============================================================================
 | 
					===============================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -74,7 +75,7 @@ OpenSSL  -  Frequently Asked Questions
 | 
				
			|||||||
* Which is the current version of OpenSSL?
 | 
					* Which is the current version of OpenSSL?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The current version is available from <URL: http://www.openssl.org>.
 | 
					The current version is available from <URL: http://www.openssl.org>.
 | 
				
			||||||
OpenSSL 0.9.8e was released on February 23rd, 2007.
 | 
					OpenSSL 0.9.8g was released on October 19th, 2007.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
In addition to the current stable release, you can also access daily
 | 
					In addition to the current stable release, you can also access daily
 | 
				
			||||||
snapshots of the OpenSSL development version at <URL:
 | 
					snapshots of the OpenSSL development version at <URL:
 | 
				
			||||||
@@ -894,5 +895,15 @@ thread-safe):
 | 
				
			|||||||
  ERR_free_strings(), EVP_cleanup() and CRYPTO_cleanup_all_ex_data().
 | 
					  ERR_free_strings(), EVP_cleanup() and CRYPTO_cleanup_all_ex_data().
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Why does Valgrind complain about the use of uninitialized data?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					When OpenSSL's PRNG routines are called to generate random numbers the supplied
 | 
				
			||||||
 | 
					buffer contents are mixed into the entropy pool: so it technically does not
 | 
				
			||||||
 | 
					matter whether the buffer is initialized at this point or not.  Valgrind (and
 | 
				
			||||||
 | 
					other test tools) will complain about this. When using Valgrind, make sure the
 | 
				
			||||||
 | 
					OpenSSL library has been compiled with the PURIFY macro defined (-DPURIFY)
 | 
				
			||||||
 | 
					to get rid of these warnings.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
===============================================================================
 | 
					===============================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -111,7 +111,7 @@ SHLIBDIRS= crypto ssl
 | 
				
			|||||||
SDIRS=  \
 | 
					SDIRS=  \
 | 
				
			||||||
	objects \
 | 
						objects \
 | 
				
			||||||
	md2 md4 md5 sha mdc2 hmac ripemd \
 | 
						md2 md4 md5 sha mdc2 hmac ripemd \
 | 
				
			||||||
	des aes rc2 rc4 rc5 idea bf cast camellia \
 | 
						des aes rc2 rc4 rc5 idea bf cast camellia seed \
 | 
				
			||||||
	bn ec rsa dsa ecdsa dh ecdh dso engine \
 | 
						bn ec rsa dsa ecdsa dh ecdh dso engine \
 | 
				
			||||||
	buffer bio stack lhash rand err \
 | 
						buffer bio stack lhash rand err \
 | 
				
			||||||
	evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
 | 
						evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -236,24 +236,30 @@ link_o.cygwin:
 | 
				
			|||||||
	@ $(CALC_VERSIONS); \
 | 
						@ $(CALC_VERSIONS); \
 | 
				
			||||||
	INHIBIT_SYMLINKS=yes; \
 | 
						INHIBIT_SYMLINKS=yes; \
 | 
				
			||||||
	SHLIB=cyg$(LIBNAME); \
 | 
						SHLIB=cyg$(LIBNAME); \
 | 
				
			||||||
	expr $(PLATFORM) : 'mingw' > /dev/null && SHLIB=$(LIBNAME)eay32; \
 | 
						base=-Wl,--enable-auto-image-base; \
 | 
				
			||||||
 | 
						if expr $(PLATFORM) : 'mingw' > /dev/null; then \
 | 
				
			||||||
 | 
							SHLIB=$(LIBNAME)eay32; base=; \
 | 
				
			||||||
 | 
						fi; \
 | 
				
			||||||
	SHLIB_SUFFIX=.dll; \
 | 
						SHLIB_SUFFIX=.dll; \
 | 
				
			||||||
	LIBVERSION="$(LIBVERSION)"; \
 | 
						LIBVERSION="$(LIBVERSION)"; \
 | 
				
			||||||
	SHLIB_SOVER=${LIBVERSION:+"-$(LIBVERSION)"}; \
 | 
						SHLIB_SOVER=${LIBVERSION:+"-$(LIBVERSION)"}; \
 | 
				
			||||||
	ALLSYMSFLAGS='-Wl,--whole-archive'; \
 | 
						ALLSYMSFLAGS='-Wl,--whole-archive'; \
 | 
				
			||||||
	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
 | 
						NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
 | 
				
			||||||
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a"; \
 | 
						SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a"; \
 | 
				
			||||||
	$(LINK_SO_O)
 | 
						$(LINK_SO_O)
 | 
				
			||||||
link_a.cygwin:
 | 
					link_a.cygwin:
 | 
				
			||||||
	@ $(CALC_VERSIONS); \
 | 
						@ $(CALC_VERSIONS); \
 | 
				
			||||||
	INHIBIT_SYMLINKS=yes; \
 | 
						INHIBIT_SYMLINKS=yes; \
 | 
				
			||||||
	SHLIB=cyg$(LIBNAME); \
 | 
						SHLIB=cyg$(LIBNAME); \
 | 
				
			||||||
	expr $(PLATFORM) : 'mingw' > /dev/null && SHLIB=$(LIBNAME)eay32; \
 | 
						base=-Wl,--enable-auto-image-base; \
 | 
				
			||||||
 | 
						if expr $(PLATFORM) : 'mingw' > /dev/null; then \
 | 
				
			||||||
 | 
							SHLIB=$(LIBNAME)eay32; \
 | 
				
			||||||
 | 
							base=;  [ $(LIBNAME) = "crypto" ] && base=-Wl,--image-base,0x63000000; \
 | 
				
			||||||
 | 
						fi; \
 | 
				
			||||||
	SHLIB_SUFFIX=.dll; \
 | 
						SHLIB_SUFFIX=.dll; \
 | 
				
			||||||
	SHLIB_SOVER=-$(LIBVERSION); \
 | 
						SHLIB_SOVER=-$(LIBVERSION); \
 | 
				
			||||||
	ALLSYMSFLAGS='-Wl,--whole-archive'; \
 | 
						ALLSYMSFLAGS='-Wl,--whole-archive'; \
 | 
				
			||||||
	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
 | 
						NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
 | 
				
			||||||
	base=;  [ $(LIBNAME) = "crypto" ] && base=-Wl,--image-base,0x63000000; \
 | 
					 | 
				
			||||||
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a"; \
 | 
						SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a"; \
 | 
				
			||||||
	[ -f apps/$$SHLIB$$SHLIB_SUFFIX ] && rm apps/$$SHLIB$$SHLIB_SUFFIX; \
 | 
						[ -f apps/$$SHLIB$$SHLIB_SUFFIX ] && rm apps/$$SHLIB$$SHLIB_SUFFIX; \
 | 
				
			||||||
	[ -f test/$$SHLIB$$SHLIB_SUFFIX ] && rm test/$$SHLIB$$SHLIB_SUFFIX; \
 | 
						[ -f test/$$SHLIB$$SHLIB_SUFFIX ] && rm test/$$SHLIB$$SHLIB_SUFFIX; \
 | 
				
			||||||
@@ -278,7 +284,7 @@ link_o.alpha-osf1:
 | 
				
			|||||||
		SHLIB_SOVER=; \
 | 
							SHLIB_SOVER=; \
 | 
				
			||||||
		ALLSYMSFLAGS='-all'; \
 | 
							ALLSYMSFLAGS='-all'; \
 | 
				
			||||||
		NOALLSYMSFLAGS='-none'; \
 | 
							NOALLSYMSFLAGS='-none'; \
 | 
				
			||||||
		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared"; \
 | 
							SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-B,symbolic"; \
 | 
				
			||||||
		if [ -n "$$SHLIB_HIST" ]; then \
 | 
							if [ -n "$$SHLIB_HIST" ]; then \
 | 
				
			||||||
			SHAREDFLAGS="$$SHAREDFLAGS -set_version $$SHLIB_HIST"; \
 | 
								SHAREDFLAGS="$$SHAREDFLAGS -set_version $$SHLIB_HIST"; \
 | 
				
			||||||
		fi; \
 | 
							fi; \
 | 
				
			||||||
@@ -299,7 +305,7 @@ link_a.alpha-osf1:
 | 
				
			|||||||
		SHLIB_SOVER=; \
 | 
							SHLIB_SOVER=; \
 | 
				
			||||||
		ALLSYMSFLAGS='-all'; \
 | 
							ALLSYMSFLAGS='-all'; \
 | 
				
			||||||
		NOALLSYMSFLAGS='-none'; \
 | 
							NOALLSYMSFLAGS='-none'; \
 | 
				
			||||||
		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared"; \
 | 
							SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-B,symbolic"; \
 | 
				
			||||||
		if [ -n "$$SHLIB_HIST" ]; then \
 | 
							if [ -n "$$SHLIB_HIST" ]; then \
 | 
				
			||||||
			SHAREDFLAGS="$$SHAREDFLAGS -set_version $$SHLIB_HIST"; \
 | 
								SHAREDFLAGS="$$SHAREDFLAGS -set_version $$SHLIB_HIST"; \
 | 
				
			||||||
		fi; \
 | 
							fi; \
 | 
				
			||||||
@@ -422,7 +428,7 @@ link_o.irix:
 | 
				
			|||||||
		($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSWL="-Wl,"; \
 | 
							($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSWL="-Wl,"; \
 | 
				
			||||||
		ALLSYMSFLAGS="$${MINUSWL}-all"; \
 | 
							ALLSYMSFLAGS="$${MINUSWL}-all"; \
 | 
				
			||||||
		NOALLSYMSFLAGS="$${MINUSWL}-none"; \
 | 
							NOALLSYMSFLAGS="$${MINUSWL}-none"; \
 | 
				
			||||||
		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
 | 
							SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX,-B,symbolic"; \
 | 
				
			||||||
	fi; \
 | 
						fi; \
 | 
				
			||||||
	$(LINK_SO_O)
 | 
						$(LINK_SO_O)
 | 
				
			||||||
link_a.irix:
 | 
					link_a.irix:
 | 
				
			||||||
@@ -436,7 +442,7 @@ link_a.irix:
 | 
				
			|||||||
		($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSWL="-Wl,"; \
 | 
							($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSWL="-Wl,"; \
 | 
				
			||||||
		ALLSYMSFLAGS="$${MINUSWL}-all"; \
 | 
							ALLSYMSFLAGS="$${MINUSWL}-all"; \
 | 
				
			||||||
		NOALLSYMSFLAGS="$${MINUSWL}-none"; \
 | 
							NOALLSYMSFLAGS="$${MINUSWL}-none"; \
 | 
				
			||||||
		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
 | 
							SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX,-B,symbolic"; \
 | 
				
			||||||
	fi; \
 | 
						fi; \
 | 
				
			||||||
	$(LINK_SO_A)
 | 
						$(LINK_SO_A)
 | 
				
			||||||
link_app.irix:
 | 
					link_app.irix:
 | 
				
			||||||
@@ -460,7 +466,7 @@ link_o.hpux:
 | 
				
			|||||||
	ALLSYMSFLAGS='-Wl,-Fl'; \
 | 
						ALLSYMSFLAGS='-Wl,-Fl'; \
 | 
				
			||||||
	NOALLSYMSFLAGS=''; \
 | 
						NOALLSYMSFLAGS=''; \
 | 
				
			||||||
	expr $(PLATFORM) : 'hpux64' > /dev/null && ALLSYMSFLAGS='-Wl,+forceload'; \
 | 
						expr $(PLATFORM) : 'hpux64' > /dev/null && ALLSYMSFLAGS='-Wl,+forceload'; \
 | 
				
			||||||
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
 | 
						SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX,+cdp,../:,+cdp,./:"; \
 | 
				
			||||||
	fi; \
 | 
						fi; \
 | 
				
			||||||
	rm -f $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
 | 
						rm -f $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
 | 
				
			||||||
	$(LINK_SO_O) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
 | 
						$(LINK_SO_O) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
 | 
				
			||||||
@@ -473,7 +479,7 @@ link_a.hpux:
 | 
				
			|||||||
	ALLSYMSFLAGS='-Wl,-Fl'; \
 | 
						ALLSYMSFLAGS='-Wl,-Fl'; \
 | 
				
			||||||
	NOALLSYMSFLAGS=''; \
 | 
						NOALLSYMSFLAGS=''; \
 | 
				
			||||||
	expr $(PLATFORM) : 'hpux64' > /dev/null && ALLSYMSFLAGS='-Wl,+forceload'; \
 | 
						expr $(PLATFORM) : 'hpux64' > /dev/null && ALLSYMSFLAGS='-Wl,+forceload'; \
 | 
				
			||||||
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
 | 
						SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX,+cdp,../:,+cdp,./:"; \
 | 
				
			||||||
	fi; \
 | 
						fi; \
 | 
				
			||||||
	rm -f $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
 | 
						rm -f $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
 | 
				
			||||||
	$(LINK_SO_A) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
 | 
						$(LINK_SO_A) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
 | 
				
			||||||
@@ -485,26 +491,26 @@ link_app.hpux:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
link_o.aix:
 | 
					link_o.aix:
 | 
				
			||||||
	@ $(CALC_VERSIONS); \
 | 
						@ $(CALC_VERSIONS); \
 | 
				
			||||||
	OBJECT_MODE=`expr x$(SHARED_LDFLAGS) : 'x\-[a-z]\([0-9]*\)'`; \
 | 
						OBJECT_MODE=`expr x$(SHARED_LDFLAGS) : 'x\-[a-z]*\(64\)'` || :; \
 | 
				
			||||||
	OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \
 | 
						OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \
 | 
				
			||||||
	SHLIB=lib$(LIBNAME).so; \
 | 
						SHLIB=lib$(LIBNAME).so; \
 | 
				
			||||||
	SHLIB_SUFFIX=; \
 | 
						SHLIB_SUFFIX=; \
 | 
				
			||||||
	ALLSYMSFLAGS='-bnogc'; \
 | 
						ALLSYMSFLAGS=''; \
 | 
				
			||||||
	NOALLSYMSFLAGS=''; \
 | 
						NOALLSYMSFLAGS=''; \
 | 
				
			||||||
	SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -G -bE:lib$(LIBNAME).exp -bM:SRE'; \
 | 
						SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-G,-bexpall,-bnolibpath,-bM:SRE'; \
 | 
				
			||||||
	$(LINK_SO_O); rm -rf lib$(LIBNAME).exp
 | 
						$(LINK_SO_O);
 | 
				
			||||||
link_a.aix:
 | 
					link_a.aix:
 | 
				
			||||||
	@ $(CALC_VERSIONS); \
 | 
						@ $(CALC_VERSIONS); \
 | 
				
			||||||
	OBJECT_MODE=`expr x$(SHARED_LDFLAGS) : 'x\-[a-z]\([0-9]*\)'`; \
 | 
						OBJECT_MODE=`expr x$(SHARED_LDFLAGS) : 'x\-[a-z]*\(64\)'` || : ; \
 | 
				
			||||||
	OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \
 | 
						OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \
 | 
				
			||||||
	SHLIB=lib$(LIBNAME).so; \
 | 
						SHLIB=lib$(LIBNAME).so; \
 | 
				
			||||||
	SHLIB_SUFFIX=; \
 | 
						SHLIB_SUFFIX=; \
 | 
				
			||||||
	ALLSYMSFLAGS='-bnogc'; \
 | 
						ALLSYMSFLAGS='-bnogc'; \
 | 
				
			||||||
	NOALLSYMSFLAGS=''; \
 | 
						NOALLSYMSFLAGS=''; \
 | 
				
			||||||
	SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -G -bE:lib$(LIBNAME).exp -bM:SRE'; \
 | 
						SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-G,-bexpall,-bnolibpath,-bM:SRE'; \
 | 
				
			||||||
	$(LINK_SO_A_VIA_O)
 | 
						$(LINK_SO_A_VIA_O)
 | 
				
			||||||
link_app.aix:
 | 
					link_app.aix:
 | 
				
			||||||
	LDFLAGS="$(CFLAGS) -blibpath:$(LIBRPATH):$${LIBPATH:-/usr/lib:/lib}"; \
 | 
						LDFLAGS="$(CFLAGS) -Wl,-brtl,-blibpath:$(LIBRPATH):$${LIBPATH:-/usr/lib:/lib}"; \
 | 
				
			||||||
	$(LINK_APP)
 | 
						$(LINK_APP)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
link_o.reliantunix:
 | 
					link_o.reliantunix:
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										15
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								NEWS
									
									
									
									
									
								
							@@ -5,6 +5,21 @@
 | 
				
			|||||||
  This file gives a brief overview of the major changes between each OpenSSL
 | 
					  This file gives a brief overview of the major changes between each OpenSSL
 | 
				
			||||||
  release. For more details please read the CHANGES file.
 | 
					  release. For more details please read the CHANGES file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Major changes between OpenSSL 0.9.8f and OpenSSL 0.9.8g:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      o Fixes for bugs introduced with 0.9.8f.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Major changes between OpenSSL 0.9.8e and OpenSSL 0.9.8f:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      o Add gcc 4.2 support.
 | 
				
			||||||
 | 
					      o Add support for AES and SSE2 assembly lanugauge optimization
 | 
				
			||||||
 | 
					        for VC++ build.
 | 
				
			||||||
 | 
					      o Support for RFC4507bis and server name extensions if explicitly 
 | 
				
			||||||
 | 
					        selected at compile time.
 | 
				
			||||||
 | 
					      o DTLS improvements.
 | 
				
			||||||
 | 
					      o RFC4507bis support.
 | 
				
			||||||
 | 
					      o TLS Extensions support.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Major changes between OpenSSL 0.9.8d and OpenSSL 0.9.8e:
 | 
					  Major changes between OpenSSL 0.9.8d and OpenSSL 0.9.8e:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      o Various ciphersuite selection fixes.
 | 
					      o Various ciphersuite selection fixes.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								README
									
									
									
									
									
								
							@@ -1,5 +1,5 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 OpenSSL 0.9.8f-dev
 | 
					 OpenSSL 0.9.8g
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 Copyright (c) 1998-2007 The OpenSSL Project
 | 
					 Copyright (c) 1998-2007 The OpenSSL Project
 | 
				
			||||||
 Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
 | 
					 Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								STATUS
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								STATUS
									
									
									
									
									
								
							@@ -1,10 +1,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  OpenSSL STATUS                           Last modified at
 | 
					  OpenSSL STATUS                           Last modified at
 | 
				
			||||||
  ______________                           $Date: 2007/02/23 12:12:27 $
 | 
					  ______________                           $Date: 2007/10/19 08:25:14 $
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  DEVELOPMENT STATE
 | 
					  DEVELOPMENT STATE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    o  OpenSSL 0.9.9:  Under development...
 | 
					    o  OpenSSL 0.9.9:  Under development...
 | 
				
			||||||
 | 
					    o  OpenSSL 0.9.8g: Released on October   19th, 2007 
 | 
				
			||||||
 | 
					    o  OpenSSL 0.9.8f: Released on October   11th, 2007 
 | 
				
			||||||
    o  OpenSSL 0.9.8e: Released on February  23rd, 2007
 | 
					    o  OpenSSL 0.9.8e: Released on February  23rd, 2007
 | 
				
			||||||
    o  OpenSSL 0.9.8d: Released on September 28th, 2006
 | 
					    o  OpenSSL 0.9.8d: Released on September 28th, 2006
 | 
				
			||||||
    o  OpenSSL 0.9.8c: Released on September  5th, 2006
 | 
					    o  OpenSSL 0.9.8c: Released on September  5th, 2006
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										90
									
								
								TABLE
									
									
									
									
									
								
							
							
						
						
									
										90
									
								
								TABLE
									
									
									
									
									
								
							@@ -677,7 +677,7 @@ $arflags      =
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
*** aix-cc
 | 
					*** aix-cc
 | 
				
			||||||
$cc           = cc
 | 
					$cc           = cc
 | 
				
			||||||
$cflags       = -q32 -O -DB_ENDIAN -qmaxmem=16384
 | 
					$cflags       = -q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst
 | 
				
			||||||
$unistd       = 
 | 
					$unistd       = 
 | 
				
			||||||
$thread_cflag = -qthreaded
 | 
					$thread_cflag = -qthreaded
 | 
				
			||||||
$sys_id       = AIX
 | 
					$sys_id       = AIX
 | 
				
			||||||
@@ -722,12 +722,12 @@ $rc4_obj      =
 | 
				
			|||||||
$rmd160_obj   = 
 | 
					$rmd160_obj   = 
 | 
				
			||||||
$rc5_obj      = 
 | 
					$rc5_obj      = 
 | 
				
			||||||
$dso_scheme   = dlfcn
 | 
					$dso_scheme   = dlfcn
 | 
				
			||||||
$shared_target= 
 | 
					$shared_target= aix-shared
 | 
				
			||||||
$shared_cflag = 
 | 
					$shared_cflag = 
 | 
				
			||||||
$shared_ldflag = 
 | 
					$shared_ldflag = 
 | 
				
			||||||
$shared_extension = 
 | 
					$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
 | 
				
			||||||
$ranlib       = 
 | 
					$ranlib       = 
 | 
				
			||||||
$arflags      = 
 | 
					$arflags      = -X 32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
*** aix3-cc
 | 
					*** aix3-cc
 | 
				
			||||||
$cc           = cc
 | 
					$cc           = cc
 | 
				
			||||||
@@ -758,7 +758,7 @@ $arflags      =
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
*** aix64-cc
 | 
					*** aix64-cc
 | 
				
			||||||
$cc           = cc
 | 
					$cc           = cc
 | 
				
			||||||
$cflags       = -q64 -O -DB_ENDIAN -qmaxmem=16384
 | 
					$cflags       = -q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst
 | 
				
			||||||
$unistd       = 
 | 
					$unistd       = 
 | 
				
			||||||
$thread_cflag = -qthreaded
 | 
					$thread_cflag = -qthreaded
 | 
				
			||||||
$sys_id       = AIX
 | 
					$sys_id       = AIX
 | 
				
			||||||
@@ -803,10 +803,10 @@ $rc4_obj      =
 | 
				
			|||||||
$rmd160_obj   = 
 | 
					$rmd160_obj   = 
 | 
				
			||||||
$rc5_obj      = 
 | 
					$rc5_obj      = 
 | 
				
			||||||
$dso_scheme   = dlfcn
 | 
					$dso_scheme   = dlfcn
 | 
				
			||||||
$shared_target= 
 | 
					$shared_target= aix-shared
 | 
				
			||||||
$shared_cflag = 
 | 
					$shared_cflag = 
 | 
				
			||||||
$shared_ldflag = 
 | 
					$shared_ldflag = -maix64
 | 
				
			||||||
$shared_extension = 
 | 
					$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
 | 
				
			||||||
$ranlib       = 
 | 
					$ranlib       = 
 | 
				
			||||||
$arflags      = -X64
 | 
					$arflags      = -X64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -947,11 +947,11 @@ $arflags      =
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
*** darwin-i386-cc
 | 
					*** darwin-i386-cc
 | 
				
			||||||
$cc           = cc
 | 
					$cc           = cc
 | 
				
			||||||
$cflags       = -O3 -fomit-frame-pointer -fno-common
 | 
					$cflags       = -arch i386 -O3 -fomit-frame-pointer -fno-common
 | 
				
			||||||
$unistd       = 
 | 
					$unistd       = 
 | 
				
			||||||
$thread_cflag = -D_REENTRANT
 | 
					$thread_cflag = -D_REENTRANT
 | 
				
			||||||
$sys_id       = MACOSX
 | 
					$sys_id       = MACOSX
 | 
				
			||||||
$lflags       = 
 | 
					$lflags       = -Wl,-search_paths_first%
 | 
				
			||||||
$bn_ops       = BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR
 | 
					$bn_ops       = BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR
 | 
				
			||||||
$cpuid_obj    = 
 | 
					$cpuid_obj    = 
 | 
				
			||||||
$bn_obj       = 
 | 
					$bn_obj       = 
 | 
				
			||||||
@@ -967,18 +967,18 @@ $rc5_obj      =
 | 
				
			|||||||
$dso_scheme   = dlfcn
 | 
					$dso_scheme   = dlfcn
 | 
				
			||||||
$shared_target= darwin-shared
 | 
					$shared_target= darwin-shared
 | 
				
			||||||
$shared_cflag = -fPIC -fno-common
 | 
					$shared_cflag = -fPIC -fno-common
 | 
				
			||||||
$shared_ldflag = -dynamiclib
 | 
					$shared_ldflag = -arch i386 -dynamiclib
 | 
				
			||||||
$shared_extension = .$(SHLIB_MAJOR).$(SHLIB_MINOR).dylib
 | 
					$shared_extension = .$(SHLIB_MAJOR).$(SHLIB_MINOR).dylib
 | 
				
			||||||
$ranlib       = 
 | 
					$ranlib       = 
 | 
				
			||||||
$arflags      = 
 | 
					$arflags      = 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
*** darwin-ppc-cc
 | 
					*** darwin-ppc-cc
 | 
				
			||||||
$cc           = cc
 | 
					$cc           = cc
 | 
				
			||||||
$cflags       = -O3 -DB_ENDIAN
 | 
					$cflags       = -arch ppc -O3 -DB_ENDIAN
 | 
				
			||||||
$unistd       = 
 | 
					$unistd       = 
 | 
				
			||||||
$thread_cflag = -D_REENTRANT
 | 
					$thread_cflag = -D_REENTRANT
 | 
				
			||||||
$sys_id       = MACOSX
 | 
					$sys_id       = MACOSX
 | 
				
			||||||
$lflags       = -Wl,-search_paths_first
 | 
					$lflags       = -Wl,-search_paths_first%
 | 
				
			||||||
$bn_ops       = BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR
 | 
					$bn_ops       = BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR
 | 
				
			||||||
$cpuid_obj    = 
 | 
					$cpuid_obj    = 
 | 
				
			||||||
$bn_obj       = osx_ppc32.o
 | 
					$bn_obj       = osx_ppc32.o
 | 
				
			||||||
@@ -994,7 +994,61 @@ $rc5_obj      =
 | 
				
			|||||||
$dso_scheme   = dlfcn
 | 
					$dso_scheme   = dlfcn
 | 
				
			||||||
$shared_target= darwin-shared
 | 
					$shared_target= darwin-shared
 | 
				
			||||||
$shared_cflag = -fPIC -fno-common
 | 
					$shared_cflag = -fPIC -fno-common
 | 
				
			||||||
$shared_ldflag = -dynamiclib
 | 
					$shared_ldflag = -arch ppc -dynamiclib
 | 
				
			||||||
 | 
					$shared_extension = .$(SHLIB_MAJOR).$(SHLIB_MINOR).dylib
 | 
				
			||||||
 | 
					$ranlib       = 
 | 
				
			||||||
 | 
					$arflags      = 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					*** darwin64-ppc-cc
 | 
				
			||||||
 | 
					$cc           = cc
 | 
				
			||||||
 | 
					$cflags       = -arch ppc64 -O3 -DB_ENDIAN
 | 
				
			||||||
 | 
					$unistd       = 
 | 
				
			||||||
 | 
					$thread_cflag = -D_REENTRANT
 | 
				
			||||||
 | 
					$sys_id       = MACOSX
 | 
				
			||||||
 | 
					$lflags       = -Wl,-search_paths_first%
 | 
				
			||||||
 | 
					$bn_ops       = SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR
 | 
				
			||||||
 | 
					$cpuid_obj    = ppccpuid_osx64.o
 | 
				
			||||||
 | 
					$bn_obj       = osx_ppc64.o osx_ppc64-mont.o
 | 
				
			||||||
 | 
					$des_obj      = 
 | 
				
			||||||
 | 
					$aes_obj      = 
 | 
				
			||||||
 | 
					$bf_obj       = 
 | 
				
			||||||
 | 
					$md5_obj      = 
 | 
				
			||||||
 | 
					$sha1_obj     = sha1-ppc_osx64.o sha256-ppc_osx64.o sha512-ppc_osx64.o
 | 
				
			||||||
 | 
					$cast_obj     = 
 | 
				
			||||||
 | 
					$rc4_obj      = 
 | 
				
			||||||
 | 
					$rmd160_obj   = 
 | 
				
			||||||
 | 
					$rc5_obj      = 
 | 
				
			||||||
 | 
					$dso_scheme   = 
 | 
				
			||||||
 | 
					$shared_target= 
 | 
				
			||||||
 | 
					$shared_cflag = dlfcn
 | 
				
			||||||
 | 
					$shared_ldflag = darwin-shared
 | 
				
			||||||
 | 
					$shared_extension = -fPIC -fno-common
 | 
				
			||||||
 | 
					$ranlib       = -arch ppc64 -dynamiclib
 | 
				
			||||||
 | 
					$arflags      = .$(SHLIB_MAJOR).$(SHLIB_MINOR).dylib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					*** darwin64-x86_64-cc
 | 
				
			||||||
 | 
					$cc           = cc
 | 
				
			||||||
 | 
					$cflags       = -arch x86_64 -O3 -fomit-frame-pointer -DL_ENDIAN -DMD32_REG_T=int -Wall
 | 
				
			||||||
 | 
					$unistd       = 
 | 
				
			||||||
 | 
					$thread_cflag = -D_REENTRANT
 | 
				
			||||||
 | 
					$sys_id       = MACOSX
 | 
				
			||||||
 | 
					$lflags       = -Wl,-search_paths_first%
 | 
				
			||||||
 | 
					$bn_ops       = SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL
 | 
				
			||||||
 | 
					$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= darwin-shared
 | 
				
			||||||
 | 
					$shared_cflag = -fPIC -fno-common
 | 
				
			||||||
 | 
					$shared_ldflag = -arch x86_64 -dynamiclib
 | 
				
			||||||
$shared_extension = .$(SHLIB_MAJOR).$(SHLIB_MINOR).dylib
 | 
					$shared_extension = .$(SHLIB_MAJOR).$(SHLIB_MINOR).dylib
 | 
				
			||||||
$ranlib       = 
 | 
					$ranlib       = 
 | 
				
			||||||
$arflags      = 
 | 
					$arflags      = 
 | 
				
			||||||
@@ -1649,7 +1703,7 @@ $arflags      =
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
*** debug-steve
 | 
					*** debug-steve
 | 
				
			||||||
$cc           = gcc
 | 
					$cc           = gcc
 | 
				
			||||||
$cflags       = -DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -march=i486 -pedantic -Wno-long-long -Wall -Werror -Wshadow -pipe
 | 
					$cflags       = -DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -m32 -g -pedantic -Wno-long-long -Wall -Werror -Wshadow -pipe
 | 
				
			||||||
$unistd       = 
 | 
					$unistd       = 
 | 
				
			||||||
$thread_cflag = -D_REENTRANT
 | 
					$thread_cflag = -D_REENTRANT
 | 
				
			||||||
$sys_id       = 
 | 
					$sys_id       = 
 | 
				
			||||||
@@ -2351,7 +2405,7 @@ $arflags      =
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
*** irix-mips3-cc
 | 
					*** irix-mips3-cc
 | 
				
			||||||
$cc           = cc
 | 
					$cc           = cc
 | 
				
			||||||
$cflags       = -n32 -mips3 -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN -DBN_DIV3W
 | 
					$cflags       = -n32 -mips3 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W
 | 
				
			||||||
$unistd       = 
 | 
					$unistd       = 
 | 
				
			||||||
$thread_cflag = -D_SGI_MP_SOURCE
 | 
					$thread_cflag = -D_SGI_MP_SOURCE
 | 
				
			||||||
$sys_id       = 
 | 
					$sys_id       = 
 | 
				
			||||||
@@ -2405,7 +2459,7 @@ $arflags      =
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
*** irix64-mips4-cc
 | 
					*** irix64-mips4-cc
 | 
				
			||||||
$cc           = cc
 | 
					$cc           = cc
 | 
				
			||||||
$cflags       = -64 -mips4 -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN -DBN_DIV3W
 | 
					$cflags       = -64 -mips4 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W
 | 
				
			||||||
$unistd       = 
 | 
					$unistd       = 
 | 
				
			||||||
$thread_cflag = -D_SGI_MP_SOURCE
 | 
					$thread_cflag = -D_SGI_MP_SOURCE
 | 
				
			||||||
$sys_id       = 
 | 
					$sys_id       = 
 | 
				
			||||||
@@ -2926,7 +2980,7 @@ $lflags       = -ldl
 | 
				
			|||||||
$bn_ops       = SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR
 | 
					$bn_ops       = SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR
 | 
				
			||||||
$cpuid_obj    = 
 | 
					$cpuid_obj    = 
 | 
				
			||||||
$bn_obj       = 
 | 
					$bn_obj       = 
 | 
				
			||||||
$des_obj      = des_enc-sparc.o fcrypt_b.o
 | 
					$des_obj      = 
 | 
				
			||||||
$aes_obj      = 
 | 
					$aes_obj      = 
 | 
				
			||||||
$bf_obj       = 
 | 
					$bf_obj       = 
 | 
				
			||||||
$md5_obj      = md5-sparcv9.o
 | 
					$md5_obj      = md5-sparcv9.o
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -153,11 +153,7 @@ $(EXE): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL)
 | 
				
			|||||||
	shlib_target=; if [ -n "$(SHARED_LIBS)" ]; then \
 | 
						shlib_target=; if [ -n "$(SHARED_LIBS)" ]; then \
 | 
				
			||||||
		shlib_target="$(SHLIB_TARGET)"; \
 | 
							shlib_target="$(SHLIB_TARGET)"; \
 | 
				
			||||||
	fi; \
 | 
						fi; \
 | 
				
			||||||
	if [ "$${shlib_target}" = "darwin-shared" ] ; then \
 | 
						LIBRARIES="$(LIBSSL) $(LIBKRB5) $(LIBCRYPTO)" ; \
 | 
				
			||||||
	  LIBRARIES="$(DLIBSSL) $(LIBKRB5) $(DLIBCRYPTO)" ; \
 | 
					 | 
				
			||||||
	else \
 | 
					 | 
				
			||||||
	  LIBRARIES="$(LIBSSL) $(LIBKRB5) $(LIBCRYPTO)" ; \
 | 
					 | 
				
			||||||
	fi; \
 | 
					 | 
				
			||||||
	$(MAKE) -f $(TOP)/Makefile.shared -e \
 | 
						$(MAKE) -f $(TOP)/Makefile.shared -e \
 | 
				
			||||||
		APPNAME=$(EXE) OBJECTS="$(PROGRAM).o $(E_OBJ)" \
 | 
							APPNAME=$(EXE) OBJECTS="$(PROGRAM).o $(E_OBJ)" \
 | 
				
			||||||
		LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
 | 
							LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										22
									
								
								apps/dgst.c
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								apps/dgst.c
									
									
									
									
									
								
							@@ -231,29 +231,33 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		BIO_printf(bio_err,"-engine e       use engine e, possibly a hardware device.\n");
 | 
							BIO_printf(bio_err,"-engine e       use engine e, possibly a hardware device.\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		BIO_printf(bio_err,"-%3s to use the %s message digest algorithm (default)\n",
 | 
							BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm (default)\n",
 | 
				
			||||||
			LN_md5,LN_md5);
 | 
								LN_md5,LN_md5);
 | 
				
			||||||
		BIO_printf(bio_err,"-%3s to use the %s message digest algorithm\n",
 | 
							BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
 | 
				
			||||||
			LN_md4,LN_md4);
 | 
								LN_md4,LN_md4);
 | 
				
			||||||
		BIO_printf(bio_err,"-%3s to use the %s message digest algorithm\n",
 | 
							BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
 | 
				
			||||||
			LN_md2,LN_md2);
 | 
								LN_md2,LN_md2);
 | 
				
			||||||
#ifndef OPENSSL_NO_SHA
 | 
					#ifndef OPENSSL_NO_SHA
 | 
				
			||||||
		BIO_printf(bio_err,"-%3s to use the %s message digest algorithm\n",
 | 
							BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
 | 
				
			||||||
			LN_sha1,LN_sha1);
 | 
								LN_sha1,LN_sha1);
 | 
				
			||||||
		BIO_printf(bio_err,"-%3s to use the %s message digest algorithm\n",
 | 
							BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
 | 
				
			||||||
			LN_sha,LN_sha);
 | 
								LN_sha,LN_sha);
 | 
				
			||||||
#ifndef OPENSSL_NO_SHA256
 | 
					#ifndef OPENSSL_NO_SHA256
 | 
				
			||||||
		BIO_printf(bio_err,"-%3s to use the %s message digest algorithm\n",
 | 
							BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
 | 
				
			||||||
 | 
								LN_sha224,LN_sha224);
 | 
				
			||||||
 | 
							BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
 | 
				
			||||||
			LN_sha256,LN_sha256);
 | 
								LN_sha256,LN_sha256);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_SHA512
 | 
					#ifndef OPENSSL_NO_SHA512
 | 
				
			||||||
		BIO_printf(bio_err,"-%3s to use the %s message digest algorithm\n",
 | 
							BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
 | 
				
			||||||
 | 
								LN_sha384,LN_sha384);
 | 
				
			||||||
 | 
							BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
 | 
				
			||||||
			LN_sha512,LN_sha512);
 | 
								LN_sha512,LN_sha512);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
		BIO_printf(bio_err,"-%3s to use the %s message digest algorithm\n",
 | 
							BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
 | 
				
			||||||
			LN_mdc2,LN_mdc2);
 | 
								LN_mdc2,LN_mdc2);
 | 
				
			||||||
		BIO_printf(bio_err,"-%3s to use the %s message digest algorithm\n",
 | 
							BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
 | 
				
			||||||
			LN_ripemd160,LN_ripemd160);
 | 
								LN_ripemd160,LN_ripemd160);
 | 
				
			||||||
		err=1;
 | 
							err=1;
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -87,6 +87,7 @@
 | 
				
			|||||||
 * -camellia128 - encrypt output if PEM format
 | 
					 * -camellia128 - encrypt output if PEM format
 | 
				
			||||||
 * -camellia192 - encrypt output if PEM format
 | 
					 * -camellia192 - encrypt output if PEM format
 | 
				
			||||||
 * -camellia256 - encrypt output if PEM format
 | 
					 * -camellia256 - encrypt output if PEM format
 | 
				
			||||||
 | 
					 * -seed        - encrypt output if PEM format
 | 
				
			||||||
 * -text	- print a text version
 | 
					 * -text	- print a text version
 | 
				
			||||||
 * -modulus	- print the DSA public key
 | 
					 * -modulus	- print the DSA public key
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -218,6 +219,9 @@ bad:
 | 
				
			|||||||
#ifndef OPENSSL_NO_CAMELLIA
 | 
					#ifndef OPENSSL_NO_CAMELLIA
 | 
				
			||||||
		BIO_printf(bio_err," -camellia128, -camellia192, -camellia256\n");
 | 
							BIO_printf(bio_err," -camellia128, -camellia192, -camellia256\n");
 | 
				
			||||||
		BIO_printf(bio_err,"                 encrypt PEM output with cbc camellia\n");
 | 
							BIO_printf(bio_err,"                 encrypt PEM output with cbc camellia\n");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
							BIO_printf(bio_err," -seed           encrypt PEM output with cbc seed\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
		BIO_printf(bio_err," -text           print the key in text\n");
 | 
							BIO_printf(bio_err," -text           print the key in text\n");
 | 
				
			||||||
		BIO_printf(bio_err," -noout          don't print key out\n");
 | 
							BIO_printf(bio_err," -noout          don't print key out\n");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -140,6 +140,10 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		else if (strcmp(*argv,"-idea") == 0)
 | 
							else if (strcmp(*argv,"-idea") == 0)
 | 
				
			||||||
			enc=EVP_idea_cbc();
 | 
								enc=EVP_idea_cbc();
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"-seed") == 0)
 | 
				
			||||||
 | 
								enc=EVP_seed_cbc();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_AES
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
		else if (strcmp(*argv,"-aes128") == 0)
 | 
							else if (strcmp(*argv,"-aes128") == 0)
 | 
				
			||||||
			enc=EVP_aes_128_cbc();
 | 
								enc=EVP_aes_128_cbc();
 | 
				
			||||||
@@ -178,6 +182,10 @@ bad:
 | 
				
			|||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
		BIO_printf(bio_err," -idea     - encrypt the generated key with IDEA in cbc mode\n");
 | 
							BIO_printf(bio_err," -idea     - encrypt the generated key with IDEA in cbc mode\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
							BIO_printf(bio_err," -seed\n");
 | 
				
			||||||
 | 
							BIO_printf(bio_err,"                 encrypt PEM output with cbc seed\n");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_AES
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
		BIO_printf(bio_err," -aes128, -aes192, -aes256\n");
 | 
							BIO_printf(bio_err," -aes128, -aes192, -aes256\n");
 | 
				
			||||||
		BIO_printf(bio_err,"                 encrypt PEM output with cbc aes\n");
 | 
							BIO_printf(bio_err,"                 encrypt PEM output with cbc aes\n");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -160,6 +160,10 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		else if (strcmp(*argv,"-idea") == 0)
 | 
							else if (strcmp(*argv,"-idea") == 0)
 | 
				
			||||||
			enc=EVP_idea_cbc();
 | 
								enc=EVP_idea_cbc();
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"-seed") == 0)
 | 
				
			||||||
 | 
								enc=EVP_seed_cbc();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_AES
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
		else if (strcmp(*argv,"-aes128") == 0)
 | 
							else if (strcmp(*argv,"-aes128") == 0)
 | 
				
			||||||
			enc=EVP_aes_128_cbc();
 | 
								enc=EVP_aes_128_cbc();
 | 
				
			||||||
@@ -195,6 +199,10 @@ bad:
 | 
				
			|||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
		BIO_printf(bio_err," -idea           encrypt the generated key with IDEA in cbc mode\n");
 | 
							BIO_printf(bio_err," -idea           encrypt the generated key with IDEA in cbc mode\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
							BIO_printf(bio_err," -seed\n");
 | 
				
			||||||
 | 
							BIO_printf(bio_err,"                 encrypt PEM output with cbc seed\n");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_AES
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
		BIO_printf(bio_err," -aes128, -aes192, -aes256\n");
 | 
							BIO_printf(bio_err," -aes128, -aes192, -aes256\n");
 | 
				
			||||||
		BIO_printf(bio_err,"                 encrypt PEM output with cbc aes\n");
 | 
							BIO_printf(bio_err,"                 encrypt PEM output with cbc aes\n");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1227,7 +1227,7 @@ static int send_ocsp_response(BIO *cbio, OCSP_RESPONSE *resp)
 | 
				
			|||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	BIO_printf(cbio, http_resp, i2d_OCSP_RESPONSE(resp, NULL));
 | 
						BIO_printf(cbio, http_resp, i2d_OCSP_RESPONSE(resp, NULL));
 | 
				
			||||||
	i2d_OCSP_RESPONSE_bio(cbio, resp);
 | 
						i2d_OCSP_RESPONSE_bio(cbio, resp);
 | 
				
			||||||
	BIO_flush(cbio);
 | 
						(void)BIO_flush(cbio);
 | 
				
			||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -153,10 +153,13 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
    			cert_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
 | 
					    			cert_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
 | 
				
			||||||
		else if (!strcmp (*args, "-export")) export_cert = 1;
 | 
							else if (!strcmp (*args, "-export")) export_cert = 1;
 | 
				
			||||||
		else if (!strcmp (*args, "-des")) enc=EVP_des_cbc();
 | 
							else if (!strcmp (*args, "-des")) enc=EVP_des_cbc();
 | 
				
			||||||
 | 
							else if (!strcmp (*args, "-des3")) enc = EVP_des_ede3_cbc();
 | 
				
			||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
		else if (!strcmp (*args, "-idea")) enc=EVP_idea_cbc();
 | 
							else if (!strcmp (*args, "-idea")) enc=EVP_idea_cbc();
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
		else if (!strcmp (*args, "-des3")) enc = EVP_des_ede3_cbc();
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
							else if (!strcmp(*args, "-seed")) enc=EVP_seed_cbc();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_AES
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
		else if (!strcmp(*args,"-aes128")) enc=EVP_aes_128_cbc();
 | 
							else if (!strcmp(*args,"-aes128")) enc=EVP_aes_128_cbc();
 | 
				
			||||||
		else if (!strcmp(*args,"-aes192")) enc=EVP_aes_192_cbc();
 | 
							else if (!strcmp(*args,"-aes192")) enc=EVP_aes_192_cbc();
 | 
				
			||||||
@@ -306,6 +309,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
	BIO_printf (bio_err, "-idea         encrypt private keys with idea\n");
 | 
						BIO_printf (bio_err, "-idea         encrypt private keys with idea\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
						BIO_printf (bio_err, "-seed         encrypt private keys with seed\n");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_AES
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
	BIO_printf (bio_err, "-aes128, -aes192, -aes256\n");
 | 
						BIO_printf (bio_err, "-aes128, -aes192, -aes256\n");
 | 
				
			||||||
	BIO_printf (bio_err, "              encrypt PEM output with cbc aes\n");
 | 
						BIO_printf (bio_err, "              encrypt PEM output with cbc aes\n");
 | 
				
			||||||
@@ -471,7 +477,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
					X509_keyid_set1(ucert, NULL, 0);
 | 
										X509_keyid_set1(ucert, NULL, 0);
 | 
				
			||||||
					X509_alias_set1(ucert, NULL, 0);
 | 
										X509_alias_set1(ucert, NULL, 0);
 | 
				
			||||||
					/* Remove from list */
 | 
										/* Remove from list */
 | 
				
			||||||
					sk_X509_delete(certs, i);
 | 
										(void)sk_X509_delete(certs, i);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										15
									
								
								apps/progs.h
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								apps/progs.h
									
									
									
									
									
								
							@@ -197,6 +197,9 @@ FUNCTION functions[] = {
 | 
				
			|||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
	{FUNC_TYPE_CIPHER,"idea",enc_main},
 | 
						{FUNC_TYPE_CIPHER,"idea",enc_main},
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
						{FUNC_TYPE_CIPHER,"seed",enc_main},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_RC4
 | 
					#ifndef OPENSSL_NO_RC4
 | 
				
			||||||
	{FUNC_TYPE_CIPHER,"rc4",enc_main},
 | 
						{FUNC_TYPE_CIPHER,"rc4",enc_main},
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -263,6 +266,18 @@ FUNCTION functions[] = {
 | 
				
			|||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
	{FUNC_TYPE_CIPHER,"idea-ofb",enc_main},
 | 
						{FUNC_TYPE_CIPHER,"idea-ofb",enc_main},
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
						{FUNC_TYPE_CIPHER,"seed-cbc",enc_main},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
						{FUNC_TYPE_CIPHER,"seed-ecb",enc_main},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
						{FUNC_TYPE_CIPHER,"seed-cfb",enc_main},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
						{FUNC_TYPE_CIPHER,"seed-ofb",enc_main},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_RC2
 | 
					#ifndef OPENSSL_NO_RC2
 | 
				
			||||||
	{FUNC_TYPE_CIPHER,"rc2-cbc",enc_main},
 | 
						{FUNC_TYPE_CIPHER,"rc2-cbc",enc_main},
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -61,13 +61,14 @@ foreach (
 | 
				
			|||||||
	"camellia-192-cbc", "camellia-192-ecb",
 | 
						"camellia-192-cbc", "camellia-192-ecb",
 | 
				
			||||||
	"camellia-256-cbc", "camellia-256-ecb",
 | 
						"camellia-256-cbc", "camellia-256-ecb",
 | 
				
			||||||
	"base64",
 | 
						"base64",
 | 
				
			||||||
	"des", "des3", "desx", "idea", "rc4", "rc4-40",
 | 
						"des", "des3", "desx", "idea", "seed", "rc4", "rc4-40",
 | 
				
			||||||
	"rc2", "bf", "cast", "rc5",
 | 
						"rc2", "bf", "cast", "rc5",
 | 
				
			||||||
	"des-ecb", "des-ede",    "des-ede3",
 | 
						"des-ecb", "des-ede",    "des-ede3",
 | 
				
			||||||
	"des-cbc", "des-ede-cbc","des-ede3-cbc",
 | 
						"des-cbc", "des-ede-cbc","des-ede3-cbc",
 | 
				
			||||||
	"des-cfb", "des-ede-cfb","des-ede3-cfb",
 | 
						"des-cfb", "des-ede-cfb","des-ede3-cfb",
 | 
				
			||||||
	"des-ofb", "des-ede-ofb","des-ede3-ofb",
 | 
						"des-ofb", "des-ede-ofb","des-ede3-ofb",
 | 
				
			||||||
	"idea-cbc","idea-ecb",   "idea-cfb", "idea-ofb",
 | 
						"idea-cbc","idea-ecb",    "idea-cfb", "idea-ofb",
 | 
				
			||||||
 | 
						"seed-cbc","seed-ecb",    "seed-cfb", "seed-ofb",
 | 
				
			||||||
	"rc2-cbc", "rc2-ecb", "rc2-cfb","rc2-ofb", "rc2-64-cbc", "rc2-40-cbc",
 | 
						"rc2-cbc", "rc2-ecb", "rc2-cfb","rc2-ofb", "rc2-64-cbc", "rc2-40-cbc",
 | 
				
			||||||
	"bf-cbc",  "bf-ecb",     "bf-cfb",   "bf-ofb",
 | 
						"bf-cbc",  "bf-ecb",     "bf-cfb",   "bf-ofb",
 | 
				
			||||||
	"cast5-cbc","cast5-ecb", "cast5-cfb","cast5-ofb",
 | 
						"cast5-cbc","cast5-ecb", "cast5-cfb","cast5-ofb",
 | 
				
			||||||
@@ -80,6 +81,7 @@ foreach (
 | 
				
			|||||||
	elsif ($_ =~ /aes/)  { $t="#ifndef OPENSSL_NO_AES\n${t}#endif\n"; }
 | 
						elsif ($_ =~ /aes/)  { $t="#ifndef OPENSSL_NO_AES\n${t}#endif\n"; }
 | 
				
			||||||
	elsif ($_ =~ /camellia/)  { $t="#ifndef OPENSSL_NO_CAMELLIA\n${t}#endif\n"; }
 | 
						elsif ($_ =~ /camellia/)  { $t="#ifndef OPENSSL_NO_CAMELLIA\n${t}#endif\n"; }
 | 
				
			||||||
	elsif ($_ =~ /idea/) { $t="#ifndef OPENSSL_NO_IDEA\n${t}#endif\n"; }
 | 
						elsif ($_ =~ /idea/) { $t="#ifndef OPENSSL_NO_IDEA\n${t}#endif\n"; }
 | 
				
			||||||
 | 
						elsif ($_ =~ /seed/) { $t="#ifndef OPENSSL_NO_SEED\n${t}#endif\n"; }
 | 
				
			||||||
	elsif ($_ =~ /rc4/)  { $t="#ifndef OPENSSL_NO_RC4\n${t}#endif\n"; }
 | 
						elsif ($_ =~ /rc4/)  { $t="#ifndef OPENSSL_NO_RC4\n${t}#endif\n"; }
 | 
				
			||||||
	elsif ($_ =~ /rc2/)  { $t="#ifndef OPENSSL_NO_RC2\n${t}#endif\n"; }
 | 
						elsif ($_ =~ /rc2/)  { $t="#ifndef OPENSSL_NO_RC2\n${t}#endif\n"; }
 | 
				
			||||||
	elsif ($_ =~ /bf/)   { $t="#ifndef OPENSSL_NO_BF\n${t}#endif\n"; }
 | 
						elsif ($_ =~ /bf/)   { $t="#ifndef OPENSSL_NO_BF\n${t}#endif\n"; }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -213,7 +213,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		BIO_write(out, buf, chunk);
 | 
							BIO_write(out, buf, chunk);
 | 
				
			||||||
		num -= chunk;
 | 
							num -= chunk;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	app_RAND_write_file(NULL, bio_err);
 | 
						app_RAND_write_file(NULL, bio_err);
 | 
				
			||||||
	ret = 0;
 | 
						ret = 0;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -81,6 +81,7 @@
 | 
				
			|||||||
 * -des		- encrypt output if PEM format with DES in cbc mode
 | 
					 * -des		- encrypt output if PEM format with DES in cbc mode
 | 
				
			||||||
 * -des3	- encrypt output if PEM format
 | 
					 * -des3	- encrypt output if PEM format
 | 
				
			||||||
 * -idea	- encrypt output if PEM format
 | 
					 * -idea	- encrypt output if PEM format
 | 
				
			||||||
 | 
					 * -seed	- encrypt output if PEM format
 | 
				
			||||||
 * -aes128	- encrypt output if PEM format
 | 
					 * -aes128	- encrypt output if PEM format
 | 
				
			||||||
 * -aes192	- encrypt output if PEM format
 | 
					 * -aes192	- encrypt output if PEM format
 | 
				
			||||||
 * -aes256	- encrypt output if PEM format
 | 
					 * -aes256	- encrypt output if PEM format
 | 
				
			||||||
@@ -211,6 +212,9 @@ bad:
 | 
				
			|||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
		BIO_printf(bio_err," -idea           encrypt PEM output with cbc idea\n");
 | 
							BIO_printf(bio_err," -idea           encrypt PEM output with cbc idea\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
							BIO_printf(bio_err," -seed           encrypt PEM output with cbc seed\n");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_AES
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
		BIO_printf(bio_err," -aes128, -aes192, -aes256\n");
 | 
							BIO_printf(bio_err," -aes128, -aes192, -aes256\n");
 | 
				
			||||||
		BIO_printf(bio_err,"                 encrypt PEM output with cbc aes\n");
 | 
							BIO_printf(bio_err,"                 encrypt PEM output with cbc aes\n");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -167,4 +167,7 @@ long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
 | 
				
			|||||||
#ifdef HEADER_SSL_H
 | 
					#ifdef HEADER_SSL_H
 | 
				
			||||||
void MS_CALLBACK apps_ssl_info_callback(const SSL *s, int where, int ret);
 | 
					void MS_CALLBACK apps_ssl_info_callback(const SSL *s, int where, int ret);
 | 
				
			||||||
void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg);
 | 
					void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg);
 | 
				
			||||||
 | 
					void MS_CALLBACK tlsext_cb(SSL *s, int client_server, int type,
 | 
				
			||||||
 | 
										unsigned char *data, int len,
 | 
				
			||||||
 | 
										void *arg);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										61
									
								
								apps/s_cb.c
									
									
									
									
									
								
							
							
						
						
									
										61
									
								
								apps/s_cb.c
									
									
									
									
									
								
							@@ -573,5 +573,64 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *
 | 
				
			|||||||
			BIO_printf(bio, " ...");
 | 
								BIO_printf(bio, " ...");
 | 
				
			||||||
		BIO_printf(bio, "\n");
 | 
							BIO_printf(bio, "\n");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	BIO_flush(bio);
 | 
						(void)BIO_flush(bio);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void MS_CALLBACK tlsext_cb(SSL *s, int client_server, int type,
 | 
				
			||||||
 | 
										unsigned char *data, int len,
 | 
				
			||||||
 | 
										void *arg)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						BIO *bio = arg;
 | 
				
			||||||
 | 
						char *extname;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						switch(type)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							case TLSEXT_TYPE_server_name:
 | 
				
			||||||
 | 
							extname = "server name";
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							case TLSEXT_TYPE_max_fragment_length:
 | 
				
			||||||
 | 
							extname = "max fragment length";
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							case TLSEXT_TYPE_client_certificate_url:
 | 
				
			||||||
 | 
							extname = "client certificate URL";
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							case TLSEXT_TYPE_trusted_ca_keys:
 | 
				
			||||||
 | 
							extname = "trusted CA keys";
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							case TLSEXT_TYPE_truncated_hmac:
 | 
				
			||||||
 | 
							extname = "truncated HMAC";
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							case TLSEXT_TYPE_status_request:
 | 
				
			||||||
 | 
							extname = "status request";
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							case TLSEXT_TYPE_elliptic_curves:
 | 
				
			||||||
 | 
							extname = "elliptic curves";
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							case TLSEXT_TYPE_ec_point_formats:
 | 
				
			||||||
 | 
							extname = "EC point formats";
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							case TLSEXT_TYPE_session_ticket:
 | 
				
			||||||
 | 
							extname = "server ticket";
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							default:
 | 
				
			||||||
 | 
							extname = "unknown";
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						BIO_printf(bio, "TLS %s extension \"%s\" (id=%d), len=%d\n",
 | 
				
			||||||
 | 
								client_server ? "server": "client",
 | 
				
			||||||
 | 
								extname, type, len);
 | 
				
			||||||
 | 
						BIO_dump(bio, (char *)data, len);
 | 
				
			||||||
 | 
						(void)BIO_flush(bio);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										140
									
								
								apps/s_client.c
									
									
									
									
									
								
							
							
						
						
									
										140
									
								
								apps/s_client.c
									
									
									
									
									
								
							@@ -171,6 +171,9 @@ static int c_nbio=0;
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
static int c_Pause=0;
 | 
					static int c_Pause=0;
 | 
				
			||||||
static int c_debug=0;
 | 
					static int c_debug=0;
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
					static int c_tlsextdebug=0;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
static int c_msg=0;
 | 
					static int c_msg=0;
 | 
				
			||||||
static int c_showcerts=0;
 | 
					static int c_showcerts=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -231,9 +234,36 @@ static void sc_usage(void)
 | 
				
			|||||||
	BIO_printf(bio_err," -engine id    - Initialise and use the specified engine\n");
 | 
						BIO_printf(bio_err," -engine id    - Initialise and use the specified engine\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
 | 
						BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
 | 
				
			||||||
 | 
						BIO_printf(bio_err," -sess_out arg - file to write SSL session to\n");
 | 
				
			||||||
 | 
						BIO_printf(bio_err," -sess_in arg  - file to read SSL session from\n");
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
						BIO_printf(bio_err," -servername host  - Set TLS extension servername in ClientHello\n");
 | 
				
			||||||
 | 
						BIO_printf(bio_err," -tlsextdebug      - hex dump of all TLS extensions received\n");
 | 
				
			||||||
 | 
						BIO_printf(bio_err," -no_ticket        - disable use of RFC4507bis session tickets\n");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* This is a context that we pass to callbacks */
 | 
				
			||||||
 | 
					typedef struct tlsextctx_st {
 | 
				
			||||||
 | 
					   BIO * biodebug;
 | 
				
			||||||
 | 
					   int ack;
 | 
				
			||||||
 | 
					} tlsextctx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int MS_CALLBACK ssl_servername_cb(SSL *s, int *ad, void *arg)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						tlsextctx * p = (tlsextctx *) arg;
 | 
				
			||||||
 | 
						const char * hn= SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
 | 
				
			||||||
 | 
						if (SSL_get_servername_type(s) != -1) 
 | 
				
			||||||
 | 
					 	        p->ack = !SSL_session_reused(s) && hn != NULL;
 | 
				
			||||||
 | 
						else 
 | 
				
			||||||
 | 
							BIO_printf(bio_err,"Can't use SSL_get_servername\n");
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						return SSL_TLSEXT_ERR_OK;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
enum
 | 
					enum
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	PROTO_OFF	= 0,
 | 
						PROTO_OFF	= 0,
 | 
				
			||||||
@@ -287,6 +317,13 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	struct timeval tv;
 | 
						struct timeval tv;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
						char *servername = NULL; 
 | 
				
			||||||
 | 
					        tlsextctx tlsextcbp = 
 | 
				
			||||||
 | 
					        {NULL,0};
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
						char *sess_in = NULL;
 | 
				
			||||||
 | 
						char *sess_out = NULL;
 | 
				
			||||||
	struct sockaddr peer;
 | 
						struct sockaddr peer;
 | 
				
			||||||
	int peerlen = sizeof(peer);
 | 
						int peerlen = sizeof(peer);
 | 
				
			||||||
	int enable_timeouts = 0 ;
 | 
						int enable_timeouts = 0 ;
 | 
				
			||||||
@@ -361,6 +398,16 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			if (--argc < 1) goto bad;
 | 
								if (--argc < 1) goto bad;
 | 
				
			||||||
			cert_file= *(++argv);
 | 
								cert_file= *(++argv);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							else if	(strcmp(*argv,"-sess_out") == 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (--argc < 1) goto bad;
 | 
				
			||||||
 | 
								sess_out = *(++argv);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							else if	(strcmp(*argv,"-sess_in") == 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (--argc < 1) goto bad;
 | 
				
			||||||
 | 
								sess_in = *(++argv);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		else if	(strcmp(*argv,"-certform") == 0)
 | 
							else if	(strcmp(*argv,"-certform") == 0)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			if (--argc < 1) goto bad;
 | 
								if (--argc < 1) goto bad;
 | 
				
			||||||
@@ -385,6 +432,10 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			c_Pause=1;
 | 
								c_Pause=1;
 | 
				
			||||||
		else if	(strcmp(*argv,"-debug") == 0)
 | 
							else if	(strcmp(*argv,"-debug") == 0)
 | 
				
			||||||
			c_debug=1;
 | 
								c_debug=1;
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
							else if	(strcmp(*argv,"-tlsextdebug") == 0)
 | 
				
			||||||
 | 
								c_tlsextdebug=1;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifdef WATT32
 | 
					#ifdef WATT32
 | 
				
			||||||
		else if (strcmp(*argv,"-wdebug") == 0)
 | 
							else if (strcmp(*argv,"-wdebug") == 0)
 | 
				
			||||||
			dbug_init();
 | 
								dbug_init();
 | 
				
			||||||
@@ -460,6 +511,10 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			off|=SSL_OP_NO_SSLv3;
 | 
								off|=SSL_OP_NO_SSLv3;
 | 
				
			||||||
		else if (strcmp(*argv,"-no_ssl2") == 0)
 | 
							else if (strcmp(*argv,"-no_ssl2") == 0)
 | 
				
			||||||
			off|=SSL_OP_NO_SSLv2;
 | 
								off|=SSL_OP_NO_SSLv2;
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
							else if	(strcmp(*argv,"-no_ticket") == 0)
 | 
				
			||||||
 | 
								{ off|=SSL_OP_NO_TICKET; }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		else if (strcmp(*argv,"-serverpref") == 0)
 | 
							else if (strcmp(*argv,"-serverpref") == 0)
 | 
				
			||||||
			off|=SSL_OP_CIPHER_SERVER_PREFERENCE;
 | 
								off|=SSL_OP_CIPHER_SERVER_PREFERENCE;
 | 
				
			||||||
		else if	(strcmp(*argv,"-cipher") == 0)
 | 
							else if	(strcmp(*argv,"-cipher") == 0)
 | 
				
			||||||
@@ -498,6 +553,14 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			if (--argc < 1) goto bad;
 | 
								if (--argc < 1) goto bad;
 | 
				
			||||||
			inrand= *(++argv);
 | 
								inrand= *(++argv);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"-servername") == 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (--argc < 1) goto bad;
 | 
				
			||||||
 | 
								servername= *(++argv);
 | 
				
			||||||
 | 
								/* meth=TLSv1_client_method(); */
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			BIO_printf(bio_err,"unknown option %s\n",*argv);
 | 
								BIO_printf(bio_err,"unknown option %s\n",*argv);
 | 
				
			||||||
@@ -621,8 +684,51 @@ bad:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	store = SSL_CTX_get_cert_store(ctx);
 | 
						store = SSL_CTX_get_cert_store(ctx);
 | 
				
			||||||
	X509_STORE_set_flags(store, vflags);
 | 
						X509_STORE_set_flags(store, vflags);
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
						if (servername != NULL)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							tlsextcbp.biodebug = bio_err;
 | 
				
			||||||
 | 
							SSL_CTX_set_tlsext_servername_callback(ctx, ssl_servername_cb);
 | 
				
			||||||
 | 
							SSL_CTX_set_tlsext_servername_arg(ctx, &tlsextcbp);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	con=SSL_new(ctx);
 | 
						con=SSL_new(ctx);
 | 
				
			||||||
 | 
						if (sess_in)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							SSL_SESSION *sess;
 | 
				
			||||||
 | 
							BIO *stmp = BIO_new_file(sess_in, "r");
 | 
				
			||||||
 | 
							if (!stmp)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(bio_err, "Can't open session file %s\n",
 | 
				
			||||||
 | 
											sess_in);
 | 
				
			||||||
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
 | 
								goto end;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							sess = PEM_read_bio_SSL_SESSION(stmp, NULL, 0, NULL);
 | 
				
			||||||
 | 
							BIO_free(stmp);
 | 
				
			||||||
 | 
							if (!sess)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(bio_err, "Can't open session file %s\n",
 | 
				
			||||||
 | 
											sess_in);
 | 
				
			||||||
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
 | 
								goto end;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							SSL_set_session(con, sess);
 | 
				
			||||||
 | 
							SSL_SESSION_free(sess);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
						if (servername != NULL)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							if (!SSL_set_tlsext_host_name(con,servername))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(bio_err,"Unable to set TLS servername extension.\n");
 | 
				
			||||||
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
 | 
								goto end;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef OPENSSL_NO_KRB5
 | 
					#ifndef OPENSSL_NO_KRB5
 | 
				
			||||||
	if (con  &&  (con->kssl_ctx = kssl_ctx_new()) != NULL)
 | 
						if (con  &&  (con->kssl_ctx = kssl_ctx_new()) != NULL)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
@@ -668,7 +774,7 @@ re_start:
 | 
				
			|||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		BIO_ctrl_set_connected(sbio, 1, &peer);
 | 
							(void)BIO_ctrl_set_connected(sbio, 1, &peer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ( enable_timeouts)
 | 
							if ( enable_timeouts)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -714,6 +820,13 @@ re_start:
 | 
				
			|||||||
		SSL_set_msg_callback(con, msg_cb);
 | 
							SSL_set_msg_callback(con, msg_cb);
 | 
				
			||||||
		SSL_set_msg_callback_arg(con, bio_c_out);
 | 
							SSL_set_msg_callback_arg(con, bio_c_out);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
						if (c_tlsextdebug)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							SSL_set_tlsext_debug_callback(con, tlsext_cb);
 | 
				
			||||||
 | 
							SSL_set_tlsext_debug_arg(con, bio_c_out);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SSL_set_bio(con,sbio,sbio);
 | 
						SSL_set_bio(con,sbio,sbio);
 | 
				
			||||||
	SSL_set_connect_state(con);
 | 
						SSL_set_connect_state(con);
 | 
				
			||||||
@@ -752,7 +865,7 @@ re_start:
 | 
				
			|||||||
		while (mbuf_len>3 && mbuf[3]=='-');
 | 
							while (mbuf_len>3 && mbuf[3]=='-');
 | 
				
			||||||
		/* STARTTLS command requires EHLO... */
 | 
							/* STARTTLS command requires EHLO... */
 | 
				
			||||||
		BIO_printf(fbio,"EHLO openssl.client.net\r\n");
 | 
							BIO_printf(fbio,"EHLO openssl.client.net\r\n");
 | 
				
			||||||
		BIO_flush(fbio);
 | 
							(void)BIO_flush(fbio);
 | 
				
			||||||
		/* wait for multi-line response to end EHLO SMTP response */
 | 
							/* wait for multi-line response to end EHLO SMTP response */
 | 
				
			||||||
		do
 | 
							do
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -761,7 +874,7 @@ re_start:
 | 
				
			|||||||
				foundit=1;
 | 
									foundit=1;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		while (mbuf_len>3 && mbuf[3]=='-');
 | 
							while (mbuf_len>3 && mbuf[3]=='-');
 | 
				
			||||||
		BIO_flush(fbio);
 | 
							(void)BIO_flush(fbio);
 | 
				
			||||||
		BIO_pop(fbio);
 | 
							BIO_pop(fbio);
 | 
				
			||||||
		BIO_free(fbio);
 | 
							BIO_free(fbio);
 | 
				
			||||||
		if (!foundit)
 | 
							if (!foundit)
 | 
				
			||||||
@@ -785,7 +898,7 @@ re_start:
 | 
				
			|||||||
		BIO_gets(fbio,mbuf,BUFSIZZ);
 | 
							BIO_gets(fbio,mbuf,BUFSIZZ);
 | 
				
			||||||
		/* STARTTLS command requires CAPABILITY... */
 | 
							/* STARTTLS command requires CAPABILITY... */
 | 
				
			||||||
		BIO_printf(fbio,". CAPABILITY\r\n");
 | 
							BIO_printf(fbio,". CAPABILITY\r\n");
 | 
				
			||||||
		BIO_flush(fbio);
 | 
							(void)BIO_flush(fbio);
 | 
				
			||||||
		/* wait for multi-line CAPABILITY response */
 | 
							/* wait for multi-line CAPABILITY response */
 | 
				
			||||||
		do
 | 
							do
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -794,7 +907,7 @@ re_start:
 | 
				
			|||||||
				foundit=1;
 | 
									foundit=1;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		while (mbuf_len>3 && mbuf[0]!='.');
 | 
							while (mbuf_len>3 && mbuf[0]!='.');
 | 
				
			||||||
		BIO_flush(fbio);
 | 
							(void)BIO_flush(fbio);
 | 
				
			||||||
		BIO_pop(fbio);
 | 
							BIO_pop(fbio);
 | 
				
			||||||
		BIO_free(fbio);
 | 
							BIO_free(fbio);
 | 
				
			||||||
		if (!foundit)
 | 
							if (!foundit)
 | 
				
			||||||
@@ -814,7 +927,7 @@ re_start:
 | 
				
			|||||||
			mbuf_len = BIO_gets(fbio,mbuf,BUFSIZZ);
 | 
								mbuf_len = BIO_gets(fbio,mbuf,BUFSIZZ);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		while (mbuf_len>3 && mbuf[3]=='-');
 | 
							while (mbuf_len>3 && mbuf[3]=='-');
 | 
				
			||||||
		BIO_flush(fbio);
 | 
							(void)BIO_flush(fbio);
 | 
				
			||||||
		BIO_pop(fbio);
 | 
							BIO_pop(fbio);
 | 
				
			||||||
		BIO_free(fbio);
 | 
							BIO_free(fbio);
 | 
				
			||||||
		BIO_printf(sbio,"AUTH TLS\r\n");
 | 
							BIO_printf(sbio,"AUTH TLS\r\n");
 | 
				
			||||||
@@ -837,6 +950,17 @@ re_start:
 | 
				
			|||||||
			if (in_init)
 | 
								if (in_init)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
				in_init=0;
 | 
									in_init=0;
 | 
				
			||||||
 | 
									if (sess_out)
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
										BIO *stmp = BIO_new_file(sess_out, "w");
 | 
				
			||||||
 | 
										if (stmp)
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
											PEM_write_bio_SSL_SESSION(stmp, SSL_get_session(con));
 | 
				
			||||||
 | 
											BIO_free(stmp);
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
										else 
 | 
				
			||||||
 | 
											BIO_printf(bio_err, "Error writing session file %s\n", sess_out);
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
				print_stuff(bio_c_out,con,full_log);
 | 
									print_stuff(bio_c_out,con,full_log);
 | 
				
			||||||
				if (full_log > 0) full_log--;
 | 
									if (full_log > 0) full_log--;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1303,6 +1427,6 @@ static void print_stuff(BIO *bio, SSL *s, int full)
 | 
				
			|||||||
	if (peer != NULL)
 | 
						if (peer != NULL)
 | 
				
			||||||
		X509_free(peer);
 | 
							X509_free(peer);
 | 
				
			||||||
	/* flush, or debugging output gets mixed with http response */
 | 
						/* flush, or debugging output gets mixed with http response */
 | 
				
			||||||
	BIO_flush(bio);
 | 
						(void)BIO_flush(bio);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										296
									
								
								apps/s_server.c
									
									
									
									
									
								
							
							
						
						
									
										296
									
								
								apps/s_server.c
									
									
									
									
									
								
							@@ -238,6 +238,9 @@ static int bufsize=BUFSIZZ;
 | 
				
			|||||||
static int accept_socket= -1;
 | 
					static int accept_socket= -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define TEST_CERT	"server.pem"
 | 
					#define TEST_CERT	"server.pem"
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
					#define TEST_CERT2	"server2.pem"
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#undef PROG
 | 
					#undef PROG
 | 
				
			||||||
#define PROG		s_server_main
 | 
					#define PROG		s_server_main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -247,6 +250,9 @@ static char *cipher=NULL;
 | 
				
			|||||||
static int s_server_verify=SSL_VERIFY_NONE;
 | 
					static int s_server_verify=SSL_VERIFY_NONE;
 | 
				
			||||||
static int s_server_session_id_context = 1; /* anything will do */
 | 
					static int s_server_session_id_context = 1; /* anything will do */
 | 
				
			||||||
static const char *s_cert_file=TEST_CERT,*s_key_file=NULL;
 | 
					static const char *s_cert_file=TEST_CERT,*s_key_file=NULL;
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
					static const char *s_cert_file2=TEST_CERT2,*s_key_file2=NULL;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
static char *s_dcert_file=NULL,*s_dkey_file=NULL;
 | 
					static char *s_dcert_file=NULL,*s_dkey_file=NULL;
 | 
				
			||||||
#ifdef FIONBIO
 | 
					#ifdef FIONBIO
 | 
				
			||||||
static int s_nbio=0;
 | 
					static int s_nbio=0;
 | 
				
			||||||
@@ -254,10 +260,16 @@ static int s_nbio=0;
 | 
				
			|||||||
static int s_nbio_test=0;
 | 
					static int s_nbio_test=0;
 | 
				
			||||||
int s_crlf=0;
 | 
					int s_crlf=0;
 | 
				
			||||||
static SSL_CTX *ctx=NULL;
 | 
					static SSL_CTX *ctx=NULL;
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
					static SSL_CTX *ctx2=NULL;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
static int www=0;
 | 
					static int www=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static BIO *bio_s_out=NULL;
 | 
					static BIO *bio_s_out=NULL;
 | 
				
			||||||
static int s_debug=0;
 | 
					static int s_debug=0;
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
					static int s_tlsextdebug=0;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
static int s_msg=0;
 | 
					static int s_msg=0;
 | 
				
			||||||
static int s_quiet=0;
 | 
					static int s_quiet=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -285,6 +297,11 @@ static void s_server_init(void)
 | 
				
			|||||||
	s_dkey_file=NULL;
 | 
						s_dkey_file=NULL;
 | 
				
			||||||
	s_cert_file=TEST_CERT;
 | 
						s_cert_file=TEST_CERT;
 | 
				
			||||||
	s_key_file=NULL;
 | 
						s_key_file=NULL;
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
						s_cert_file2=TEST_CERT2;
 | 
				
			||||||
 | 
						s_key_file2=NULL;
 | 
				
			||||||
 | 
						ctx2=NULL;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifdef FIONBIO
 | 
					#ifdef FIONBIO
 | 
				
			||||||
	s_nbio=0;
 | 
						s_nbio=0;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -371,6 +388,16 @@ static void sv_usage(void)
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
	BIO_printf(bio_err," -id_prefix arg - Generate SSL/TLS session IDs prefixed by 'arg'\n");
 | 
						BIO_printf(bio_err," -id_prefix arg - Generate SSL/TLS session IDs prefixed by 'arg'\n");
 | 
				
			||||||
	BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
 | 
						BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
						BIO_printf(bio_err," -servername host - servername for HostName TLS extension\n");
 | 
				
			||||||
 | 
						BIO_printf(bio_err," -servername_fatal - on mismatch send fatal alert (default warning alert)\n");
 | 
				
			||||||
 | 
						BIO_printf(bio_err," -cert2 arg    - certificate file to use for servername\n");
 | 
				
			||||||
 | 
						BIO_printf(bio_err,"                 (default is %s)\n",TEST_CERT2);
 | 
				
			||||||
 | 
						BIO_printf(bio_err," -key2 arg     - Private Key file to use for servername, in cert file if\n");
 | 
				
			||||||
 | 
						BIO_printf(bio_err,"                 not specified (default is %s)\n",TEST_CERT2);
 | 
				
			||||||
 | 
						BIO_printf(bio_err," -tlsextdebug  - hex dump of all TLS extensions received\n");
 | 
				
			||||||
 | 
						BIO_printf(bio_err," -no_ticket    - disable use of RFC4507bis session tickets\n");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int local_argc=0;
 | 
					static int local_argc=0;
 | 
				
			||||||
@@ -526,6 +553,39 @@ static int ebcdic_puts(BIO *bp, const char *str)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* This is a context that we pass to callbacks */
 | 
				
			||||||
 | 
					typedef struct tlsextctx_st {
 | 
				
			||||||
 | 
					   char * servername;
 | 
				
			||||||
 | 
					   BIO * biodebug;
 | 
				
			||||||
 | 
					   int extension_error;
 | 
				
			||||||
 | 
					} tlsextctx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int MS_CALLBACK ssl_servername_cb(SSL *s, int *ad, void *arg)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						tlsextctx * p = (tlsextctx *) arg;
 | 
				
			||||||
 | 
						const char * servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
 | 
				
			||||||
 | 
					        if (servername && p->biodebug) 
 | 
				
			||||||
 | 
							BIO_printf(p->biodebug,"Hostname in TLS extension: \"%s\"\n",servername);
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
						if (!p->servername)
 | 
				
			||||||
 | 
							return SSL_TLSEXT_ERR_NOACK;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (servername)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
					    		if (strcmp(servername,p->servername)) 
 | 
				
			||||||
 | 
								return p->extension_error;
 | 
				
			||||||
 | 
							if (ctx2)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(p->biodebug,"Swiching server context.\n");
 | 
				
			||||||
 | 
								SSL_set_SSL_CTX(s,ctx2);
 | 
				
			||||||
 | 
								}     
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						return SSL_TLSEXT_ERR_OK;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
int MAIN(int, char **);
 | 
					int MAIN(int, char **);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int MAIN(int argc, char *argv[])
 | 
					int MAIN(int argc, char *argv[])
 | 
				
			||||||
@@ -545,10 +605,7 @@ int MAIN(int argc, char *argv[])
 | 
				
			|||||||
	int no_tmp_rsa=0,no_dhe=0,no_ecdhe=0,nocert=0;
 | 
						int no_tmp_rsa=0,no_dhe=0,no_ecdhe=0,nocert=0;
 | 
				
			||||||
	int state=0;
 | 
						int state=0;
 | 
				
			||||||
	SSL_METHOD *meth=NULL;
 | 
						SSL_METHOD *meth=NULL;
 | 
				
			||||||
#ifdef sock_type
 | 
					        int socket_type=SOCK_STREAM;
 | 
				
			||||||
#undef sock_type
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    int sock_type=SOCK_STREAM;
 | 
					 | 
				
			||||||
#ifndef OPENSSL_NO_ENGINE
 | 
					#ifndef OPENSSL_NO_ENGINE
 | 
				
			||||||
	ENGINE *e=NULL;
 | 
						ENGINE *e=NULL;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -559,6 +616,14 @@ int MAIN(int argc, char *argv[])
 | 
				
			|||||||
	int s_dcert_format = FORMAT_PEM, s_dkey_format = FORMAT_PEM;
 | 
						int s_dcert_format = FORMAT_PEM, s_dkey_format = FORMAT_PEM;
 | 
				
			||||||
	X509 *s_cert = NULL, *s_dcert = NULL;
 | 
						X509 *s_cert = NULL, *s_dcert = NULL;
 | 
				
			||||||
	EVP_PKEY *s_key = NULL, *s_dkey = NULL;
 | 
						EVP_PKEY *s_key = NULL, *s_dkey = NULL;
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
						EVP_PKEY *s_key2 = NULL;
 | 
				
			||||||
 | 
						X509 *s_cert2 = NULL;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
					        tlsextctx tlsextcbp = {NULL, NULL, SSL_TLSEXT_ERR_ALERT_WARNING};
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3)
 | 
					#if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3)
 | 
				
			||||||
	meth=SSLv23_server_method();
 | 
						meth=SSLv23_server_method();
 | 
				
			||||||
@@ -724,6 +789,10 @@ int MAIN(int argc, char *argv[])
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		else if	(strcmp(*argv,"-debug") == 0)
 | 
							else if	(strcmp(*argv,"-debug") == 0)
 | 
				
			||||||
			{ s_debug=1; }
 | 
								{ s_debug=1; }
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
							else if	(strcmp(*argv,"-tlsextdebug") == 0)
 | 
				
			||||||
 | 
								s_tlsextdebug=1;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		else if	(strcmp(*argv,"-msg") == 0)
 | 
							else if	(strcmp(*argv,"-msg") == 0)
 | 
				
			||||||
			{ s_msg=1; }
 | 
								{ s_msg=1; }
 | 
				
			||||||
		else if	(strcmp(*argv,"-hack") == 0)
 | 
							else if	(strcmp(*argv,"-hack") == 0)
 | 
				
			||||||
@@ -754,6 +823,10 @@ int MAIN(int argc, char *argv[])
 | 
				
			|||||||
			{ off|=SSL_OP_NO_SSLv3; }
 | 
								{ off|=SSL_OP_NO_SSLv3; }
 | 
				
			||||||
		else if	(strcmp(*argv,"-no_tls1") == 0)
 | 
							else if	(strcmp(*argv,"-no_tls1") == 0)
 | 
				
			||||||
			{ off|=SSL_OP_NO_TLSv1; }
 | 
								{ off|=SSL_OP_NO_TLSv1; }
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
							else if	(strcmp(*argv,"-no_ticket") == 0)
 | 
				
			||||||
 | 
								{ off|=SSL_OP_NO_TICKET; }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_SSL2
 | 
					#ifndef OPENSSL_NO_SSL2
 | 
				
			||||||
		else if	(strcmp(*argv,"-ssl2") == 0)
 | 
							else if	(strcmp(*argv,"-ssl2") == 0)
 | 
				
			||||||
			{ meth=SSLv2_server_method(); }
 | 
								{ meth=SSLv2_server_method(); }
 | 
				
			||||||
@@ -770,7 +843,7 @@ int MAIN(int argc, char *argv[])
 | 
				
			|||||||
		else if	(strcmp(*argv,"-dtls1") == 0)
 | 
							else if	(strcmp(*argv,"-dtls1") == 0)
 | 
				
			||||||
			{ 
 | 
								{ 
 | 
				
			||||||
			meth=DTLSv1_server_method();
 | 
								meth=DTLSv1_server_method();
 | 
				
			||||||
			sock_type = SOCK_DGRAM;
 | 
								socket_type = SOCK_DGRAM;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		else if (strcmp(*argv,"-timeout") == 0)
 | 
							else if (strcmp(*argv,"-timeout") == 0)
 | 
				
			||||||
			enable_timeouts = 1;
 | 
								enable_timeouts = 1;
 | 
				
			||||||
@@ -799,6 +872,25 @@ int MAIN(int argc, char *argv[])
 | 
				
			|||||||
			if (--argc < 1) goto bad;
 | 
								if (--argc < 1) goto bad;
 | 
				
			||||||
			inrand= *(++argv);
 | 
								inrand= *(++argv);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"-servername") == 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (--argc < 1) goto bad;
 | 
				
			||||||
 | 
								tlsextcbp.servername= *(++argv);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"-servername_fatal") == 0)
 | 
				
			||||||
 | 
								{ tlsextcbp.extension_error = SSL_TLSEXT_ERR_ALERT_FATAL; }
 | 
				
			||||||
 | 
							else if	(strcmp(*argv,"-cert2") == 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (--argc < 1) goto bad;
 | 
				
			||||||
 | 
								s_cert_file2= *(++argv);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							else if	(strcmp(*argv,"-key2") == 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (--argc < 1) goto bad;
 | 
				
			||||||
 | 
								s_key_file2= *(++argv);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			BIO_printf(bio_err,"unknown option %s\n",*argv);
 | 
								BIO_printf(bio_err,"unknown option %s\n",*argv);
 | 
				
			||||||
@@ -831,6 +923,10 @@ bad:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (s_key_file == NULL)
 | 
						if (s_key_file == NULL)
 | 
				
			||||||
		s_key_file = s_cert_file;
 | 
							s_key_file = s_cert_file;
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
						if (s_key_file2 == NULL)
 | 
				
			||||||
 | 
							s_key_file2 = s_cert_file2;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (nocert == 0)
 | 
						if (nocert == 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -850,8 +946,29 @@ bad:
 | 
				
			|||||||
			ERR_print_errors(bio_err);
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
							if (tlsextcbp.servername) 
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								s_key2 = load_key(bio_err, s_key_file2, s_key_format, 0, pass, e,
 | 
				
			||||||
 | 
									"second server certificate private key file");
 | 
				
			||||||
 | 
								if (!s_key2)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									ERR_print_errors(bio_err);
 | 
				
			||||||
 | 
									goto end;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
								s_cert2 = load_cert(bio_err,s_cert_file2,s_cert_format,
 | 
				
			||||||
 | 
									NULL, e, "second server certificate file");
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
								if (!s_cert2)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									ERR_print_errors(bio_err);
 | 
				
			||||||
 | 
									goto end;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	if (s_dcert_file)
 | 
						if (s_dcert_file)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -908,6 +1025,10 @@ bad:
 | 
				
			|||||||
		s_key_file=NULL;
 | 
							s_key_file=NULL;
 | 
				
			||||||
		s_dcert_file=NULL;
 | 
							s_dcert_file=NULL;
 | 
				
			||||||
		s_dkey_file=NULL;
 | 
							s_dkey_file=NULL;
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
							s_cert_file2=NULL;
 | 
				
			||||||
 | 
							s_key_file2=NULL;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ctx=SSL_CTX_new(meth);
 | 
						ctx=SSL_CTX_new(meth);
 | 
				
			||||||
@@ -939,7 +1060,7 @@ bad:
 | 
				
			|||||||
	/* DTLS: partial reads end up discarding unread UDP bytes :-( 
 | 
						/* DTLS: partial reads end up discarding unread UDP bytes :-( 
 | 
				
			||||||
	 * Setting read ahead solves this problem.
 | 
						 * Setting read ahead solves this problem.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	if (sock_type == SOCK_DGRAM) SSL_CTX_set_read_ahead(ctx, 1);
 | 
						if (socket_type == SOCK_DGRAM) SSL_CTX_set_read_ahead(ctx, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (state) SSL_CTX_set_info_callback(ctx,apps_ssl_info_callback);
 | 
						if (state) SSL_CTX_set_info_callback(ctx,apps_ssl_info_callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -966,6 +1087,62 @@ bad:
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	store = SSL_CTX_get_cert_store(ctx);
 | 
						store = SSL_CTX_get_cert_store(ctx);
 | 
				
			||||||
	X509_STORE_set_flags(store, vflags);
 | 
						X509_STORE_set_flags(store, vflags);
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
						if (s_cert2)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							ctx2=SSL_CTX_new(meth);
 | 
				
			||||||
 | 
							if (ctx2 == NULL)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
 | 
								goto end;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (ctx2)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							BIO_printf(bio_s_out,"Setting secondary ctx parameters\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (session_id_prefix)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if(strlen(session_id_prefix) >= 32)
 | 
				
			||||||
 | 
									BIO_printf(bio_err,
 | 
				
			||||||
 | 
										"warning: id_prefix is too long, only one new session will be possible\n");
 | 
				
			||||||
 | 
								else if(strlen(session_id_prefix) >= 16)
 | 
				
			||||||
 | 
									BIO_printf(bio_err,
 | 
				
			||||||
 | 
										"warning: id_prefix is too long if you use SSLv2\n");
 | 
				
			||||||
 | 
								if(!SSL_CTX_set_generate_session_id(ctx2, generate_session_id))
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									BIO_printf(bio_err,"error setting 'id_prefix'\n");
 | 
				
			||||||
 | 
									ERR_print_errors(bio_err);
 | 
				
			||||||
 | 
									goto end;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								BIO_printf(bio_err,"id_prefix '%s' set.\n", session_id_prefix);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							SSL_CTX_set_quiet_shutdown(ctx2,1);
 | 
				
			||||||
 | 
							if (bugs) SSL_CTX_set_options(ctx2,SSL_OP_ALL);
 | 
				
			||||||
 | 
							if (hack) SSL_CTX_set_options(ctx2,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);
 | 
				
			||||||
 | 
							SSL_CTX_set_options(ctx2,off);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/* DTLS: partial reads end up discarding unread UDP bytes :-( 
 | 
				
			||||||
 | 
							 * Setting read ahead solves this problem.
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
 | 
							if (socket_type == SOCK_DGRAM) SSL_CTX_set_read_ahead(ctx2, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (state) SSL_CTX_set_info_callback(ctx2,apps_ssl_info_callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							SSL_CTX_sess_set_cache_size(ctx2,128);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if ((!SSL_CTX_load_verify_locations(ctx2,CAfile,CApath)) ||
 | 
				
			||||||
 | 
								(!SSL_CTX_set_default_verify_paths(ctx2)))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							store = SSL_CTX_get_cert_store(ctx2);
 | 
				
			||||||
 | 
							X509_STORE_set_flags(store, vflags);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					#endif 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef OPENSSL_NO_DH
 | 
					#ifndef OPENSSL_NO_DH
 | 
				
			||||||
	if (!no_dhe)
 | 
						if (!no_dhe)
 | 
				
			||||||
@@ -989,6 +1166,24 @@ bad:
 | 
				
			|||||||
		(void)BIO_flush(bio_s_out);
 | 
							(void)BIO_flush(bio_s_out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		SSL_CTX_set_tmp_dh(ctx,dh);
 | 
							SSL_CTX_set_tmp_dh(ctx,dh);
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
							if (ctx2)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (!dhfile)
 | 
				
			||||||
 | 
									{ 
 | 
				
			||||||
 | 
									DH *dh2=load_dh_param(s_cert_file2);
 | 
				
			||||||
 | 
									if (dh2 != NULL)
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
										BIO_printf(bio_s_out,"Setting temp DH parameters\n");
 | 
				
			||||||
 | 
										(void)BIO_flush(bio_s_out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										DH_free(dh);
 | 
				
			||||||
 | 
										dh = dh2;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								SSL_CTX_set_tmp_dh(ctx2,dh);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		DH_free(dh);
 | 
							DH_free(dh);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -1034,12 +1229,20 @@ bad:
 | 
				
			|||||||
		(void)BIO_flush(bio_s_out);
 | 
							(void)BIO_flush(bio_s_out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		SSL_CTX_set_tmp_ecdh(ctx,ecdh);
 | 
							SSL_CTX_set_tmp_ecdh(ctx,ecdh);
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
							if (ctx2) 
 | 
				
			||||||
 | 
								SSL_CTX_set_tmp_ecdh(ctx2,ecdh);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		EC_KEY_free(ecdh);
 | 
							EC_KEY_free(ecdh);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if (!set_cert_key_stuff(ctx,s_cert,s_key))
 | 
						if (!set_cert_key_stuff(ctx,s_cert,s_key))
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
						if (ctx2 && !set_cert_key_stuff(ctx2,s_cert2,s_key2))
 | 
				
			||||||
 | 
							goto end; 
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	if (s_dcert != NULL)
 | 
						if (s_dcert != NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		if (!set_cert_key_stuff(ctx,s_dcert,s_dkey))
 | 
							if (!set_cert_key_stuff(ctx,s_dcert,s_dkey))
 | 
				
			||||||
@@ -1049,7 +1252,13 @@ bad:
 | 
				
			|||||||
#ifndef OPENSSL_NO_RSA
 | 
					#ifndef OPENSSL_NO_RSA
 | 
				
			||||||
#if 1
 | 
					#if 1
 | 
				
			||||||
	if (!no_tmp_rsa)
 | 
						if (!no_tmp_rsa)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
		SSL_CTX_set_tmp_rsa_callback(ctx,tmp_rsa_cb);
 | 
							SSL_CTX_set_tmp_rsa_callback(ctx,tmp_rsa_cb);
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
							if (ctx2) 
 | 
				
			||||||
 | 
								SSL_CTX_set_tmp_rsa_callback(ctx2,tmp_rsa_cb);
 | 
				
			||||||
 | 
					#endif	
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
	if (!no_tmp_rsa && SSL_CTX_need_tmp_RSA(ctx))
 | 
						if (!no_tmp_rsa && SSL_CTX_need_tmp_RSA(ctx))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -1065,6 +1274,16 @@ bad:
 | 
				
			|||||||
			ERR_print_errors(bio_err);
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
								if (ctx2)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									if (!SSL_CTX_set_tmp_rsa(ctx2,rsa))
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
										ERR_print_errors(bio_err);
 | 
				
			||||||
 | 
										goto end;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		RSA_free(rsa);
 | 
							RSA_free(rsa);
 | 
				
			||||||
		BIO_printf(bio_s_out,"\n");
 | 
							BIO_printf(bio_s_out,"\n");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -1076,19 +1295,46 @@ bad:
 | 
				
			|||||||
		BIO_printf(bio_err,"error setting cipher list\n");
 | 
							BIO_printf(bio_err,"error setting cipher list\n");
 | 
				
			||||||
		ERR_print_errors(bio_err);
 | 
							ERR_print_errors(bio_err);
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
							if (ctx2 && !SSL_CTX_set_cipher_list(ctx2,cipher))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(bio_err,"error setting cipher list\n");
 | 
				
			||||||
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
 | 
								goto end;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	SSL_CTX_set_verify(ctx,s_server_verify,verify_callback);
 | 
						SSL_CTX_set_verify(ctx,s_server_verify,verify_callback);
 | 
				
			||||||
	SSL_CTX_set_session_id_context(ctx,(void*)&s_server_session_id_context,
 | 
						SSL_CTX_set_session_id_context(ctx,(void*)&s_server_session_id_context,
 | 
				
			||||||
		sizeof s_server_session_id_context);
 | 
							sizeof s_server_session_id_context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (CAfile != NULL)
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
	    SSL_CTX_set_client_CA_list(ctx,SSL_load_client_CA_file(CAfile));
 | 
						if (ctx2)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							SSL_CTX_set_verify(ctx2,s_server_verify,verify_callback);
 | 
				
			||||||
 | 
							SSL_CTX_set_session_id_context(ctx2,(void*)&s_server_session_id_context,
 | 
				
			||||||
 | 
								sizeof s_server_session_id_context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							tlsextcbp.biodebug = bio_s_out;
 | 
				
			||||||
 | 
							SSL_CTX_set_tlsext_servername_callback(ctx2, ssl_servername_cb);
 | 
				
			||||||
 | 
							SSL_CTX_set_tlsext_servername_arg(ctx2, &tlsextcbp);
 | 
				
			||||||
 | 
							SSL_CTX_set_tlsext_servername_callback(ctx, ssl_servername_cb);
 | 
				
			||||||
 | 
							SSL_CTX_set_tlsext_servername_arg(ctx, &tlsextcbp);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
						if (CAfile != NULL)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							SSL_CTX_set_client_CA_list(ctx,SSL_load_client_CA_file(CAfile));
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
							if (ctx2) 
 | 
				
			||||||
 | 
								SSL_CTX_set_client_CA_list(ctx2,SSL_load_client_CA_file(CAfile));
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	BIO_printf(bio_s_out,"ACCEPT\n");
 | 
						BIO_printf(bio_s_out,"ACCEPT\n");
 | 
				
			||||||
	if (www)
 | 
						if (www)
 | 
				
			||||||
		do_server(port,sock_type,&accept_socket,www_body, context);
 | 
							do_server(port,socket_type,&accept_socket,www_body, context);
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		do_server(port,sock_type,&accept_socket,sv_body, context);
 | 
							do_server(port,socket_type,&accept_socket,sv_body, context);
 | 
				
			||||||
	print_stats(bio_s_out,ctx);
 | 
						print_stats(bio_s_out,ctx);
 | 
				
			||||||
	ret=0;
 | 
						ret=0;
 | 
				
			||||||
end:
 | 
					end:
 | 
				
			||||||
@@ -1105,6 +1351,13 @@ end:
 | 
				
			|||||||
		OPENSSL_free(pass);
 | 
							OPENSSL_free(pass);
 | 
				
			||||||
	if (dpass)
 | 
						if (dpass)
 | 
				
			||||||
		OPENSSL_free(dpass);
 | 
							OPENSSL_free(dpass);
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
						if (ctx2 != NULL) SSL_CTX_free(ctx2);
 | 
				
			||||||
 | 
						if (s_cert2)
 | 
				
			||||||
 | 
							X509_free(s_cert2);
 | 
				
			||||||
 | 
						if (s_key2)
 | 
				
			||||||
 | 
							EVP_PKEY_free(s_key2);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	if (bio_s_out != NULL)
 | 
						if (bio_s_out != NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
        BIO_free(bio_s_out);
 | 
					        BIO_free(bio_s_out);
 | 
				
			||||||
@@ -1171,6 +1424,13 @@ static int sv_body(char *hostname, int s, unsigned char *context)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (con == NULL) {
 | 
						if (con == NULL) {
 | 
				
			||||||
		con=SSL_new(ctx);
 | 
							con=SSL_new(ctx);
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
						if (s_tlsextdebug)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							SSL_set_tlsext_debug_callback(con, tlsext_cb);
 | 
				
			||||||
 | 
							SSL_set_tlsext_debug_arg(con, bio_s_out);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_KRB5
 | 
					#ifndef OPENSSL_NO_KRB5
 | 
				
			||||||
		if ((con->kssl_ctx = kssl_ctx_new()) != NULL)
 | 
							if ((con->kssl_ctx = kssl_ctx_new()) != NULL)
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
@@ -1241,6 +1501,13 @@ static int sv_body(char *hostname, int s, unsigned char *context)
 | 
				
			|||||||
		SSL_set_msg_callback(con, msg_cb);
 | 
							SSL_set_msg_callback(con, msg_cb);
 | 
				
			||||||
		SSL_set_msg_callback_arg(con, bio_s_out);
 | 
							SSL_set_msg_callback_arg(con, bio_s_out);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
						if (s_tlsextdebug)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							SSL_set_tlsext_debug_callback(con, tlsext_cb);
 | 
				
			||||||
 | 
							SSL_set_tlsext_debug_arg(con, bio_s_out);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	width=s+1;
 | 
						width=s+1;
 | 
				
			||||||
	for (;;)
 | 
						for (;;)
 | 
				
			||||||
@@ -1606,6 +1873,13 @@ static int www_body(char *hostname, int s, unsigned char *context)
 | 
				
			|||||||
	if (!BIO_set_write_buffer_size(io,bufsize)) goto err;
 | 
						if (!BIO_set_write_buffer_size(io,bufsize)) goto err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((con=SSL_new(ctx)) == NULL) goto err;
 | 
						if ((con=SSL_new(ctx)) == NULL) goto err;
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_TLSEXT
 | 
				
			||||||
 | 
							if (s_tlsextdebug)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								SSL_set_tlsext_debug_callback(con, tlsext_cb);
 | 
				
			||||||
 | 
								SSL_set_tlsext_debug_arg(con, bio_s_out);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_KRB5
 | 
					#ifndef OPENSSL_NO_KRB5
 | 
				
			||||||
	if ((con->kssl_ctx = kssl_ctx_new()) != NULL)
 | 
						if ((con->kssl_ctx = kssl_ctx_new()) != NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -145,6 +145,10 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		else if (!strcmp (*args, "-des")) 
 | 
							else if (!strcmp (*args, "-des")) 
 | 
				
			||||||
				cipher = EVP_des_cbc();
 | 
									cipher = EVP_des_cbc();
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
							else if (!strcmp (*args, "-seed")) 
 | 
				
			||||||
 | 
									cipher = EVP_seed_cbc();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_RC2
 | 
					#ifndef OPENSSL_NO_RC2
 | 
				
			||||||
		else if (!strcmp (*args, "-rc2-40")) 
 | 
							else if (!strcmp (*args, "-rc2-40")) 
 | 
				
			||||||
				cipher = EVP_rc2_40_cbc();
 | 
									cipher = EVP_rc2_40_cbc();
 | 
				
			||||||
@@ -423,6 +427,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		BIO_printf (bio_err, "-des3          encrypt with triple DES\n");
 | 
							BIO_printf (bio_err, "-des3          encrypt with triple DES\n");
 | 
				
			||||||
		BIO_printf (bio_err, "-des           encrypt with DES\n");
 | 
							BIO_printf (bio_err, "-des           encrypt with DES\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
							BIO_printf (bio_err, "-seed          encrypt with SEED\n");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_RC2
 | 
					#ifndef OPENSSL_NO_RC2
 | 
				
			||||||
		BIO_printf (bio_err, "-rc2-40        encrypt with RC2-40 (default)\n");
 | 
							BIO_printf (bio_err, "-rc2-40        encrypt with RC2-40 (default)\n");
 | 
				
			||||||
		BIO_printf (bio_err, "-rc2-64        encrypt with RC2-64\n");
 | 
							BIO_printf (bio_err, "-rc2-64        encrypt with RC2-64\n");
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										138
									
								
								apps/speed.c
									
									
									
									
									
								
							
							
						
						
									
										138
									
								
								apps/speed.c
									
									
									
									
									
								
							@@ -201,6 +201,9 @@
 | 
				
			|||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
#include <openssl/idea.h>
 | 
					#include <openssl/idea.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
					#include <openssl/seed.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_BF
 | 
					#ifndef OPENSSL_NO_BF
 | 
				
			||||||
#include <openssl/blowfish.h>
 | 
					#include <openssl/blowfish.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -272,7 +275,7 @@ static void print_result(int alg,int run_no,int count,double time_used);
 | 
				
			|||||||
static int do_multi(int multi);
 | 
					static int do_multi(int multi);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ALGOR_NUM	24
 | 
					#define ALGOR_NUM	28
 | 
				
			||||||
#define SIZE_NUM	5
 | 
					#define SIZE_NUM	5
 | 
				
			||||||
#define RSA_NUM		4
 | 
					#define RSA_NUM		4
 | 
				
			||||||
#define DSA_NUM		3
 | 
					#define DSA_NUM		3
 | 
				
			||||||
@@ -282,11 +285,12 @@ static int do_multi(int multi);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static const char *names[ALGOR_NUM]={
 | 
					static const char *names[ALGOR_NUM]={
 | 
				
			||||||
  "md2","mdc2","md4","md5","hmac(md5)","sha1","rmd160","rc4",
 | 
					  "md2","mdc2","md4","md5","hmac(md5)","sha1","rmd160","rc4",
 | 
				
			||||||
  "des cbc","des ede3","idea cbc",
 | 
					  "des cbc","des ede3","idea cbc","seed cbc",
 | 
				
			||||||
  "rc2 cbc","rc5-32/12 cbc","blowfish cbc","cast cbc",
 | 
					  "rc2 cbc","rc5-32/12 cbc","blowfish cbc","cast cbc",
 | 
				
			||||||
  "aes-128 cbc","aes-192 cbc","aes-256 cbc",
 | 
					  "aes-128 cbc","aes-192 cbc","aes-256 cbc",
 | 
				
			||||||
  "camellia-128 cbc","camellia-192 cbc","camellia-256 cbc",
 | 
					  "camellia-128 cbc","camellia-192 cbc","camellia-256 cbc",
 | 
				
			||||||
  "evp","sha256","sha512"};
 | 
					  "evp","sha256","sha512",
 | 
				
			||||||
 | 
					  "aes-128 ige","aes-192 ige","aes-256 ige"};
 | 
				
			||||||
static double results[ALGOR_NUM][SIZE_NUM];
 | 
					static double results[ALGOR_NUM][SIZE_NUM];
 | 
				
			||||||
static int lengths[SIZE_NUM]={16,64,256,1024,8*1024};
 | 
					static int lengths[SIZE_NUM]={16,64,256,1024,8*1024};
 | 
				
			||||||
static double rsa_results[RSA_NUM][2];
 | 
					static double rsa_results[RSA_NUM][2];
 | 
				
			||||||
@@ -533,6 +537,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
	IDEA_KEY_SCHEDULE idea_ks;
 | 
						IDEA_KEY_SCHEDULE idea_ks;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
						SEED_KEY_SCHEDULE seed_ks;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_BF
 | 
					#ifndef OPENSSL_NO_BF
 | 
				
			||||||
	BF_KEY bf_ks;
 | 
						BF_KEY bf_ks;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -597,19 +604,23 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
#define	D_CBC_DES	8
 | 
					#define	D_CBC_DES	8
 | 
				
			||||||
#define	D_EDE3_DES	9
 | 
					#define	D_EDE3_DES	9
 | 
				
			||||||
#define	D_CBC_IDEA	10
 | 
					#define	D_CBC_IDEA	10
 | 
				
			||||||
#define	D_CBC_RC2	11
 | 
					#define	D_CBC_SEED	11
 | 
				
			||||||
#define	D_CBC_RC5	12
 | 
					#define	D_CBC_RC2	12
 | 
				
			||||||
#define	D_CBC_BF	13
 | 
					#define	D_CBC_RC5	13
 | 
				
			||||||
#define	D_CBC_CAST	14
 | 
					#define	D_CBC_BF	14
 | 
				
			||||||
#define D_CBC_128_AES	15
 | 
					#define	D_CBC_CAST	15
 | 
				
			||||||
#define D_CBC_192_AES	16
 | 
					#define D_CBC_128_AES	16
 | 
				
			||||||
#define D_CBC_256_AES	17
 | 
					#define D_CBC_192_AES	17
 | 
				
			||||||
#define D_CBC_128_CML   18 
 | 
					#define D_CBC_256_AES	18
 | 
				
			||||||
#define D_CBC_192_CML   19
 | 
					#define D_CBC_128_CML   19 
 | 
				
			||||||
#define D_CBC_256_CML   20 
 | 
					#define D_CBC_192_CML   20
 | 
				
			||||||
#define D_EVP		21
 | 
					#define D_CBC_256_CML   21 
 | 
				
			||||||
#define D_SHA256	22	
 | 
					#define D_EVP		22
 | 
				
			||||||
#define D_SHA512	23
 | 
					#define D_SHA256	23	
 | 
				
			||||||
 | 
					#define D_SHA512	24
 | 
				
			||||||
 | 
					#define D_IGE_128_AES   25
 | 
				
			||||||
 | 
					#define D_IGE_192_AES   26
 | 
				
			||||||
 | 
					#define D_IGE_256_AES   27
 | 
				
			||||||
	double d=0.0;
 | 
						double d=0.0;
 | 
				
			||||||
	long c[ALGOR_NUM][SIZE_NUM];
 | 
						long c[ALGOR_NUM][SIZE_NUM];
 | 
				
			||||||
#define	R_DSA_512	0
 | 
					#define	R_DSA_512	0
 | 
				
			||||||
@@ -950,7 +961,10 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			if (strcmp(*argv,"aes-128-cbc") == 0) doit[D_CBC_128_AES]=1;
 | 
								if (strcmp(*argv,"aes-128-cbc") == 0) doit[D_CBC_128_AES]=1;
 | 
				
			||||||
		else	if (strcmp(*argv,"aes-192-cbc") == 0) doit[D_CBC_192_AES]=1;
 | 
							else	if (strcmp(*argv,"aes-192-cbc") == 0) doit[D_CBC_192_AES]=1;
 | 
				
			||||||
		else	if (strcmp(*argv,"aes-256-cbc") == 0) doit[D_CBC_256_AES]=1;
 | 
							else	if (strcmp(*argv,"aes-256-cbc") == 0) doit[D_CBC_256_AES]=1;
 | 
				
			||||||
		else
 | 
							else    if (strcmp(*argv,"aes-128-ige") == 0) doit[D_IGE_128_AES]=1;
 | 
				
			||||||
 | 
							else	if (strcmp(*argv,"aes-192-ige") == 0) doit[D_IGE_192_AES]=1;
 | 
				
			||||||
 | 
							else	if (strcmp(*argv,"aes-256-ige") == 0) doit[D_IGE_256_AES]=1;
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_CAMELLIA
 | 
					#ifndef OPENSSL_NO_CAMELLIA
 | 
				
			||||||
			if (strcmp(*argv,"camellia-128-cbc") == 0) doit[D_CBC_128_CML]=1;
 | 
								if (strcmp(*argv,"camellia-128-cbc") == 0) doit[D_CBC_128_CML]=1;
 | 
				
			||||||
@@ -999,6 +1013,11 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		else if (strcmp(*argv,"idea") == 0) doit[D_CBC_IDEA]=1;
 | 
							else if (strcmp(*argv,"idea") == 0) doit[D_CBC_IDEA]=1;
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
							     if (strcmp(*argv,"seed-cbc") == 0) doit[D_CBC_SEED]=1;
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"seed") == 0) doit[D_CBC_SEED]=1;
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_BF
 | 
					#ifndef OPENSSL_NO_BF
 | 
				
			||||||
		     if (strcmp(*argv,"bf-cbc") == 0) doit[D_CBC_BF]=1;
 | 
							     if (strcmp(*argv,"bf-cbc") == 0) doit[D_CBC_BF]=1;
 | 
				
			||||||
		else if (strcmp(*argv,"blowfish") == 0) doit[D_CBC_BF]=1;
 | 
							else if (strcmp(*argv,"blowfish") == 0) doit[D_CBC_BF]=1;
 | 
				
			||||||
@@ -1144,6 +1163,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
			BIO_printf(bio_err,"idea-cbc ");
 | 
								BIO_printf(bio_err,"idea-cbc ");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
								BIO_printf(bio_err,"seed-cbc ");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_RC2
 | 
					#ifndef OPENSSL_NO_RC2
 | 
				
			||||||
			BIO_printf(bio_err,"rc2-cbc  ");
 | 
								BIO_printf(bio_err,"rc2-cbc  ");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -1153,7 +1175,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
#ifndef OPENSSL_NO_BF
 | 
					#ifndef OPENSSL_NO_BF
 | 
				
			||||||
			BIO_printf(bio_err,"bf-cbc");
 | 
								BIO_printf(bio_err,"bf-cbc");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#if !defined(OPENSSL_NO_IDEA) || !defined(OPENSSL_NO_RC2) || \
 | 
					#if !defined(OPENSSL_NO_IDEA) || !defined(OPENSSL_NO_SEED) || !defined(OPENSSL_NO_RC2) || \
 | 
				
			||||||
    !defined(OPENSSL_NO_BF) || !defined(OPENSSL_NO_RC5)
 | 
					    !defined(OPENSSL_NO_BF) || !defined(OPENSSL_NO_RC5)
 | 
				
			||||||
			BIO_printf(bio_err,"\n");
 | 
								BIO_printf(bio_err,"\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -1162,6 +1184,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_AES
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
			BIO_printf(bio_err,"aes-128-cbc aes-192-cbc aes-256-cbc ");
 | 
								BIO_printf(bio_err,"aes-128-cbc aes-192-cbc aes-256-cbc ");
 | 
				
			||||||
 | 
								BIO_printf(bio_err,"aes-128-ige aes-192-ige aes-256-ige ");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_CAMELLIA
 | 
					#ifndef OPENSSL_NO_CAMELLIA
 | 
				
			||||||
			BIO_printf(bio_err,"\n");
 | 
								BIO_printf(bio_err,"\n");
 | 
				
			||||||
@@ -1195,6 +1218,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
			BIO_printf(bio_err,"idea     ");
 | 
								BIO_printf(bio_err,"idea     ");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
								BIO_printf(bio_err,"seed     ");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_RC2
 | 
					#ifndef OPENSSL_NO_RC2
 | 
				
			||||||
			BIO_printf(bio_err,"rc2      ");
 | 
								BIO_printf(bio_err,"rc2      ");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -1213,10 +1239,10 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
#ifndef OPENSSL_NO_BF
 | 
					#ifndef OPENSSL_NO_BF
 | 
				
			||||||
			BIO_printf(bio_err,"blowfish");
 | 
								BIO_printf(bio_err,"blowfish");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#if !defined(OPENSSL_NO_IDEA) || !defined(OPENSSL_NO_RC2) || \
 | 
					#if !defined(OPENSSL_NO_IDEA) || !defined(OPENSSL_NO_SEED) || \
 | 
				
			||||||
    !defined(OPENSSL_NO_DES) || !defined(OPENSSL_NO_RSA) || \
 | 
					    !defined(OPENSSL_NO_RC2) || !defined(OPENSSL_NO_DES) || \
 | 
				
			||||||
    !defined(OPENSSL_NO_BF) || !defined(OPENSSL_NO_AES) || \
 | 
					    !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_BF) || \
 | 
				
			||||||
    !defined(OPENSSL_NO_CAMELLIA) 
 | 
					    !defined(OPENSSL_NO_AES) || !defined(OPENSSL_NO_CAMELLIA)
 | 
				
			||||||
			BIO_printf(bio_err,"\n");
 | 
								BIO_printf(bio_err,"\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1318,6 +1344,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
	idea_set_encrypt_key(key16,&idea_ks);
 | 
						idea_set_encrypt_key(key16,&idea_ks);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
						SEED_set_key(key16,&seed_ks);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_RC4
 | 
					#ifndef OPENSSL_NO_RC4
 | 
				
			||||||
	RC4_set_key(&rc4_ks,16,key16);
 | 
						RC4_set_key(&rc4_ks,16,key16);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -1361,6 +1390,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	c[D_CBC_DES][0]=count;
 | 
						c[D_CBC_DES][0]=count;
 | 
				
			||||||
	c[D_EDE3_DES][0]=count/3;
 | 
						c[D_EDE3_DES][0]=count/3;
 | 
				
			||||||
	c[D_CBC_IDEA][0]=count;
 | 
						c[D_CBC_IDEA][0]=count;
 | 
				
			||||||
 | 
						c[D_CBC_SEED][0]=count;
 | 
				
			||||||
	c[D_CBC_RC2][0]=count;
 | 
						c[D_CBC_RC2][0]=count;
 | 
				
			||||||
	c[D_CBC_RC5][0]=count;
 | 
						c[D_CBC_RC5][0]=count;
 | 
				
			||||||
	c[D_CBC_BF][0]=count;
 | 
						c[D_CBC_BF][0]=count;
 | 
				
			||||||
@@ -1373,6 +1403,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	c[D_CBC_256_CML][0]=count;
 | 
						c[D_CBC_256_CML][0]=count;
 | 
				
			||||||
	c[D_SHA256][0]=count;
 | 
						c[D_SHA256][0]=count;
 | 
				
			||||||
	c[D_SHA512][0]=count;
 | 
						c[D_SHA512][0]=count;
 | 
				
			||||||
 | 
						c[D_IGE_128_AES][0]=count;
 | 
				
			||||||
 | 
						c[D_IGE_192_AES][0]=count;
 | 
				
			||||||
 | 
						c[D_IGE_256_AES][0]=count;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i=1; i<SIZE_NUM; i++)
 | 
						for (i=1; i<SIZE_NUM; i++)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -1396,6 +1429,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		c[D_CBC_DES][i]=c[D_CBC_DES][i-1]*l0/l1;
 | 
							c[D_CBC_DES][i]=c[D_CBC_DES][i-1]*l0/l1;
 | 
				
			||||||
		c[D_EDE3_DES][i]=c[D_EDE3_DES][i-1]*l0/l1;
 | 
							c[D_EDE3_DES][i]=c[D_EDE3_DES][i-1]*l0/l1;
 | 
				
			||||||
		c[D_CBC_IDEA][i]=c[D_CBC_IDEA][i-1]*l0/l1;
 | 
							c[D_CBC_IDEA][i]=c[D_CBC_IDEA][i-1]*l0/l1;
 | 
				
			||||||
 | 
							c[D_CBC_SEED][i]=c[D_CBC_SEED][i-1]*l0/l1;
 | 
				
			||||||
		c[D_CBC_RC2][i]=c[D_CBC_RC2][i-1]*l0/l1;
 | 
							c[D_CBC_RC2][i]=c[D_CBC_RC2][i-1]*l0/l1;
 | 
				
			||||||
		c[D_CBC_RC5][i]=c[D_CBC_RC5][i-1]*l0/l1;
 | 
							c[D_CBC_RC5][i]=c[D_CBC_RC5][i-1]*l0/l1;
 | 
				
			||||||
		c[D_CBC_BF][i]=c[D_CBC_BF][i-1]*l0/l1;
 | 
							c[D_CBC_BF][i]=c[D_CBC_BF][i-1]*l0/l1;
 | 
				
			||||||
@@ -1406,6 +1440,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
 		c[D_CBC_128_CML][i]=c[D_CBC_128_CML][i-1]*l0/l1;
 | 
					 		c[D_CBC_128_CML][i]=c[D_CBC_128_CML][i-1]*l0/l1;
 | 
				
			||||||
		c[D_CBC_192_CML][i]=c[D_CBC_192_CML][i-1]*l0/l1;
 | 
							c[D_CBC_192_CML][i]=c[D_CBC_192_CML][i-1]*l0/l1;
 | 
				
			||||||
		c[D_CBC_256_CML][i]=c[D_CBC_256_CML][i-1]*l0/l1;
 | 
							c[D_CBC_256_CML][i]=c[D_CBC_256_CML][i-1]*l0/l1;
 | 
				
			||||||
 | 
							c[D_IGE_128_AES][i]=c[D_IGE_128_AES][i-1]*l0/l1;
 | 
				
			||||||
 | 
							c[D_IGE_192_AES][i]=c[D_IGE_192_AES][i-1]*l0/l1;
 | 
				
			||||||
 | 
							c[D_IGE_256_AES][i]=c[D_IGE_256_AES][i-1]*l0/l1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
#ifndef OPENSSL_NO_RSA
 | 
					#ifndef OPENSSL_NO_RSA
 | 
				
			||||||
	rsa_c[R_RSA_512][0]=count/2000;
 | 
						rsa_c[R_RSA_512][0]=count/2000;
 | 
				
			||||||
@@ -1799,6 +1836,48 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (doit[D_IGE_128_AES])
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							for (j=0; j<SIZE_NUM; j++)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								print_message(names[D_IGE_128_AES],c[D_IGE_128_AES][j],lengths[j]);
 | 
				
			||||||
 | 
								Time_F(START);
 | 
				
			||||||
 | 
								for (count=0,run=1; COND(c[D_IGE_128_AES][j]); count++)
 | 
				
			||||||
 | 
									AES_ige_encrypt(buf,buf2,
 | 
				
			||||||
 | 
										(unsigned long)lengths[j],&aes_ks1,
 | 
				
			||||||
 | 
										iv,AES_ENCRYPT);
 | 
				
			||||||
 | 
								d=Time_F(STOP);
 | 
				
			||||||
 | 
								print_result(D_IGE_128_AES,j,count,d);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						if (doit[D_IGE_192_AES])
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							for (j=0; j<SIZE_NUM; j++)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								print_message(names[D_IGE_192_AES],c[D_IGE_192_AES][j],lengths[j]);
 | 
				
			||||||
 | 
								Time_F(START);
 | 
				
			||||||
 | 
								for (count=0,run=1; COND(c[D_IGE_192_AES][j]); count++)
 | 
				
			||||||
 | 
									AES_ige_encrypt(buf,buf2,
 | 
				
			||||||
 | 
										(unsigned long)lengths[j],&aes_ks2,
 | 
				
			||||||
 | 
										iv,AES_ENCRYPT);
 | 
				
			||||||
 | 
								d=Time_F(STOP);
 | 
				
			||||||
 | 
								print_result(D_IGE_192_AES,j,count,d);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						if (doit[D_IGE_256_AES])
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							for (j=0; j<SIZE_NUM; j++)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								print_message(names[D_IGE_256_AES],c[D_IGE_256_AES][j],lengths[j]);
 | 
				
			||||||
 | 
								Time_F(START);
 | 
				
			||||||
 | 
								for (count=0,run=1; COND(c[D_IGE_256_AES][j]); count++)
 | 
				
			||||||
 | 
									AES_ige_encrypt(buf,buf2,
 | 
				
			||||||
 | 
										(unsigned long)lengths[j],&aes_ks3,
 | 
				
			||||||
 | 
										iv,AES_ENCRYPT);
 | 
				
			||||||
 | 
								d=Time_F(STOP);
 | 
				
			||||||
 | 
								print_result(D_IGE_256_AES,j,count,d);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_CAMELLIA
 | 
					#ifndef OPENSSL_NO_CAMELLIA
 | 
				
			||||||
	if (doit[D_CBC_128_CML])
 | 
						if (doit[D_CBC_128_CML])
 | 
				
			||||||
@@ -1861,6 +1940,21 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
						if (doit[D_CBC_SEED])
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							for (j=0; j<SIZE_NUM; j++)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								print_message(names[D_CBC_SEED],c[D_CBC_SEED][j],lengths[j]);
 | 
				
			||||||
 | 
								Time_F(START);
 | 
				
			||||||
 | 
								for (count=0,run=1; COND(c[D_CBC_SEED][j]); count++)
 | 
				
			||||||
 | 
									SEED_cbc_encrypt(buf,buf,
 | 
				
			||||||
 | 
										(unsigned long)lengths[j],&seed_ks,iv,1);
 | 
				
			||||||
 | 
								d=Time_F(STOP);
 | 
				
			||||||
 | 
								print_result(D_CBC_SEED,j,count,d);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_RC2
 | 
					#ifndef OPENSSL_NO_RC2
 | 
				
			||||||
	if (doit[D_CBC_RC2])
 | 
						if (doit[D_CBC_RC2])
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										17
									
								
								config
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								config
									
									
									
									
									
								
							@@ -527,9 +527,9 @@ case "$GUESSOS" in
 | 
				
			|||||||
	esac
 | 
						esac
 | 
				
			||||||
	if [ "$CC" = "gcc" ]; then
 | 
						if [ "$CC" = "gcc" ]; then
 | 
				
			||||||
	    case ${ISA:-generic} in
 | 
						    case ${ISA:-generic} in
 | 
				
			||||||
	    EV5|EV45)		options="$options -march=ev5";;
 | 
						    EV5|EV45)		options="$options -mcpu=ev5";;
 | 
				
			||||||
	    EV56|PCA56)		options="$options -march=ev56";;
 | 
						    EV56|PCA56)		options="$options -mcpu=ev56";;
 | 
				
			||||||
	    *)			options="$options -march=ev6";;
 | 
						    *)			options="$options -mcpu=ev6";;
 | 
				
			||||||
	    esac
 | 
						    esac
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	;;
 | 
						;;
 | 
				
			||||||
@@ -588,7 +588,8 @@ case "$GUESSOS" in
 | 
				
			|||||||
  sh*b-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
 | 
					  sh*b-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
 | 
				
			||||||
  sh*-*-linux2)  OUT="linux-generic32"; options="$options -DL_ENDIAN" ;;
 | 
					  sh*-*-linux2)  OUT="linux-generic32"; options="$options -DL_ENDIAN" ;;
 | 
				
			||||||
  m68k*-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
 | 
					  m68k*-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
 | 
				
			||||||
  s390*-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN -DNO_ASM" ;;
 | 
					  s390-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN -DNO_ASM" ;;
 | 
				
			||||||
 | 
					  s390x-*-linux2) OUT="linux-generic64"; options="$options -DB_ENDIAN" ;;
 | 
				
			||||||
  x86_64-*-linux?) OUT="linux-x86_64" ;;
 | 
					  x86_64-*-linux?) OUT="linux-x86_64" ;;
 | 
				
			||||||
  *86-*-linux2) OUT="linux-elf"
 | 
					  *86-*-linux2) OUT="linux-elf"
 | 
				
			||||||
	if [ "$GCCVER" -gt 28 ]; then
 | 
						if [ "$GCCVER" -gt 28 ]; then
 | 
				
			||||||
@@ -604,7 +605,7 @@ case "$GUESSOS" in
 | 
				
			|||||||
        fi ;;
 | 
					        fi ;;
 | 
				
			||||||
  *-*-linux1) OUT="linux-aout" ;;
 | 
					  *-*-linux1) OUT="linux-aout" ;;
 | 
				
			||||||
  *-*-linux2) OUT="linux-generic32" ;;
 | 
					  *-*-linux2) OUT="linux-generic32" ;;
 | 
				
			||||||
  sun4u*-*-solaris2)
 | 
					  sun4[uv]*-*-solaris2)
 | 
				
			||||||
	OUT="solaris-sparcv9-$CC"
 | 
						OUT="solaris-sparcv9-$CC"
 | 
				
			||||||
	ISA64=`(isalist) 2>/dev/null | grep sparcv9`
 | 
						ISA64=`(isalist) 2>/dev/null | grep sparcv9`
 | 
				
			||||||
	if [ "$ISA64" != "" ]; then
 | 
						if [ "$ISA64" != "" ]; then
 | 
				
			||||||
@@ -655,8 +656,8 @@ case "$GUESSOS" in
 | 
				
			|||||||
  *-*-sunos4)		OUT="sunos-$CC" ;;
 | 
					  *-*-sunos4)		OUT="sunos-$CC" ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  *86*-*-bsdi4)		OUT="BSD-x86-elf"; options="$options no-sse2 -ldl" ;;
 | 
					  *86*-*-bsdi4)		OUT="BSD-x86-elf"; options="$options no-sse2 -ldl" ;;
 | 
				
			||||||
  alpha*-*-*bsd*)	OUT="BSD-generic64; options="$options -DL_ENDIAN" ;;
 | 
					  alpha*-*-*bsd*)	OUT="BSD-generic64"; options="$options -DL_ENDIAN" ;;
 | 
				
			||||||
  powerpc64-*-*bsd*)	OUT="BSD-generic64; options="$options -DB_ENDIAN" ;;
 | 
					  powerpc64-*-*bsd*)	OUT="BSD-generic64"; options="$options -DB_ENDIAN" ;;
 | 
				
			||||||
  sparc64-*-*bsd*)	OUT="BSD-sparc64" ;;
 | 
					  sparc64-*-*bsd*)	OUT="BSD-sparc64" ;;
 | 
				
			||||||
  ia64-*-*bsd*)		OUT="BSD-ia64" ;;
 | 
					  ia64-*-*bsd*)		OUT="BSD-ia64" ;;
 | 
				
			||||||
  amd64-*-*bsd*)	OUT="BSD-x86_64" ;;
 | 
					  amd64-*-*bsd*)	OUT="BSD-x86_64" ;;
 | 
				
			||||||
@@ -797,7 +798,7 @@ case "$GUESSOS" in
 | 
				
			|||||||
  i386-*) options="$options 386" ;;
 | 
					  i386-*) options="$options 386" ;;
 | 
				
			||||||
esac
 | 
					esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for i in aes bf camellia cast des dh dsa ec hmac idea md2 md5 mdc2 rc2 rc4 rc5 ripemd rsa sha
 | 
					for i in aes bf camellia cast des dh dsa ec hmac idea md2 md5 mdc2 rc2 rc4 rc5 ripemd rsa seed sha
 | 
				
			||||||
do
 | 
					do
 | 
				
			||||||
  if [ ! -d crypto/$i ]
 | 
					  if [ ! -d crypto/$i ]
 | 
				
			||||||
  then
 | 
					  then
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -54,21 +54,25 @@
 | 
				
			|||||||
#include <openssl/aes.h>
 | 
					#include <openssl/aes.h>
 | 
				
			||||||
#include "aes_locl.h"
 | 
					#include "aes_locl.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					#define N_WORDS (AES_BLOCK_SIZE / sizeof(unsigned long))
 | 
				
			||||||
static void hexdump(FILE *f,const char *title,const unsigned char *s,int l)
 | 
					typedef struct {
 | 
				
			||||||
    {
 | 
					        unsigned long data[N_WORDS];
 | 
				
			||||||
    int n=0;
 | 
					} aes_block_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fprintf(f,"%s",title);
 | 
					/* XXX: probably some better way to do this */
 | 
				
			||||||
    for( ; n < l ; ++n)
 | 
					#if defined(__i386__) || defined(__x86_64__)
 | 
				
			||||||
		{
 | 
					#define UNALIGNED_MEMOPS_ARE_FAST 1
 | 
				
			||||||
		if((n%16) == 0)
 | 
					#else
 | 
				
			||||||
			fprintf(f,"\n%04x",n);
 | 
					#define UNALIGNED_MEMOPS_ARE_FAST 0
 | 
				
			||||||
		fprintf(f," %02x",s[n]);
 | 
					#endif
 | 
				
			||||||
		}
 | 
					
 | 
				
			||||||
    fprintf(f,"\n");
 | 
					#if UNALIGNED_MEMOPS_ARE_FAST
 | 
				
			||||||
    }
 | 
					#define load_block(d, s)        (d) = *(const aes_block_t *)(s)
 | 
				
			||||||
*/
 | 
					#define store_block(d, s)       *(aes_block_t *)(d) = (s)
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					#define load_block(d, s)        memcpy((d).data, (s), AES_BLOCK_SIZE)
 | 
				
			||||||
 | 
					#define store_block(d, s)       memcpy((d), (s).data, AES_BLOCK_SIZE)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* N.B. The IV for this mode is _twice_ the block size */
 | 
					/* N.B. The IV for this mode is _twice_ the block size */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -77,68 +81,125 @@ void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
 | 
				
			|||||||
					 unsigned char *ivec, const int enc)
 | 
										 unsigned char *ivec, const int enc)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	unsigned long n;
 | 
						unsigned long n;
 | 
				
			||||||
	unsigned long len = length;
 | 
						unsigned long len;
 | 
				
			||||||
	unsigned char tmp[AES_BLOCK_SIZE];
 | 
					 | 
				
			||||||
	unsigned char tmp2[AES_BLOCK_SIZE];
 | 
					 | 
				
			||||||
	unsigned char prev[AES_BLOCK_SIZE];
 | 
					 | 
				
			||||||
	const unsigned char *iv = ivec;
 | 
					 | 
				
			||||||
	const unsigned char *iv2 = ivec + AES_BLOCK_SIZE;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	OPENSSL_assert(in && out && key && ivec);
 | 
						OPENSSL_assert(in && out && key && ivec);
 | 
				
			||||||
	OPENSSL_assert((AES_ENCRYPT == enc)||(AES_DECRYPT == enc));
 | 
						OPENSSL_assert((AES_ENCRYPT == enc)||(AES_DECRYPT == enc));
 | 
				
			||||||
	OPENSSL_assert((length%AES_BLOCK_SIZE) == 0);
 | 
						OPENSSL_assert((length%AES_BLOCK_SIZE) == 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						len = length / AES_BLOCK_SIZE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (AES_ENCRYPT == enc)
 | 
						if (AES_ENCRYPT == enc)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		/* XXX: Do a separate case for when in != out (strictly should
 | 
							if (in != out &&
 | 
				
			||||||
		   check for overlap, too) */
 | 
							    (UNALIGNED_MEMOPS_ARE_FAST || ((size_t)in|(size_t)out|(size_t)ivec)%sizeof(long)==0))
 | 
				
			||||||
		while (len >= AES_BLOCK_SIZE)
 | 
					 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			/*			hexdump(stdout, "in", in, AES_BLOCK_SIZE); */
 | 
								aes_block_t *ivp = (aes_block_t *)ivec;
 | 
				
			||||||
			/*			hexdump(stdout, "iv", iv, AES_BLOCK_SIZE); */
 | 
								aes_block_t *iv2p = (aes_block_t *)(ivec + AES_BLOCK_SIZE);
 | 
				
			||||||
			for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
					
 | 
				
			||||||
				out[n] = in[n] ^ iv[n];
 | 
								while (len)
 | 
				
			||||||
			/*			hexdump(stdout, "in ^ iv", out, AES_BLOCK_SIZE); */
 | 
									{
 | 
				
			||||||
			AES_encrypt(out, out, key);
 | 
									aes_block_t *inp = (aes_block_t *)in;
 | 
				
			||||||
			/*			hexdump(stdout,"enc", out, AES_BLOCK_SIZE); */
 | 
									aes_block_t *outp = (aes_block_t *)out;
 | 
				
			||||||
			/*			hexdump(stdout,"iv2", iv2, AES_BLOCK_SIZE); */
 | 
					
 | 
				
			||||||
			for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
									for(n=0 ; n < N_WORDS; ++n)
 | 
				
			||||||
				out[n] ^= iv2[n];
 | 
										outp->data[n] = inp->data[n] ^ ivp->data[n];
 | 
				
			||||||
			/*			hexdump(stdout,"out", out, AES_BLOCK_SIZE); */
 | 
									AES_encrypt((unsigned char *)outp->data, (unsigned char *)outp->data, key);
 | 
				
			||||||
			iv = out;
 | 
									for(n=0 ; n < N_WORDS; ++n)
 | 
				
			||||||
			memcpy(prev, in, AES_BLOCK_SIZE);
 | 
										outp->data[n] ^= iv2p->data[n];
 | 
				
			||||||
			iv2 = prev;
 | 
									ivp = outp;
 | 
				
			||||||
			len -= AES_BLOCK_SIZE;
 | 
									iv2p = inp;
 | 
				
			||||||
			in += AES_BLOCK_SIZE;
 | 
									--len;
 | 
				
			||||||
			out += AES_BLOCK_SIZE;
 | 
									in += AES_BLOCK_SIZE;
 | 
				
			||||||
 | 
									out += AES_BLOCK_SIZE;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								memcpy(ivec, ivp->data, AES_BLOCK_SIZE);
 | 
				
			||||||
 | 
								memcpy(ivec + AES_BLOCK_SIZE, iv2p->data, AES_BLOCK_SIZE);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								aes_block_t tmp, tmp2;
 | 
				
			||||||
 | 
								aes_block_t iv;
 | 
				
			||||||
 | 
								aes_block_t iv2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								load_block(iv, ivec);
 | 
				
			||||||
 | 
								load_block(iv2, ivec + AES_BLOCK_SIZE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								while (len)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									load_block(tmp, in);
 | 
				
			||||||
 | 
									for(n=0 ; n < N_WORDS; ++n)
 | 
				
			||||||
 | 
										tmp2.data[n] = tmp.data[n] ^ iv.data[n];
 | 
				
			||||||
 | 
									AES_encrypt((unsigned char *)tmp2.data, (unsigned char *)tmp2.data, key);
 | 
				
			||||||
 | 
									for(n=0 ; n < N_WORDS; ++n)
 | 
				
			||||||
 | 
										tmp2.data[n] ^= iv2.data[n];
 | 
				
			||||||
 | 
									store_block(out, tmp2);
 | 
				
			||||||
 | 
									iv = tmp2;
 | 
				
			||||||
 | 
									iv2 = tmp;
 | 
				
			||||||
 | 
									--len;
 | 
				
			||||||
 | 
									in += AES_BLOCK_SIZE;
 | 
				
			||||||
 | 
									out += AES_BLOCK_SIZE;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								memcpy(ivec, iv.data, AES_BLOCK_SIZE);
 | 
				
			||||||
 | 
								memcpy(ivec + AES_BLOCK_SIZE, iv2.data, AES_BLOCK_SIZE);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		memcpy(ivec, iv, AES_BLOCK_SIZE);
 | 
					 | 
				
			||||||
		memcpy(ivec + AES_BLOCK_SIZE, iv2, AES_BLOCK_SIZE);
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		while (len >= AES_BLOCK_SIZE)
 | 
							if (in != out &&
 | 
				
			||||||
 | 
							    (UNALIGNED_MEMOPS_ARE_FAST || ((size_t)in|(size_t)out|(size_t)ivec)%sizeof(long)==0))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			memcpy(tmp, in, AES_BLOCK_SIZE);
 | 
								aes_block_t *ivp = (aes_block_t *)ivec;
 | 
				
			||||||
			memcpy(tmp2, in, AES_BLOCK_SIZE);
 | 
								aes_block_t *iv2p = (aes_block_t *)(ivec + AES_BLOCK_SIZE);
 | 
				
			||||||
			/*			hexdump(stdout, "in", in, AES_BLOCK_SIZE); */
 | 
					
 | 
				
			||||||
			/*			hexdump(stdout, "iv2", iv2, AES_BLOCK_SIZE); */
 | 
								while (len)
 | 
				
			||||||
			for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
									{
 | 
				
			||||||
				tmp[n] ^= iv2[n];
 | 
									aes_block_t tmp;
 | 
				
			||||||
			/*			hexdump(stdout, "in ^ iv2", tmp, AES_BLOCK_SIZE); */
 | 
									aes_block_t *inp = (aes_block_t *)in;
 | 
				
			||||||
			AES_decrypt(tmp, out, key);
 | 
									aes_block_t *outp = (aes_block_t *)out;
 | 
				
			||||||
			/*			hexdump(stdout, "dec", out, AES_BLOCK_SIZE); */
 | 
					
 | 
				
			||||||
			/*			hexdump(stdout, "iv", ivec, AES_BLOCK_SIZE); */
 | 
									for(n=0 ; n < N_WORDS; ++n)
 | 
				
			||||||
			for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
										tmp.data[n] = inp->data[n] ^ iv2p->data[n];
 | 
				
			||||||
				out[n] ^= ivec[n];
 | 
									AES_decrypt((unsigned char *)tmp.data, (unsigned char *)outp->data, key);
 | 
				
			||||||
			/*			hexdump(stdout, "out", out, AES_BLOCK_SIZE); */
 | 
									for(n=0 ; n < N_WORDS; ++n)
 | 
				
			||||||
			memcpy(ivec, tmp2, AES_BLOCK_SIZE);
 | 
										outp->data[n] ^= ivp->data[n];
 | 
				
			||||||
			iv2 = out;
 | 
									ivp = inp;
 | 
				
			||||||
			len -= AES_BLOCK_SIZE;
 | 
									iv2p = outp;
 | 
				
			||||||
			in += AES_BLOCK_SIZE;
 | 
									--len;
 | 
				
			||||||
			out += AES_BLOCK_SIZE;
 | 
									in += AES_BLOCK_SIZE;
 | 
				
			||||||
 | 
									out += AES_BLOCK_SIZE;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								memcpy(ivec, ivp->data, AES_BLOCK_SIZE);
 | 
				
			||||||
 | 
								memcpy(ivec + AES_BLOCK_SIZE, iv2p->data, AES_BLOCK_SIZE);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								aes_block_t tmp, tmp2;
 | 
				
			||||||
 | 
								aes_block_t iv;
 | 
				
			||||||
 | 
								aes_block_t iv2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								load_block(iv, ivec);
 | 
				
			||||||
 | 
								load_block(iv2, ivec + AES_BLOCK_SIZE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								while (len)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									load_block(tmp, in);
 | 
				
			||||||
 | 
									tmp2 = tmp;
 | 
				
			||||||
 | 
									for(n=0 ; n < N_WORDS; ++n)
 | 
				
			||||||
 | 
										tmp.data[n] ^= iv2.data[n];
 | 
				
			||||||
 | 
									AES_decrypt((unsigned char *)tmp.data, (unsigned char *)tmp.data, key);
 | 
				
			||||||
 | 
									for(n=0 ; n < N_WORDS; ++n)
 | 
				
			||||||
 | 
										tmp.data[n] ^= iv.data[n];
 | 
				
			||||||
 | 
									store_block(out, tmp);
 | 
				
			||||||
 | 
									iv = tmp2;
 | 
				
			||||||
 | 
									iv2 = tmp;
 | 
				
			||||||
 | 
									--len;
 | 
				
			||||||
 | 
									in += AES_BLOCK_SIZE;
 | 
				
			||||||
 | 
									out += AES_BLOCK_SIZE;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								memcpy(ivec, iv.data, AES_BLOCK_SIZE);
 | 
				
			||||||
 | 
								memcpy(ivec + AES_BLOCK_SIZE, iv2.data, AES_BLOCK_SIZE);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		memcpy(ivec + AES_BLOCK_SIZE, iv2, AES_BLOCK_SIZE);
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -177,17 +238,11 @@ void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
 | 
				
			|||||||
		iv2 = ivec + AES_BLOCK_SIZE;
 | 
							iv2 = ivec + AES_BLOCK_SIZE;
 | 
				
			||||||
		while (len >= AES_BLOCK_SIZE)
 | 
							while (len >= AES_BLOCK_SIZE)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			/*			hexdump(stdout, "in", in, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			/*			hexdump(stdout, "iv", iv, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
								for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
				
			||||||
				out[n] = in[n] ^ iv[n];
 | 
									out[n] = in[n] ^ iv[n];
 | 
				
			||||||
			/*			hexdump(stdout, "in ^ iv", out, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			AES_encrypt(out, out, key);
 | 
								AES_encrypt(out, out, key);
 | 
				
			||||||
			/*			hexdump(stdout,"enc", out, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			/*			hexdump(stdout,"iv2", iv2, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
								for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
				
			||||||
				out[n] ^= iv2[n];
 | 
									out[n] ^= iv2[n];
 | 
				
			||||||
			/*			hexdump(stdout,"out", out, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			iv = out;
 | 
								iv = out;
 | 
				
			||||||
			memcpy(prev, in, AES_BLOCK_SIZE);
 | 
								memcpy(prev, in, AES_BLOCK_SIZE);
 | 
				
			||||||
			iv2 = prev;
 | 
								iv2 = prev;
 | 
				
			||||||
@@ -203,8 +258,6 @@ void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
 | 
				
			|||||||
		while(len >= AES_BLOCK_SIZE)
 | 
							while(len >= AES_BLOCK_SIZE)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			out -= AES_BLOCK_SIZE;
 | 
								out -= AES_BLOCK_SIZE;
 | 
				
			||||||
			/*			hexdump(stdout, "intermediate", out, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			/*			hexdump(stdout, "iv", iv, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			/* XXX: reduce copies by alternating between buffers */
 | 
								/* XXX: reduce copies by alternating between buffers */
 | 
				
			||||||
			memcpy(tmp, out, AES_BLOCK_SIZE);
 | 
								memcpy(tmp, out, AES_BLOCK_SIZE);
 | 
				
			||||||
			for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
								for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
				
			||||||
@@ -235,17 +288,11 @@ void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
 | 
				
			|||||||
			out -= AES_BLOCK_SIZE;
 | 
								out -= AES_BLOCK_SIZE;
 | 
				
			||||||
			memcpy(tmp, in, AES_BLOCK_SIZE);
 | 
								memcpy(tmp, in, AES_BLOCK_SIZE);
 | 
				
			||||||
			memcpy(tmp2, in, AES_BLOCK_SIZE);
 | 
								memcpy(tmp2, in, AES_BLOCK_SIZE);
 | 
				
			||||||
			/*			hexdump(stdout, "in", in, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			/*			hexdump(stdout, "iv2", iv2, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
								for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
				
			||||||
				tmp[n] ^= iv2[n];
 | 
									tmp[n] ^= iv2[n];
 | 
				
			||||||
			/*			hexdump(stdout, "in ^ iv2", tmp, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			AES_decrypt(tmp, out, key);
 | 
								AES_decrypt(tmp, out, key);
 | 
				
			||||||
			/*			hexdump(stdout, "dec", out, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			/*			hexdump(stdout, "iv", iv, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
								for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
				
			||||||
				out[n] ^= iv[n];
 | 
									out[n] ^= iv[n];
 | 
				
			||||||
			/*			hexdump(stdout, "out", out, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			memcpy(tmp3, tmp2, AES_BLOCK_SIZE);
 | 
								memcpy(tmp3, tmp2, AES_BLOCK_SIZE);
 | 
				
			||||||
			iv = tmp3;
 | 
								iv = tmp3;
 | 
				
			||||||
			iv2 = out;
 | 
								iv2 = out;
 | 
				
			||||||
@@ -260,17 +307,11 @@ void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
 | 
				
			|||||||
			{
 | 
								{
 | 
				
			||||||
			memcpy(tmp, out, AES_BLOCK_SIZE);
 | 
								memcpy(tmp, out, AES_BLOCK_SIZE);
 | 
				
			||||||
			memcpy(tmp2, out, AES_BLOCK_SIZE);
 | 
								memcpy(tmp2, out, AES_BLOCK_SIZE);
 | 
				
			||||||
			/*			hexdump(stdout, "intermediate", out, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			/*			hexdump(stdout, "iv2", iv2, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
								for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
				
			||||||
				tmp[n] ^= iv2[n];
 | 
									tmp[n] ^= iv2[n];
 | 
				
			||||||
			/*			hexdump(stdout, "out ^ iv2", tmp, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			AES_decrypt(tmp, out, key);
 | 
								AES_decrypt(tmp, out, key);
 | 
				
			||||||
			/*			hexdump(stdout, "dec", out, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			/*			hexdump(stdout, "iv", ivec, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
								for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
				
			||||||
				out[n] ^= iv[n];
 | 
									out[n] ^= iv[n];
 | 
				
			||||||
			/*			hexdump(stdout, "out", out, AES_BLOCK_SIZE); */
 | 
					 | 
				
			||||||
			memcpy(tmp3, tmp2, AES_BLOCK_SIZE);
 | 
								memcpy(tmp3, tmp2, AES_BLOCK_SIZE);
 | 
				
			||||||
			iv = tmp3;
 | 
								iv = tmp3;
 | 
				
			||||||
			iv2 = out;
 | 
								iv2 = out;
 | 
				
			||||||
@@ -278,6 +319,5 @@ void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
 | 
				
			|||||||
			in += AES_BLOCK_SIZE;
 | 
								in += AES_BLOCK_SIZE;
 | 
				
			||||||
			out += AES_BLOCK_SIZE;
 | 
								out += AES_BLOCK_SIZE;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -512,11 +512,11 @@ sub declast()
 | 
				
			|||||||
	if($i==3)   {	&mov	($key,&DWP(12,"esp"));		}
 | 
						if($i==3)   {	&mov	($key,&DWP(12,"esp"));		}
 | 
				
			||||||
	else        {	&mov	($out,$s[0]);			}
 | 
						else        {	&mov	($out,$s[0]);			}
 | 
				
			||||||
			&and	($out,0xFF);
 | 
								&and	($out,0xFF);
 | 
				
			||||||
			&movz	($out,&DWP(2048,$td,$out,1));
 | 
								&movz	($out,&BP(2048,$td,$out,1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ($i==3)  {	$tmp=$s[1];				}
 | 
						if ($i==3)  {	$tmp=$s[1];				}
 | 
				
			||||||
			&movz	($tmp,&HB($s[1]));
 | 
								&movz	($tmp,&HB($s[1]));
 | 
				
			||||||
			&movz	($tmp,&DWP(2048,$td,$tmp,1));
 | 
								&movz	($tmp,&BP(2048,$td,$tmp,1));
 | 
				
			||||||
			&shl	($tmp,8);
 | 
								&shl	($tmp,8);
 | 
				
			||||||
			&xor	($out,$tmp);
 | 
								&xor	($out,$tmp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -524,14 +524,14 @@ sub declast()
 | 
				
			|||||||
	else        {	mov	($tmp,$s[2]);			}
 | 
						else        {	mov	($tmp,$s[2]);			}
 | 
				
			||||||
			&shr	($tmp,16);
 | 
								&shr	($tmp,16);
 | 
				
			||||||
			&and	($tmp,0xFF);
 | 
								&and	($tmp,0xFF);
 | 
				
			||||||
			&movz	($tmp,&DWP(2048,$td,$tmp,1));
 | 
								&movz	($tmp,&BP(2048,$td,$tmp,1));
 | 
				
			||||||
			&shl	($tmp,16);
 | 
								&shl	($tmp,16);
 | 
				
			||||||
			&xor	($out,$tmp);
 | 
								&xor	($out,$tmp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ($i==3)  {	$tmp=$s[3]; &mov ($s[2],&DWP(8,"esp"));	}
 | 
						if ($i==3)  {	$tmp=$s[3]; &mov ($s[2],&DWP(8,"esp"));	}
 | 
				
			||||||
	else        {	&mov	($tmp,$s[3]);			}
 | 
						else        {	&mov	($tmp,$s[3]);			}
 | 
				
			||||||
			&shr	($tmp,24);
 | 
								&shr	($tmp,24);
 | 
				
			||||||
			&movz	($tmp,&DWP(2048,$td,$tmp,1));
 | 
								&movz	($tmp,&BP(2048,$td,$tmp,1));
 | 
				
			||||||
			&shl	($tmp,24);
 | 
								&shl	($tmp,24);
 | 
				
			||||||
			&xor	($out,$tmp);
 | 
								&xor	($out,$tmp);
 | 
				
			||||||
	if ($i<2)   {	&mov	(&DWP(4+4*$i,"esp"),$out);	}
 | 
						if ($i<2)   {	&mov	(&DWP(4+4*$i,"esp"),$out);	}
 | 
				
			||||||
@@ -940,7 +940,6 @@ my $mark=&DWP(60+240,"esp");	#copy of aes_key->rounds
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	&cmp	($mark,0);		# was the key schedule copied?
 | 
						&cmp	($mark,0);		# was the key schedule copied?
 | 
				
			||||||
	&mov	("edi",$_key);
 | 
						&mov	("edi",$_key);
 | 
				
			||||||
	&mov	("esp",$_esp);
 | 
					 | 
				
			||||||
	&je	(&label("skip_ezero"));
 | 
						&je	(&label("skip_ezero"));
 | 
				
			||||||
	# zero copy of key schedule
 | 
						# zero copy of key schedule
 | 
				
			||||||
	&mov	("ecx",240/4);
 | 
						&mov	("ecx",240/4);
 | 
				
			||||||
@@ -948,6 +947,7 @@ my $mark=&DWP(60+240,"esp");	#copy of aes_key->rounds
 | 
				
			|||||||
	&align	(4);
 | 
						&align	(4);
 | 
				
			||||||
	&data_word(0xABF3F689);	# rep stosd
 | 
						&data_word(0xABF3F689);	# rep stosd
 | 
				
			||||||
	&set_label("skip_ezero")
 | 
						&set_label("skip_ezero")
 | 
				
			||||||
 | 
						&mov	("esp",$_esp);
 | 
				
			||||||
	&popf	();
 | 
						&popf	();
 | 
				
			||||||
    &set_label("enc_out");
 | 
					    &set_label("enc_out");
 | 
				
			||||||
	&function_end_A();
 | 
						&function_end_A();
 | 
				
			||||||
@@ -1197,7 +1197,6 @@ my $mark=&DWP(60+240,"esp");	#copy of aes_key->rounds
 | 
				
			|||||||
    &set_label("dec_out");
 | 
					    &set_label("dec_out");
 | 
				
			||||||
    &cmp	($mark,0);		# was the key schedule copied?
 | 
					    &cmp	($mark,0);		# was the key schedule copied?
 | 
				
			||||||
    &mov	("edi",$_key);
 | 
					    &mov	("edi",$_key);
 | 
				
			||||||
    &mov	("esp",$_esp);
 | 
					 | 
				
			||||||
    &je		(&label("skip_dzero"));
 | 
					    &je		(&label("skip_dzero"));
 | 
				
			||||||
    # zero copy of key schedule
 | 
					    # zero copy of key schedule
 | 
				
			||||||
    &mov	("ecx",240/4);
 | 
					    &mov	("ecx",240/4);
 | 
				
			||||||
@@ -1205,6 +1204,7 @@ my $mark=&DWP(60+240,"esp");	#copy of aes_key->rounds
 | 
				
			|||||||
    &align	(4);
 | 
					    &align	(4);
 | 
				
			||||||
    &data_word(0xABF3F689);	# rep stosd
 | 
					    &data_word(0xABF3F689);	# rep stosd
 | 
				
			||||||
    &set_label("skip_dzero")
 | 
					    &set_label("skip_dzero")
 | 
				
			||||||
 | 
					    &mov	("esp",$_esp);
 | 
				
			||||||
    &popf	();
 | 
					    &popf	();
 | 
				
			||||||
&function_end("AES_cbc_encrypt");
 | 
					&function_end("AES_cbc_encrypt");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -322,6 +322,17 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
 | 
				
			|||||||
#define I2D_OF(type) int (*)(type *,unsigned char **)
 | 
					#define I2D_OF(type) int (*)(type *,unsigned char **)
 | 
				
			||||||
#define I2D_OF_const(type) int (*)(const type *,unsigned char **)
 | 
					#define I2D_OF_const(type) int (*)(const type *,unsigned char **)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define CHECKED_D2I_OF(type, d2i) \
 | 
				
			||||||
 | 
					    ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0)))
 | 
				
			||||||
 | 
					#define CHECKED_I2D_OF(type, i2d) \
 | 
				
			||||||
 | 
					    ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0)))
 | 
				
			||||||
 | 
					#define CHECKED_NEW_OF(type, xnew) \
 | 
				
			||||||
 | 
					    ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0)))
 | 
				
			||||||
 | 
					#define CHECKED_PTR_OF(type, p) \
 | 
				
			||||||
 | 
					    ((void*) (1 ? p : (type*)0))
 | 
				
			||||||
 | 
					#define CHECKED_PPTR_OF(type, p) \
 | 
				
			||||||
 | 
					    ((void**) (1 ? p : (type**)0))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long)
 | 
					#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long)
 | 
				
			||||||
#define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **)
 | 
					#define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **)
 | 
				
			||||||
#define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type)
 | 
					#define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type)
 | 
				
			||||||
@@ -902,23 +913,41 @@ int ASN1_object_size(int constructed, int length, int tag);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* Used to implement other functions */
 | 
					/* Used to implement other functions */
 | 
				
			||||||
void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x);
 | 
					void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ASN1_dup_of(type,i2d,d2i,x) \
 | 
					#define ASN1_dup_of(type,i2d,d2i,x) \
 | 
				
			||||||
	((type *(*)(I2D_OF(type),D2I_OF(type),type *))openssl_fcast(ASN1_dup))(i2d,d2i,x)
 | 
					    ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \
 | 
				
			||||||
 | 
							     CHECKED_D2I_OF(type, d2i), \
 | 
				
			||||||
 | 
							     CHECKED_PTR_OF(type, x)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ASN1_dup_of_const(type,i2d,d2i,x) \
 | 
					#define ASN1_dup_of_const(type,i2d,d2i,x) \
 | 
				
			||||||
	((type *(*)(I2D_OF_const(type),D2I_OF(type),type *))openssl_fcast(ASN1_dup))(i2d,d2i,x)
 | 
					    ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \
 | 
				
			||||||
 | 
							     CHECKED_D2I_OF(type, d2i), \
 | 
				
			||||||
 | 
							     CHECKED_PTR_OF(const type, x)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
 | 
					void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef OPENSSL_NO_FP_API
 | 
					#ifndef OPENSSL_NO_FP_API
 | 
				
			||||||
void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x);
 | 
					void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \
 | 
					#define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \
 | 
				
			||||||
	((type *(*)(type *(*)(void),D2I_OF(type),FILE *,type **))openssl_fcast(ASN1_d2i_fp))(xnew,d2i,in,x)
 | 
					    ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \
 | 
				
			||||||
 | 
								CHECKED_D2I_OF(type, d2i), \
 | 
				
			||||||
 | 
								in, \
 | 
				
			||||||
 | 
								CHECKED_PPTR_OF(type, x)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);
 | 
					void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);
 | 
				
			||||||
int ASN1_i2d_fp(i2d_of_void *i2d,FILE *out,void *x);
 | 
					int ASN1_i2d_fp(i2d_of_void *i2d,FILE *out,void *x);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ASN1_i2d_fp_of(type,i2d,out,x) \
 | 
					#define ASN1_i2d_fp_of(type,i2d,out,x) \
 | 
				
			||||||
	((int (*)(I2D_OF(type),FILE *,type *))openssl_fcast(ASN1_i2d_fp))(i2d,out,x)
 | 
					    (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \
 | 
				
			||||||
 | 
							 out, \
 | 
				
			||||||
 | 
							 CHECKED_PTR_OF(type, x)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ASN1_i2d_fp_of_const(type,i2d,out,x) \
 | 
					#define ASN1_i2d_fp_of_const(type,i2d,out,x) \
 | 
				
			||||||
	((int (*)(I2D_OF_const(type),FILE *,type *))openssl_fcast(ASN1_i2d_fp))(i2d,out,x)
 | 
					    (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \
 | 
				
			||||||
 | 
							 out, \
 | 
				
			||||||
 | 
							 CHECKED_PTR_OF(const type, x)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);
 | 
					int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);
 | 
				
			||||||
int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);
 | 
					int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -927,14 +956,26 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#ifndef OPENSSL_NO_BIO
 | 
					#ifndef OPENSSL_NO_BIO
 | 
				
			||||||
void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x);
 | 
					void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \
 | 
					#define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \
 | 
				
			||||||
	((type *(*)(type *(*)(void),D2I_OF(type),BIO *,type **))openssl_fcast(ASN1_d2i_bio))(xnew,d2i,in,x)
 | 
					    ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \
 | 
				
			||||||
 | 
								  CHECKED_D2I_OF(type, d2i), \
 | 
				
			||||||
 | 
								  in, \
 | 
				
			||||||
 | 
								  CHECKED_PPTR_OF(type, x)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);
 | 
					void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);
 | 
				
			||||||
int ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x);
 | 
					int ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ASN1_i2d_bio_of(type,i2d,out,x) \
 | 
					#define ASN1_i2d_bio_of(type,i2d,out,x) \
 | 
				
			||||||
	((int (*)(I2D_OF(type),BIO *,type *))openssl_fcast(ASN1_i2d_bio))(i2d,out,x)
 | 
					    (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \
 | 
				
			||||||
 | 
							  out, \
 | 
				
			||||||
 | 
							  CHECKED_PTR_OF(type, x)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ASN1_i2d_bio_of_const(type,i2d,out,x) \
 | 
					#define ASN1_i2d_bio_of_const(type,i2d,out,x) \
 | 
				
			||||||
	((int (*)(I2D_OF_const(type),BIO *,const type *))openssl_fcast(ASN1_i2d_bio))(i2d,out,x)
 | 
					    (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \
 | 
				
			||||||
 | 
							  out, \
 | 
				
			||||||
 | 
							  CHECKED_PTR_OF(const type, x)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
 | 
					int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
 | 
				
			||||||
int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a);
 | 
					int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a);
 | 
				
			||||||
int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a);
 | 
					int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a);
 | 
				
			||||||
@@ -977,8 +1018,12 @@ void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);
 | 
				
			|||||||
void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
 | 
					void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
 | 
				
			||||||
ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
 | 
					ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
 | 
				
			||||||
			      ASN1_OCTET_STRING **oct);
 | 
								      ASN1_OCTET_STRING **oct);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ASN1_pack_string_of(type,obj,i2d,oct) \
 | 
					#define ASN1_pack_string_of(type,obj,i2d,oct) \
 | 
				
			||||||
	((ASN1_STRING *(*)(type *,I2D_OF(type),ASN1_OCTET_STRING **))openssl_fcast(ASN1_pack_string))(obj,i2d,oct)
 | 
					    (ASN1_pack_string(CHECKED_PTR_OF(type, obj), \
 | 
				
			||||||
 | 
							      CHECKED_I2D_OF(type, i2d), \
 | 
				
			||||||
 | 
							      oct))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct);
 | 
					ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ASN1_STRING_set_default_mask(unsigned long mask);
 | 
					void ASN1_STRING_set_default_mask(unsigned long mask);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -149,7 +149,7 @@ static int do_create(char *value, char *name)
 | 
				
			|||||||
		if (lntmp == NULL)
 | 
							if (lntmp == NULL)
 | 
				
			||||||
			return 0;
 | 
								return 0;
 | 
				
			||||||
		memcpy(lntmp, ln, p - ln);
 | 
							memcpy(lntmp, ln, p - ln);
 | 
				
			||||||
		lntmp[p - ln + 1] = 0;
 | 
							lntmp[p - ln] = 0;
 | 
				
			||||||
		oid = OBJ_nid2obj(nid);
 | 
							oid = OBJ_nid2obj(nid);
 | 
				
			||||||
		oid->ln = lntmp;
 | 
							oid->ln = lntmp;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -244,7 +244,7 @@ get_next:
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	if(!(cflag & X509_FLAG_NO_ATTRIBUTES))
 | 
						if(!(cflag & X509_FLAG_NO_EXTENSIONS))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		exts = X509_REQ_get_extensions(x);
 | 
							exts = X509_REQ_get_extensions(x);
 | 
				
			||||||
		if(exts)
 | 
							if(exts)
 | 
				
			||||||
@@ -262,7 +262,7 @@ get_next:
 | 
				
			|||||||
				j=X509_EXTENSION_get_critical(ex);
 | 
									j=X509_EXTENSION_get_critical(ex);
 | 
				
			||||||
				if (BIO_printf(bp,": %s\n",j?"critical":"") <= 0)
 | 
									if (BIO_printf(bp,": %s\n",j?"critical":"") <= 0)
 | 
				
			||||||
					goto err;
 | 
										goto err;
 | 
				
			||||||
				if(!X509V3_EXT_print(bp, ex, 0, 16))
 | 
									if(!X509V3_EXT_print(bp, ex, cflag, 16))
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
					BIO_printf(bp, "%16s", "");
 | 
										BIO_printf(bp, "%16s", "");
 | 
				
			||||||
					M_ASN1_OCTET_STRING_print(bp,ex->value);
 | 
										M_ASN1_OCTET_STRING_print(bp,ex->value);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -130,7 +130,7 @@ ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval,
 | 
				
			|||||||
	ASN1_VALUE *ptmpval = NULL;
 | 
						ASN1_VALUE *ptmpval = NULL;
 | 
				
			||||||
	if (!pval)
 | 
						if (!pval)
 | 
				
			||||||
		pval = &ptmpval;
 | 
							pval = &ptmpval;
 | 
				
			||||||
	asn1_tlc_clear(&c);
 | 
						c.valid = 0;
 | 
				
			||||||
	if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) 
 | 
						if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) 
 | 
				
			||||||
		return *pval;
 | 
							return *pval;
 | 
				
			||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
@@ -140,7 +140,7 @@ int ASN1_template_d2i(ASN1_VALUE **pval,
 | 
				
			|||||||
		const unsigned char **in, long len, const ASN1_TEMPLATE *tt)
 | 
							const unsigned char **in, long len, const ASN1_TEMPLATE *tt)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	ASN1_TLC c;
 | 
						ASN1_TLC c;
 | 
				
			||||||
	asn1_tlc_clear(&c);
 | 
						c.valid = 0;
 | 
				
			||||||
	return asn1_template_ex_d2i(pval, in, len, tt, 0, &c);
 | 
						return asn1_template_ex_d2i(pval, in, len, tt, 0, &c);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -494,7 +494,7 @@ static int asn1_set_seq_out(STACK_OF(ASN1_VALUE) *sk, unsigned char **out,
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
		for (i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk);
 | 
							for (i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk);
 | 
				
			||||||
							i++, tder++)
 | 
												i++, tder++)
 | 
				
			||||||
			sk_ASN1_VALUE_set(sk, i, tder->field);
 | 
								(void)sk_ASN1_VALUE_set(sk, i, tder->field);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	OPENSSL_free(derlst);
 | 
						OPENSSL_free(derlst);
 | 
				
			||||||
	OPENSSL_free(tmpdat);
 | 
						OPENSSL_free(tmpdat);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -84,7 +84,7 @@ static int crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
 | 
				
			|||||||
		 * would affect the output of X509_CRL_print().
 | 
							 * would affect the output of X509_CRL_print().
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		case ASN1_OP_D2I_POST:
 | 
							case ASN1_OP_D2I_POST:
 | 
				
			||||||
		sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_cmp);
 | 
							(void)sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_cmp);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -160,40 +160,40 @@ static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long len
 | 
				
			|||||||
					int tag, int aclass, char opt, ASN1_TLC *ctx)
 | 
										int tag, int aclass, char opt, ASN1_TLC *ctx)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	const unsigned char *p = *in, *q;
 | 
						const unsigned char *p = *in, *q;
 | 
				
			||||||
	STACK *intname = NULL, **intname_pp = &intname;
 | 
						union { STACK *s; ASN1_VALUE *a; } intname = {NULL};
 | 
				
			||||||
 | 
						union { X509_NAME *x; ASN1_VALUE *a; } nm = {NULL};
 | 
				
			||||||
	int i, j, ret;
 | 
						int i, j, ret;
 | 
				
			||||||
	X509_NAME *nm = NULL, **nm_pp = &nm;
 | 
					 | 
				
			||||||
	STACK_OF(X509_NAME_ENTRY) *entries;
 | 
						STACK_OF(X509_NAME_ENTRY) *entries;
 | 
				
			||||||
	X509_NAME_ENTRY *entry;
 | 
						X509_NAME_ENTRY *entry;
 | 
				
			||||||
	q = p;
 | 
						q = p;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Get internal representation of Name */
 | 
						/* Get internal representation of Name */
 | 
				
			||||||
	ret = ASN1_item_ex_d2i((ASN1_VALUE **)intname_pp,
 | 
						ret = ASN1_item_ex_d2i(&intname.a,
 | 
				
			||||||
			       &p, len, ASN1_ITEM_rptr(X509_NAME_INTERNAL),
 | 
								       &p, len, ASN1_ITEM_rptr(X509_NAME_INTERNAL),
 | 
				
			||||||
			       tag, aclass, opt, ctx);
 | 
								       tag, aclass, opt, ctx);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if(ret <= 0) return ret;
 | 
						if(ret <= 0) return ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(*val) x509_name_ex_free(val, NULL);
 | 
						if(*val) x509_name_ex_free(val, NULL);
 | 
				
			||||||
	if(!x509_name_ex_new((ASN1_VALUE **)nm_pp, NULL)) goto err;
 | 
						if(!x509_name_ex_new(&nm.a, NULL)) goto err;
 | 
				
			||||||
	/* We've decoded it: now cache encoding */
 | 
						/* We've decoded it: now cache encoding */
 | 
				
			||||||
	if(!BUF_MEM_grow(nm->bytes, p - q)) goto err;
 | 
						if(!BUF_MEM_grow(nm.x->bytes, p - q)) goto err;
 | 
				
			||||||
	memcpy(nm->bytes->data, q, p - q);
 | 
						memcpy(nm.x->bytes->data, q, p - q);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Convert internal representation to X509_NAME structure */
 | 
						/* Convert internal representation to X509_NAME structure */
 | 
				
			||||||
	for(i = 0; i < sk_num(intname); i++) {
 | 
						for(i = 0; i < sk_num(intname.s); i++) {
 | 
				
			||||||
		entries = (STACK_OF(X509_NAME_ENTRY) *)sk_value(intname, i);
 | 
							entries = (STACK_OF(X509_NAME_ENTRY) *)sk_value(intname.s, i);
 | 
				
			||||||
		for(j = 0; j < sk_X509_NAME_ENTRY_num(entries); j++) {
 | 
							for(j = 0; j < sk_X509_NAME_ENTRY_num(entries); j++) {
 | 
				
			||||||
			entry = sk_X509_NAME_ENTRY_value(entries, j);
 | 
								entry = sk_X509_NAME_ENTRY_value(entries, j);
 | 
				
			||||||
			entry->set = i;
 | 
								entry->set = i;
 | 
				
			||||||
			if(!sk_X509_NAME_ENTRY_push(nm->entries, entry))
 | 
								if(!sk_X509_NAME_ENTRY_push(nm.x->entries, entry))
 | 
				
			||||||
				goto err;
 | 
									goto err;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		sk_X509_NAME_ENTRY_free(entries);
 | 
							sk_X509_NAME_ENTRY_free(entries);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	sk_free(intname);
 | 
						sk_free(intname.s);
 | 
				
			||||||
	nm->modified = 0;
 | 
						nm.x->modified = 0;
 | 
				
			||||||
	*val = (ASN1_VALUE *)nm;
 | 
						*val = nm.a;
 | 
				
			||||||
	*in = p;
 | 
						*in = p;
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
	err:
 | 
						err:
 | 
				
			||||||
@@ -219,35 +219,35 @@ static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out, const ASN1_IT
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static int x509_name_encode(X509_NAME *a)
 | 
					static int x509_name_encode(X509_NAME *a)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	STACK *intname = NULL, **intname_pp = &intname;
 | 
						union { STACK *s; ASN1_VALUE *a; } intname = {NULL};
 | 
				
			||||||
	int len;
 | 
						int len;
 | 
				
			||||||
	unsigned char *p;
 | 
						unsigned char *p;
 | 
				
			||||||
	STACK_OF(X509_NAME_ENTRY) *entries = NULL;
 | 
						STACK_OF(X509_NAME_ENTRY) *entries = NULL;
 | 
				
			||||||
	X509_NAME_ENTRY *entry;
 | 
						X509_NAME_ENTRY *entry;
 | 
				
			||||||
	int i, set = -1;
 | 
						int i, set = -1;
 | 
				
			||||||
	intname = sk_new_null();
 | 
						intname.s = sk_new_null();
 | 
				
			||||||
	if(!intname) goto memerr;
 | 
						if(!intname.s) goto memerr;
 | 
				
			||||||
	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
 | 
						for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
 | 
				
			||||||
		entry = sk_X509_NAME_ENTRY_value(a->entries, i);
 | 
							entry = sk_X509_NAME_ENTRY_value(a->entries, i);
 | 
				
			||||||
		if(entry->set != set) {
 | 
							if(entry->set != set) {
 | 
				
			||||||
			entries = sk_X509_NAME_ENTRY_new_null();
 | 
								entries = sk_X509_NAME_ENTRY_new_null();
 | 
				
			||||||
			if(!entries) goto memerr;
 | 
								if(!entries) goto memerr;
 | 
				
			||||||
			if(!sk_push(intname, (char *)entries)) goto memerr;
 | 
								if(!sk_push(intname.s, (char *)entries)) goto memerr;
 | 
				
			||||||
			set = entry->set;
 | 
								set = entry->set;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr;
 | 
							if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	len = ASN1_item_ex_i2d((ASN1_VALUE **)intname_pp, NULL,
 | 
						len = ASN1_item_ex_i2d(&intname.a, NULL,
 | 
				
			||||||
			       ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1);
 | 
								       ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1);
 | 
				
			||||||
	if (!BUF_MEM_grow(a->bytes,len)) goto memerr;
 | 
						if (!BUF_MEM_grow(a->bytes,len)) goto memerr;
 | 
				
			||||||
	p=(unsigned char *)a->bytes->data;
 | 
						p=(unsigned char *)a->bytes->data;
 | 
				
			||||||
	ASN1_item_ex_i2d((ASN1_VALUE **)intname_pp,
 | 
						ASN1_item_ex_i2d(&intname.a,
 | 
				
			||||||
			 &p, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1);
 | 
								 &p, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1);
 | 
				
			||||||
	sk_pop_free(intname, sk_internal_free);
 | 
						sk_pop_free(intname.s, sk_internal_free);
 | 
				
			||||||
	a->modified = 0;
 | 
						a->modified = 0;
 | 
				
			||||||
	return len;
 | 
						return len;
 | 
				
			||||||
	memerr:
 | 
						memerr:
 | 
				
			||||||
	sk_pop_free(intname, sk_internal_free);
 | 
						sk_pop_free(intname.s, sk_internal_free);
 | 
				
			||||||
	ASN1err(ASN1_F_X509_NAME_ENCODE, ERR_R_MALLOC_FAILURE);
 | 
						ASN1err(ASN1_F_X509_NAME_ENCODE, ERR_R_MALLOC_FAILURE);
 | 
				
			||||||
	return -1;
 | 
						return -1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -79,7 +79,7 @@
 | 
				
			|||||||
#include <openssl/bn.h>         /* To get BN_LLONG properly defined */
 | 
					#include <openssl/bn.h>         /* To get BN_LLONG properly defined */
 | 
				
			||||||
#include <openssl/bio.h>
 | 
					#include <openssl/bio.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef BN_LLONG
 | 
					#if defined(BN_LLONG) || defined(SIXTY_FOUR_BIT)
 | 
				
			||||||
# ifndef HAVE_LONG_LONG
 | 
					# ifndef HAVE_LONG_LONG
 | 
				
			||||||
#  define HAVE_LONG_LONG 1
 | 
					#  define HAVE_LONG_LONG 1
 | 
				
			||||||
# endif
 | 
					# endif
 | 
				
			||||||
@@ -117,7 +117,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#if HAVE_LONG_LONG
 | 
					#if HAVE_LONG_LONG
 | 
				
			||||||
# if defined(OPENSSL_SYS_WIN32) && !defined(__GNUC__)
 | 
					# if defined(OPENSSL_SYS_WIN32) && !defined(__GNUC__)
 | 
				
			||||||
# define LLONG _int64
 | 
					# define LLONG __int64
 | 
				
			||||||
# else
 | 
					# else
 | 
				
			||||||
# define LLONG long long
 | 
					# define LLONG long long
 | 
				
			||||||
# endif
 | 
					# endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -456,9 +456,6 @@ int BIO_sock_init(void)
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
		int err;
 | 
							int err;
 | 
				
			||||||
	  
 | 
						  
 | 
				
			||||||
#ifdef SIGINT
 | 
					 | 
				
			||||||
		signal(SIGINT,(void (*)(int))BIO_sock_cleanup);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
		wsa_init_done=1;
 | 
							wsa_init_done=1;
 | 
				
			||||||
		memset(&wsa_state,0,sizeof(wsa_state));
 | 
							memset(&wsa_state,0,sizeof(wsa_state));
 | 
				
			||||||
		if (WSAStartup(0x0101,&wsa_state)!=0)
 | 
							if (WSAStartup(0x0101,&wsa_state)!=0)
 | 
				
			||||||
@@ -484,11 +481,6 @@ int BIO_sock_init(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (!wsa_init_done)
 | 
					    if (!wsa_init_done)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
   
 | 
					 | 
				
			||||||
# ifdef SIGINT
 | 
					 | 
				
			||||||
        signal(SIGINT,(void (*)(int))BIO_sock_cleanup);
 | 
					 | 
				
			||||||
# endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        wsa_init_done=1;
 | 
					        wsa_init_done=1;
 | 
				
			||||||
        wVerReq = MAKEWORD( 2, 0 );
 | 
					        wVerReq = MAKEWORD( 2, 0 );
 | 
				
			||||||
        err = WSAStartup(wVerReq,&wsaData);
 | 
					        err = WSAStartup(wVerReq,&wsaData);
 | 
				
			||||||
@@ -511,7 +503,7 @@ void BIO_sock_cleanup(void)
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
		wsa_init_done=0;
 | 
							wsa_init_done=0;
 | 
				
			||||||
#ifndef OPENSSL_SYS_WINCE
 | 
					#ifndef OPENSSL_SYS_WINCE
 | 
				
			||||||
		WSACancelBlockingCall();
 | 
							WSACancelBlockingCall();	/* Winsock 1.1 specific */
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
		WSACleanup();
 | 
							WSACleanup();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -129,8 +129,8 @@ extern "C" {
 | 
				
			|||||||
/* dgram BIO stuff */
 | 
					/* dgram BIO stuff */
 | 
				
			||||||
#define BIO_CTRL_DGRAM_CONNECT       31  /* BIO dgram special */
 | 
					#define BIO_CTRL_DGRAM_CONNECT       31  /* BIO dgram special */
 | 
				
			||||||
#define BIO_CTRL_DGRAM_SET_CONNECTED 32  /* allow for an externally
 | 
					#define BIO_CTRL_DGRAM_SET_CONNECTED 32  /* allow for an externally
 | 
				
			||||||
										  * connected socket to be
 | 
										  * connected socket to be
 | 
				
			||||||
										  * passed in */ 
 | 
										  * passed in */ 
 | 
				
			||||||
#define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */
 | 
					#define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */
 | 
				
			||||||
#define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */
 | 
					#define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */
 | 
				
			||||||
#define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */
 | 
					#define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */
 | 
				
			||||||
@@ -146,14 +146,14 @@ extern "C" {
 | 
				
			|||||||
#define BIO_CTRL_DGRAM_QUERY_MTU          40 /* as kernel for current MTU */
 | 
					#define BIO_CTRL_DGRAM_QUERY_MTU          40 /* as kernel for current MTU */
 | 
				
			||||||
#define BIO_CTRL_DGRAM_GET_MTU            41 /* get cached value for MTU */
 | 
					#define BIO_CTRL_DGRAM_GET_MTU            41 /* get cached value for MTU */
 | 
				
			||||||
#define BIO_CTRL_DGRAM_SET_MTU            42 /* set cached value for
 | 
					#define BIO_CTRL_DGRAM_SET_MTU            42 /* set cached value for
 | 
				
			||||||
											  * MTU. want to use this
 | 
										      * MTU. want to use this
 | 
				
			||||||
                                              * if asking the kernel
 | 
										      * if asking the kernel
 | 
				
			||||||
                                              * fails */
 | 
										      * fails */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define BIO_CTRL_DGRAM_MTU_EXCEEDED       43 /* check whether the MTU
 | 
					#define BIO_CTRL_DGRAM_MTU_EXCEEDED       43 /* check whether the MTU
 | 
				
			||||||
											  * was exceed in the
 | 
										      * was exceed in the
 | 
				
			||||||
											  * previous write
 | 
										      * previous write
 | 
				
			||||||
											  * operation */
 | 
										      * operation */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define BIO_CTRL_DGRAM_SET_PEER           44 /* Destination for the data */
 | 
					#define BIO_CTRL_DGRAM_SET_PEER           44 /* Destination for the data */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -171,21 +171,21 @@
 | 
				
			|||||||
.skip	32	// makes the loop body aligned at 64-byte boundary
 | 
					.skip	32	// makes the loop body aligned at 64-byte boundary
 | 
				
			||||||
bn_add_words:
 | 
					bn_add_words:
 | 
				
			||||||
	.prologue
 | 
						.prologue
 | 
				
			||||||
	.fframe	0
 | 
					 | 
				
			||||||
	.save	ar.pfs,r2
 | 
						.save	ar.pfs,r2
 | 
				
			||||||
{ .mii;	alloc		r2=ar.pfs,4,12,0,16
 | 
					{ .mii;	alloc		r2=ar.pfs,4,12,0,16
 | 
				
			||||||
	cmp4.le		p6,p0=r35,r0	};;
 | 
						cmp4.le		p6,p0=r35,r0	};;
 | 
				
			||||||
{ .mfb;	mov		r8=r0			// return value
 | 
					{ .mfb;	mov		r8=r0			// return value
 | 
				
			||||||
(p6)	br.ret.spnt.many	b0	};;
 | 
					(p6)	br.ret.spnt.many	b0	};;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.save	ar.lc,r3
 | 
					 | 
				
			||||||
{ .mib;	sub		r10=r35,r0,1
 | 
					{ .mib;	sub		r10=r35,r0,1
 | 
				
			||||||
 | 
						.save	ar.lc,r3
 | 
				
			||||||
	mov		r3=ar.lc
 | 
						mov		r3=ar.lc
 | 
				
			||||||
	brp.loop.imp	.L_bn_add_words_ctop,.L_bn_add_words_cend-16
 | 
						brp.loop.imp	.L_bn_add_words_ctop,.L_bn_add_words_cend-16
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
	.body
 | 
					 | 
				
			||||||
{ .mib;	ADDP		r14=0,r32		// rp
 | 
					{ .mib;	ADDP		r14=0,r32		// rp
 | 
				
			||||||
 | 
						.save	pr,r9
 | 
				
			||||||
	mov		r9=pr		};;
 | 
						mov		r9=pr		};;
 | 
				
			||||||
 | 
						.body
 | 
				
			||||||
{ .mii;	ADDP		r15=0,r33		// ap
 | 
					{ .mii;	ADDP		r15=0,r33		// ap
 | 
				
			||||||
	mov		ar.lc=r10
 | 
						mov		ar.lc=r10
 | 
				
			||||||
	mov		ar.ec=6		}
 | 
						mov		ar.ec=6		}
 | 
				
			||||||
@@ -224,21 +224,21 @@ bn_add_words:
 | 
				
			|||||||
.skip	32	// makes the loop body aligned at 64-byte boundary
 | 
					.skip	32	// makes the loop body aligned at 64-byte boundary
 | 
				
			||||||
bn_sub_words:
 | 
					bn_sub_words:
 | 
				
			||||||
	.prologue
 | 
						.prologue
 | 
				
			||||||
	.fframe	0
 | 
					 | 
				
			||||||
	.save	ar.pfs,r2
 | 
						.save	ar.pfs,r2
 | 
				
			||||||
{ .mii;	alloc		r2=ar.pfs,4,12,0,16
 | 
					{ .mii;	alloc		r2=ar.pfs,4,12,0,16
 | 
				
			||||||
	cmp4.le		p6,p0=r35,r0	};;
 | 
						cmp4.le		p6,p0=r35,r0	};;
 | 
				
			||||||
{ .mfb;	mov		r8=r0			// return value
 | 
					{ .mfb;	mov		r8=r0			// return value
 | 
				
			||||||
(p6)	br.ret.spnt.many	b0	};;
 | 
					(p6)	br.ret.spnt.many	b0	};;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.save	ar.lc,r3
 | 
					 | 
				
			||||||
{ .mib;	sub		r10=r35,r0,1
 | 
					{ .mib;	sub		r10=r35,r0,1
 | 
				
			||||||
 | 
						.save	ar.lc,r3
 | 
				
			||||||
	mov		r3=ar.lc
 | 
						mov		r3=ar.lc
 | 
				
			||||||
	brp.loop.imp	.L_bn_sub_words_ctop,.L_bn_sub_words_cend-16
 | 
						brp.loop.imp	.L_bn_sub_words_ctop,.L_bn_sub_words_cend-16
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
	.body
 | 
					 | 
				
			||||||
{ .mib;	ADDP		r14=0,r32		// rp
 | 
					{ .mib;	ADDP		r14=0,r32		// rp
 | 
				
			||||||
 | 
						.save	pr,r9
 | 
				
			||||||
	mov		r9=pr		};;
 | 
						mov		r9=pr		};;
 | 
				
			||||||
 | 
						.body
 | 
				
			||||||
{ .mii;	ADDP		r15=0,r33		// ap
 | 
					{ .mii;	ADDP		r15=0,r33		// ap
 | 
				
			||||||
	mov		ar.lc=r10
 | 
						mov		ar.lc=r10
 | 
				
			||||||
	mov		ar.ec=6		}
 | 
						mov		ar.ec=6		}
 | 
				
			||||||
@@ -283,7 +283,6 @@ bn_sub_words:
 | 
				
			|||||||
.skip	32	// makes the loop body aligned at 64-byte boundary
 | 
					.skip	32	// makes the loop body aligned at 64-byte boundary
 | 
				
			||||||
bn_mul_words:
 | 
					bn_mul_words:
 | 
				
			||||||
	.prologue
 | 
						.prologue
 | 
				
			||||||
	.fframe	0
 | 
					 | 
				
			||||||
	.save	ar.pfs,r2
 | 
						.save	ar.pfs,r2
 | 
				
			||||||
#ifdef XMA_TEMPTATION
 | 
					#ifdef XMA_TEMPTATION
 | 
				
			||||||
{ .mfi;	alloc		r2=ar.pfs,4,0,0,0	};;
 | 
					{ .mfi;	alloc		r2=ar.pfs,4,0,0,0	};;
 | 
				
			||||||
@@ -294,9 +293,10 @@ bn_mul_words:
 | 
				
			|||||||
	cmp4.le		p6,p0=r34,r0
 | 
						cmp4.le		p6,p0=r34,r0
 | 
				
			||||||
(p6)	br.ret.spnt.many	b0		};;
 | 
					(p6)	br.ret.spnt.many	b0		};;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.save	ar.lc,r3
 | 
					 | 
				
			||||||
{ .mii;	sub	r10=r34,r0,1
 | 
					{ .mii;	sub	r10=r34,r0,1
 | 
				
			||||||
 | 
						.save	ar.lc,r3
 | 
				
			||||||
	mov	r3=ar.lc
 | 
						mov	r3=ar.lc
 | 
				
			||||||
 | 
						.save	pr,r9
 | 
				
			||||||
	mov	r9=pr			};;
 | 
						mov	r9=pr			};;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.body
 | 
						.body
 | 
				
			||||||
@@ -397,22 +397,21 @@ bn_mul_words:
 | 
				
			|||||||
.skip	48	// makes the loop body aligned at 64-byte boundary
 | 
					.skip	48	// makes the loop body aligned at 64-byte boundary
 | 
				
			||||||
bn_mul_add_words:
 | 
					bn_mul_add_words:
 | 
				
			||||||
	.prologue
 | 
						.prologue
 | 
				
			||||||
	.fframe	0
 | 
					 | 
				
			||||||
	.save	ar.pfs,r2
 | 
						.save	ar.pfs,r2
 | 
				
			||||||
	.save	ar.lc,r3
 | 
					 | 
				
			||||||
	.save	pr,r9
 | 
					 | 
				
			||||||
{ .mmi;	alloc		r2=ar.pfs,4,4,0,8
 | 
					{ .mmi;	alloc		r2=ar.pfs,4,4,0,8
 | 
				
			||||||
	cmp4.le		p6,p0=r34,r0
 | 
						cmp4.le		p6,p0=r34,r0
 | 
				
			||||||
 | 
						.save	ar.lc,r3
 | 
				
			||||||
	mov		r3=ar.lc	};;
 | 
						mov		r3=ar.lc	};;
 | 
				
			||||||
{ .mib;	mov		r8=r0		// return value
 | 
					{ .mib;	mov		r8=r0		// return value
 | 
				
			||||||
	sub		r10=r34,r0,1
 | 
						sub		r10=r34,r0,1
 | 
				
			||||||
(p6)	br.ret.spnt.many	b0	};;
 | 
					(p6)	br.ret.spnt.many	b0	};;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.body
 | 
					 | 
				
			||||||
{ .mib;	setf.sig	f8=r35		// w
 | 
					{ .mib;	setf.sig	f8=r35		// w
 | 
				
			||||||
 | 
						.save	pr,r9
 | 
				
			||||||
	mov		r9=pr
 | 
						mov		r9=pr
 | 
				
			||||||
	brp.loop.imp	.L_bn_mul_add_words_ctop,.L_bn_mul_add_words_cend-16
 | 
						brp.loop.imp	.L_bn_mul_add_words_ctop,.L_bn_mul_add_words_cend-16
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
						.body
 | 
				
			||||||
{ .mmi;	ADDP		r14=0,r32	// rp
 | 
					{ .mmi;	ADDP		r14=0,r32	// rp
 | 
				
			||||||
	ADDP		r15=0,r33	// ap
 | 
						ADDP		r15=0,r33	// ap
 | 
				
			||||||
	mov		ar.lc=r10	}
 | 
						mov		ar.lc=r10	}
 | 
				
			||||||
@@ -466,7 +465,6 @@ bn_mul_add_words:
 | 
				
			|||||||
.skip	32	// makes the loop body aligned at 64-byte boundary 
 | 
					.skip	32	// makes the loop body aligned at 64-byte boundary 
 | 
				
			||||||
bn_sqr_words:
 | 
					bn_sqr_words:
 | 
				
			||||||
	.prologue
 | 
						.prologue
 | 
				
			||||||
	.fframe	0
 | 
					 | 
				
			||||||
	.save	ar.pfs,r2
 | 
						.save	ar.pfs,r2
 | 
				
			||||||
{ .mii;	alloc		r2=ar.pfs,3,0,0,0
 | 
					{ .mii;	alloc		r2=ar.pfs,3,0,0,0
 | 
				
			||||||
	sxt4		r34=r34		};;
 | 
						sxt4		r34=r34		};;
 | 
				
			||||||
@@ -476,9 +474,10 @@ bn_sqr_words:
 | 
				
			|||||||
	nop.f		0x0
 | 
						nop.f		0x0
 | 
				
			||||||
(p6)	br.ret.spnt.many	b0	};;
 | 
					(p6)	br.ret.spnt.many	b0	};;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.save	ar.lc,r3
 | 
					 | 
				
			||||||
{ .mii;	sub	r10=r34,r0,1
 | 
					{ .mii;	sub	r10=r34,r0,1
 | 
				
			||||||
 | 
						.save	ar.lc,r3
 | 
				
			||||||
	mov	r3=ar.lc
 | 
						mov	r3=ar.lc
 | 
				
			||||||
 | 
						.save	pr,r9
 | 
				
			||||||
	mov	r9=pr			};;
 | 
						mov	r9=pr			};;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.body
 | 
						.body
 | 
				
			||||||
@@ -545,7 +544,6 @@ bn_sqr_words:
 | 
				
			|||||||
.align	64
 | 
					.align	64
 | 
				
			||||||
bn_sqr_comba8:
 | 
					bn_sqr_comba8:
 | 
				
			||||||
	.prologue
 | 
						.prologue
 | 
				
			||||||
	.fframe	0
 | 
					 | 
				
			||||||
	.save	ar.pfs,r2
 | 
						.save	ar.pfs,r2
 | 
				
			||||||
#if defined(_HPUX_SOURCE) && !defined(_LP64)
 | 
					#if defined(_HPUX_SOURCE) && !defined(_LP64)
 | 
				
			||||||
{ .mii;	alloc	r2=ar.pfs,2,1,0,0
 | 
					{ .mii;	alloc	r2=ar.pfs,2,1,0,0
 | 
				
			||||||
@@ -617,7 +615,6 @@ bn_sqr_comba8:
 | 
				
			|||||||
.align	64
 | 
					.align	64
 | 
				
			||||||
bn_mul_comba8:
 | 
					bn_mul_comba8:
 | 
				
			||||||
	.prologue
 | 
						.prologue
 | 
				
			||||||
	.fframe	0
 | 
					 | 
				
			||||||
	.save	ar.pfs,r2
 | 
						.save	ar.pfs,r2
 | 
				
			||||||
#if defined(_HPUX_SOURCE) && !defined(_LP64)
 | 
					#if defined(_HPUX_SOURCE) && !defined(_LP64)
 | 
				
			||||||
{ .mii;	alloc	r2=ar.pfs,3,0,0,0
 | 
					{ .mii;	alloc	r2=ar.pfs,3,0,0,0
 | 
				
			||||||
@@ -1175,7 +1172,6 @@ bn_mul_comba8:
 | 
				
			|||||||
.align	64
 | 
					.align	64
 | 
				
			||||||
bn_sqr_comba4:
 | 
					bn_sqr_comba4:
 | 
				
			||||||
	.prologue
 | 
						.prologue
 | 
				
			||||||
	.fframe	0
 | 
					 | 
				
			||||||
	.save	ar.pfs,r2
 | 
						.save	ar.pfs,r2
 | 
				
			||||||
#if defined(_HPUX_SOURCE) && !defined(_LP64)
 | 
					#if defined(_HPUX_SOURCE) && !defined(_LP64)
 | 
				
			||||||
{ .mii;	alloc   r2=ar.pfs,2,1,0,0
 | 
					{ .mii;	alloc   r2=ar.pfs,2,1,0,0
 | 
				
			||||||
@@ -1208,7 +1204,6 @@ bn_sqr_comba4:
 | 
				
			|||||||
.align	64
 | 
					.align	64
 | 
				
			||||||
bn_mul_comba4:
 | 
					bn_mul_comba4:
 | 
				
			||||||
	.prologue
 | 
						.prologue
 | 
				
			||||||
	.fframe	0
 | 
					 | 
				
			||||||
	.save	ar.pfs,r2
 | 
						.save	ar.pfs,r2
 | 
				
			||||||
#if defined(_HPUX_SOURCE) && !defined(_LP64)
 | 
					#if defined(_HPUX_SOURCE) && !defined(_LP64)
 | 
				
			||||||
{ .mii;	alloc   r2=ar.pfs,3,0,0,0
 | 
					{ .mii;	alloc   r2=ar.pfs,3,0,0,0
 | 
				
			||||||
@@ -1411,11 +1406,11 @@ equ=p24
 | 
				
			|||||||
.align	64
 | 
					.align	64
 | 
				
			||||||
bn_div_words:
 | 
					bn_div_words:
 | 
				
			||||||
	.prologue
 | 
						.prologue
 | 
				
			||||||
	.fframe	0
 | 
					 | 
				
			||||||
	.save	ar.pfs,r2
 | 
						.save	ar.pfs,r2
 | 
				
			||||||
	.save	b0,r3
 | 
					 | 
				
			||||||
{ .mii;	alloc		r2=ar.pfs,3,5,0,8
 | 
					{ .mii;	alloc		r2=ar.pfs,3,5,0,8
 | 
				
			||||||
 | 
						.save	b0,r3
 | 
				
			||||||
	mov		r3=b0
 | 
						mov		r3=b0
 | 
				
			||||||
 | 
						.save	pr,r10
 | 
				
			||||||
	mov		r10=pr		};;
 | 
						mov		r10=pr		};;
 | 
				
			||||||
{ .mmb;	cmp.eq		p6,p0=r34,r0
 | 
					{ .mmb;	cmp.eq		p6,p0=r34,r0
 | 
				
			||||||
	mov		r8=-1
 | 
						mov		r8=-1
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -245,8 +245,18 @@ extern "C" {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#define BN_FLG_MALLOCED		0x01
 | 
					#define BN_FLG_MALLOCED		0x01
 | 
				
			||||||
#define BN_FLG_STATIC_DATA	0x02
 | 
					#define BN_FLG_STATIC_DATA	0x02
 | 
				
			||||||
#define BN_FLG_EXP_CONSTTIME	0x04 /* avoid leaking exponent information through timings
 | 
					#define BN_FLG_CONSTTIME	0x04 /* avoid leaking exponent information through timing,
 | 
				
			||||||
                            	      * (BN_mod_exp_mont() will call BN_mod_exp_mont_consttime) */
 | 
					                                      * BN_mod_exp_mont() will call BN_mod_exp_mont_consttime,
 | 
				
			||||||
 | 
					                                      * BN_div() will call BN_div_no_branch,
 | 
				
			||||||
 | 
					                                      * BN_mod_inverse() will call BN_mod_inverse_no_branch.
 | 
				
			||||||
 | 
					                                      */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_DEPRECATED
 | 
				
			||||||
 | 
					#define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME /* deprecated name for the flag */
 | 
				
			||||||
 | 
					                                      /* avoid leaking exponent information through timings
 | 
				
			||||||
 | 
					                                      * (BN_mod_exp_mont() will call BN_mod_exp_mont_consttime) */
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef OPENSSL_NO_DEPRECATED
 | 
					#ifndef OPENSSL_NO_DEPRECATED
 | 
				
			||||||
#define BN_FLG_FREE		0x8000	/* used for debuging */
 | 
					#define BN_FLG_FREE		0x8000	/* used for debuging */
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -534,7 +544,7 @@ BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock,
 | 
				
			|||||||
#define	BN_BLINDING_NO_UPDATE	0x00000001
 | 
					#define	BN_BLINDING_NO_UPDATE	0x00000001
 | 
				
			||||||
#define	BN_BLINDING_NO_RECREATE	0x00000002
 | 
					#define	BN_BLINDING_NO_RECREATE	0x00000002
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod);
 | 
					BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, /* const */ BIGNUM *mod);
 | 
				
			||||||
void BN_BLINDING_free(BN_BLINDING *b);
 | 
					void BN_BLINDING_free(BN_BLINDING *b);
 | 
				
			||||||
int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx);
 | 
					int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx);
 | 
				
			||||||
int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
 | 
					int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
 | 
				
			||||||
@@ -546,7 +556,7 @@ void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long);
 | 
				
			|||||||
unsigned long BN_BLINDING_get_flags(const BN_BLINDING *);
 | 
					unsigned long BN_BLINDING_get_flags(const BN_BLINDING *);
 | 
				
			||||||
void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);
 | 
					void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);
 | 
				
			||||||
BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
 | 
					BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
 | 
				
			||||||
	const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
 | 
						const BIGNUM *e, /* const */ BIGNUM *m, BN_CTX *ctx,
 | 
				
			||||||
	int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
 | 
						int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
 | 
				
			||||||
			  const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx),
 | 
								  const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx),
 | 
				
			||||||
	BN_MONT_CTX *m_ctx);
 | 
						BN_MONT_CTX *m_ctx);
 | 
				
			||||||
@@ -775,6 +785,7 @@ void ERR_load_BN_strings(void);
 | 
				
			|||||||
#define BN_F_BN_CTX_NEW					 106
 | 
					#define BN_F_BN_CTX_NEW					 106
 | 
				
			||||||
#define BN_F_BN_CTX_START				 129
 | 
					#define BN_F_BN_CTX_START				 129
 | 
				
			||||||
#define BN_F_BN_DIV					 107
 | 
					#define BN_F_BN_DIV					 107
 | 
				
			||||||
 | 
					#define BN_F_BN_DIV_NO_BRANCH				 138
 | 
				
			||||||
#define BN_F_BN_DIV_RECP				 130
 | 
					#define BN_F_BN_DIV_RECP				 130
 | 
				
			||||||
#define BN_F_BN_EXP					 123
 | 
					#define BN_F_BN_EXP					 123
 | 
				
			||||||
#define BN_F_BN_EXPAND2					 108
 | 
					#define BN_F_BN_EXPAND2					 108
 | 
				
			||||||
@@ -793,6 +804,7 @@ void ERR_load_BN_strings(void);
 | 
				
			|||||||
#define BN_F_BN_MOD_EXP_RECP				 125
 | 
					#define BN_F_BN_MOD_EXP_RECP				 125
 | 
				
			||||||
#define BN_F_BN_MOD_EXP_SIMPLE				 126
 | 
					#define BN_F_BN_MOD_EXP_SIMPLE				 126
 | 
				
			||||||
#define BN_F_BN_MOD_INVERSE				 110
 | 
					#define BN_F_BN_MOD_INVERSE				 110
 | 
				
			||||||
 | 
					#define BN_F_BN_MOD_INVERSE_NO_BRANCH			 139
 | 
				
			||||||
#define BN_F_BN_MOD_LSHIFT_QUICK			 119
 | 
					#define BN_F_BN_MOD_LSHIFT_QUICK			 119
 | 
				
			||||||
#define BN_F_BN_MOD_MUL_RECIPROCAL			 111
 | 
					#define BN_F_BN_MOD_MUL_RECIPROCAL			 111
 | 
				
			||||||
#define BN_F_BN_MOD_SQRT				 121
 | 
					#define BN_F_BN_MOD_SQRT				 121
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -131,7 +131,7 @@ struct bn_blinding_st
 | 
				
			|||||||
			  BN_MONT_CTX *m_ctx);
 | 
								  BN_MONT_CTX *m_ctx);
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod)
 | 
					BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, /* const */ BIGNUM *mod)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	BN_BLINDING *ret=NULL;
 | 
						BN_BLINDING *ret=NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -151,7 +151,12 @@ BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod)
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
		if ((ret->Ai = BN_dup(Ai)) == NULL) goto err;
 | 
							if ((ret->Ai = BN_dup(Ai)) == NULL) goto err;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	ret->mod = mod;
 | 
					
 | 
				
			||||||
 | 
						/* save a copy of mod in the BN_BLINDING structure */
 | 
				
			||||||
 | 
						if ((ret->mod = BN_dup(mod)) == NULL) goto err;
 | 
				
			||||||
 | 
						if (BN_get_flags(mod, BN_FLG_CONSTTIME) != 0)
 | 
				
			||||||
 | 
							BN_set_flags(ret->mod, BN_FLG_CONSTTIME);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret->counter = BN_BLINDING_COUNTER;
 | 
						ret->counter = BN_BLINDING_COUNTER;
 | 
				
			||||||
	return(ret);
 | 
						return(ret);
 | 
				
			||||||
err:
 | 
					err:
 | 
				
			||||||
@@ -167,6 +172,7 @@ void BN_BLINDING_free(BN_BLINDING *r)
 | 
				
			|||||||
	if (r->A  != NULL) BN_free(r->A );
 | 
						if (r->A  != NULL) BN_free(r->A );
 | 
				
			||||||
	if (r->Ai != NULL) BN_free(r->Ai);
 | 
						if (r->Ai != NULL) BN_free(r->Ai);
 | 
				
			||||||
	if (r->e  != NULL) BN_free(r->e );
 | 
						if (r->e  != NULL) BN_free(r->e );
 | 
				
			||||||
 | 
						if (r->mod != NULL) BN_free(r->mod); 
 | 
				
			||||||
	OPENSSL_free(r);
 | 
						OPENSSL_free(r);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -278,7 +284,7 @@ void BN_BLINDING_set_flags(BN_BLINDING *b, unsigned long flags)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
 | 
					BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
 | 
				
			||||||
	const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
 | 
						const BIGNUM *e, /* const */ BIGNUM *m, BN_CTX *ctx,
 | 
				
			||||||
	int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
 | 
						int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
 | 
				
			||||||
			  const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx),
 | 
								  const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx),
 | 
				
			||||||
	BN_MONT_CTX *m_ctx)
 | 
						BN_MONT_CTX *m_ctx)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -169,13 +169,15 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
 | 
				
			|||||||
#endif /* OPENSSL_NO_ASM */
 | 
					#endif /* OPENSSL_NO_ASM */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* BN_div computes  dv := num / divisor,  rounding towards zero, and sets up
 | 
					/* BN_div[_no_branch] computes  dv := num / divisor,  rounding towards
 | 
				
			||||||
 * rm  such that  dv*divisor + rm = num  holds.
 | 
					 * zero, and sets up rm  such that  dv*divisor + rm = num  holds.
 | 
				
			||||||
 * Thus:
 | 
					 * Thus:
 | 
				
			||||||
 *     dv->neg == num->neg ^ divisor->neg  (unless the result is zero)
 | 
					 *     dv->neg == num->neg ^ divisor->neg  (unless the result is zero)
 | 
				
			||||||
 *     rm->neg == num->neg                 (unless the remainder is zero)
 | 
					 *     rm->neg == num->neg                 (unless the remainder is zero)
 | 
				
			||||||
 * If 'dv' or 'rm' is NULL, the respective value is not returned.
 | 
					 * If 'dv' or 'rm' is NULL, the respective value is not returned.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					static int BN_div_no_branch(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num,
 | 
				
			||||||
 | 
					        const BIGNUM *divisor, BN_CTX *ctx);
 | 
				
			||||||
int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
 | 
					int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
 | 
				
			||||||
	   BN_CTX *ctx)
 | 
						   BN_CTX *ctx)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@@ -185,6 +187,11 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
 | 
				
			|||||||
	BN_ULONG d0,d1;
 | 
						BN_ULONG d0,d1;
 | 
				
			||||||
	int num_n,div_n;
 | 
						int num_n,div_n;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if ((BN_get_flags(num, BN_FLG_CONSTTIME) != 0) || (BN_get_flags(divisor, BN_FLG_CONSTTIME) != 0))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							return BN_div_no_branch(dv, rm, num, divisor, ctx);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bn_check_top(dv);
 | 
						bn_check_top(dv);
 | 
				
			||||||
	bn_check_top(rm);
 | 
						bn_check_top(rm);
 | 
				
			||||||
	bn_check_top(num);
 | 
						bn_check_top(num);
 | 
				
			||||||
@@ -397,4 +404,229 @@ err:
 | 
				
			|||||||
	return(0);
 | 
						return(0);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* BN_div_no_branch is a special version of BN_div. It does not contain
 | 
				
			||||||
 | 
					 * branches that may leak sensitive information.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static int BN_div_no_branch(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, 
 | 
				
			||||||
 | 
						const BIGNUM *divisor, BN_CTX *ctx)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						int norm_shift,i,loop;
 | 
				
			||||||
 | 
						BIGNUM *tmp,wnum,*snum,*sdiv,*res;
 | 
				
			||||||
 | 
						BN_ULONG *resp,*wnump;
 | 
				
			||||||
 | 
						BN_ULONG d0,d1;
 | 
				
			||||||
 | 
						int num_n,div_n;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						bn_check_top(dv);
 | 
				
			||||||
 | 
						bn_check_top(rm);
 | 
				
			||||||
 | 
						bn_check_top(num);
 | 
				
			||||||
 | 
						bn_check_top(divisor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (BN_is_zero(divisor))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							BNerr(BN_F_BN_DIV_NO_BRANCH,BN_R_DIV_BY_ZERO);
 | 
				
			||||||
 | 
							return(0);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						BN_CTX_start(ctx);
 | 
				
			||||||
 | 
						tmp=BN_CTX_get(ctx);
 | 
				
			||||||
 | 
						snum=BN_CTX_get(ctx);
 | 
				
			||||||
 | 
						sdiv=BN_CTX_get(ctx);
 | 
				
			||||||
 | 
						if (dv == NULL)
 | 
				
			||||||
 | 
							res=BN_CTX_get(ctx);
 | 
				
			||||||
 | 
						else	res=dv;
 | 
				
			||||||
 | 
						if (sdiv == NULL || res == NULL) goto err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* First we normalise the numbers */
 | 
				
			||||||
 | 
						norm_shift=BN_BITS2-((BN_num_bits(divisor))%BN_BITS2);
 | 
				
			||||||
 | 
						if (!(BN_lshift(sdiv,divisor,norm_shift))) goto err;
 | 
				
			||||||
 | 
						sdiv->neg=0;
 | 
				
			||||||
 | 
						norm_shift+=BN_BITS2;
 | 
				
			||||||
 | 
						if (!(BN_lshift(snum,num,norm_shift))) goto err;
 | 
				
			||||||
 | 
						snum->neg=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Since we don't know whether snum is larger than sdiv,
 | 
				
			||||||
 | 
						 * we pad snum with enough zeroes without changing its
 | 
				
			||||||
 | 
						 * value. 
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						if (snum->top <= sdiv->top+1) 
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							if (bn_wexpand(snum, sdiv->top + 2) == NULL) goto err;
 | 
				
			||||||
 | 
							for (i = snum->top; i < sdiv->top + 2; i++) snum->d[i] = 0;
 | 
				
			||||||
 | 
							snum->top = sdiv->top + 2;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							if (bn_wexpand(snum, snum->top + 1) == NULL) goto err;
 | 
				
			||||||
 | 
							snum->d[snum->top] = 0;
 | 
				
			||||||
 | 
							snum->top ++;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						div_n=sdiv->top;
 | 
				
			||||||
 | 
						num_n=snum->top;
 | 
				
			||||||
 | 
						loop=num_n-div_n;
 | 
				
			||||||
 | 
						/* Lets setup a 'window' into snum
 | 
				
			||||||
 | 
						 * This is the part that corresponds to the current
 | 
				
			||||||
 | 
						 * 'area' being divided */
 | 
				
			||||||
 | 
						wnum.neg   = 0;
 | 
				
			||||||
 | 
						wnum.d     = &(snum->d[loop]);
 | 
				
			||||||
 | 
						wnum.top   = div_n;
 | 
				
			||||||
 | 
						/* only needed when BN_ucmp messes up the values between top and max */
 | 
				
			||||||
 | 
						wnum.dmax  = snum->dmax - loop; /* so we don't step out of bounds */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Get the top 2 words of sdiv */
 | 
				
			||||||
 | 
						/* div_n=sdiv->top; */
 | 
				
			||||||
 | 
						d0=sdiv->d[div_n-1];
 | 
				
			||||||
 | 
						d1=(div_n == 1)?0:sdiv->d[div_n-2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* pointer to the 'top' of snum */
 | 
				
			||||||
 | 
						wnump= &(snum->d[num_n-1]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Setup to 'res' */
 | 
				
			||||||
 | 
						res->neg= (num->neg^divisor->neg);
 | 
				
			||||||
 | 
						if (!bn_wexpand(res,(loop+1))) goto err;
 | 
				
			||||||
 | 
						res->top=loop-1;
 | 
				
			||||||
 | 
						resp= &(res->d[loop-1]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* space for temp */
 | 
				
			||||||
 | 
						if (!bn_wexpand(tmp,(div_n+1))) goto err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* if res->top == 0 then clear the neg value otherwise decrease
 | 
				
			||||||
 | 
						 * the resp pointer */
 | 
				
			||||||
 | 
						if (res->top == 0)
 | 
				
			||||||
 | 
							res->neg = 0;
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							resp--;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (i=0; i<loop-1; i++, wnump--, resp--)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							BN_ULONG q,l0;
 | 
				
			||||||
 | 
							/* the first part of the loop uses the top two words of
 | 
				
			||||||
 | 
							 * snum and sdiv to calculate a BN_ULONG q such that
 | 
				
			||||||
 | 
							 * | wnum - sdiv * q | < sdiv */
 | 
				
			||||||
 | 
					#if defined(BN_DIV3W) && !defined(OPENSSL_NO_ASM)
 | 
				
			||||||
 | 
							BN_ULONG bn_div_3_words(BN_ULONG*,BN_ULONG,BN_ULONG);
 | 
				
			||||||
 | 
							q=bn_div_3_words(wnump,d1,d0);
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
							BN_ULONG n0,n1,rem=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							n0=wnump[0];
 | 
				
			||||||
 | 
							n1=wnump[-1];
 | 
				
			||||||
 | 
							if (n0 == d0)
 | 
				
			||||||
 | 
								q=BN_MASK2;
 | 
				
			||||||
 | 
							else 			/* n0 < d0 */
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
					#ifdef BN_LLONG
 | 
				
			||||||
 | 
								BN_ULLONG t2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(BN_LLONG) && defined(BN_DIV2W) && !defined(bn_div_words)
 | 
				
			||||||
 | 
								q=(BN_ULONG)(((((BN_ULLONG)n0)<<BN_BITS2)|n1)/d0);
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
								q=bn_div_words(n0,n1,d0);
 | 
				
			||||||
 | 
					#ifdef BN_DEBUG_LEVITTE
 | 
				
			||||||
 | 
								fprintf(stderr,"DEBUG: bn_div_words(0x%08X,0x%08X,0x%08\
 | 
				
			||||||
 | 
					X) -> 0x%08X\n",
 | 
				
			||||||
 | 
									n0, n1, d0, q);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef REMAINDER_IS_ALREADY_CALCULATED
 | 
				
			||||||
 | 
								/*
 | 
				
			||||||
 | 
								 * rem doesn't have to be BN_ULLONG. The least we
 | 
				
			||||||
 | 
								 * know it's less that d0, isn't it?
 | 
				
			||||||
 | 
								 */
 | 
				
			||||||
 | 
								rem=(n1-q*d0)&BN_MASK2;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
								t2=(BN_ULLONG)d1*q;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								for (;;)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									if (t2 <= ((((BN_ULLONG)rem)<<BN_BITS2)|wnump[-2]))
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									q--;
 | 
				
			||||||
 | 
									rem += d0;
 | 
				
			||||||
 | 
									if (rem < d0) break; /* don't let rem overflow */
 | 
				
			||||||
 | 
									t2 -= d1;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
					#else /* !BN_LLONG */
 | 
				
			||||||
 | 
								BN_ULONG t2l,t2h,ql,qh;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								q=bn_div_words(n0,n1,d0);
 | 
				
			||||||
 | 
					#ifdef BN_DEBUG_LEVITTE
 | 
				
			||||||
 | 
								fprintf(stderr,"DEBUG: bn_div_words(0x%08X,0x%08X,0x%08\
 | 
				
			||||||
 | 
					X) -> 0x%08X\n",
 | 
				
			||||||
 | 
									n0, n1, d0, q);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef REMAINDER_IS_ALREADY_CALCULATED
 | 
				
			||||||
 | 
								rem=(n1-q*d0)&BN_MASK2;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(BN_UMULT_LOHI)
 | 
				
			||||||
 | 
								BN_UMULT_LOHI(t2l,t2h,d1,q);
 | 
				
			||||||
 | 
					#elif defined(BN_UMULT_HIGH)
 | 
				
			||||||
 | 
								t2l = d1 * q;
 | 
				
			||||||
 | 
								t2h = BN_UMULT_HIGH(d1,q);
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
								t2l=LBITS(d1); t2h=HBITS(d1);
 | 
				
			||||||
 | 
								ql =LBITS(q);  qh =HBITS(q);
 | 
				
			||||||
 | 
								mul64(t2l,t2h,ql,qh); /* t2=(BN_ULLONG)d1*q; */
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								for (;;)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									if ((t2h < rem) ||
 | 
				
			||||||
 | 
										((t2h == rem) && (t2l <= wnump[-2])))
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									q--;
 | 
				
			||||||
 | 
									rem += d0;
 | 
				
			||||||
 | 
									if (rem < d0) break; /* don't let rem overflow */
 | 
				
			||||||
 | 
									if (t2l < d1) t2h--; t2l -= d1;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
					#endif /* !BN_LLONG */
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					#endif /* !BN_DIV3W */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							l0=bn_mul_words(tmp->d,sdiv->d,div_n,q);
 | 
				
			||||||
 | 
							tmp->d[div_n]=l0;
 | 
				
			||||||
 | 
							wnum.d--;
 | 
				
			||||||
 | 
							/* ingore top values of the bignums just sub the two 
 | 
				
			||||||
 | 
							 * BN_ULONG arrays with bn_sub_words */
 | 
				
			||||||
 | 
							if (bn_sub_words(wnum.d, wnum.d, tmp->d, div_n+1))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								/* Note: As we have considered only the leading
 | 
				
			||||||
 | 
								 * two BN_ULONGs in the calculation of q, sdiv * q
 | 
				
			||||||
 | 
								 * might be greater than wnum (but then (q-1) * sdiv
 | 
				
			||||||
 | 
								 * is less or equal than wnum)
 | 
				
			||||||
 | 
								 */
 | 
				
			||||||
 | 
								q--;
 | 
				
			||||||
 | 
								if (bn_add_words(wnum.d, wnum.d, sdiv->d, div_n))
 | 
				
			||||||
 | 
									/* we can't have an overflow here (assuming
 | 
				
			||||||
 | 
									 * that q != 0, but if q == 0 then tmp is
 | 
				
			||||||
 | 
									 * zero anyway) */
 | 
				
			||||||
 | 
									(*wnump)++;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							/* store part of the result */
 | 
				
			||||||
 | 
							*resp = q;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						bn_correct_top(snum);
 | 
				
			||||||
 | 
						if (rm != NULL)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							/* Keep a copy of the neg flag in num because if rm==num
 | 
				
			||||||
 | 
							 * BN_rshift() will overwrite it.
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
 | 
							int neg = num->neg;
 | 
				
			||||||
 | 
							BN_rshift(rm,snum,norm_shift);
 | 
				
			||||||
 | 
							if (!BN_is_zero(rm))
 | 
				
			||||||
 | 
								rm->neg = neg;
 | 
				
			||||||
 | 
							bn_check_top(rm);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						bn_correct_top(res);
 | 
				
			||||||
 | 
						BN_CTX_end(ctx);
 | 
				
			||||||
 | 
						return(1);
 | 
				
			||||||
 | 
					err:
 | 
				
			||||||
 | 
						bn_check_top(rm);
 | 
				
			||||||
 | 
						BN_CTX_end(ctx);
 | 
				
			||||||
 | 
						return(0);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/* crypto/bn/bn_err.c */
 | 
					/* crypto/bn/bn_err.c */
 | 
				
			||||||
/* ====================================================================
 | 
					/* ====================================================================
 | 
				
			||||||
 * Copyright (c) 1999-2005 The OpenSSL Project.  All rights reserved.
 | 
					 * Copyright (c) 1999-2007 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Redistribution and use in source and binary forms, with or without
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 * modification, are permitted provided that the following conditions
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
@@ -82,6 +82,7 @@ static ERR_STRING_DATA BN_str_functs[]=
 | 
				
			|||||||
{ERR_FUNC(BN_F_BN_CTX_NEW),	"BN_CTX_new"},
 | 
					{ERR_FUNC(BN_F_BN_CTX_NEW),	"BN_CTX_new"},
 | 
				
			||||||
{ERR_FUNC(BN_F_BN_CTX_START),	"BN_CTX_start"},
 | 
					{ERR_FUNC(BN_F_BN_CTX_START),	"BN_CTX_start"},
 | 
				
			||||||
{ERR_FUNC(BN_F_BN_DIV),	"BN_div"},
 | 
					{ERR_FUNC(BN_F_BN_DIV),	"BN_div"},
 | 
				
			||||||
 | 
					{ERR_FUNC(BN_F_BN_DIV_NO_BRANCH),	"BN_div_no_branch"},
 | 
				
			||||||
{ERR_FUNC(BN_F_BN_DIV_RECP),	"BN_div_recp"},
 | 
					{ERR_FUNC(BN_F_BN_DIV_RECP),	"BN_div_recp"},
 | 
				
			||||||
{ERR_FUNC(BN_F_BN_EXP),	"BN_exp"},
 | 
					{ERR_FUNC(BN_F_BN_EXP),	"BN_exp"},
 | 
				
			||||||
{ERR_FUNC(BN_F_BN_EXPAND2),	"bn_expand2"},
 | 
					{ERR_FUNC(BN_F_BN_EXPAND2),	"bn_expand2"},
 | 
				
			||||||
@@ -100,6 +101,7 @@ static ERR_STRING_DATA BN_str_functs[]=
 | 
				
			|||||||
{ERR_FUNC(BN_F_BN_MOD_EXP_RECP),	"BN_mod_exp_recp"},
 | 
					{ERR_FUNC(BN_F_BN_MOD_EXP_RECP),	"BN_mod_exp_recp"},
 | 
				
			||||||
{ERR_FUNC(BN_F_BN_MOD_EXP_SIMPLE),	"BN_mod_exp_simple"},
 | 
					{ERR_FUNC(BN_F_BN_MOD_EXP_SIMPLE),	"BN_mod_exp_simple"},
 | 
				
			||||||
{ERR_FUNC(BN_F_BN_MOD_INVERSE),	"BN_mod_inverse"},
 | 
					{ERR_FUNC(BN_F_BN_MOD_INVERSE),	"BN_mod_inverse"},
 | 
				
			||||||
 | 
					{ERR_FUNC(BN_F_BN_MOD_INVERSE_NO_BRANCH),	"BN_mod_inverse_no_branch"},
 | 
				
			||||||
{ERR_FUNC(BN_F_BN_MOD_LSHIFT_QUICK),	"BN_mod_lshift_quick"},
 | 
					{ERR_FUNC(BN_F_BN_MOD_LSHIFT_QUICK),	"BN_mod_lshift_quick"},
 | 
				
			||||||
{ERR_FUNC(BN_F_BN_MOD_MUL_RECIPROCAL),	"BN_mod_mul_reciprocal"},
 | 
					{ERR_FUNC(BN_F_BN_MOD_MUL_RECIPROCAL),	"BN_mod_mul_reciprocal"},
 | 
				
			||||||
{ERR_FUNC(BN_F_BN_MOD_SQRT),	"BN_mod_sqrt"},
 | 
					{ERR_FUNC(BN_F_BN_MOD_SQRT),	"BN_mod_sqrt"},
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -122,9 +122,9 @@ int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
 | 
				
			|||||||
	int i,bits,ret=0;
 | 
						int i,bits,ret=0;
 | 
				
			||||||
	BIGNUM *v,*rr;
 | 
						BIGNUM *v,*rr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (BN_get_flags(p, BN_FLG_EXP_CONSTTIME) != 0)
 | 
						if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		/* BN_FLG_EXP_CONSTTIME only supported by BN_mod_exp_mont() */
 | 
							/* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
 | 
				
			||||||
		BNerr(BN_F_BN_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
 | 
							BNerr(BN_F_BN_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -213,7 +213,7 @@ int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
 | 
				
			|||||||
	if (BN_is_odd(m))
 | 
						if (BN_is_odd(m))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
#  ifdef MONT_EXP_WORD
 | 
					#  ifdef MONT_EXP_WORD
 | 
				
			||||||
		if (a->top == 1 && !a->neg && (BN_get_flags(p, BN_FLG_EXP_CONSTTIME) == 0))
 | 
							if (a->top == 1 && !a->neg && (BN_get_flags(p, BN_FLG_CONSTTIME) == 0))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			BN_ULONG A = a->d[0];
 | 
								BN_ULONG A = a->d[0];
 | 
				
			||||||
			ret=BN_mod_exp_mont_word(r,A,p,m,ctx,NULL);
 | 
								ret=BN_mod_exp_mont_word(r,A,p,m,ctx,NULL);
 | 
				
			||||||
@@ -245,9 +245,9 @@ int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
 | 
				
			|||||||
	BIGNUM *val[TABLE_SIZE];
 | 
						BIGNUM *val[TABLE_SIZE];
 | 
				
			||||||
	BN_RECP_CTX recp;
 | 
						BN_RECP_CTX recp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (BN_get_flags(p, BN_FLG_EXP_CONSTTIME) != 0)
 | 
						if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		/* BN_FLG_EXP_CONSTTIME only supported by BN_mod_exp_mont() */
 | 
							/* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
 | 
				
			||||||
		BNerr(BN_F_BN_MOD_EXP_RECP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
 | 
							BNerr(BN_F_BN_MOD_EXP_RECP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -379,7 +379,7 @@ int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
 | 
				
			|||||||
	BIGNUM *val[TABLE_SIZE];
 | 
						BIGNUM *val[TABLE_SIZE];
 | 
				
			||||||
	BN_MONT_CTX *mont=NULL;
 | 
						BN_MONT_CTX *mont=NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (BN_get_flags(p, BN_FLG_EXP_CONSTTIME) != 0)
 | 
						if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
 | 
							return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -745,9 +745,9 @@ int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p,
 | 
				
			|||||||
#define BN_TO_MONTGOMERY_WORD(r, w, mont) \
 | 
					#define BN_TO_MONTGOMERY_WORD(r, w, mont) \
 | 
				
			||||||
		(BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx))
 | 
							(BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (BN_get_flags(p, BN_FLG_EXP_CONSTTIME) != 0)
 | 
						if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		/* BN_FLG_EXP_CONSTTIME only supported by BN_mod_exp_mont() */
 | 
							/* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
 | 
				
			||||||
		BNerr(BN_F_BN_MOD_EXP_MONT_WORD,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
 | 
							BNerr(BN_F_BN_MOD_EXP_MONT_WORD,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -881,9 +881,9 @@ int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
 | 
				
			|||||||
	/* Table of variables obtained from 'ctx' */
 | 
						/* Table of variables obtained from 'ctx' */
 | 
				
			||||||
	BIGNUM *val[TABLE_SIZE];
 | 
						BIGNUM *val[TABLE_SIZE];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (BN_get_flags(p, BN_FLG_EXP_CONSTTIME) != 0)
 | 
						if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		/* BN_FLG_EXP_CONSTTIME only supported by BN_mod_exp_mont() */
 | 
							/* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
 | 
				
			||||||
		BNerr(BN_F_BN_MOD_EXP_SIMPLE,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
 | 
							BNerr(BN_F_BN_MOD_EXP_SIMPLE,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -203,6 +203,8 @@ err:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* solves ax == 1 (mod n) */
 | 
					/* solves ax == 1 (mod n) */
 | 
				
			||||||
 | 
					static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
 | 
				
			||||||
 | 
					        const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
 | 
				
			||||||
BIGNUM *BN_mod_inverse(BIGNUM *in,
 | 
					BIGNUM *BN_mod_inverse(BIGNUM *in,
 | 
				
			||||||
	const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
 | 
						const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@@ -210,6 +212,11 @@ BIGNUM *BN_mod_inverse(BIGNUM *in,
 | 
				
			|||||||
	BIGNUM *ret=NULL;
 | 
						BIGNUM *ret=NULL;
 | 
				
			||||||
	int sign;
 | 
						int sign;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							return BN_mod_inverse_no_branch(in, a, n, ctx);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bn_check_top(a);
 | 
						bn_check_top(a);
 | 
				
			||||||
	bn_check_top(n);
 | 
						bn_check_top(n);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -491,3 +498,157 @@ err:
 | 
				
			|||||||
	bn_check_top(ret);
 | 
						bn_check_top(ret);
 | 
				
			||||||
	return(ret);
 | 
						return(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* BN_mod_inverse_no_branch is a special version of BN_mod_inverse. 
 | 
				
			||||||
 | 
					 * It does not contain branches that may leak sensitive information.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
 | 
				
			||||||
 | 
						const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						BIGNUM *A,*B,*X,*Y,*M,*D,*T,*R=NULL;
 | 
				
			||||||
 | 
						BIGNUM local_A, local_B;
 | 
				
			||||||
 | 
						BIGNUM *pA, *pB;
 | 
				
			||||||
 | 
						BIGNUM *ret=NULL;
 | 
				
			||||||
 | 
						int sign;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						bn_check_top(a);
 | 
				
			||||||
 | 
						bn_check_top(n);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						BN_CTX_start(ctx);
 | 
				
			||||||
 | 
						A = BN_CTX_get(ctx);
 | 
				
			||||||
 | 
						B = BN_CTX_get(ctx);
 | 
				
			||||||
 | 
						X = BN_CTX_get(ctx);
 | 
				
			||||||
 | 
						D = BN_CTX_get(ctx);
 | 
				
			||||||
 | 
						M = BN_CTX_get(ctx);
 | 
				
			||||||
 | 
						Y = BN_CTX_get(ctx);
 | 
				
			||||||
 | 
						T = BN_CTX_get(ctx);
 | 
				
			||||||
 | 
						if (T == NULL) goto err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (in == NULL)
 | 
				
			||||||
 | 
							R=BN_new();
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							R=in;
 | 
				
			||||||
 | 
						if (R == NULL) goto err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						BN_one(X);
 | 
				
			||||||
 | 
						BN_zero(Y);
 | 
				
			||||||
 | 
						if (BN_copy(B,a) == NULL) goto err;
 | 
				
			||||||
 | 
						if (BN_copy(A,n) == NULL) goto err;
 | 
				
			||||||
 | 
						A->neg = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (B->neg || (BN_ucmp(B, A) >= 0))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							/* Turn BN_FLG_CONSTTIME flag on, so that when BN_div is invoked,
 | 
				
			||||||
 | 
						 	 * BN_div_no_branch will be called eventually.
 | 
				
			||||||
 | 
						 	 */
 | 
				
			||||||
 | 
							pB = &local_B;
 | 
				
			||||||
 | 
							BN_with_flags(pB, B, BN_FLG_CONSTTIME);	
 | 
				
			||||||
 | 
							if (!BN_nnmod(B, pB, A, ctx)) goto err;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						sign = -1;
 | 
				
			||||||
 | 
						/* From  B = a mod |n|,  A = |n|  it follows that
 | 
				
			||||||
 | 
						 *
 | 
				
			||||||
 | 
						 *      0 <= B < A,
 | 
				
			||||||
 | 
						 *     -sign*X*a  ==  B   (mod |n|),
 | 
				
			||||||
 | 
						 *      sign*Y*a  ==  A   (mod |n|).
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						while (!BN_is_zero(B))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							BIGNUM *tmp;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							/*
 | 
				
			||||||
 | 
							 *      0 < B < A,
 | 
				
			||||||
 | 
							 * (*) -sign*X*a  ==  B   (mod |n|),
 | 
				
			||||||
 | 
							 *      sign*Y*a  ==  A   (mod |n|)
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/* Turn BN_FLG_CONSTTIME flag on, so that when BN_div is invoked,
 | 
				
			||||||
 | 
						 	 * BN_div_no_branch will be called eventually.
 | 
				
			||||||
 | 
						 	 */
 | 
				
			||||||
 | 
							pA = &local_A;
 | 
				
			||||||
 | 
							BN_with_flags(pA, A, BN_FLG_CONSTTIME);	
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							/* (D, M) := (A/B, A%B) ... */		
 | 
				
			||||||
 | 
							if (!BN_div(D,M,pA,B,ctx)) goto err;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							/* Now
 | 
				
			||||||
 | 
							 *      A = D*B + M;
 | 
				
			||||||
 | 
							 * thus we have
 | 
				
			||||||
 | 
							 * (**)  sign*Y*a  ==  D*B + M   (mod |n|).
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							tmp=A; /* keep the BIGNUM object, the value does not matter */
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							/* (A, B) := (B, A mod B) ... */
 | 
				
			||||||
 | 
							A=B;
 | 
				
			||||||
 | 
							B=M;
 | 
				
			||||||
 | 
							/* ... so we have  0 <= B < A  again */
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							/* Since the former  M  is now  B  and the former  B  is now  A,
 | 
				
			||||||
 | 
							 * (**) translates into
 | 
				
			||||||
 | 
							 *       sign*Y*a  ==  D*A + B    (mod |n|),
 | 
				
			||||||
 | 
							 * i.e.
 | 
				
			||||||
 | 
							 *       sign*Y*a - D*A  ==  B    (mod |n|).
 | 
				
			||||||
 | 
							 * Similarly, (*) translates into
 | 
				
			||||||
 | 
							 *      -sign*X*a  ==  A          (mod |n|).
 | 
				
			||||||
 | 
							 *
 | 
				
			||||||
 | 
							 * Thus,
 | 
				
			||||||
 | 
							 *   sign*Y*a + D*sign*X*a  ==  B  (mod |n|),
 | 
				
			||||||
 | 
							 * i.e.
 | 
				
			||||||
 | 
							 *        sign*(Y + D*X)*a  ==  B  (mod |n|).
 | 
				
			||||||
 | 
							 *
 | 
				
			||||||
 | 
							 * So if we set  (X, Y, sign) := (Y + D*X, X, -sign),  we arrive back at
 | 
				
			||||||
 | 
							 *      -sign*X*a  ==  B   (mod |n|),
 | 
				
			||||||
 | 
							 *       sign*Y*a  ==  A   (mod |n|).
 | 
				
			||||||
 | 
							 * Note that  X  and  Y  stay non-negative all the time.
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
							if (!BN_mul(tmp,D,X,ctx)) goto err;
 | 
				
			||||||
 | 
							if (!BN_add(tmp,tmp,Y)) goto err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							M=Y; /* keep the BIGNUM object, the value does not matter */
 | 
				
			||||||
 | 
							Y=X;
 | 
				
			||||||
 | 
							X=tmp;
 | 
				
			||||||
 | 
							sign = -sign;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * The while loop (Euclid's algorithm) ends when
 | 
				
			||||||
 | 
						 *      A == gcd(a,n);
 | 
				
			||||||
 | 
						 * we have
 | 
				
			||||||
 | 
						 *       sign*Y*a  ==  A  (mod |n|),
 | 
				
			||||||
 | 
						 * where  Y  is non-negative.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (sign < 0)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							if (!BN_sub(Y,n,Y)) goto err;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						/* Now  Y*a  ==  A  (mod |n|).  */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (BN_is_one(A))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							/* Y*a == 1  (mod |n|) */
 | 
				
			||||||
 | 
							if (!Y->neg && BN_ucmp(Y,n) < 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (!BN_copy(R,Y)) goto err;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (!BN_nnmod(R,Y,n,ctx)) goto err;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							BNerr(BN_F_BN_MOD_INVERSE_NO_BRANCH,BN_R_NO_INVERSE);
 | 
				
			||||||
 | 
							goto err;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						ret=R;
 | 
				
			||||||
 | 
					err:
 | 
				
			||||||
 | 
						if ((ret == NULL) && (in == NULL)) BN_free(R);
 | 
				
			||||||
 | 
						BN_CTX_end(ctx);
 | 
				
			||||||
 | 
						bn_check_top(ret);
 | 
				
			||||||
 | 
						return(ret);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -763,7 +763,7 @@ int BN_is_bit_set(const BIGNUM *a, int n)
 | 
				
			|||||||
	i=n/BN_BITS2;
 | 
						i=n/BN_BITS2;
 | 
				
			||||||
	j=n%BN_BITS2;
 | 
						j=n%BN_BITS2;
 | 
				
			||||||
	if (a->top <= i) return 0;
 | 
						if (a->top <= i) return 0;
 | 
				
			||||||
	return((a->d[i]&(((BN_ULONG)1)<<j))?1:0);
 | 
						return(((a->d[i])>>j)&((BN_ULONG)1));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int BN_mask_bits(BIGNUM *a, int n)
 | 
					int BN_mask_bits(BIGNUM *a, int n)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -176,7 +176,6 @@ int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	max=(nl+al+1); /* allow for overflow (no?) XXX */
 | 
						max=(nl+al+1); /* allow for overflow (no?) XXX */
 | 
				
			||||||
	if (bn_wexpand(r,max) == NULL) goto err;
 | 
						if (bn_wexpand(r,max) == NULL) goto err;
 | 
				
			||||||
	if (bn_wexpand(ret,max) == NULL) goto err;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	r->neg=a->neg^n->neg;
 | 
						r->neg=a->neg^n->neg;
 | 
				
			||||||
	np=n->d;
 | 
						np=n->d;
 | 
				
			||||||
@@ -228,19 +227,72 @@ int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont,
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	bn_correct_top(r);
 | 
						bn_correct_top(r);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	/* mont->ri will be a multiple of the word size */
 | 
						/* mont->ri will be a multiple of the word size and below code
 | 
				
			||||||
#if 0
 | 
						 * is kind of BN_rshift(ret,r,mont->ri) equivalent */
 | 
				
			||||||
	BN_rshift(ret,r,mont->ri);
 | 
						if (r->top <= ri)
 | 
				
			||||||
#else
 | 
							{
 | 
				
			||||||
	ret->neg = r->neg;
 | 
							ret->top=0;
 | 
				
			||||||
	x=ri;
 | 
							retn=1;
 | 
				
			||||||
 | 
							goto err;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						al=r->top-ri;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# define BRANCH_FREE 1
 | 
				
			||||||
 | 
					# if BRANCH_FREE
 | 
				
			||||||
 | 
						if (bn_wexpand(ret,ri) == NULL) goto err;
 | 
				
			||||||
 | 
						x=0-(((al-ri)>>(sizeof(al)*8-1))&1);
 | 
				
			||||||
 | 
						ret->top=x=(ri&~x)|(al&x);	/* min(ri,al) */
 | 
				
			||||||
 | 
						ret->neg=r->neg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rp=ret->d;
 | 
						rp=ret->d;
 | 
				
			||||||
	ap= &(r->d[x]);
 | 
						ap=&(r->d[ri]);
 | 
				
			||||||
	if (r->top < x)
 | 
					
 | 
				
			||||||
		al=0;
 | 
						{
 | 
				
			||||||
	else
 | 
						size_t m1,m2;
 | 
				
			||||||
		al=r->top-x;
 | 
					
 | 
				
			||||||
 | 
						v=bn_sub_words(rp,ap,np,ri);
 | 
				
			||||||
 | 
						/* this ----------------^^ works even in al<ri case
 | 
				
			||||||
 | 
						 * thanks to zealous zeroing of top of the vector in the
 | 
				
			||||||
 | 
						 * beginning. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* if (al==ri && !v) || al>ri) nrp=rp; else nrp=ap; */
 | 
				
			||||||
 | 
						/* in other words if subtraction result is real, then
 | 
				
			||||||
 | 
						 * trick unconditional memcpy below to perform in-place
 | 
				
			||||||
 | 
						 * "refresh" instead of actual copy. */
 | 
				
			||||||
 | 
						m1=0-(size_t)(((al-ri)>>(sizeof(al)*8-1))&1);	/* al<ri */
 | 
				
			||||||
 | 
						m2=0-(size_t)(((ri-al)>>(sizeof(al)*8-1))&1);	/* al>ri */
 | 
				
			||||||
 | 
						m1|=m2;			/* (al!=ri) */
 | 
				
			||||||
 | 
						m1|=(0-(size_t)v);	/* (al!=ri || v) */
 | 
				
			||||||
 | 
						m1&=~m2;		/* (al!=ri || v) && !al>ri */
 | 
				
			||||||
 | 
						nrp=(BN_ULONG *)(((size_t)rp&~m1)|((size_t)ap&m1));
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* 'i<ri' is chosen to eliminate dependency on input data, even
 | 
				
			||||||
 | 
						 * though it results in redundant copy in al<ri case. */
 | 
				
			||||||
 | 
						for (i=0,ri-=4; i<ri; i+=4)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							BN_ULONG t1,t2,t3,t4;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							t1=nrp[i+0];
 | 
				
			||||||
 | 
							t2=nrp[i+1];
 | 
				
			||||||
 | 
							t3=nrp[i+2];	ap[i+0]=0;
 | 
				
			||||||
 | 
							t4=nrp[i+3];	ap[i+1]=0;
 | 
				
			||||||
 | 
							rp[i+0]=t1;	ap[i+2]=0;
 | 
				
			||||||
 | 
							rp[i+1]=t2;	ap[i+3]=0;
 | 
				
			||||||
 | 
							rp[i+2]=t3;
 | 
				
			||||||
 | 
							rp[i+3]=t4;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						for (ri+=4; i<ri; i++)
 | 
				
			||||||
 | 
							rp[i]=nrp[i], ap[i]=0;
 | 
				
			||||||
 | 
						bn_correct_top(r);
 | 
				
			||||||
 | 
						bn_correct_top(ret);
 | 
				
			||||||
 | 
					# else
 | 
				
			||||||
 | 
						if (bn_wexpand(ret,al) == NULL) goto err;
 | 
				
			||||||
	ret->top=al;
 | 
						ret->top=al;
 | 
				
			||||||
 | 
						ret->neg=r->neg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						rp=ret->d;
 | 
				
			||||||
 | 
						ap=&(r->d[ri]);
 | 
				
			||||||
	al-=4;
 | 
						al-=4;
 | 
				
			||||||
	for (i=0; i<al; i+=4)
 | 
						for (i=0; i<al; i+=4)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -258,7 +310,7 @@ int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont,
 | 
				
			|||||||
	al+=4;
 | 
						al+=4;
 | 
				
			||||||
	for (; i<al; i++)
 | 
						for (; i<al; i++)
 | 
				
			||||||
		rp[i]=ap[i];
 | 
							rp[i]=ap[i];
 | 
				
			||||||
#endif
 | 
					# endif
 | 
				
			||||||
#else /* !MONT_WORD */ 
 | 
					#else /* !MONT_WORD */ 
 | 
				
			||||||
	BIGNUM *t1,*t2;
 | 
						BIGNUM *t1,*t2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -278,10 +330,12 @@ int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont,
 | 
				
			|||||||
	if (!BN_rshift(ret,t2,mont->ri)) goto err;
 | 
						if (!BN_rshift(ret,t2,mont->ri)) goto err;
 | 
				
			||||||
#endif /* MONT_WORD */
 | 
					#endif /* MONT_WORD */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if !defined(BRANCH_FREE) || BRANCH_FREE==0
 | 
				
			||||||
	if (BN_ucmp(ret, &(mont->N)) >= 0)
 | 
						if (BN_ucmp(ret, &(mont->N)) >= 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		if (!BN_usub(ret,ret,&(mont->N))) goto err;
 | 
							if (!BN_usub(ret,ret,&(mont->N))) goto err;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	retn=1;
 | 
						retn=1;
 | 
				
			||||||
	bn_check_top(ret);
 | 
						bn_check_top(ret);
 | 
				
			||||||
 err:
 | 
					 err:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -655,16 +655,16 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
 | 
				
			|||||||
				for (;;)
 | 
									for (;;)
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
					i/=2;
 | 
										i/=2;
 | 
				
			||||||
					if (i < tna && i < tnb)
 | 
										if (i <= tna && tna == tnb)
 | 
				
			||||||
						{
 | 
											{
 | 
				
			||||||
						bn_mul_part_recursive(&(r[n2]),
 | 
											bn_mul_recursive(&(r[n2]),
 | 
				
			||||||
							&(a[n]),&(b[n]),
 | 
												&(a[n]),&(b[n]),
 | 
				
			||||||
							i,tna-i,tnb-i,p);
 | 
												i,tna-i,tnb-i,p);
 | 
				
			||||||
						break;
 | 
											break;
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					else if (i <= tna && i <= tnb)
 | 
										else if (i < tna || i < tnb)
 | 
				
			||||||
						{
 | 
											{
 | 
				
			||||||
						bn_mul_recursive(&(r[n2]),
 | 
											bn_mul_part_recursive(&(r[n2]),
 | 
				
			||||||
							&(a[n]),&(b[n]),
 | 
												&(a[n]),&(b[n]),
 | 
				
			||||||
							i,tna-i,tnb-i,p);
 | 
												i,tna-i,tnb-i,p);
 | 
				
			||||||
						break;
 | 
											break;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -377,14 +377,14 @@ static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1,
 | 
				
			|||||||
static int probable_prime(BIGNUM *rnd, int bits)
 | 
					static int probable_prime(BIGNUM *rnd, int bits)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
	BN_ULONG mods[NUMPRIMES];
 | 
						prime_t mods[NUMPRIMES];
 | 
				
			||||||
	BN_ULONG delta,maxdelta;
 | 
						BN_ULONG delta,maxdelta;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
again:
 | 
					again:
 | 
				
			||||||
	if (!BN_rand(rnd,bits,1,1)) return(0);
 | 
						if (!BN_rand(rnd,bits,1,1)) return(0);
 | 
				
			||||||
	/* we now have a random number 'rand' to test. */
 | 
						/* we now have a random number 'rand' to test. */
 | 
				
			||||||
	for (i=1; i<NUMPRIMES; i++)
 | 
						for (i=1; i<NUMPRIMES; i++)
 | 
				
			||||||
		mods[i]=BN_mod_word(rnd,(BN_ULONG)primes[i]);
 | 
							mods[i]=(prime_t)BN_mod_word(rnd,(BN_ULONG)primes[i]);
 | 
				
			||||||
	maxdelta=BN_MASK2 - primes[NUMPRIMES-1];
 | 
						maxdelta=BN_MASK2 - primes[NUMPRIMES-1];
 | 
				
			||||||
	delta=0;
 | 
						delta=0;
 | 
				
			||||||
	loop: for (i=1; i<NUMPRIMES; i++)
 | 
						loop: for (i=1; i<NUMPRIMES; i++)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -58,10 +58,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#ifndef EIGHT_BIT
 | 
					#ifndef EIGHT_BIT
 | 
				
			||||||
#define NUMPRIMES 2048
 | 
					#define NUMPRIMES 2048
 | 
				
			||||||
 | 
					typedef unsigned short prime_t;
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define NUMPRIMES 54
 | 
					#define NUMPRIMES 54
 | 
				
			||||||
 | 
					typedef unsigned char prime_t;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
static const unsigned int primes[NUMPRIMES]=
 | 
					static const prime_t primes[NUMPRIMES]=
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	   2,   3,   5,   7,  11,  13,  17,  19,
 | 
						   2,   3,   5,   7,  11,  13,  17,  19,
 | 
				
			||||||
	  23,  29,  31,  37,  41,  43,  47,  53,
 | 
						  23,  29,  31,  37,  41,  43,  47,  53,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -101,10 +101,12 @@ for ($i=0; $i <= $#primes; $i++)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
printf "#ifndef EIGHT_BIT\n";
 | 
					printf "#ifndef EIGHT_BIT\n";
 | 
				
			||||||
printf "#define NUMPRIMES %d\n",$num;
 | 
					printf "#define NUMPRIMES %d\n",$num;
 | 
				
			||||||
 | 
					printf "typedef unsigned short prime_t;\n";
 | 
				
			||||||
printf "#else\n";
 | 
					printf "#else\n";
 | 
				
			||||||
printf "#define NUMPRIMES %d\n",$eight;
 | 
					printf "#define NUMPRIMES %d\n",$eight;
 | 
				
			||||||
 | 
					printf "typedef unsigned char prime_t;\n";
 | 
				
			||||||
printf "#endif\n";
 | 
					printf "#endif\n";
 | 
				
			||||||
print "static const unsigned int primes[NUMPRIMES]=\n\t{\n\t";
 | 
					print "static const prime_t primes[NUMPRIMES]=\n\t{\n\t";
 | 
				
			||||||
$init=0;
 | 
					$init=0;
 | 
				
			||||||
for ($i=0; $i <= $#primes; $i++)
 | 
					for ($i=0; $i <= $#primes; $i++)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -184,120 +184,120 @@ int main(int argc, char *argv[])
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_add");
 | 
						message(out,"BN_add");
 | 
				
			||||||
	if (!test_add(out)) goto err;
 | 
						if (!test_add(out)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_sub");
 | 
						message(out,"BN_sub");
 | 
				
			||||||
	if (!test_sub(out)) goto err;
 | 
						if (!test_sub(out)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_lshift1");
 | 
						message(out,"BN_lshift1");
 | 
				
			||||||
	if (!test_lshift1(out)) goto err;
 | 
						if (!test_lshift1(out)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_lshift (fixed)");
 | 
						message(out,"BN_lshift (fixed)");
 | 
				
			||||||
	if (!test_lshift(out,ctx,BN_bin2bn(lst,sizeof(lst)-1,NULL)))
 | 
						if (!test_lshift(out,ctx,BN_bin2bn(lst,sizeof(lst)-1,NULL)))
 | 
				
			||||||
	    goto err;
 | 
						    goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_lshift");
 | 
						message(out,"BN_lshift");
 | 
				
			||||||
	if (!test_lshift(out,ctx,NULL)) goto err;
 | 
						if (!test_lshift(out,ctx,NULL)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_rshift1");
 | 
						message(out,"BN_rshift1");
 | 
				
			||||||
	if (!test_rshift1(out)) goto err;
 | 
						if (!test_rshift1(out)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_rshift");
 | 
						message(out,"BN_rshift");
 | 
				
			||||||
	if (!test_rshift(out,ctx)) goto err;
 | 
						if (!test_rshift(out,ctx)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_sqr");
 | 
						message(out,"BN_sqr");
 | 
				
			||||||
	if (!test_sqr(out,ctx)) goto err;
 | 
						if (!test_sqr(out,ctx)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_mul");
 | 
						message(out,"BN_mul");
 | 
				
			||||||
	if (!test_mul(out)) goto err;
 | 
						if (!test_mul(out)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_div");
 | 
						message(out,"BN_div");
 | 
				
			||||||
	if (!test_div(out,ctx)) goto err;
 | 
						if (!test_div(out,ctx)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_div_word");
 | 
						message(out,"BN_div_word");
 | 
				
			||||||
	if (!test_div_word(out)) goto err;
 | 
						if (!test_div_word(out)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_div_recp");
 | 
						message(out,"BN_div_recp");
 | 
				
			||||||
	if (!test_div_recp(out,ctx)) goto err;
 | 
						if (!test_div_recp(out,ctx)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_mod");
 | 
						message(out,"BN_mod");
 | 
				
			||||||
	if (!test_mod(out,ctx)) goto err;
 | 
						if (!test_mod(out,ctx)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_mod_mul");
 | 
						message(out,"BN_mod_mul");
 | 
				
			||||||
	if (!test_mod_mul(out,ctx)) goto err;
 | 
						if (!test_mod_mul(out,ctx)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_mont");
 | 
						message(out,"BN_mont");
 | 
				
			||||||
	if (!test_mont(out,ctx)) goto err;
 | 
						if (!test_mont(out,ctx)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_mod_exp");
 | 
						message(out,"BN_mod_exp");
 | 
				
			||||||
	if (!test_mod_exp(out,ctx)) goto err;
 | 
						if (!test_mod_exp(out,ctx)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_mod_exp_mont_consttime");
 | 
						message(out,"BN_mod_exp_mont_consttime");
 | 
				
			||||||
	if (!test_mod_exp_mont_consttime(out,ctx)) goto err;
 | 
						if (!test_mod_exp_mont_consttime(out,ctx)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_exp");
 | 
						message(out,"BN_exp");
 | 
				
			||||||
	if (!test_exp(out,ctx)) goto err;
 | 
						if (!test_exp(out,ctx)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_kronecker");
 | 
						message(out,"BN_kronecker");
 | 
				
			||||||
	if (!test_kron(out,ctx)) goto err;
 | 
						if (!test_kron(out,ctx)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_mod_sqrt");
 | 
						message(out,"BN_mod_sqrt");
 | 
				
			||||||
	if (!test_sqrt(out,ctx)) goto err;
 | 
						if (!test_sqrt(out,ctx)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_GF2m_add");
 | 
						message(out,"BN_GF2m_add");
 | 
				
			||||||
	if (!test_gf2m_add(out)) goto err;
 | 
						if (!test_gf2m_add(out)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_GF2m_mod");
 | 
						message(out,"BN_GF2m_mod");
 | 
				
			||||||
	if (!test_gf2m_mod(out)) goto err;
 | 
						if (!test_gf2m_mod(out)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_GF2m_mod_mul");
 | 
						message(out,"BN_GF2m_mod_mul");
 | 
				
			||||||
	if (!test_gf2m_mod_mul(out,ctx)) goto err;
 | 
						if (!test_gf2m_mod_mul(out,ctx)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_GF2m_mod_sqr");
 | 
						message(out,"BN_GF2m_mod_sqr");
 | 
				
			||||||
	if (!test_gf2m_mod_sqr(out,ctx)) goto err;
 | 
						if (!test_gf2m_mod_sqr(out,ctx)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_GF2m_mod_inv");
 | 
						message(out,"BN_GF2m_mod_inv");
 | 
				
			||||||
	if (!test_gf2m_mod_inv(out,ctx)) goto err;
 | 
						if (!test_gf2m_mod_inv(out,ctx)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_GF2m_mod_div");
 | 
						message(out,"BN_GF2m_mod_div");
 | 
				
			||||||
	if (!test_gf2m_mod_div(out,ctx)) goto err;
 | 
						if (!test_gf2m_mod_div(out,ctx)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_GF2m_mod_exp");
 | 
						message(out,"BN_GF2m_mod_exp");
 | 
				
			||||||
	if (!test_gf2m_mod_exp(out,ctx)) goto err;
 | 
						if (!test_gf2m_mod_exp(out,ctx)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_GF2m_mod_sqrt");
 | 
						message(out,"BN_GF2m_mod_sqrt");
 | 
				
			||||||
	if (!test_gf2m_mod_sqrt(out,ctx)) goto err;
 | 
						if (!test_gf2m_mod_sqrt(out,ctx)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message(out,"BN_GF2m_mod_solve_quad");
 | 
						message(out,"BN_GF2m_mod_solve_quad");
 | 
				
			||||||
	if (!test_gf2m_mod_solve_quad(out,ctx)) goto err;
 | 
						if (!test_gf2m_mod_solve_quad(out,ctx)) goto err;
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	BN_CTX_free(ctx);
 | 
						BN_CTX_free(ctx);
 | 
				
			||||||
	BIO_free(out);
 | 
						BIO_free(out);
 | 
				
			||||||
@@ -307,7 +307,7 @@ int main(int argc, char *argv[])
 | 
				
			|||||||
err:
 | 
					err:
 | 
				
			||||||
	BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices
 | 
						BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices
 | 
				
			||||||
	                      * the failure, see test_bn in test/Makefile.ssl*/
 | 
						                      * the failure, see test_bn in test/Makefile.ssl*/
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
	ERR_load_crypto_strings();
 | 
						ERR_load_crypto_strings();
 | 
				
			||||||
	ERR_print_errors_fp(stderr);
 | 
						ERR_print_errors_fp(stderr);
 | 
				
			||||||
	EXIT(1);
 | 
						EXIT(1);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -114,6 +114,7 @@ typedef void conf_finish_func(CONF_IMODULE *md);
 | 
				
			|||||||
#define CONF_MFLAGS_SILENT		0x4
 | 
					#define CONF_MFLAGS_SILENT		0x4
 | 
				
			||||||
#define CONF_MFLAGS_NO_DSO		0x8
 | 
					#define CONF_MFLAGS_NO_DSO		0x8
 | 
				
			||||||
#define CONF_MFLAGS_IGNORE_MISSING_FILE	0x10
 | 
					#define CONF_MFLAGS_IGNORE_MISSING_FILE	0x10
 | 
				
			||||||
 | 
					#define CONF_MFLAGS_DEFAULT_SECTION	0x20
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int CONF_set_default_method(CONF_METHOD *meth);
 | 
					int CONF_set_default_method(CONF_METHOD *meth);
 | 
				
			||||||
void CONF_set_nconf(CONF *conf,LHASH *hash);
 | 
					void CONF_set_nconf(CONF *conf,LHASH *hash);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -121,7 +121,7 @@ int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value)
 | 
				
			|||||||
	v = (CONF_VALUE *)lh_insert(conf->data, value);
 | 
						v = (CONF_VALUE *)lh_insert(conf->data, value);
 | 
				
			||||||
	if (v != NULL)
 | 
						if (v != NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		sk_CONF_VALUE_delete_ptr(ts,v);
 | 
							(void)sk_CONF_VALUE_delete_ptr(ts,v);
 | 
				
			||||||
		OPENSSL_free(v->name);
 | 
							OPENSSL_free(v->name);
 | 
				
			||||||
		OPENSSL_free(v->value);
 | 
							OPENSSL_free(v->value);
 | 
				
			||||||
		OPENSSL_free(v);
 | 
							OPENSSL_free(v);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -126,17 +126,18 @@ int CONF_modules_load(const CONF *cnf, const char *appname,
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
	STACK_OF(CONF_VALUE) *values;
 | 
						STACK_OF(CONF_VALUE) *values;
 | 
				
			||||||
	CONF_VALUE *vl;
 | 
						CONF_VALUE *vl;
 | 
				
			||||||
	char *vsection;
 | 
						char *vsection = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int ret, i;
 | 
						int ret, i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!cnf)
 | 
						if (!cnf)
 | 
				
			||||||
		return 1;
 | 
							return 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (appname == NULL)
 | 
						if (appname)
 | 
				
			||||||
		appname = "openssl_conf";
 | 
							vsection = NCONF_get_string(cnf, NULL, appname);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	vsection = NCONF_get_string(cnf, NULL, appname); 
 | 
						if (!appname || (!vsection && (flags & CONF_MFLAGS_DEFAULT_SECTION)))
 | 
				
			||||||
 | 
							vsection = NCONF_get_string(cnf, NULL, "openssl_conf");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!vsection)
 | 
						if (!vsection)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -431,7 +432,7 @@ void CONF_modules_unload(int all)
 | 
				
			|||||||
		if (((md->links > 0) || !md->dso) && !all)
 | 
							if (((md->links > 0) || !md->dso) && !all)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		/* Since we're working in reverse this is OK */
 | 
							/* Since we're working in reverse this is OK */
 | 
				
			||||||
		sk_CONF_MODULE_delete(supported_modules, i);
 | 
							(void)sk_CONF_MODULE_delete(supported_modules, i);
 | 
				
			||||||
		module_free(md);
 | 
							module_free(md);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	if (sk_CONF_MODULE_num(supported_modules) == 0)
 | 
						if (sk_CONF_MODULE_num(supported_modules) == 0)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -88,8 +88,8 @@ void OPENSSL_config(const char *config_name)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ERR_clear_error();
 | 
						ERR_clear_error();
 | 
				
			||||||
	if (CONF_modules_load_file(NULL, NULL,
 | 
						if (CONF_modules_load_file(NULL, config_name,
 | 
				
			||||||
					CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0)
 | 
						CONF_MFLAGS_DEFAULT_SECTION|CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		BIO *bio_err;
 | 
							BIO *bio_err;
 | 
				
			||||||
		ERR_load_crypto_strings();
 | 
							ERR_load_crypto_strings();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -277,7 +277,7 @@ int CRYPTO_get_new_dynlockid(void)
 | 
				
			|||||||
	else
 | 
						else
 | 
				
			||||||
		/* If we found a place with a NULL pointer, put our pointer
 | 
							/* If we found a place with a NULL pointer, put our pointer
 | 
				
			||||||
		   in it.  */
 | 
							   in it.  */
 | 
				
			||||||
		sk_CRYPTO_dynlock_set(dyn_locks,i,pointer);
 | 
							(void)sk_CRYPTO_dynlock_set(dyn_locks,i,pointer);
 | 
				
			||||||
	CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
 | 
						CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (i == -1)
 | 
						if (i == -1)
 | 
				
			||||||
@@ -319,7 +319,7 @@ void CRYPTO_destroy_dynlockid(int i)
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
			if (pointer->references <= 0)
 | 
								if (pointer->references <= 0)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
				sk_CRYPTO_dynlock_set(dyn_locks, i, NULL);
 | 
									(void)sk_CRYPTO_dynlock_set(dyn_locks, i, NULL);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
				pointer = NULL;
 | 
									pointer = NULL;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -78,7 +78,7 @@ $!
 | 
				
			|||||||
$ ENCRYPT_TYPES = "Basic,"+ -
 | 
					$ ENCRYPT_TYPES = "Basic,"+ -
 | 
				
			||||||
		  "OBJECTS,"+ -
 | 
							  "OBJECTS,"+ -
 | 
				
			||||||
		  "MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,"+ -
 | 
							  "MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,"+ -
 | 
				
			||||||
		  "DES,RC2,RC4,RC5,IDEA,BF,CAST,CAMELLIA,"+ -
 | 
							  "DES,RC2,RC4,RC5,IDEA,BF,CAST,CAMELLIA,SEED,"+ -
 | 
				
			||||||
		  "BN,EC,RSA,DSA,ECDSA,DH,ECDH,DSO,ENGINE,AES,"+ -
 | 
							  "BN,EC,RSA,DSA,ECDSA,DH,ECDH,DSO,ENGINE,AES,"+ -
 | 
				
			||||||
		  "BUFFER,BIO,STACK,LHASH,RAND,ERR,"+ -
 | 
							  "BUFFER,BIO,STACK,LHASH,RAND,ERR,"+ -
 | 
				
			||||||
		  "EVP,EVP_2,ASN1,ASN1_2,PEM,X509,X509V3,"+ -
 | 
							  "EVP,EVP_2,ASN1,ASN1_2,PEM,X509,X509V3,"+ -
 | 
				
			||||||
@@ -184,6 +184,7 @@ $ LIB_BF = "bf_skey,bf_ecb,bf_enc,bf_cfb64,bf_ofb64"
 | 
				
			|||||||
$ LIB_CAST = "c_skey,c_ecb,c_enc,c_cfb64,c_ofb64"
 | 
					$ LIB_CAST = "c_skey,c_ecb,c_enc,c_cfb64,c_ofb64"
 | 
				
			||||||
$ LIB_CAMELLIA = "camellia,cmll_misc,cmll_ecb,cmll_cbc,cmll_ofb,"+ -
 | 
					$ LIB_CAMELLIA = "camellia,cmll_misc,cmll_ecb,cmll_cbc,cmll_ofb,"+ -
 | 
				
			||||||
	"cmll_cfb,cmll_ctr"
 | 
						"cmll_cfb,cmll_ctr"
 | 
				
			||||||
 | 
					$ LIB_SEED = "seed,seed_cbc,seed_ecb,seed_cfb,seed_ofb"
 | 
				
			||||||
$ LIB_BN_ASM = "[.asm]vms.mar,vms-helper"
 | 
					$ LIB_BN_ASM = "[.asm]vms.mar,vms-helper"
 | 
				
			||||||
$ IF F$TRNLNM("OPENSSL_NO_ASM").OR.ARCH.EQS."AXP" THEN LIB_BN_ASM = "bn_asm"
 | 
					$ IF F$TRNLNM("OPENSSL_NO_ASM").OR.ARCH.EQS."AXP" THEN LIB_BN_ASM = "bn_asm"
 | 
				
			||||||
$ LIB_BN = "bn_add,bn_div,bn_exp,bn_lib,bn_ctx,bn_mul,bn_mod,"+ -
 | 
					$ LIB_BN = "bn_add,bn_div,bn_exp,bn_lib,bn_ctx,bn_mul,bn_mod,"+ -
 | 
				
			||||||
@@ -226,7 +227,7 @@ $ LIB_RAND = "md_rand,randfile,rand_lib,rand_err,rand_egd,"+ -
 | 
				
			|||||||
$ LIB_ERR = "err,err_all,err_prn"
 | 
					$ LIB_ERR = "err,err_all,err_prn"
 | 
				
			||||||
$ LIB_OBJECTS = "o_names,obj_dat,obj_lib,obj_err"
 | 
					$ LIB_OBJECTS = "o_names,obj_dat,obj_lib,obj_err"
 | 
				
			||||||
$ LIB_EVP = "encode,digest,evp_enc,evp_key,evp_acnf,"+ -
 | 
					$ LIB_EVP = "encode,digest,evp_enc,evp_key,evp_acnf,"+ -
 | 
				
			||||||
	"e_des,e_bf,e_idea,e_des3,e_camellia,"+ -
 | 
						"e_des,e_bf,e_idea,e_des3,e_camellia,e_seed,"+ -
 | 
				
			||||||
	"e_rc4,e_aes,names,"+ -
 | 
						"e_rc4,e_aes,names,"+ -
 | 
				
			||||||
	"e_xcbc_d,e_rc2,e_cast,e_rc5"
 | 
						"e_xcbc_d,e_rc2,e_cast,e_rc5"
 | 
				
			||||||
$ LIB_EVP_2 = "m_null,m_md2,m_md4,m_md5,m_sha,m_sha1," + -
 | 
					$ LIB_EVP_2 = "m_null,m_md2,m_md4,m_md5,m_sha,m_sha1," + -
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -115,7 +115,7 @@ int DES_check_key_parity(const_DES_cblock *key)
 | 
				
			|||||||
 * (and actual cblock values).
 | 
					 * (and actual cblock values).
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#define NUM_WEAK_KEY	16
 | 
					#define NUM_WEAK_KEY	16
 | 
				
			||||||
static DES_cblock weak_keys[NUM_WEAK_KEY]={
 | 
					static const DES_cblock weak_keys[NUM_WEAK_KEY]={
 | 
				
			||||||
	/* weak keys */
 | 
						/* weak keys */
 | 
				
			||||||
	{0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01},
 | 
						{0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01},
 | 
				
			||||||
	{0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE},
 | 
						{0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE},
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -62,7 +62,7 @@
 | 
				
			|||||||
#include <openssl/dh.h>
 | 
					#include <openssl/dh.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Check that p is a safe prime and
 | 
					/* Check that p is a safe prime and
 | 
				
			||||||
 * if g is 2, 3 or 5, check that is is a suitable generator
 | 
					 * if g is 2, 3 or 5, check that it is a suitable generator
 | 
				
			||||||
 * where
 | 
					 * where
 | 
				
			||||||
 * for 2, p mod 24 == 11
 | 
					 * for 2, p mod 24 == 11
 | 
				
			||||||
 * for 3, p mod 12 == 5
 | 
					 * for 3, p mod 12 == 5
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -150,7 +150,7 @@ static int generate_key(DH *dh)
 | 
				
			|||||||
			{
 | 
								{
 | 
				
			||||||
			BN_init(&local_prk);
 | 
								BN_init(&local_prk);
 | 
				
			||||||
			prk = &local_prk;
 | 
								prk = &local_prk;
 | 
				
			||||||
			BN_with_flags(prk, priv_key, BN_FLG_EXP_CONSTTIME);
 | 
								BN_with_flags(prk, priv_key, BN_FLG_CONSTTIME);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			prk = priv_key;
 | 
								prk = priv_key;
 | 
				
			||||||
@@ -203,7 +203,7 @@ static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
 | 
				
			|||||||
		if ((dh->flags & DH_FLAG_NO_EXP_CONSTTIME) == 0)
 | 
							if ((dh->flags & DH_FLAG_NO_EXP_CONSTTIME) == 0)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			/* XXX */
 | 
								/* XXX */
 | 
				
			||||||
			BN_set_flags(dh->priv_key, BN_FLG_EXP_CONSTTIME);
 | 
								BN_set_flags(dh->priv_key, BN_FLG_CONSTTIME);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		if (!mont)
 | 
							if (!mont)
 | 
				
			||||||
			goto err;
 | 
								goto err;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -117,13 +117,20 @@ static int dsa_builtin_paramgen(DSA *ret, int bits,
 | 
				
			|||||||
	if (bits < 512) bits=512;
 | 
						if (bits < 512) bits=512;
 | 
				
			||||||
	bits=(bits+63)/64*64;
 | 
						bits=(bits+63)/64*64;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (seed_len < 20)
 | 
						/* NB: seed_len == 0 is special case: copy generated seed to
 | 
				
			||||||
 | 
					 	 * seed_in if it is not NULL.
 | 
				
			||||||
 | 
					 	 */
 | 
				
			||||||
 | 
						if (seed_len && (seed_len < 20))
 | 
				
			||||||
		seed_in = NULL; /* seed buffer too small -- ignore */
 | 
							seed_in = NULL; /* seed buffer too small -- ignore */
 | 
				
			||||||
	if (seed_len > 20) 
 | 
						if (seed_len > 20) 
 | 
				
			||||||
		seed_len = 20; /* App. 2.2 of FIPS PUB 186 allows larger SEED,
 | 
							seed_len = 20; /* App. 2.2 of FIPS PUB 186 allows larger SEED,
 | 
				
			||||||
		                * but our internal buffers are restricted to 160 bits*/
 | 
							                * but our internal buffers are restricted to 160 bits*/
 | 
				
			||||||
	if ((seed_in != NULL) && (seed_len == 20))
 | 
						if ((seed_in != NULL) && (seed_len == 20))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
		memcpy(seed,seed_in,seed_len);
 | 
							memcpy(seed,seed_in,seed_len);
 | 
				
			||||||
 | 
							/* set seed_in to NULL to avoid it being copied back */
 | 
				
			||||||
 | 
							seed_in = NULL;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((ctx=BN_CTX_new()) == NULL) goto err;
 | 
						if ((ctx=BN_CTX_new()) == NULL) goto err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -300,7 +307,7 @@ err:
 | 
				
			|||||||
			ok=0;
 | 
								ok=0;
 | 
				
			||||||
			goto err;
 | 
								goto err;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		if ((m > 1) && (seed_in != NULL)) memcpy(seed_in,seed,20);
 | 
							if (seed_in != NULL) memcpy(seed_in,seed,20);
 | 
				
			||||||
		if (counter_ret != NULL) *counter_ret=counter;
 | 
							if (counter_ret != NULL) *counter_ret=counter;
 | 
				
			||||||
		if (h_ret != NULL) *h_ret=h;
 | 
							if (h_ret != NULL) *h_ret=h;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -107,7 +107,7 @@ static int dsa_builtin_keygen(DSA *dsa)
 | 
				
			|||||||
			{
 | 
								{
 | 
				
			||||||
			BN_init(&local_prk);
 | 
								BN_init(&local_prk);
 | 
				
			||||||
			prk = &local_prk;
 | 
								prk = &local_prk;
 | 
				
			||||||
			BN_with_flags(prk, priv_key, BN_FLG_EXP_CONSTTIME);
 | 
								BN_with_flags(prk, priv_key, BN_FLG_CONSTTIME);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			prk = priv_key;
 | 
								prk = priv_key;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -229,7 +229,7 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
 | 
				
			|||||||
	while (BN_is_zero(&k));
 | 
						while (BN_is_zero(&k));
 | 
				
			||||||
	if ((dsa->flags & DSA_FLAG_NO_EXP_CONSTTIME) == 0)
 | 
						if ((dsa->flags & DSA_FLAG_NO_EXP_CONSTTIME) == 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		BN_set_flags(&k, BN_FLG_EXP_CONSTTIME);
 | 
							BN_set_flags(&k, BN_FLG_CONSTTIME);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (dsa->flags & DSA_FLAG_CACHE_MONT_P)
 | 
						if (dsa->flags & DSA_FLAG_CACHE_MONT_P)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -471,6 +471,7 @@ void ERR_load_EC_strings(void);
 | 
				
			|||||||
#define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP	 126
 | 
					#define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP	 126
 | 
				
			||||||
#define EC_F_EC_POINT_SET_TO_INFINITY			 127
 | 
					#define EC_F_EC_POINT_SET_TO_INFINITY			 127
 | 
				
			||||||
#define EC_F_EC_PRE_COMP_DUP				 207
 | 
					#define EC_F_EC_PRE_COMP_DUP				 207
 | 
				
			||||||
 | 
					#define EC_F_EC_PRE_COMP_NEW				 196
 | 
				
			||||||
#define EC_F_EC_WNAF_MUL				 187
 | 
					#define EC_F_EC_WNAF_MUL				 187
 | 
				
			||||||
#define EC_F_EC_WNAF_PRECOMPUTE_MULT			 188
 | 
					#define EC_F_EC_WNAF_PRECOMPUTE_MULT			 188
 | 
				
			||||||
#define EC_F_I2D_ECPARAMETERS				 190
 | 
					#define EC_F_I2D_ECPARAMETERS				 190
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/* crypto/ec/ec_err.c */
 | 
					/* crypto/ec/ec_err.c */
 | 
				
			||||||
/* ====================================================================
 | 
					/* ====================================================================
 | 
				
			||||||
 * Copyright (c) 1999-2005 The OpenSSL Project.  All rights reserved.
 | 
					 * Copyright (c) 1999-2007 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Redistribution and use in source and binary forms, with or without
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 * modification, are permitted provided that the following conditions
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
@@ -170,6 +170,7 @@ static ERR_STRING_DATA EC_str_functs[]=
 | 
				
			|||||||
{ERR_FUNC(EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP),	"EC_POINT_set_Jprojective_coordinates_GFp"},
 | 
					{ERR_FUNC(EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP),	"EC_POINT_set_Jprojective_coordinates_GFp"},
 | 
				
			||||||
{ERR_FUNC(EC_F_EC_POINT_SET_TO_INFINITY),	"EC_POINT_set_to_infinity"},
 | 
					{ERR_FUNC(EC_F_EC_POINT_SET_TO_INFINITY),	"EC_POINT_set_to_infinity"},
 | 
				
			||||||
{ERR_FUNC(EC_F_EC_PRE_COMP_DUP),	"EC_PRE_COMP_DUP"},
 | 
					{ERR_FUNC(EC_F_EC_PRE_COMP_DUP),	"EC_PRE_COMP_DUP"},
 | 
				
			||||||
 | 
					{ERR_FUNC(EC_F_EC_PRE_COMP_NEW),	"EC_PRE_COMP_NEW"},
 | 
				
			||||||
{ERR_FUNC(EC_F_EC_WNAF_MUL),	"ec_wNAF_mul"},
 | 
					{ERR_FUNC(EC_F_EC_WNAF_MUL),	"ec_wNAF_mul"},
 | 
				
			||||||
{ERR_FUNC(EC_F_EC_WNAF_PRECOMPUTE_MULT),	"ec_wNAF_precompute_mult"},
 | 
					{ERR_FUNC(EC_F_EC_WNAF_PRECOMPUTE_MULT),	"ec_wNAF_precompute_mult"},
 | 
				
			||||||
{ERR_FUNC(EC_F_I2D_ECPARAMETERS),	"i2d_ECParameters"},
 | 
					{ERR_FUNC(EC_F_I2D_ECPARAMETERS),	"i2d_ECParameters"},
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@
 | 
				
			|||||||
 * Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project.
 | 
					 * Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
/* ====================================================================
 | 
					/* ====================================================================
 | 
				
			||||||
 * Copyright (c) 1998-2003 The OpenSSL Project.  All rights reserved.
 | 
					 * Copyright (c) 1998-2007 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Redistribution and use in source and binary forms, with or without
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 * modification, are permitted provided that the following conditions
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
@@ -104,7 +104,10 @@ static EC_PRE_COMP *ec_pre_comp_new(const EC_GROUP *group)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	ret = (EC_PRE_COMP *)OPENSSL_malloc(sizeof(EC_PRE_COMP));
 | 
						ret = (EC_PRE_COMP *)OPENSSL_malloc(sizeof(EC_PRE_COMP));
 | 
				
			||||||
	if (!ret)
 | 
						if (!ret)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							ECerr(EC_F_EC_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
 | 
				
			||||||
		return ret;
 | 
							return ret;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	ret->group = group;
 | 
						ret->group = group;
 | 
				
			||||||
	ret->blocksize = 8; /* default */
 | 
						ret->blocksize = 8; /* default */
 | 
				
			||||||
	ret->numblocks = 0;
 | 
						ret->numblocks = 0;
 | 
				
			||||||
@@ -194,6 +197,19 @@ static signed char *compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len)
 | 
				
			|||||||
	int bit, next_bit, mask;
 | 
						int bit, next_bit, mask;
 | 
				
			||||||
	size_t len = 0, j;
 | 
						size_t len = 0, j;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						if (BN_is_zero(scalar))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							r = OPENSSL_malloc(1);
 | 
				
			||||||
 | 
							if (!r)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								ECerr(EC_F_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE);
 | 
				
			||||||
 | 
								goto err;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							r[0] = 0;
 | 
				
			||||||
 | 
							*ret_len = 1;
 | 
				
			||||||
 | 
							return r;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
	if (w <= 0 || w > 7) /* 'signed char' can represent integers with absolute values less than 2^7 */
 | 
						if (w <= 0 || w > 7) /* 'signed char' can represent integers with absolute values less than 2^7 */
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		ECerr(EC_F_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
 | 
							ECerr(EC_F_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
 | 
				
			||||||
@@ -212,7 +228,11 @@ static signed char *compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len)
 | 
				
			|||||||
	r = OPENSSL_malloc(len + 1); /* modified wNAF may be one digit longer than binary representation
 | 
						r = OPENSSL_malloc(len + 1); /* modified wNAF may be one digit longer than binary representation
 | 
				
			||||||
	                              * (*ret_len will be set to the actual length, i.e. at most
 | 
						                              * (*ret_len will be set to the actual length, i.e. at most
 | 
				
			||||||
	                              * BN_num_bits(scalar) + 1) */
 | 
						                              * BN_num_bits(scalar) + 1) */
 | 
				
			||||||
	if (r == NULL) goto err;
 | 
						if (r == NULL)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							ECerr(EC_F_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE);
 | 
				
			||||||
 | 
							goto err;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (scalar->d == NULL || scalar->top == 0)
 | 
						if (scalar->d == NULL || scalar->top == 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -425,7 +445,10 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
 | 
				
			|||||||
	val_sub  = OPENSSL_malloc(totalnum * sizeof val_sub[0]);
 | 
						val_sub  = OPENSSL_malloc(totalnum * sizeof val_sub[0]);
 | 
				
			||||||
		 
 | 
							 
 | 
				
			||||||
	if (!wsize || !wNAF_len || !wNAF || !val_sub)
 | 
						if (!wsize || !wNAF_len || !wNAF || !val_sub)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE);
 | 
				
			||||||
		goto err;
 | 
							goto err;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wNAF[0] = NULL;	/* preliminary pivot */
 | 
						wNAF[0] = NULL;	/* preliminary pivot */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -538,6 +561,7 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
 | 
				
			|||||||
					wNAF[i] = OPENSSL_malloc(wNAF_len[i]);
 | 
										wNAF[i] = OPENSSL_malloc(wNAF_len[i]);
 | 
				
			||||||
					if (wNAF[i] == NULL)
 | 
										if (wNAF[i] == NULL)
 | 
				
			||||||
						{
 | 
											{
 | 
				
			||||||
 | 
											ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE);
 | 
				
			||||||
						OPENSSL_free(tmp_wNAF);
 | 
											OPENSSL_free(tmp_wNAF);
 | 
				
			||||||
						goto err;
 | 
											goto err;
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
@@ -564,7 +588,11 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
 | 
				
			|||||||
	 * 'val_sub[i]' is a pointer to the subarray for the i-th point,
 | 
						 * 'val_sub[i]' is a pointer to the subarray for the i-th point,
 | 
				
			||||||
	 * or to a subarray of 'pre_comp->points' if we already have precomputation. */
 | 
						 * or to a subarray of 'pre_comp->points' if we already have precomputation. */
 | 
				
			||||||
	val = OPENSSL_malloc((num_val + 1) * sizeof val[0]);
 | 
						val = OPENSSL_malloc((num_val + 1) * sizeof val[0]);
 | 
				
			||||||
	if (val == NULL) goto err;
 | 
						if (val == NULL)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE);
 | 
				
			||||||
 | 
							goto err;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	val[num_val] = NULL; /* pivot element */
 | 
						val[num_val] = NULL; /* pivot element */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* allocate points for precomputation */
 | 
						/* allocate points for precomputation */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -659,13 +659,15 @@ void prime_field_tests()
 | 
				
			|||||||
	if (!EC_POINT_is_at_infinity(group, R)) ABORT; /* R = P + 2Q */
 | 
						if (!EC_POINT_is_at_infinity(group, R)) ABORT; /* R = P + 2Q */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		const EC_POINT *points[3];
 | 
							const EC_POINT *points[4];
 | 
				
			||||||
		const BIGNUM *scalars[3];
 | 
							const BIGNUM *scalars[4];
 | 
				
			||||||
 | 
							BIGNUM scalar3;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
		if (EC_POINT_is_at_infinity(group, Q)) ABORT;
 | 
							if (EC_POINT_is_at_infinity(group, Q)) ABORT;
 | 
				
			||||||
		points[0] = Q;
 | 
							points[0] = Q;
 | 
				
			||||||
		points[1] = Q;
 | 
							points[1] = Q;
 | 
				
			||||||
		points[2] = Q;
 | 
							points[2] = Q;
 | 
				
			||||||
 | 
							points[3] = Q;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!BN_add(y, z, BN_value_one())) ABORT;
 | 
							if (!BN_add(y, z, BN_value_one())) ABORT;
 | 
				
			||||||
		if (BN_is_odd(y)) ABORT;
 | 
							if (BN_is_odd(y)) ABORT;
 | 
				
			||||||
@@ -704,10 +706,16 @@ void prime_field_tests()
 | 
				
			|||||||
		scalars[1] = y;
 | 
							scalars[1] = y;
 | 
				
			||||||
		scalars[2] = z; /* z = -(x+y) */
 | 
							scalars[2] = z; /* z = -(x+y) */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!EC_POINTs_mul(group, P, NULL, 3, points, scalars, ctx)) ABORT;
 | 
							BN_init(&scalar3);
 | 
				
			||||||
 | 
							BN_zero(&scalar3);
 | 
				
			||||||
 | 
							scalars[3] = &scalar3;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (!EC_POINTs_mul(group, P, NULL, 4, points, scalars, ctx)) ABORT;
 | 
				
			||||||
		if (!EC_POINT_is_at_infinity(group, P)) ABORT;
 | 
							if (!EC_POINT_is_at_infinity(group, P)) ABORT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		fprintf(stdout, " ok\n\n");
 | 
							fprintf(stdout, " ok\n\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							BN_free(&scalar3);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -148,7 +148,7 @@ static int test_ecdh_curve(int nid, const char *text, BN_CTX *ctx, BIO *out)
 | 
				
			|||||||
#ifdef NOISY
 | 
					#ifdef NOISY
 | 
				
			||||||
	BIO_puts(out,"\n");
 | 
						BIO_puts(out,"\n");
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!EC_KEY_generate_key(a)) goto err;
 | 
						if (!EC_KEY_generate_key(a)) goto err;
 | 
				
			||||||
@@ -173,7 +173,7 @@ static int test_ecdh_curve(int nid, const char *text, BN_CTX *ctx, BIO *out)
 | 
				
			|||||||
	BIO_puts(out,"\n");
 | 
						BIO_puts(out,"\n");
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
	BIO_printf(out," .");
 | 
						BIO_printf(out," .");
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!EC_KEY_generate_key(b)) goto err;
 | 
						if (!EC_KEY_generate_key(b)) goto err;
 | 
				
			||||||
@@ -199,7 +199,7 @@ static int test_ecdh_curve(int nid, const char *text, BN_CTX *ctx, BIO *out)
 | 
				
			|||||||
	BIO_puts(out,"\n");
 | 
						BIO_puts(out,"\n");
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
	BIO_printf(out,".");
 | 
						BIO_printf(out,".");
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	alen=KDF1_SHA1_len;
 | 
						alen=KDF1_SHA1_len;
 | 
				
			||||||
@@ -216,7 +216,7 @@ static int test_ecdh_curve(int nid, const char *text, BN_CTX *ctx, BIO *out)
 | 
				
			|||||||
	BIO_puts(out,"\n");
 | 
						BIO_puts(out,"\n");
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
	BIO_printf(out,".");
 | 
						BIO_printf(out,".");
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	blen=KDF1_SHA1_len;
 | 
						blen=KDF1_SHA1_len;
 | 
				
			||||||
@@ -233,7 +233,7 @@ static int test_ecdh_curve(int nid, const char *text, BN_CTX *ctx, BIO *out)
 | 
				
			|||||||
	BIO_puts(out,"\n");
 | 
						BIO_puts(out,"\n");
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
	BIO_printf(out,".");
 | 
						BIO_printf(out,".");
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((aout < 4) || (bout != aout) || (memcmp(abuf,bbuf,aout) != 0))
 | 
						if ((aout < 4) || (bout != aout) || (memcmp(abuf,bbuf,aout) != 0))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -203,13 +203,13 @@ int x9_62_test_internal(BIO *out, int nid, const char *r_in, const char *s_in)
 | 
				
			|||||||
	if (!EC_KEY_generate_key(key))
 | 
						if (!EC_KEY_generate_key(key))
 | 
				
			||||||
		goto x962_int_err;
 | 
							goto x962_int_err;
 | 
				
			||||||
	BIO_printf(out, ".");
 | 
						BIO_printf(out, ".");
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
	/* create the signature */
 | 
						/* create the signature */
 | 
				
			||||||
	signature = ECDSA_do_sign(digest, 20, key);
 | 
						signature = ECDSA_do_sign(digest, 20, key);
 | 
				
			||||||
	if (signature == NULL)
 | 
						if (signature == NULL)
 | 
				
			||||||
		goto x962_int_err;
 | 
							goto x962_int_err;
 | 
				
			||||||
	BIO_printf(out, ".");
 | 
						BIO_printf(out, ".");
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
	/* compare the created signature with the expected signature */
 | 
						/* compare the created signature with the expected signature */
 | 
				
			||||||
	if ((r = BN_new()) == NULL || (s = BN_new()) == NULL)
 | 
						if ((r = BN_new()) == NULL || (s = BN_new()) == NULL)
 | 
				
			||||||
		goto x962_int_err;
 | 
							goto x962_int_err;
 | 
				
			||||||
@@ -219,12 +219,12 @@ int x9_62_test_internal(BIO *out, int nid, const char *r_in, const char *s_in)
 | 
				
			|||||||
	if (BN_cmp(signature->r ,r) || BN_cmp(signature->s, s))
 | 
						if (BN_cmp(signature->r ,r) || BN_cmp(signature->s, s))
 | 
				
			||||||
		goto x962_int_err;
 | 
							goto x962_int_err;
 | 
				
			||||||
	BIO_printf(out, ".");
 | 
						BIO_printf(out, ".");
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
	/* verify the signature */
 | 
						/* verify the signature */
 | 
				
			||||||
	if (ECDSA_do_verify(digest, 20, signature, key) != 1)
 | 
						if (ECDSA_do_verify(digest, 20, signature, key) != 1)
 | 
				
			||||||
		goto x962_int_err;
 | 
							goto x962_int_err;
 | 
				
			||||||
	BIO_printf(out, ".");
 | 
						BIO_printf(out, ".");
 | 
				
			||||||
	BIO_flush(out);
 | 
						(void)BIO_flush(out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	BIO_printf(out, " ok\n");
 | 
						BIO_printf(out, " ok\n");
 | 
				
			||||||
	ret = 1;
 | 
						ret = 1;
 | 
				
			||||||
@@ -369,7 +369,7 @@ int test_builtin(BIO *out)
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		BIO_printf(out, ".");
 | 
							BIO_printf(out, ".");
 | 
				
			||||||
		BIO_flush(out);
 | 
							(void)BIO_flush(out);
 | 
				
			||||||
		/* check key */
 | 
							/* check key */
 | 
				
			||||||
		if (!EC_KEY_check_key(eckey))
 | 
							if (!EC_KEY_check_key(eckey))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -377,7 +377,7 @@ int test_builtin(BIO *out)
 | 
				
			|||||||
			goto builtin_err;
 | 
								goto builtin_err;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		BIO_printf(out, ".");
 | 
							BIO_printf(out, ".");
 | 
				
			||||||
		BIO_flush(out);
 | 
							(void)BIO_flush(out);
 | 
				
			||||||
		/* create signature */
 | 
							/* create signature */
 | 
				
			||||||
		sig_len = ECDSA_size(eckey);
 | 
							sig_len = ECDSA_size(eckey);
 | 
				
			||||||
		if ((signature = OPENSSL_malloc(sig_len)) == NULL)
 | 
							if ((signature = OPENSSL_malloc(sig_len)) == NULL)
 | 
				
			||||||
@@ -388,7 +388,7 @@ int test_builtin(BIO *out)
 | 
				
			|||||||
			goto builtin_err;
 | 
								goto builtin_err;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		BIO_printf(out, ".");
 | 
							BIO_printf(out, ".");
 | 
				
			||||||
		BIO_flush(out);
 | 
							(void)BIO_flush(out);
 | 
				
			||||||
		/* verify signature */
 | 
							/* verify signature */
 | 
				
			||||||
		if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) != 1)
 | 
							if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) != 1)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -396,7 +396,7 @@ int test_builtin(BIO *out)
 | 
				
			|||||||
			goto builtin_err;
 | 
								goto builtin_err;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		BIO_printf(out, ".");
 | 
							BIO_printf(out, ".");
 | 
				
			||||||
		BIO_flush(out);
 | 
							(void)BIO_flush(out);
 | 
				
			||||||
		/* verify signature with the wrong key */
 | 
							/* verify signature with the wrong key */
 | 
				
			||||||
		if (ECDSA_verify(0, digest, 20, signature, sig_len, 
 | 
							if (ECDSA_verify(0, digest, 20, signature, sig_len, 
 | 
				
			||||||
			wrong_eckey) == 1)
 | 
								wrong_eckey) == 1)
 | 
				
			||||||
@@ -405,7 +405,7 @@ int test_builtin(BIO *out)
 | 
				
			|||||||
			goto builtin_err;
 | 
								goto builtin_err;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		BIO_printf(out, ".");
 | 
							BIO_printf(out, ".");
 | 
				
			||||||
		BIO_flush(out);
 | 
							(void)BIO_flush(out);
 | 
				
			||||||
		/* wrong digest */
 | 
							/* wrong digest */
 | 
				
			||||||
		if (ECDSA_verify(0, wrong_digest, 20, signature, sig_len,
 | 
							if (ECDSA_verify(0, wrong_digest, 20, signature, sig_len,
 | 
				
			||||||
			eckey) == 1)
 | 
								eckey) == 1)
 | 
				
			||||||
@@ -414,7 +414,7 @@ int test_builtin(BIO *out)
 | 
				
			|||||||
			goto builtin_err;
 | 
								goto builtin_err;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		BIO_printf(out, ".");
 | 
							BIO_printf(out, ".");
 | 
				
			||||||
		BIO_flush(out);
 | 
							(void)BIO_flush(out);
 | 
				
			||||||
		/* modify a single byte of the signature */
 | 
							/* modify a single byte of the signature */
 | 
				
			||||||
		offset = signature[10] % sig_len;
 | 
							offset = signature[10] % sig_len;
 | 
				
			||||||
		dirt   = signature[11];
 | 
							dirt   = signature[11];
 | 
				
			||||||
@@ -425,7 +425,7 @@ int test_builtin(BIO *out)
 | 
				
			|||||||
			goto builtin_err;
 | 
								goto builtin_err;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		BIO_printf(out, ".");
 | 
							BIO_printf(out, ".");
 | 
				
			||||||
		BIO_flush(out);
 | 
							(void)BIO_flush(out);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		BIO_printf(out, " ok\n");
 | 
							BIO_printf(out, " ok\n");
 | 
				
			||||||
		/* cleanup */
 | 
							/* cleanup */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -436,7 +436,7 @@ static inline void *name(size_t cnt,		\
 | 
				
			|||||||
			rep_xcrypt "\n"		\
 | 
								rep_xcrypt "\n"		\
 | 
				
			||||||
		"	popl	%%ebx"		\
 | 
							"	popl	%%ebx"		\
 | 
				
			||||||
		: "=a"(iv), "=c"(cnt), "=D"(out), "=S"(inp) \
 | 
							: "=a"(iv), "=c"(cnt), "=D"(out), "=S"(inp) \
 | 
				
			||||||
		: "0"(cdata), "1"(cnt), "2"(out), "3"(inp), "m"(*cdata)  \
 | 
							: "0"(cdata), "1"(cnt), "2"(out), "3"(inp)  \
 | 
				
			||||||
		: "edx", "cc", "memory");	\
 | 
							: "edx", "cc", "memory");	\
 | 
				
			||||||
	return iv;				\
 | 
						return iv;				\
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -147,7 +147,7 @@ int engine_table_register(ENGINE_TABLE **table, ENGINE_CLEANUP_CB *cleanup,
 | 
				
			|||||||
			lh_insert(&(*table)->piles, fnd);
 | 
								lh_insert(&(*table)->piles, fnd);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		/* A registration shouldn't add duplciate entries */
 | 
							/* A registration shouldn't add duplciate entries */
 | 
				
			||||||
		sk_ENGINE_delete_ptr(fnd->sk, e);
 | 
							(void)sk_ENGINE_delete_ptr(fnd->sk, e);
 | 
				
			||||||
		/* if 'setdefault', this ENGINE goes to the head of the list */
 | 
							/* if 'setdefault', this ENGINE goes to the head of the list */
 | 
				
			||||||
		if(!sk_ENGINE_push(fnd->sk, e))
 | 
							if(!sk_ENGINE_push(fnd->sk, e))
 | 
				
			||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
@@ -178,7 +178,7 @@ static void int_unregister_cb(ENGINE_PILE *pile, ENGINE *e)
 | 
				
			|||||||
	/* Iterate the 'c->sk' stack removing any occurance of 'e' */
 | 
						/* Iterate the 'c->sk' stack removing any occurance of 'e' */
 | 
				
			||||||
	while((n = sk_ENGINE_find(pile->sk, e)) >= 0)
 | 
						while((n = sk_ENGINE_find(pile->sk, e)) >= 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		sk_ENGINE_delete(pile->sk, n);
 | 
							(void)sk_ENGINE_delete(pile->sk, n);
 | 
				
			||||||
		/* "touch" this ENGINE_CIPHER */
 | 
							/* "touch" this ENGINE_CIPHER */
 | 
				
			||||||
		pile->uptodate = 1;
 | 
							pile->uptodate = 1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,7 @@ APPS=
 | 
				
			|||||||
LIB=$(TOP)/libcrypto.a
 | 
					LIB=$(TOP)/libcrypto.a
 | 
				
			||||||
LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \
 | 
					LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \
 | 
				
			||||||
	e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c\
 | 
						e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c\
 | 
				
			||||||
	e_rc4.c e_aes.c names.c \
 | 
						e_rc4.c e_aes.c names.c e_seed.c \
 | 
				
			||||||
	e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \
 | 
						e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \
 | 
				
			||||||
	m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c \
 | 
						m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c \
 | 
				
			||||||
	m_dss.c m_dss1.c m_mdc2.c m_ripemd.c m_ecdsa.c\
 | 
						m_dss.c m_dss1.c m_mdc2.c m_ripemd.c m_ecdsa.c\
 | 
				
			||||||
@@ -32,7 +32,7 @@ LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
LIBOBJ=	encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \
 | 
					LIBOBJ=	encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \
 | 
				
			||||||
	e_des.o e_bf.o e_idea.o e_des3.o e_camellia.o\
 | 
						e_des.o e_bf.o e_idea.o e_des3.o e_camellia.o\
 | 
				
			||||||
	e_rc4.o e_aes.o names.o \
 | 
						e_rc4.o e_aes.o names.o e_seed.o \
 | 
				
			||||||
	e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \
 | 
						e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \
 | 
				
			||||||
	m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o \
 | 
						m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o \
 | 
				
			||||||
	m_dss.o m_dss1.o m_mdc2.o m_ripemd.o m_ecdsa.o\
 | 
						m_dss.o m_dss1.o m_mdc2.o m_ripemd.o m_ecdsa.o\
 | 
				
			||||||
@@ -271,6 +271,14 @@ e_rc5.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
 | 
				
			|||||||
e_rc5.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
					e_rc5.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
				
			||||||
e_rc5.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 | 
					e_rc5.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 | 
				
			||||||
e_rc5.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc5.c
 | 
					e_rc5.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc5.c
 | 
				
			||||||
 | 
					e_seed.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
				
			||||||
 | 
					e_seed.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
				
			||||||
 | 
					e_seed.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
				
			||||||
 | 
					e_seed.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
				
			||||||
 | 
					e_seed.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
				
			||||||
 | 
					e_seed.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
				
			||||||
 | 
					e_seed.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 | 
				
			||||||
 | 
					e_seed.o: ../../include/openssl/symhacks.h e_seed.c
 | 
				
			||||||
e_xcbc_d.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
					e_xcbc_d.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
				
			||||||
e_xcbc_d.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
					e_xcbc_d.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
				
			||||||
e_xcbc_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
 | 
					e_xcbc_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -107,6 +107,15 @@ void OpenSSL_add_all_ciphers(void)
 | 
				
			|||||||
	EVP_add_cipher_alias(SN_idea_cbc,"idea");
 | 
						EVP_add_cipher_alias(SN_idea_cbc,"idea");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
						EVP_add_cipher(EVP_seed_ecb());
 | 
				
			||||||
 | 
						EVP_add_cipher(EVP_seed_cfb());
 | 
				
			||||||
 | 
						EVP_add_cipher(EVP_seed_ofb());
 | 
				
			||||||
 | 
						EVP_add_cipher(EVP_seed_cbc());
 | 
				
			||||||
 | 
						EVP_add_cipher_alias(SN_seed_cbc,"SEED");
 | 
				
			||||||
 | 
						EVP_add_cipher_alias(SN_seed_cbc,"seed");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef OPENSSL_NO_RC2
 | 
					#ifndef OPENSSL_NO_RC2
 | 
				
			||||||
	EVP_add_cipher(EVP_rc2_ecb());
 | 
						EVP_add_cipher(EVP_rc2_ecb());
 | 
				
			||||||
	EVP_add_cipher(EVP_rc2_cfb());
 | 
						EVP_add_cipher(EVP_rc2_cfb());
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										83
									
								
								crypto/evp/e_seed.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								crypto/evp/e_seed.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,83 @@
 | 
				
			|||||||
 | 
					/* crypto/evp/e_seed.c -*- mode:C; c-file-style: "eay" -*- */
 | 
				
			||||||
 | 
					/* ====================================================================
 | 
				
			||||||
 | 
					 * Copyright (c) 2007 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer. 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in
 | 
				
			||||||
 | 
					 *    the documentation and/or other materials provided with the
 | 
				
			||||||
 | 
					 *    distribution.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this
 | 
				
			||||||
 | 
					 *    software must display the following acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
				
			||||||
 | 
					 *    endorse or promote products derived from this software without
 | 
				
			||||||
 | 
					 *    prior written permission. For written permission, please contact
 | 
				
			||||||
 | 
					 *    openssl-core@openssl.org.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 5. Products derived from this software may not be called "OpenSSL"
 | 
				
			||||||
 | 
					 *    nor may "OpenSSL" appear in their names without prior written
 | 
				
			||||||
 | 
					 *    permission of the OpenSSL Project.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 6. Redistributions of any form whatsoever must retain the following
 | 
				
			||||||
 | 
					 *    acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
				
			||||||
 | 
					 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
				
			||||||
 | 
					 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
				
			||||||
 | 
					 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
				
			||||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
				
			||||||
 | 
					 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
				
			||||||
 | 
					 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
				
			||||||
 | 
					 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
				
			||||||
 | 
					 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
				
			||||||
 | 
					 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * ====================================================================
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This product includes cryptographic software written by Eric Young
 | 
				
			||||||
 | 
					 * (eay@cryptsoft.com).  This product includes software written by Tim
 | 
				
			||||||
 | 
					 * Hudson (tjh@cryptsoft.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <openssl/opensslconf.h>
 | 
				
			||||||
 | 
					#include <openssl/evp.h>
 | 
				
			||||||
 | 
					#include <openssl/err.h>
 | 
				
			||||||
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					#include <assert.h>
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
					#include <openssl/seed.h>
 | 
				
			||||||
 | 
					#include "evp_locl.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,	const unsigned char *iv, int enc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef struct
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						SEED_KEY_SCHEDULE ks;
 | 
				
			||||||
 | 
						} EVP_SEED_KEY;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					IMPLEMENT_BLOCK_CIPHER(seed, ks, SEED, EVP_SEED_KEY, NID_seed,
 | 
				
			||||||
 | 
					                       16, 16, 16, 128,
 | 
				
			||||||
 | 
					                       0, seed_init_key, 0, 0, 0, 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
 | 
				
			||||||
 | 
					                         const unsigned char *iv, int enc)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						SEED_set_key(key, ctx->cipher_data);
 | 
				
			||||||
 | 
						return 1;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
@@ -766,6 +766,14 @@ const EVP_CIPHER *EVP_camellia_256_cfb128(void);
 | 
				
			|||||||
const EVP_CIPHER *EVP_camellia_256_ofb(void);
 | 
					const EVP_CIPHER *EVP_camellia_256_ofb(void);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
					const EVP_CIPHER *EVP_seed_ecb(void);
 | 
				
			||||||
 | 
					const EVP_CIPHER *EVP_seed_cbc(void);
 | 
				
			||||||
 | 
					const EVP_CIPHER *EVP_seed_cfb128(void);
 | 
				
			||||||
 | 
					# define EVP_seed_cfb EVP_seed_cfb128
 | 
				
			||||||
 | 
					const EVP_CIPHER *EVP_seed_ofb(void);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void OPENSSL_add_all_algorithms_noconf(void);
 | 
					void OPENSSL_add_all_algorithms_noconf(void);
 | 
				
			||||||
void OPENSSL_add_all_algorithms_conf(void);
 | 
					void OPENSSL_add_all_algorithms_conf(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -963,6 +971,7 @@ void ERR_load_EVP_strings(void);
 | 
				
			|||||||
#define EVP_R_UNSUPPORTED_SALT_TYPE			 126
 | 
					#define EVP_R_UNSUPPORTED_SALT_TYPE			 126
 | 
				
			||||||
#define EVP_R_WRONG_FINAL_BLOCK_LENGTH			 109
 | 
					#define EVP_R_WRONG_FINAL_BLOCK_LENGTH			 109
 | 
				
			||||||
#define EVP_R_WRONG_PUBLIC_KEY_TYPE			 110
 | 
					#define EVP_R_WRONG_PUBLIC_KEY_TYPE			 110
 | 
				
			||||||
 | 
					#define EVP_R_SEED_KEY_SETUP_FAILED			 162
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef  __cplusplus
 | 
					#ifdef  __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -92,7 +92,7 @@ static int cname##_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const uns
 | 
				
			|||||||
#define BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \
 | 
					#define BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \
 | 
				
			||||||
static int cname##_cfb##cbits##_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \
 | 
					static int cname##_cfb##cbits##_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \
 | 
				
			||||||
{\
 | 
					{\
 | 
				
			||||||
	cprefix##_cfb##cbits##_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num, ctx->encrypt);\
 | 
						cprefix##_cfb##cbits##_encrypt(in, out, (long)(cbits==1?inl*8:inl), &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num, ctx->encrypt);\
 | 
				
			||||||
	return 1;\
 | 
						return 1;\
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -423,6 +423,13 @@ int main(int argc,char **argv)
 | 
				
			|||||||
		fprintf(stdout, "Cipher disabled, skipping %s\n", cipher); 
 | 
							fprintf(stdout, "Cipher disabled, skipping %s\n", cipher); 
 | 
				
			||||||
		continue;
 | 
							continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifdef OPENSSL_NO_SEED
 | 
				
			||||||
 | 
						    if (strstr(cipher, "SEED") == cipher)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							fprintf(stdout, "Cipher disabled, skipping %s\n", cipher); 
 | 
				
			||||||
 | 
							continue;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	    fprintf(stderr,"Can't find %s\n",cipher);
 | 
						    fprintf(stderr,"Can't find %s\n",cipher);
 | 
				
			||||||
	    EXIT(3);
 | 
						    EXIT(3);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -310,3 +310,12 @@ CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF
 | 
				
			|||||||
CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:6BFF6265A6A6B7A535BC65A80B17214E:0
 | 
					CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:6BFF6265A6A6B7A535BC65A80B17214E:0
 | 
				
			||||||
CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0A4A0404E26AA78A27CB271E8BF3CF20:0
 | 
					CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0A4A0404E26AA78A27CB271E8BF3CF20:0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# SEED test vectors from RFC4269
 | 
				
			||||||
 | 
					SEED-ECB:00000000000000000000000000000000::000102030405060708090A0B0C0D0E0F:5EBAC6E0054E166819AFF1CC6D346CDB:0
 | 
				
			||||||
 | 
					SEED-ECB:000102030405060708090A0B0C0D0E0F::00000000000000000000000000000000:C11F22F20140505084483597E4370F43:0
 | 
				
			||||||
 | 
					SEED-ECB:4706480851E61BE85D74BFB3FD956185::83A2F8A288641FB9A4E9A5CC2F131C7D:EE54D13EBCAE706D226BC3142CD40D4A:0
 | 
				
			||||||
 | 
					SEED-ECB:28DBC3BC49FFD87DCFA509B11D422BE7::B41E6BE2EBA84A148E2EED84593C5EC7:9B9B7BFCD1813CB95D0B3618F40F5122:0
 | 
				
			||||||
 | 
					SEED-ECB:00000000000000000000000000000000::000102030405060708090A0B0C0D0E0F:5EBAC6E0054E166819AFF1CC6D346CDB:1
 | 
				
			||||||
 | 
					SEED-ECB:000102030405060708090A0B0C0D0E0F::00000000000000000000000000000000:C11F22F20140505084483597E4370F43:1
 | 
				
			||||||
 | 
					SEED-ECB:4706480851E61BE85D74BFB3FD956185::83A2F8A288641FB9A4E9A5CC2F131C7D:EE54D13EBCAE706D226BC3142CD40D4A:1
 | 
				
			||||||
 | 
					SEED-ECB:28DBC3BC49FFD87DCFA509B11D422BE7::B41E6BE2EBA84A148E2EED84593C5EC7:9B9B7BFCD1813CB95D0B3618F40F5122:1
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -354,7 +354,7 @@ static int def_add_index(EX_CLASS_ITEM *item, long argl, void *argp,
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	toret = item->meth_num++;
 | 
						toret = item->meth_num++;
 | 
				
			||||||
	sk_CRYPTO_EX_DATA_FUNCS_set(item->meth, toret, a);
 | 
						(void)sk_CRYPTO_EX_DATA_FUNCS_set(item->meth, toret, a);
 | 
				
			||||||
err:
 | 
					err:
 | 
				
			||||||
	CRYPTO_w_unlock(CRYPTO_LOCK_EX_DATA);
 | 
						CRYPTO_w_unlock(CRYPTO_LOCK_EX_DATA);
 | 
				
			||||||
	return toret;
 | 
						return toret;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,7 +35,7 @@ $
 | 
				
			|||||||
$	SDIRS := ,-
 | 
					$	SDIRS := ,-
 | 
				
			||||||
		 OBJECTS,-
 | 
							 OBJECTS,-
 | 
				
			||||||
		 MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,-
 | 
							 MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,-
 | 
				
			||||||
		 DES,RC2,RC4,RC5,IDEA,BF,CAST,CAMELLIA,-
 | 
							 DES,RC2,RC4,RC5,IDEA,BF,CAST,CAMELLIA,SEED,-
 | 
				
			||||||
		 BN,EC,RSA,DSA,ECDSA,DH,ECDH,DSO,ENGINE,AES,-
 | 
							 BN,EC,RSA,DSA,ECDSA,DH,ECDH,DSO,ENGINE,AES,-
 | 
				
			||||||
		 BUFFER,BIO,STACK,LHASH,RAND,ERR,-
 | 
							 BUFFER,BIO,STACK,LHASH,RAND,ERR,-
 | 
				
			||||||
		 EVP,ASN1,PEM,X509,X509V3,CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,-
 | 
							 EVP,ASN1,PEM,X509,X509V3,CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,-
 | 
				
			||||||
@@ -59,6 +59,7 @@ $	EXHEADER_IDEA := idea.h
 | 
				
			|||||||
$	EXHEADER_BF := blowfish.h
 | 
					$	EXHEADER_BF := blowfish.h
 | 
				
			||||||
$	EXHEADER_CAST := cast.h
 | 
					$	EXHEADER_CAST := cast.h
 | 
				
			||||||
$	EXHEADER_CAMELLIA := camellia.h
 | 
					$	EXHEADER_CAMELLIA := camellia.h
 | 
				
			||||||
 | 
					$	EXHEADER_SEED := seed.h
 | 
				
			||||||
$	EXHEADER_BN := bn.h
 | 
					$	EXHEADER_BN := bn.h
 | 
				
			||||||
$	EXHEADER_EC := ec.h
 | 
					$	EXHEADER_EC := ec.h
 | 
				
			||||||
$	EXHEADER_RSA := rsa.h
 | 
					$	EXHEADER_RSA := rsa.h
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -97,12 +97,12 @@ static char *pt(unsigned char *md);
 | 
				
			|||||||
int main(int argc, char *argv[])
 | 
					int main(int argc, char *argv[])
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	int i,err=0;
 | 
						int i,err=0;
 | 
				
			||||||
	unsigned char **P,**R;
 | 
						char **P,**R;
 | 
				
			||||||
	char *p;
 | 
						char *p;
 | 
				
			||||||
	unsigned char md[MD4_DIGEST_LENGTH];
 | 
						unsigned char md[MD4_DIGEST_LENGTH];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	P=(unsigned char **)test;
 | 
						P=test;
 | 
				
			||||||
	R=(unsigned char **)ret;
 | 
						R=ret;
 | 
				
			||||||
	i=1;
 | 
						i=1;
 | 
				
			||||||
	while (*P != NULL)
 | 
						while (*P != NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -97,12 +97,12 @@ static char *pt(unsigned char *md);
 | 
				
			|||||||
int main(int argc, char *argv[])
 | 
					int main(int argc, char *argv[])
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	int i,err=0;
 | 
						int i,err=0;
 | 
				
			||||||
	unsigned char **P,**R;
 | 
						char **P,**R;
 | 
				
			||||||
	char *p;
 | 
						char *p;
 | 
				
			||||||
	unsigned char md[MD5_DIGEST_LENGTH];
 | 
						unsigned char md[MD5_DIGEST_LENGTH];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	P=(unsigned char **)test;
 | 
						P=test;
 | 
				
			||||||
	R=(unsigned char **)ret;
 | 
						R=ret;
 | 
				
			||||||
	i=1;
 | 
						i=1;
 | 
				
			||||||
	while (*P != NULL)
 | 
						while (*P != NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -64,12 +64,14 @@ unsigned char cleanse_ctr = 0;
 | 
				
			|||||||
void OPENSSL_cleanse(void *ptr, size_t len)
 | 
					void OPENSSL_cleanse(void *ptr, size_t len)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	unsigned char *p = ptr;
 | 
						unsigned char *p = ptr;
 | 
				
			||||||
	size_t loop = len;
 | 
						size_t loop = len, ctr = cleanse_ctr;
 | 
				
			||||||
	while(loop--)
 | 
						while(loop--)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		*(p++) = cleanse_ctr;
 | 
							*(p++) = (unsigned char)ctr;
 | 
				
			||||||
		cleanse_ctr += (17 + (unsigned char)((unsigned long)p & 0xF));
 | 
							ctr += (17 + ((size_t)p & 0xF));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	if(memchr(ptr, cleanse_ctr, len))
 | 
						p=memchr(ptr, (unsigned char)ctr, len);
 | 
				
			||||||
		cleanse_ctr += 63;
 | 
						if(p)
 | 
				
			||||||
 | 
							ctr += (63 + (size_t)p);
 | 
				
			||||||
 | 
						cleanse_ctr = (unsigned char)ctr;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -62,12 +62,12 @@
 | 
				
			|||||||
 * [including the GNU Public Licence.]
 | 
					 * [including the GNU Public Licence.]
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NUM_NID 772
 | 
					#define NUM_NID 780
 | 
				
			||||||
#define NUM_SN 768
 | 
					#define NUM_SN 773
 | 
				
			||||||
#define NUM_LN 768
 | 
					#define NUM_LN 773
 | 
				
			||||||
#define NUM_OBJ 724
 | 
					#define NUM_OBJ 729
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static unsigned char lvalues[5116]={
 | 
					static unsigned char lvalues[5154]={
 | 
				
			||||||
0x00,                                        /* [  0] OBJ_undef */
 | 
					0x00,                                        /* [  0] OBJ_undef */
 | 
				
			||||||
0x2A,0x86,0x48,0x86,0xF7,0x0D,               /* [  1] OBJ_rsadsi */
 | 
					0x2A,0x86,0x48,0x86,0xF7,0x0D,               /* [  1] OBJ_rsadsi */
 | 
				
			||||||
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,          /* [  7] OBJ_pkcs */
 | 
					0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,          /* [  7] OBJ_pkcs */
 | 
				
			||||||
@@ -792,6 +792,11 @@ static unsigned char lvalues[5116]={
 | 
				
			|||||||
0x55,0x1D,0x09,                              /* [5106] OBJ_subject_directory_attributes */
 | 
					0x55,0x1D,0x09,                              /* [5106] OBJ_subject_directory_attributes */
 | 
				
			||||||
0x55,0x1D,0x1C,                              /* [5109] OBJ_issuing_distribution_point */
 | 
					0x55,0x1D,0x1C,                              /* [5109] OBJ_issuing_distribution_point */
 | 
				
			||||||
0x55,0x1D,0x1D,                              /* [5112] OBJ_certificate_issuer */
 | 
					0x55,0x1D,0x1D,                              /* [5112] OBJ_certificate_issuer */
 | 
				
			||||||
 | 
					0x2A,0x83,0x1A,0x8C,0x9A,0x44,               /* [5115] OBJ_kisa */
 | 
				
			||||||
 | 
					0x2A,0x83,0x1A,0x8C,0x9A,0x44,0x01,0x03,     /* [5121] OBJ_seed_ecb */
 | 
				
			||||||
 | 
					0x2A,0x83,0x1A,0x8C,0x9A,0x44,0x01,0x04,     /* [5129] OBJ_seed_cbc */
 | 
				
			||||||
 | 
					0x2A,0x83,0x1A,0x8C,0x9A,0x44,0x01,0x06,     /* [5137] OBJ_seed_ofb128 */
 | 
				
			||||||
 | 
					0x2A,0x83,0x1A,0x8C,0x9A,0x44,0x01,0x05,     /* [5145] OBJ_seed_cfb128 */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ASN1_OBJECT nid_objs[NUM_NID]={
 | 
					static ASN1_OBJECT nid_objs[NUM_NID]={
 | 
				
			||||||
@@ -1996,6 +2001,14 @@ static ASN1_OBJECT nid_objs[NUM_NID]={
 | 
				
			|||||||
	NID_issuing_distribution_point,3,&(lvalues[5109]),0},
 | 
						NID_issuing_distribution_point,3,&(lvalues[5109]),0},
 | 
				
			||||||
{"certificateIssuer","X509v3 Certificate Issuer",
 | 
					{"certificateIssuer","X509v3 Certificate Issuer",
 | 
				
			||||||
	NID_certificate_issuer,3,&(lvalues[5112]),0},
 | 
						NID_certificate_issuer,3,&(lvalues[5112]),0},
 | 
				
			||||||
 | 
					{NULL,NULL,NID_undef,0,NULL,0},
 | 
				
			||||||
 | 
					{"KISA","kisa",NID_kisa,6,&(lvalues[5115]),0},
 | 
				
			||||||
 | 
					{NULL,NULL,NID_undef,0,NULL,0},
 | 
				
			||||||
 | 
					{NULL,NULL,NID_undef,0,NULL,0},
 | 
				
			||||||
 | 
					{"SEED-ECB","seed-ecb",NID_seed_ecb,8,&(lvalues[5121]),0},
 | 
				
			||||||
 | 
					{"SEED-CBC","seed-cbc",NID_seed_cbc,8,&(lvalues[5129]),0},
 | 
				
			||||||
 | 
					{"SEED-OFB","seed-ofb",NID_seed_ofb128,8,&(lvalues[5137]),0},
 | 
				
			||||||
 | 
					{"SEED-CFB","seed-cfb",NID_seed_cfb128,8,&(lvalues[5145]),0},
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ASN1_OBJECT *sn_objs[NUM_SN]={
 | 
					static ASN1_OBJECT *sn_objs[NUM_SN]={
 | 
				
			||||||
@@ -2085,6 +2098,7 @@ static ASN1_OBJECT *sn_objs[NUM_SN]={
 | 
				
			|||||||
&(nid_objs[183]),/* "ISO-US" */
 | 
					&(nid_objs[183]),/* "ISO-US" */
 | 
				
			||||||
&(nid_objs[645]),/* "ITU-T" */
 | 
					&(nid_objs[645]),/* "ITU-T" */
 | 
				
			||||||
&(nid_objs[646]),/* "JOINT-ISO-ITU-T" */
 | 
					&(nid_objs[646]),/* "JOINT-ISO-ITU-T" */
 | 
				
			||||||
 | 
					&(nid_objs[773]),/* "KISA" */
 | 
				
			||||||
&(nid_objs[15]),/* "L" */
 | 
					&(nid_objs[15]),/* "L" */
 | 
				
			||||||
&(nid_objs[ 3]),/* "MD2" */
 | 
					&(nid_objs[ 3]),/* "MD2" */
 | 
				
			||||||
&(nid_objs[257]),/* "MD4" */
 | 
					&(nid_objs[257]),/* "MD4" */
 | 
				
			||||||
@@ -2147,6 +2161,10 @@ static ASN1_OBJECT *sn_objs[NUM_SN]={
 | 
				
			|||||||
&(nid_objs[668]),/* "RSA-SHA256" */
 | 
					&(nid_objs[668]),/* "RSA-SHA256" */
 | 
				
			||||||
&(nid_objs[669]),/* "RSA-SHA384" */
 | 
					&(nid_objs[669]),/* "RSA-SHA384" */
 | 
				
			||||||
&(nid_objs[670]),/* "RSA-SHA512" */
 | 
					&(nid_objs[670]),/* "RSA-SHA512" */
 | 
				
			||||||
 | 
					&(nid_objs[777]),/* "SEED-CBC" */
 | 
				
			||||||
 | 
					&(nid_objs[779]),/* "SEED-CFB" */
 | 
				
			||||||
 | 
					&(nid_objs[776]),/* "SEED-ECB" */
 | 
				
			||||||
 | 
					&(nid_objs[778]),/* "SEED-OFB" */
 | 
				
			||||||
&(nid_objs[41]),/* "SHA" */
 | 
					&(nid_objs[41]),/* "SHA" */
 | 
				
			||||||
&(nid_objs[64]),/* "SHA1" */
 | 
					&(nid_objs[64]),/* "SHA1" */
 | 
				
			||||||
&(nid_objs[675]),/* "SHA224" */
 | 
					&(nid_objs[675]),/* "SHA224" */
 | 
				
			||||||
@@ -3221,6 +3239,7 @@ static ASN1_OBJECT *ln_objs[NUM_LN]={
 | 
				
			|||||||
&(nid_objs[492]),/* "janetMailbox" */
 | 
					&(nid_objs[492]),/* "janetMailbox" */
 | 
				
			||||||
&(nid_objs[646]),/* "joint-iso-itu-t" */
 | 
					&(nid_objs[646]),/* "joint-iso-itu-t" */
 | 
				
			||||||
&(nid_objs[150]),/* "keyBag" */
 | 
					&(nid_objs[150]),/* "keyBag" */
 | 
				
			||||||
 | 
					&(nid_objs[773]),/* "kisa" */
 | 
				
			||||||
&(nid_objs[477]),/* "lastModifiedBy" */
 | 
					&(nid_objs[477]),/* "lastModifiedBy" */
 | 
				
			||||||
&(nid_objs[476]),/* "lastModifiedTime" */
 | 
					&(nid_objs[476]),/* "lastModifiedTime" */
 | 
				
			||||||
&(nid_objs[157]),/* "localKeyID" */
 | 
					&(nid_objs[157]),/* "localKeyID" */
 | 
				
			||||||
@@ -3371,6 +3390,10 @@ static ASN1_OBJECT *ln_objs[NUM_LN]={
 | 
				
			|||||||
&(nid_objs[733]),/* "sect571k1" */
 | 
					&(nid_objs[733]),/* "sect571k1" */
 | 
				
			||||||
&(nid_objs[734]),/* "sect571r1" */
 | 
					&(nid_objs[734]),/* "sect571r1" */
 | 
				
			||||||
&(nid_objs[635]),/* "secure device signature" */
 | 
					&(nid_objs[635]),/* "secure device signature" */
 | 
				
			||||||
 | 
					&(nid_objs[777]),/* "seed-cbc" */
 | 
				
			||||||
 | 
					&(nid_objs[779]),/* "seed-cfb" */
 | 
				
			||||||
 | 
					&(nid_objs[776]),/* "seed-ecb" */
 | 
				
			||||||
 | 
					&(nid_objs[778]),/* "seed-ofb" */
 | 
				
			||||||
&(nid_objs[105]),/* "serialNumber" */
 | 
					&(nid_objs[105]),/* "serialNumber" */
 | 
				
			||||||
&(nid_objs[625]),/* "set-addPolicy" */
 | 
					&(nid_objs[625]),/* "set-addPolicy" */
 | 
				
			||||||
&(nid_objs[515]),/* "set-attr" */
 | 
					&(nid_objs[515]),/* "set-attr" */
 | 
				
			||||||
@@ -3811,6 +3834,7 @@ static ASN1_OBJECT *obj_objs[NUM_OBJ]={
 | 
				
			|||||||
&(nid_objs[745]),/* OBJ_wap_wsg_idm_ecid_wtls12      2 23 43 13 4 12 */
 | 
					&(nid_objs[745]),/* OBJ_wap_wsg_idm_ecid_wtls12      2 23 43 13 4 12 */
 | 
				
			||||||
&(nid_objs[124]),/* OBJ_rle_compression              1 1 1 1 666 1 */
 | 
					&(nid_objs[124]),/* OBJ_rle_compression              1 1 1 1 666 1 */
 | 
				
			||||||
&(nid_objs[125]),/* OBJ_zlib_compression             1 1 1 1 666 2 */
 | 
					&(nid_objs[125]),/* OBJ_zlib_compression             1 1 1 1 666 2 */
 | 
				
			||||||
 | 
					&(nid_objs[773]),/* OBJ_kisa                         1 2 410 200004 */
 | 
				
			||||||
&(nid_objs[ 1]),/* OBJ_rsadsi                       1 2 840 113549 */
 | 
					&(nid_objs[ 1]),/* OBJ_rsadsi                       1 2 840 113549 */
 | 
				
			||||||
&(nid_objs[185]),/* OBJ_X9cm                         1 2 840 10040 4 */
 | 
					&(nid_objs[185]),/* OBJ_X9cm                         1 2 840 10040 4 */
 | 
				
			||||||
&(nid_objs[127]),/* OBJ_id_pkix                      1 3 6 1 5 5 7 */
 | 
					&(nid_objs[127]),/* OBJ_id_pkix                      1 3 6 1 5 5 7 */
 | 
				
			||||||
@@ -3861,6 +3885,10 @@ static ASN1_OBJECT *obj_objs[NUM_OBJ]={
 | 
				
			|||||||
&(nid_objs[768]),/* OBJ_camellia_256_ofb128          0 3 4401 5 3 1 9 43 */
 | 
					&(nid_objs[768]),/* OBJ_camellia_256_ofb128          0 3 4401 5 3 1 9 43 */
 | 
				
			||||||
&(nid_objs[759]),/* OBJ_camellia_256_cfb128          0 3 4401 5 3 1 9 44 */
 | 
					&(nid_objs[759]),/* OBJ_camellia_256_cfb128          0 3 4401 5 3 1 9 44 */
 | 
				
			||||||
&(nid_objs[437]),/* OBJ_pilot                        0 9 2342 19200300 100 */
 | 
					&(nid_objs[437]),/* OBJ_pilot                        0 9 2342 19200300 100 */
 | 
				
			||||||
 | 
					&(nid_objs[776]),/* OBJ_seed_ecb                     1 2 410 200004 1 3 */
 | 
				
			||||||
 | 
					&(nid_objs[777]),/* OBJ_seed_cbc                     1 2 410 200004 1 4 */
 | 
				
			||||||
 | 
					&(nid_objs[779]),/* OBJ_seed_cfb128                  1 2 410 200004 1 5 */
 | 
				
			||||||
 | 
					&(nid_objs[778]),/* OBJ_seed_ofb128                  1 2 410 200004 1 6 */
 | 
				
			||||||
&(nid_objs[186]),/* OBJ_pkcs1                        1 2 840 113549 1 1 */
 | 
					&(nid_objs[186]),/* OBJ_pkcs1                        1 2 840 113549 1 1 */
 | 
				
			||||||
&(nid_objs[27]),/* OBJ_pkcs3                        1 2 840 113549 1 3 */
 | 
					&(nid_objs[27]),/* OBJ_pkcs3                        1 2 840 113549 1 3 */
 | 
				
			||||||
&(nid_objs[187]),/* OBJ_pkcs5                        1 2 840 113549 1 5 */
 | 
					&(nid_objs[187]),/* OBJ_pkcs5                        1 2 840 113549 1 5 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3406,3 +3406,28 @@
 | 
				
			|||||||
#define LN_camellia_256_cfb8		"camellia-256-cfb8"
 | 
					#define LN_camellia_256_cfb8		"camellia-256-cfb8"
 | 
				
			||||||
#define NID_camellia_256_cfb8		765
 | 
					#define NID_camellia_256_cfb8		765
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SN_kisa		"KISA"
 | 
				
			||||||
 | 
					#define LN_kisa		"kisa"
 | 
				
			||||||
 | 
					#define NID_kisa		773
 | 
				
			||||||
 | 
					#define OBJ_kisa		OBJ_member_body,410L,200004L
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SN_seed_ecb		"SEED-ECB"
 | 
				
			||||||
 | 
					#define LN_seed_ecb		"seed-ecb"
 | 
				
			||||||
 | 
					#define NID_seed_ecb		776
 | 
				
			||||||
 | 
					#define OBJ_seed_ecb		OBJ_kisa,1L,3L
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SN_seed_cbc		"SEED-CBC"
 | 
				
			||||||
 | 
					#define LN_seed_cbc		"seed-cbc"
 | 
				
			||||||
 | 
					#define NID_seed_cbc		777
 | 
				
			||||||
 | 
					#define OBJ_seed_cbc		OBJ_kisa,1L,4L
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SN_seed_cfb128		"SEED-CFB"
 | 
				
			||||||
 | 
					#define LN_seed_cfb128		"seed-cfb"
 | 
				
			||||||
 | 
					#define NID_seed_cfb128		779
 | 
				
			||||||
 | 
					#define OBJ_seed_cfb128		OBJ_kisa,1L,5L
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SN_seed_ofb128		"SEED-OFB"
 | 
				
			||||||
 | 
					#define LN_seed_ofb128		"seed-ofb"
 | 
				
			||||||
 | 
					#define NID_seed_ofb128		778
 | 
				
			||||||
 | 
					#define OBJ_seed_ofb128		OBJ_kisa,1L,6L
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -769,3 +769,11 @@ camellia_256_ofb128		768
 | 
				
			|||||||
subject_directory_attributes		769
 | 
					subject_directory_attributes		769
 | 
				
			||||||
issuing_distribution_point		770
 | 
					issuing_distribution_point		770
 | 
				
			||||||
certificate_issuer		771
 | 
					certificate_issuer		771
 | 
				
			||||||
 | 
					korea		772
 | 
				
			||||||
 | 
					kisa		773
 | 
				
			||||||
 | 
					kftc		774
 | 
				
			||||||
 | 
					npki_alg		775
 | 
				
			||||||
 | 
					seed_ecb		776
 | 
				
			||||||
 | 
					seed_cbc		777
 | 
				
			||||||
 | 
					seed_ofb128		778
 | 
				
			||||||
 | 
					seed_cfb128		779
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1091,3 +1091,13 @@ camellia 44		: CAMELLIA-256-CFB		: camellia-256-cfb
 | 
				
			|||||||
			: CAMELLIA-192-CFB8		: camellia-192-cfb8
 | 
								: CAMELLIA-192-CFB8		: camellia-192-cfb8
 | 
				
			||||||
			: CAMELLIA-256-CFB8		: camellia-256-cfb8
 | 
								: CAMELLIA-256-CFB8		: camellia-256-cfb8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Definitions for SEED cipher - ECB, CBC, OFB mode
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					member-body 410 200004  : KISA          : kisa
 | 
				
			||||||
 | 
					kisa 1 3                : SEED-ECB      : seed-ecb
 | 
				
			||||||
 | 
					kisa 1 4                : SEED-CBC      : seed-cbc
 | 
				
			||||||
 | 
					!Cname seed-cfb128
 | 
				
			||||||
 | 
					kisa 1 5                : SEED-CFB      : seed-cfb
 | 
				
			||||||
 | 
					!Cname seed-ofb128
 | 
				
			||||||
 | 
					kisa 1 6                : SEED-OFB      : seed-ofb
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -469,7 +469,7 @@ int OCSP_basic_sign(OCSP_BASICRESP *brsp,
 | 
				
			|||||||
ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d,
 | 
					ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d,
 | 
				
			||||||
				void *data, STACK_OF(ASN1_OBJECT) *sk);
 | 
									void *data, STACK_OF(ASN1_OBJECT) *sk);
 | 
				
			||||||
#define ASN1_STRING_encode_of(type,s,i2d,data,sk) \
 | 
					#define ASN1_STRING_encode_of(type,s,i2d,data,sk) \
 | 
				
			||||||
((ASN1_STRING *(*)(ASN1_STRING *,I2D_OF(type),type *,STACK_OF(ASN1_OBJECT) *))openssl_fcast(ASN1_STRING_encode))(s,i2d,data,sk)
 | 
						ASN1_STRING_encode(s, CHECKED_I2D_OF(type, i2d), data, sk)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim);
 | 
					X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,11 +25,11 @@
 | 
				
			|||||||
 * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
 | 
					 * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
 | 
				
			||||||
 *  major minor fix final patch/beta)
 | 
					 *  major minor fix final patch/beta)
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#define OPENSSL_VERSION_NUMBER	0x00908060L
 | 
					#define OPENSSL_VERSION_NUMBER	0x0090807fL
 | 
				
			||||||
#ifdef OPENSSL_FIPS
 | 
					#ifdef OPENSSL_FIPS
 | 
				
			||||||
#define OPENSSL_VERSION_TEXT	"OpenSSL 0.9.8f-fips-dev xx XXXX xxxx"
 | 
					#define OPENSSL_VERSION_TEXT	"OpenSSL 0.9.8g-fips 19 Oct 2007"
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define OPENSSL_VERSION_TEXT	"OpenSSL 0.9.8f-dev xx XXXX xxxx"
 | 
					#define OPENSSL_VERSION_TEXT	"OpenSSL 0.9.8g 19 Oct 2007"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#define OPENSSL_VERSION_PTEXT	" part of " OPENSSL_VERSION_TEXT
 | 
					#define OPENSSL_VERSION_PTEXT	" part of " OPENSSL_VERSION_TEXT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -220,19 +220,28 @@ typedef struct pem_ctx_st
 | 
				
			|||||||
#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \
 | 
					#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \
 | 
				
			||||||
type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\
 | 
					type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\
 | 
				
			||||||
{ \
 | 
					{ \
 | 
				
			||||||
return(((type *(*)(D2I_OF(type),char *,FILE *,type **,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_read))(d2i_##asn1, str,fp,x,cb,u)); \
 | 
					    return (type*)PEM_ASN1_read(CHECKED_D2I_OF(type, d2i_##asn1), \
 | 
				
			||||||
 | 
									str, fp, \
 | 
				
			||||||
 | 
									CHECKED_PPTR_OF(type, x), \
 | 
				
			||||||
 | 
									cb, u); \
 | 
				
			||||||
} 
 | 
					} 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \
 | 
					#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \
 | 
				
			||||||
int PEM_write_##name(FILE *fp, type *x) \
 | 
					int PEM_write_##name(FILE *fp, type *x) \
 | 
				
			||||||
{ \
 | 
					{ \
 | 
				
			||||||
return(((int (*)(I2D_OF(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL)); \
 | 
					    return PEM_ASN1_write(CHECKED_I2D_OF(type, i2d_##asn1), \
 | 
				
			||||||
 | 
								  str, fp, \
 | 
				
			||||||
 | 
								  CHECKED_PTR_OF(type, x), \
 | 
				
			||||||
 | 
								  NULL, NULL, 0, NULL, NULL); \
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \
 | 
					#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \
 | 
				
			||||||
int PEM_write_##name(FILE *fp, const type *x) \
 | 
					int PEM_write_##name(FILE *fp, const type *x) \
 | 
				
			||||||
{ \
 | 
					{ \
 | 
				
			||||||
return(((int (*)(I2D_OF_const(type),const char *,FILE *, const type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL)); \
 | 
					    return PEM_ASN1_write(CHECKED_I2D_OF(const type, i2d_##asn1), \
 | 
				
			||||||
 | 
								  str, fp, \
 | 
				
			||||||
 | 
								  CHECKED_PTR_OF(const type, x), \
 | 
				
			||||||
 | 
								  NULL, NULL, 0, NULL, NULL); \
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \
 | 
					#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \
 | 
				
			||||||
@@ -240,7 +249,10 @@ int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
 | 
				
			|||||||
	     unsigned char *kstr, int klen, pem_password_cb *cb, \
 | 
						     unsigned char *kstr, int klen, pem_password_cb *cb, \
 | 
				
			||||||
		  void *u) \
 | 
							  void *u) \
 | 
				
			||||||
	{ \
 | 
						{ \
 | 
				
			||||||
	return(((int (*)(I2D_OF(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u)); \
 | 
						    return PEM_ASN1_write(CHECKED_I2D_OF(type, i2d_##asn1), \
 | 
				
			||||||
 | 
									  str, fp, \
 | 
				
			||||||
 | 
									  CHECKED_PTR_OF(type, x), \
 | 
				
			||||||
 | 
									  enc, kstr, klen, cb, u); \
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \
 | 
					#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \
 | 
				
			||||||
@@ -248,7 +260,10 @@ int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
 | 
				
			|||||||
	     unsigned char *kstr, int klen, pem_password_cb *cb, \
 | 
						     unsigned char *kstr, int klen, pem_password_cb *cb, \
 | 
				
			||||||
		  void *u) \
 | 
							  void *u) \
 | 
				
			||||||
	{ \
 | 
						{ \
 | 
				
			||||||
	return(((int (*)(I2D_OF_const(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u)); \
 | 
						    return PEM_ASN1_write(CHECKED_I2D_OF(const type, i2d_##asn1), \
 | 
				
			||||||
 | 
									  str, fp, \
 | 
				
			||||||
 | 
									  CHECKED_PTR_OF(const type, x), \
 | 
				
			||||||
 | 
									  enc, kstr, klen, cb, u); \
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -256,33 +271,48 @@ int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
 | 
				
			|||||||
#define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
 | 
					#define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
 | 
				
			||||||
type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\
 | 
					type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\
 | 
				
			||||||
{ \
 | 
					{ \
 | 
				
			||||||
return(((type *(*)(D2I_OF(type),const char *,BIO *,type **,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_read_bio))(d2i_##asn1, str,bp,x,cb,u)); \
 | 
					    return (type*)PEM_ASN1_read_bio(CHECKED_D2I_OF(type, d2i_##asn1), \
 | 
				
			||||||
 | 
									    str, bp, \
 | 
				
			||||||
 | 
									    CHECKED_PPTR_OF(type, x), \
 | 
				
			||||||
 | 
									    cb, u); \
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
 | 
					#define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
 | 
				
			||||||
int PEM_write_bio_##name(BIO *bp, type *x) \
 | 
					int PEM_write_bio_##name(BIO *bp, type *x) \
 | 
				
			||||||
{ \
 | 
					{ \
 | 
				
			||||||
return(((int (*)(I2D_OF(type),const char *,BIO *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL)); \
 | 
					    return PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d_##asn1), \
 | 
				
			||||||
 | 
								      str, bp, \
 | 
				
			||||||
 | 
								      CHECKED_PTR_OF(type, x), \
 | 
				
			||||||
 | 
								      NULL, NULL, 0, NULL, NULL); \
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
 | 
					#define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
 | 
				
			||||||
int PEM_write_bio_##name(BIO *bp, const type *x) \
 | 
					int PEM_write_bio_##name(BIO *bp, const type *x) \
 | 
				
			||||||
{ \
 | 
					{ \
 | 
				
			||||||
return(((int (*)(I2D_OF_const(type),const char *,BIO *,const type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL)); \
 | 
					    return PEM_ASN1_write_bio(CHECKED_I2D_OF(const type, i2d_##asn1), \
 | 
				
			||||||
 | 
								      str, bp, \
 | 
				
			||||||
 | 
								      CHECKED_PTR_OF(const type, x), \
 | 
				
			||||||
 | 
								      NULL, NULL, 0, NULL, NULL); \
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
 | 
					#define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
 | 
				
			||||||
int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
 | 
					int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
 | 
				
			||||||
	     unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
 | 
						     unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
 | 
				
			||||||
	{ \
 | 
						{ \
 | 
				
			||||||
	return(((int (*)(I2D_OF(type),const char *,BIO *,type *,const EVP_CIPHER *,unsigned char *,int,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u)); \
 | 
						    return PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d_##asn1), \
 | 
				
			||||||
 | 
									      str, bp, \
 | 
				
			||||||
 | 
									      CHECKED_PTR_OF(type, x), \
 | 
				
			||||||
 | 
									      enc, kstr, klen, cb, u); \
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
 | 
					#define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
 | 
				
			||||||
int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
 | 
					int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
 | 
				
			||||||
	     unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
 | 
						     unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
 | 
				
			||||||
	{ \
 | 
						{ \
 | 
				
			||||||
	return(((int (*)(I2D_OF_const(type),const char *,BIO *,type *,const EVP_CIPHER *,unsigned char *,int,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u)); \
 | 
						    return PEM_ASN1_write_bio(CHECKED_I2D_OF(const type, i2d_##asn1), \
 | 
				
			||||||
 | 
									      str, bp, \
 | 
				
			||||||
 | 
									      CHECKED_PTR_OF(const type, x), \
 | 
				
			||||||
 | 
									      enc, kstr, klen, cb, u); \
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define IMPLEMENT_PEM_write(name, type, str, asn1) \
 | 
					#define IMPLEMENT_PEM_write(name, type, str, asn1) \
 | 
				
			||||||
@@ -545,13 +575,22 @@ int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char
 | 
				
			|||||||
	     pem_password_cb *cb, void *u);
 | 
						     pem_password_cb *cb, void *u);
 | 
				
			||||||
void *	PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp,
 | 
					void *	PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp,
 | 
				
			||||||
			  void **x, pem_password_cb *cb, void *u);
 | 
								  void **x, pem_password_cb *cb, void *u);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define PEM_ASN1_read_bio_of(type,d2i,name,bp,x,cb,u) \
 | 
					#define PEM_ASN1_read_bio_of(type,d2i,name,bp,x,cb,u) \
 | 
				
			||||||
((type *(*)(D2I_OF(type),const char *,BIO *,type **,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_read_bio))(d2i,name,bp,x,cb,u)
 | 
					    ((type*)PEM_ASN1_read_bio(CHECKED_D2I_OF(type, d2i), \
 | 
				
			||||||
 | 
								      name, bp,			\
 | 
				
			||||||
 | 
								      CHECKED_PPTR_OF(type, x), \
 | 
				
			||||||
 | 
								      cb, u))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int	PEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp,char *x,
 | 
					int	PEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp,char *x,
 | 
				
			||||||
			   const EVP_CIPHER *enc,unsigned char *kstr,int klen,
 | 
								   const EVP_CIPHER *enc,unsigned char *kstr,int klen,
 | 
				
			||||||
			   pem_password_cb *cb, void *u);
 | 
								   pem_password_cb *cb, void *u);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define PEM_ASN1_write_bio_of(type,i2d,name,bp,x,enc,kstr,klen,cb,u) \
 | 
					#define PEM_ASN1_write_bio_of(type,i2d,name,bp,x,enc,kstr,klen,cb,u) \
 | 
				
			||||||
	((int (*)(I2D_OF(type),const char *,BIO *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d,name,bp,x,enc,kstr,klen,cb,u)
 | 
					    (PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d), \
 | 
				
			||||||
 | 
								name, bp,		   \
 | 
				
			||||||
 | 
								CHECKED_PTR_OF(type, x), \
 | 
				
			||||||
 | 
								enc, kstr, klen, cb, u))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
STACK_OF(X509_INFO) *	PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);
 | 
					STACK_OF(X509_INFO) *	PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);
 | 
				
			||||||
int	PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc,
 | 
					int	PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -204,16 +204,17 @@ sub main'pand	{ &out2("pand",@_); }
 | 
				
			|||||||
sub out2
 | 
					sub out2
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	local($name,$p1,$p2)=@_;
 | 
						local($name,$p1,$p2)=@_;
 | 
				
			||||||
	local($l,$t);
 | 
						local($l,$t,$line);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	push(@out,"\t$name\t");
 | 
						$line="\t$name\t";
 | 
				
			||||||
	$t=&conv($p1).",";
 | 
						$t=&conv($p1).",";
 | 
				
			||||||
	$l=length($t);
 | 
						$l=length($t);
 | 
				
			||||||
	push(@out,$t);
 | 
						$line.="$t";
 | 
				
			||||||
	$l=4-($l+9)/8;
 | 
						$l=4-($l+9)/8;
 | 
				
			||||||
	push(@out,"\t" x $l);
 | 
						$line.="\t" x $l;
 | 
				
			||||||
	push(@out,&conv($p2));
 | 
						$line.=&conv($p2);
 | 
				
			||||||
	push(@out,"\n");
 | 
						if ($line=~/\bxmm[0-7]\b/i) { $line=~s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i; }
 | 
				
			||||||
 | 
						push(@out,$line."\n");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
sub out0
 | 
					sub out0
 | 
				
			||||||
@@ -338,12 +339,9 @@ EOF
 | 
				
			|||||||
sub main'file_end
 | 
					sub main'file_end
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	# try to detect if SSE2 or MMX extensions were used...
 | 
						# try to detect if SSE2 or MMX extensions were used...
 | 
				
			||||||
	if (grep {/xmm[0-7]\s*,/i} @out) {
 | 
						if (grep {/\b[x]?mm[0-7]\b,/i} @out) {
 | 
				
			||||||
		grep {s/\.[3-7]86/\.686\n\t\.XMM/} @out;
 | 
							grep {s/\.[3-7]86/\.686\n\t\.XMM/} @out;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	elsif (grep {/mm[0-7]\s*,/i} @out) {
 | 
					 | 
				
			||||||
		grep {s/\.[3-7]86/\.686\n\t\.MMX/} @out;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	push(@out,"_TEXT\$	ENDS\n");
 | 
						push(@out,"_TEXT\$	ENDS\n");
 | 
				
			||||||
	push(@out,"END\n");
 | 
						push(@out,"END\n");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -121,7 +121,7 @@ static int B64_write_PKCS7(BIO *bio, PKCS7 *p7)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	bio = BIO_push(b64, bio);
 | 
						bio = BIO_push(b64, bio);
 | 
				
			||||||
	i2d_PKCS7_bio(bio, p7);
 | 
						i2d_PKCS7_bio(bio, p7);
 | 
				
			||||||
	BIO_flush(bio);
 | 
						(void)BIO_flush(bio);
 | 
				
			||||||
	bio = BIO_pop(bio);
 | 
						bio = BIO_pop(bio);
 | 
				
			||||||
	BIO_free(b64);
 | 
						BIO_free(b64);
 | 
				
			||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
@@ -138,7 +138,7 @@ static PKCS7 *B64_read_PKCS7(BIO *bio)
 | 
				
			|||||||
	bio = BIO_push(b64, bio);
 | 
						bio = BIO_push(b64, bio);
 | 
				
			||||||
	if(!(p7 = d2i_PKCS7_bio(bio, NULL))) 
 | 
						if(!(p7 = d2i_PKCS7_bio(bio, NULL))) 
 | 
				
			||||||
		PKCS7err(PKCS7_F_B64_READ_PKCS7,PKCS7_R_DECODE_ERROR);
 | 
							PKCS7err(PKCS7_F_B64_READ_PKCS7,PKCS7_R_DECODE_ERROR);
 | 
				
			||||||
	BIO_flush(bio);
 | 
						(void)BIO_flush(bio);
 | 
				
			||||||
	bio = BIO_pop(bio);
 | 
						bio = BIO_pop(bio);
 | 
				
			||||||
	BIO_free(b64);
 | 
						BIO_free(b64);
 | 
				
			||||||
	return p7;
 | 
						return p7;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -426,7 +426,7 @@ PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	SMIME_crlf_copy(in, p7bio, flags);
 | 
						SMIME_crlf_copy(in, p7bio, flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	BIO_flush(p7bio);
 | 
						(void)BIO_flush(p7bio);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!PKCS7_dataFinal(p7,p7bio)) {
 | 
					        if (!PKCS7_dataFinal(p7,p7bio)) {
 | 
				
			||||||
		PKCS7err(PKCS7_F_PKCS7_ENCRYPT,PKCS7_R_PKCS7_DATAFINAL_ERROR);
 | 
							PKCS7err(PKCS7_F_PKCS7_ENCRYPT,PKCS7_R_PKCS7_DATAFINAL_ERROR);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -57,7 +57,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "opensslconf.h"
 | 
					#include <openssl/opensslconf.h>
 | 
				
			||||||
#include <openssl/bn.h>
 | 
					#include <openssl/bn.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* 
 | 
					/* 
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -154,7 +154,6 @@ void RAND_add(const void *buf, int num, double entropy)
 | 
				
			|||||||
int RAND_bytes(unsigned char *buf, int num)
 | 
					int RAND_bytes(unsigned char *buf, int num)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	const RAND_METHOD *meth = RAND_get_rand_method();
 | 
						const RAND_METHOD *meth = RAND_get_rand_method();
 | 
				
			||||||
	memset(buf, 0, num);
 | 
					 | 
				
			||||||
	if (meth && meth->bytes)
 | 
						if (meth && meth->bytes)
 | 
				
			||||||
		return meth->bytes(buf,num);
 | 
							return meth->bytes(buf,num);
 | 
				
			||||||
	return(-1);
 | 
						return(-1);
 | 
				
			||||||
@@ -163,7 +162,6 @@ int RAND_bytes(unsigned char *buf, int num)
 | 
				
			|||||||
int RAND_pseudo_bytes(unsigned char *buf, int num)
 | 
					int RAND_pseudo_bytes(unsigned char *buf, int num)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	const RAND_METHOD *meth = RAND_get_rand_method();
 | 
						const RAND_METHOD *meth = RAND_get_rand_method();
 | 
				
			||||||
	memset(buf, 0, num);
 | 
					 | 
				
			||||||
	if (meth && meth->pseudorand)
 | 
						if (meth && meth->pseudorand)
 | 
				
			||||||
		return meth->pseudorand(buf,num);
 | 
							return meth->pseudorand(buf,num);
 | 
				
			||||||
	return(-1);
 | 
						return(-1);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -75,14 +75,13 @@ yy=r31;
 | 
				
			|||||||
.skip	16
 | 
					.skip	16
 | 
				
			||||||
RC4:
 | 
					RC4:
 | 
				
			||||||
	.prologue
 | 
						.prologue
 | 
				
			||||||
	.fframe 0
 | 
					 | 
				
			||||||
	.save   ar.pfs,r2
 | 
						.save   ar.pfs,r2
 | 
				
			||||||
	.save	ar.lc,r3
 | 
					 | 
				
			||||||
	.save	pr,prsave
 | 
					 | 
				
			||||||
{ .mii;	alloc	r2=ar.pfs,4,12,0,16
 | 
					{ .mii;	alloc	r2=ar.pfs,4,12,0,16
 | 
				
			||||||
 | 
						.save	pr,prsave
 | 
				
			||||||
	mov	prsave=pr
 | 
						mov	prsave=pr
 | 
				
			||||||
	ADDP	key=0,in0		};;
 | 
						ADDP	key=0,in0		};;
 | 
				
			||||||
{ .mib;	cmp.eq	p6,p0=0,in1			// len==0?
 | 
					{ .mib;	cmp.eq	p6,p0=0,in1			// len==0?
 | 
				
			||||||
 | 
						.save	ar.lc,r3
 | 
				
			||||||
	mov	r3=ar.lc
 | 
						mov	r3=ar.lc
 | 
				
			||||||
(p6)	br.ret.spnt.many	b0	};;	// emergency exit
 | 
					(p6)	br.ret.spnt.many	b0	};;	// emergency exit
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -103,12 +103,12 @@ static char *pt(unsigned char *md);
 | 
				
			|||||||
int main(int argc, char *argv[])
 | 
					int main(int argc, char *argv[])
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	int i,err=0;
 | 
						int i,err=0;
 | 
				
			||||||
	unsigned char **P,**R;
 | 
						char **P,**R;
 | 
				
			||||||
	char *p;
 | 
						char *p;
 | 
				
			||||||
	unsigned char md[RIPEMD160_DIGEST_LENGTH];
 | 
						unsigned char md[RIPEMD160_DIGEST_LENGTH];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	P=(unsigned char **)test;
 | 
						P=test;
 | 
				
			||||||
	R=(unsigned char **)ret;
 | 
						R=ret;
 | 
				
			||||||
	i=1;
 | 
						i=1;
 | 
				
			||||||
	while (*P != NULL)
 | 
						while (*P != NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 
 | 
				
			|||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user