X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=ssl%2Ft1_meth.c;h=fcc243f782643d5cdb3c015d90390a442562208f;hp=888ea3e6a8e7a878ba5fb93cbcde54b2668548ca;hb=dc0ed30cfeb37d64fc2bd26887b19e0898a96bde;hpb=5cc146f344bd2225e7afa66052a8401468b94ef4 diff --git a/ssl/t1_meth.c b/ssl/t1_meth.c index 888ea3e6a8..fcc243f782 100644 --- a/ssl/t1_meth.c +++ b/ssl/t1_meth.c @@ -57,15 +57,10 @@ */ #include -#include "objects.h" +#include #include "ssl_locl.h" -#ifndef NOPROTO static SSL_METHOD *tls1_get_method(int ver); -#else -static SSL_METHOD *tls1_get_method(); -#endif - static SSL_METHOD *tls1_get_method(int ver) { if (ver == TLS1_VERSION) @@ -81,13 +76,21 @@ SSL_METHOD *TLSv1_method(void) if (init) { - memcpy((char *)&TLSv1_data,(char *)tlsv1_base_method(), - sizeof(SSL_METHOD)); - TLSv1_data.ssl_connect=ssl3_connect; - TLSv1_data.ssl_accept=ssl3_accept; - TLSv1_data.get_ssl_method=tls1_get_method; - init=0; + CRYPTO_w_lock(CRYPTO_LOCK_SSL_METHOD); + + if (init) + { + memcpy((char *)&TLSv1_data,(char *)tlsv1_base_method(), + sizeof(SSL_METHOD)); + TLSv1_data.ssl_connect=ssl3_connect; + TLSv1_data.ssl_accept=ssl3_accept; + TLSv1_data.get_ssl_method=tls1_get_method; + init=0; + } + + CRYPTO_w_unlock(CRYPTO_LOCK_SSL_METHOD); } + return(&TLSv1_data); }