initialize cipher/digest methods table in SSL_library_init() and hence remove the need for a lock
This commit is contained in:
		@@ -115,6 +115,8 @@ int SSL_library_init(void)
 | 
				
			|||||||
	   be discarded safely */
 | 
						   be discarded safely */
 | 
				
			||||||
	(void)SSL_COMP_get_compression_methods();
 | 
						(void)SSL_COMP_get_compression_methods();
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
						/* initialize cipher/digest methods table */
 | 
				
			||||||
 | 
						ssl_load_ciphers();
 | 
				
			||||||
	return(1);
 | 
						return(1);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -165,9 +165,7 @@ static const SSL_CIPHER cipher_aliases[]={
 | 
				
			|||||||
	{0,SSL_TXT_HIGH,  0, 0,  SSL_HIGH, 0,0,0,0,SSL_STRONG_MASK},
 | 
						{0,SSL_TXT_HIGH,  0, 0,  SSL_HIGH, 0,0,0,0,SSL_STRONG_MASK},
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int init_ciphers=1;
 | 
					void ssl_load_ciphers(void)
 | 
				
			||||||
 | 
					 | 
				
			||||||
static void load_ciphers(void)
 | 
					 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	ssl_cipher_methods[SSL_ENC_DES_IDX]= 
 | 
						ssl_cipher_methods[SSL_ENC_DES_IDX]= 
 | 
				
			||||||
		EVP_get_cipherbyname(SN_des_cbc);
 | 
							EVP_get_cipherbyname(SN_des_cbc);
 | 
				
			||||||
@@ -192,7 +190,6 @@ static void load_ciphers(void)
 | 
				
			|||||||
		EVP_get_digestbyname(SN_md5);
 | 
							EVP_get_digestbyname(SN_md5);
 | 
				
			||||||
	ssl_digest_methods[SSL_MD_SHA1_IDX]=
 | 
						ssl_digest_methods[SSL_MD_SHA1_IDX]=
 | 
				
			||||||
		EVP_get_digestbyname(SN_sha1);
 | 
							EVP_get_digestbyname(SN_sha1);
 | 
				
			||||||
	init_ciphers=0;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int sk_comp_cmp(const SSL_COMP * const *a,
 | 
					static int sk_comp_cmp(const SSL_COMP * const *a,
 | 
				
			||||||
@@ -816,13 +813,6 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
 | 
				
			|||||||
	if (rule_str == NULL || cipher_list == NULL || cipher_list_by_id == NULL)
 | 
						if (rule_str == NULL || cipher_list == NULL || cipher_list_by_id == NULL)
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (init_ciphers)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		CRYPTO_w_lock(CRYPTO_LOCK_SSL);
 | 
					 | 
				
			||||||
		if (init_ciphers) load_ciphers();
 | 
					 | 
				
			||||||
		CRYPTO_w_unlock(CRYPTO_LOCK_SSL);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * To reduce the work to do we only want to process the compiled
 | 
						 * To reduce the work to do we only want to process the compiled
 | 
				
			||||||
	 * in algorithms, so we first get the mask of disabled ciphers.
 | 
						 * in algorithms, so we first get the mask of disabled ciphers.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -739,6 +739,7 @@ int ssl_cert_type(X509 *x,EVP_PKEY *pkey);
 | 
				
			|||||||
void ssl_set_cert_masks(CERT *c, SSL_CIPHER *cipher);
 | 
					void ssl_set_cert_masks(CERT *c, SSL_CIPHER *cipher);
 | 
				
			||||||
STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s);
 | 
					STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s);
 | 
				
			||||||
int ssl_verify_alarm_type(long type);
 | 
					int ssl_verify_alarm_type(long type);
 | 
				
			||||||
 | 
					void ssl_load_ciphers(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ssl2_enc_init(SSL *s, int client);
 | 
					int ssl2_enc_init(SSL *s, int client);
 | 
				
			||||||
int ssl2_generate_key_material(SSL *s);
 | 
					int ssl2_generate_key_material(SSL *s);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user