Return per-certificate chain if extra chain is NULL.
[openssl.git] / ssl / s2_meth.c
index 8b6cbd0..f0e8ca5 100644 (file)
@@ -61,8 +61,8 @@
 #include <stdio.h>
 #include <openssl/objects.h>
 
-static SSL_METHOD *ssl2_get_method(int ver);
-static SSL_METHOD *ssl2_get_method(int ver)
+static const SSL_METHOD *ssl2_get_method(int ver);
+static const SSL_METHOD *ssl2_get_method(int ver)
        {
        if (ver == SSL2_VERSION)
                return(SSLv2_method());
@@ -70,29 +70,11 @@ static SSL_METHOD *ssl2_get_method(int ver)
                return(NULL);
        }
 
-SSL_METHOD *SSLv2_method(void)
-       {
-       static int init=1;
-       static SSL_METHOD SSLv2_data;
+IMPLEMENT_ssl2_meth_func(SSLv2_method,
+                        ssl2_accept,
+                        ssl2_connect,
+                        ssl2_get_method)
 
-       if (init)
-               {
-               CRYPTO_w_lock(CRYPTO_LOCK_SSL_METHOD);
-               
-               if (init)
-                       {
-                       memcpy((char *)&SSLv2_data,(char *)sslv2_base_method(),
-                               sizeof(SSL_METHOD));
-                       SSLv2_data.ssl_connect=ssl2_connect;
-                       SSLv2_data.ssl_accept=ssl2_accept;
-                       SSLv2_data.get_ssl_method=ssl2_get_method;
-                       init=0;
-                       }
-               
-               CRYPTO_w_unlock(CRYPTO_LOCK_SSL_METHOD);
-               }
-       return(&SSLv2_data);
-       }
 #else /* !OPENSSL_NO_SSL2 */
 
 # if PEDANTIC