-/* ssl/t1_meth.c */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* Hudson (tjh@cryptsoft.com).
*
*/
-
+
#include <stdio.h>
#include <openssl/objects.h>
#include "ssl_locl.h"
* TLS/SSLv3 methods
*/
-static const SSL_METHOD *tls1_get_method(int ver)
-{
- if (ver == TLS_ANY_VERSION)
- return TLS_method();
- if (ver == TLS1_2_VERSION)
- return TLSv1_2_method();
- if (ver == TLS1_1_VERSION)
- return TLSv1_1_method();
- if (ver == TLS1_VERSION)
- return TLSv1_method();
-#ifndef OPENSSL_NO_SSL3
- if (ver == SSL3_VERSION)
- return (SSLv3_method());
- else
-#endif
- return NULL;
-}
-
-IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, TLS_method,
- statem_accept,
- statem_connect, tls1_get_method, TLSv1_2_enc_data)
+IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
+ TLS_method,
+ ossl_statem_accept,
+ ossl_statem_connect, TLSv1_2_enc_data)
-IMPLEMENT_tls_meth_func(TLS1_2_VERSION, TLSv1_2_method,
- statem_accept,
- statem_connect, tls1_get_method, TLSv1_2_enc_data)
+#ifndef OPENSSL_NO_TLS1_2_METHOD
+IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
+ tlsv1_2_method,
+ ossl_statem_accept,
+ ossl_statem_connect, TLSv1_2_enc_data)
+#endif
-IMPLEMENT_tls_meth_func(TLS1_1_VERSION, TLSv1_1_method,
- statem_accept,
- statem_connect, tls1_get_method, TLSv1_1_enc_data)
+#ifndef OPENSSL_NO_TLS1_1_METHOD
+IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
+ tlsv1_1_method,
+ ossl_statem_accept,
+ ossl_statem_connect, TLSv1_1_enc_data)
+#endif
-IMPLEMENT_tls_meth_func(TLS1_VERSION, TLSv1_method,
- statem_accept,
- statem_connect, tls1_get_method, TLSv1_enc_data)
+#ifndef OPENSSL_NO_TLS1_METHOD
+IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
+ tlsv1_method,
+ ossl_statem_accept,
+ ossl_statem_connect, TLSv1_enc_data)
+#endif
#ifndef OPENSSL_NO_SSL3_METHOD
-IMPLEMENT_ssl3_meth_func(SSLv3_method,
- statem_accept, statem_connect, tls1_get_method)
+IMPLEMENT_ssl3_meth_func(sslv3_method, ossl_statem_accept, ossl_statem_connect)
#endif
* TLS/SSLv3 server methods
*/
-static const SSL_METHOD *tls1_get_server_method(int ver)
-{
- if (ver == TLS_ANY_VERSION)
- return TLS_server_method();
- if (ver == TLS1_2_VERSION)
- return TLSv1_2_server_method();
- if (ver == TLS1_1_VERSION)
- return TLSv1_1_server_method();
- if (ver == TLS1_VERSION)
- return TLSv1_server_method();
-#ifndef OPENSSL_NO_SSL3
- if (ver == SSL3_VERSION)
- return (SSLv3_server_method());
-#endif
- return NULL;
-}
-
-IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, TLS_server_method,
- statem_accept,
+IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
+ TLS_server_method,
+ ossl_statem_accept,
ssl_undefined_function,
- tls1_get_server_method, TLSv1_2_enc_data)
+ TLSv1_2_enc_data)
-IMPLEMENT_tls_meth_func(TLS1_2_VERSION, TLSv1_2_server_method,
- statem_accept,
+#ifndef OPENSSL_NO_TLS1_2_METHOD
+IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
+ tlsv1_2_server_method,
+ ossl_statem_accept,
ssl_undefined_function,
- tls1_get_server_method, TLSv1_2_enc_data)
+ TLSv1_2_enc_data)
+#endif
-IMPLEMENT_tls_meth_func(TLS1_1_VERSION, TLSv1_1_server_method,
- statem_accept,
+#ifndef OPENSSL_NO_TLS1_1_METHOD
+IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
+ tlsv1_1_server_method,
+ ossl_statem_accept,
ssl_undefined_function,
- tls1_get_server_method, TLSv1_1_enc_data)
+ TLSv1_1_enc_data)
+#endif
-IMPLEMENT_tls_meth_func(TLS1_VERSION, TLSv1_server_method,
- statem_accept,
+#ifndef OPENSSL_NO_TLS1_METHOD
+IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
+ tlsv1_server_method,
+ ossl_statem_accept,
ssl_undefined_function,
- tls1_get_server_method, TLSv1_enc_data)
+ TLSv1_enc_data)
+#endif
#ifndef OPENSSL_NO_SSL3_METHOD
-IMPLEMENT_ssl3_meth_func(SSLv3_server_method,
- statem_accept,
- ssl_undefined_function, tls1_get_server_method)
+IMPLEMENT_ssl3_meth_func(sslv3_server_method,
+ ossl_statem_accept,
+ ssl_undefined_function)
#endif
* TLS/SSLv3 client methods
*/
-static const SSL_METHOD *tls1_get_client_method(int ver)
-{
- if (ver == TLS_ANY_VERSION)
- return TLS_client_method();
- if (ver == TLS1_2_VERSION)
- return TLSv1_2_client_method();
- if (ver == TLS1_1_VERSION)
- return TLSv1_1_client_method();
- if (ver == TLS1_VERSION)
- return TLSv1_client_method();
-#ifndef OPENSSL_NO_SSL3
- if (ver == SSL3_VERSION)
- return (SSLv3_client_method());
-#endif
- return NULL;
-}
-
-IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, TLS_client_method,
+IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
+ TLS_client_method,
ssl_undefined_function,
- statem_connect,
- tls1_get_client_method, TLSv1_2_enc_data)
+ ossl_statem_connect,
+ TLSv1_2_enc_data)
-IMPLEMENT_tls_meth_func(TLS1_2_VERSION, TLSv1_2_client_method,
+#ifndef OPENSSL_NO_TLS1_2_METHOD
+IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
+ tlsv1_2_client_method,
ssl_undefined_function,
- statem_connect,
- tls1_get_client_method, TLSv1_2_enc_data)
+ ossl_statem_connect,
+ TLSv1_2_enc_data)
+#endif
-IMPLEMENT_tls_meth_func(TLS1_1_VERSION, TLSv1_1_client_method,
+#ifndef OPENSSL_NO_TLS1_1_METHOD
+IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
+ tlsv1_1_client_method,
ssl_undefined_function,
- statem_connect,
- tls1_get_client_method, TLSv1_1_enc_data)
+ ossl_statem_connect,
+ TLSv1_1_enc_data)
+#endif
-IMPLEMENT_tls_meth_func(TLS1_VERSION, TLSv1_client_method,
+#ifndef OPENSSL_NO_TLS1_METHOD
+IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
+ tlsv1_client_method,
ssl_undefined_function,
- statem_connect, tls1_get_client_method, TLSv1_enc_data)
+ ossl_statem_connect,
+ TLSv1_enc_data)
+#endif
#ifndef OPENSSL_NO_SSL3_METHOD
-IMPLEMENT_ssl3_meth_func(SSLv3_client_method,
+IMPLEMENT_ssl3_meth_func(sslv3_client_method,
ssl_undefined_function,
- statem_connect, tls1_get_client_method)
+ ossl_statem_connect)
#endif
/*
* DTLS methods
*/
-static const SSL_METHOD *dtls1_get_method(int ver)
-{
- if (ver == DTLS1_VERSION)
- return (DTLSv1_method());
- else if (ver == DTLS1_2_VERSION)
- return (DTLSv1_2_method());
- else
- return (NULL);
-}
-IMPLEMENT_dtls1_meth_func(DTLS1_VERSION,
- DTLSv1_method,
- statem_accept,
- statem_connect, dtls1_get_method, DTLSv1_enc_data)
+#ifndef OPENSSL_NO_DTLS1_METHOD
+IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
+ dtlsv1_method,
+ ossl_statem_accept,
+ ossl_statem_connect,
+ DTLSv1_enc_data)
+#endif
-IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION,
- DTLSv1_2_method,
- statem_accept,
- statem_connect, dtls1_get_method, DTLSv1_2_enc_data)
+#ifndef OPENSSL_NO_DTLS1_2_METHOD
+IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
+ dtlsv1_2_method,
+ ossl_statem_accept,
+ ossl_statem_connect,
+ DTLSv1_2_enc_data)
+#endif
-IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION,
+IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
DTLS_method,
- statem_accept,
- statem_connect, dtls1_get_method, DTLSv1_2_enc_data)
-
+ ossl_statem_accept,
+ ossl_statem_connect,
+ DTLSv1_2_enc_data)
/*
* DTLS server methods
*/
-static const SSL_METHOD *dtls1_get_server_method(int ver)
-{
- if (ver == DTLS1_VERSION)
- return (DTLSv1_server_method());
- else if (ver == DTLS1_2_VERSION)
- return (DTLSv1_2_server_method());
- else
- return (NULL);
-}
-
-IMPLEMENT_dtls1_meth_func(DTLS1_VERSION,
- DTLSv1_server_method,
- statem_accept,
+#ifndef OPENSSL_NO_DTLS1_METHOD
+IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
+ dtlsv1_server_method,
+ ossl_statem_accept,
ssl_undefined_function,
- dtls1_get_server_method, DTLSv1_enc_data)
+ DTLSv1_enc_data)
+#endif
-IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION,
- DTLSv1_2_server_method,
- statem_accept,
+#ifndef OPENSSL_NO_DTLS1_2_METHOD
+IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
+ dtlsv1_2_server_method,
+ ossl_statem_accept,
ssl_undefined_function,
- dtls1_get_server_method, DTLSv1_2_enc_data)
+ DTLSv1_2_enc_data)
+#endif
-IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION,
+IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
DTLS_server_method,
- statem_accept,
+ ossl_statem_accept,
ssl_undefined_function,
- dtls1_get_server_method, DTLSv1_2_enc_data)
+ DTLSv1_2_enc_data)
/*
* DTLS client methods
*/
-static const SSL_METHOD *dtls1_get_client_method(int ver)
-{
- if (ver == DTLS1_VERSION || ver == DTLS1_BAD_VER)
- return (DTLSv1_client_method());
- else if (ver == DTLS1_2_VERSION)
- return (DTLSv1_2_client_method());
- else
- return (NULL);
-}
-
-IMPLEMENT_dtls1_meth_func(DTLS1_VERSION,
- DTLSv1_client_method,
+#ifndef OPENSSL_NO_DTLS1_METHOD
+IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
+ dtlsv1_client_method,
ssl_undefined_function,
- statem_connect,
- dtls1_get_client_method, DTLSv1_enc_data)
+ ossl_statem_connect,
+ DTLSv1_enc_data)
+#endif
-IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION,
- DTLSv1_2_client_method,
+#ifndef OPENSSL_NO_DTLS1_2_METHOD
+IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
+ dtlsv1_2_client_method,
ssl_undefined_function,
- statem_connect,
- dtls1_get_client_method, DTLSv1_2_enc_data)
+ ossl_statem_connect,
+ DTLSv1_2_enc_data)
+#endif
-IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION,
+IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
DTLS_client_method,
ssl_undefined_function,
- statem_connect,
- dtls1_get_client_method, DTLSv1_2_enc_data)
+ ossl_statem_connect,
+ DTLSv1_2_enc_data)
+
+#if OPENSSL_API_COMPAT < 0x10100000L
+
+# ifndef OPENSSL_NO_TLS1_2_METHOD
+const SSL_METHOD *TLSv1_2_method(void)
+{
+ return tlsv1_2_method();
+}
+
+const SSL_METHOD *TLSv1_2_server_method(void)
+{
+ return tlsv1_2_server_method();
+}
+
+const SSL_METHOD *TLSv1_2_client_method(void)
+{
+ return tlsv1_2_client_method();
+}
+# endif
+
+# ifndef OPENSSL_NO_TLS1_1_METHOD
+const SSL_METHOD *TLSv1_1_method(void)
+{
+ return tlsv1_1_method();
+}
+
+const SSL_METHOD *TLSv1_1_server_method(void)
+{
+ return tlsv1_1_server_method();
+}
+
+const SSL_METHOD *TLSv1_1_client_method(void)
+{
+ return tlsv1_1_client_method();
+}
+# endif
+
+# ifndef OPENSSL_NO_TLS1_METHOD
+const SSL_METHOD *TLSv1_method(void)
+{
+ return tlsv1_method();
+}
+
+const SSL_METHOD *TLSv1_server_method(void)
+{
+ return tlsv1_server_method();
+}
+
+const SSL_METHOD *TLSv1_client_method(void)
+{
+ return tlsv1_client_method();
+}
+# endif
+
+# ifndef OPENSSL_NO_SSL3_METHOD
+const SSL_METHOD *SSLv3_method(void)
+{
+ return sslv3_method();
+}
+
+const SSL_METHOD *SSLv3_server_method(void)
+{
+ return sslv3_server_method();
+}
+
+const SSL_METHOD *SSLv3_client_method(void)
+{
+ return sslv3_client_method();
+}
+# endif
+
+# ifndef OPENSSL_NO_DTLS1_2_METHOD
+const SSL_METHOD *DTLSv1_2_method(void)
+{
+ return dtlsv1_2_method();
+}
+
+const SSL_METHOD *DTLSv1_2_server_method(void)
+{
+ return dtlsv1_2_server_method();
+}
+
+const SSL_METHOD *DTLSv1_2_client_method(void)
+{
+ return dtlsv1_2_client_method();
+}
+# endif
+
+# ifndef OPENSSL_NO_DTLS1_METHOD
+const SSL_METHOD *DTLSv1_method(void)
+{
+ return dtlsv1_method();
+}
+
+const SSL_METHOD *DTLSv1_server_method(void)
+{
+ return dtlsv1_server_method();
+}
+
+const SSL_METHOD *DTLSv1_client_method(void)
+{
+ return dtlsv1_client_method();
+}
+# endif
+
+#endif
+