DeIMPLEMENT libssl. Expand the IMPLEMENT_* macros since it is far more
authorjsing <jsing@openbsd.org>
Sat, 24 May 2014 12:44:48 +0000 (12:44 +0000)
committerjsing <jsing@openbsd.org>
Sat, 24 May 2014 12:44:48 +0000 (12:44 +0000)
readable and one less layer of abstraction. Use C99 initialisers for
clarity, grepability and to protect from future field reordering/removal.

ok miod@ (tedu@ also thought it was a wonderful idea, beck@ also agreed,
but ran away squealing since it reminded him of the VOP layer...)

24 files changed:
lib/libssl/d1_clnt.c
lib/libssl/d1_meth.c
lib/libssl/d1_srvr.c
lib/libssl/s23_clnt.c
lib/libssl/s23_srvr.c
lib/libssl/s3_clnt.c
lib/libssl/s3_srvr.c
lib/libssl/src/ssl/d1_clnt.c
lib/libssl/src/ssl/d1_meth.c
lib/libssl/src/ssl/d1_srvr.c
lib/libssl/src/ssl/s23_clnt.c
lib/libssl/src/ssl/s23_meth.c
lib/libssl/src/ssl/s23_srvr.c
lib/libssl/src/ssl/s3_clnt.c
lib/libssl/src/ssl/s3_meth.c
lib/libssl/src/ssl/s3_srvr.c
lib/libssl/src/ssl/ssl_locl.h
lib/libssl/src/ssl/t1_clnt.c
lib/libssl/src/ssl/t1_meth.c
lib/libssl/src/ssl/t1_srvr.c
lib/libssl/ssl_locl.h
lib/libssl/t1_clnt.c
lib/libssl/t1_meth.c
lib/libssl/t1_srvr.c

index 8967879..8f304a7 100644 (file)
 static const SSL_METHOD *dtls1_get_client_method(int ver);
 static int dtls1_get_hello_verify(SSL *s);
 
+const SSL_METHOD DTLSv1_client_method_data = {
+       .version = DTLS1_VERSION,
+       .ssl_new = dtls1_new,
+       .ssl_clear = dtls1_clear,
+       .ssl_free = dtls1_free,
+       .ssl_accept = ssl_undefined_function,
+       .ssl_connect = dtls1_connect,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = dtls1_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = dtls1_get_message,
+       .ssl_read_bytes = dtls1_read_bytes,
+       .ssl_write_bytes = dtls1_write_app_data_bytes,
+       .ssl_dispatch_alert = dtls1_dispatch_alert,
+       .ssl_ctrl = dtls1_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = dtls1_get_cipher,
+       .get_ssl_method = dtls1_get_client_method,
+       .get_timeout = dtls1_default_timeout,
+       .ssl3_enc = &DTLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+DTLSv1_client_method(void)
+{
+       return &DTLSv1_client_method_data;
+}
+
 static const SSL_METHOD *
 dtls1_get_client_method(int ver)
 {
@@ -136,9 +174,6 @@ dtls1_get_client_method(int ver)
        return (NULL);
 }
 
-IMPLEMENT_dtls1_meth_func(DTLSv1_client_method,
-    ssl_undefined_function, dtls1_connect, dtls1_get_client_method)
-
 int
 dtls1_connect(SSL *s)
 {
index 1140da6..5e4bf02 100644 (file)
 #include "ssl_locl.h"
 
 static const SSL_METHOD *dtls1_get_method(int ver);
+
+const SSL_METHOD DTLSv1_method_data = {
+       .version = DTLS1_VERSION,
+       .ssl_new = dtls1_new,
+       .ssl_clear = dtls1_clear,
+       .ssl_free = dtls1_free,
+       .ssl_accept = dtls1_accept,
+       .ssl_connect = dtls1_connect,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = dtls1_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = dtls1_get_message,
+       .ssl_read_bytes = dtls1_read_bytes,
+       .ssl_write_bytes = dtls1_write_app_data_bytes,
+       .ssl_dispatch_alert = dtls1_dispatch_alert,
+       .ssl_ctrl = dtls1_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = dtls1_get_cipher,
+       .get_ssl_method = dtls1_get_method,
+       .get_timeout = dtls1_default_timeout,
+       .ssl3_enc = &DTLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+DTLSv1_method(void)
+{
+       return &DTLSv1_method_data;
+}
+
 static const SSL_METHOD *
 dtls1_get_method(int ver)
 {
@@ -69,6 +108,3 @@ dtls1_get_method(int ver)
                return (DTLSv1_method());
        return (NULL);
 }
-
-IMPLEMENT_dtls1_meth_func(DTLSv1_method,
-    dtls1_accept, dtls1_connect, dtls1_get_method)
index 6183815..2c22a25 100644 (file)
 static const SSL_METHOD *dtls1_get_server_method(int ver);
 static int dtls1_send_hello_verify_request(SSL *s);
 
+const SSL_METHOD DTLSv1_server_method_data = {
+       .version = DTLS1_VERSION,
+       .ssl_new = dtls1_new,
+       .ssl_clear = dtls1_clear,
+       .ssl_free = dtls1_free,
+       .ssl_accept = dtls1_accept,
+       .ssl_connect = ssl_undefined_function,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = dtls1_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = dtls1_get_message,
+       .ssl_read_bytes = dtls1_read_bytes,
+       .ssl_write_bytes = dtls1_write_app_data_bytes,
+       .ssl_dispatch_alert = dtls1_dispatch_alert,
+       .ssl_ctrl = dtls1_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = dtls1_get_cipher,
+       .get_ssl_method = dtls1_get_server_method,
+       .get_timeout = dtls1_default_timeout,
+       .ssl3_enc = &DTLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+DTLSv1_server_method(void)
+{
+       return &DTLSv1_server_method_data;
+}
+
 static const SSL_METHOD *
 dtls1_get_server_method(int ver)
 {
@@ -137,9 +175,6 @@ dtls1_get_server_method(int ver)
        return (NULL);
 }
 
-IMPLEMENT_dtls1_meth_func(DTLSv1_server_method,
-    dtls1_accept, ssl_undefined_function, dtls1_get_server_method)
-
 int
 dtls1_accept(SSL *s)
 {
index 293b1e5..897ac7e 100644 (file)
 static const SSL_METHOD *ssl23_get_client_method(int ver);
 static int ssl23_client_hello(SSL *s);
 static int ssl23_get_server_hello(SSL *s);
+
+const SSL_METHOD SSLv23_client_method_data = {
+       .version = TLS1_2_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl_undefined_function,
+       .ssl_connect = ssl23_connect,
+       .ssl_read = ssl23_read,
+       .ssl_peek = ssl23_peek,
+       .ssl_write = ssl23_write,
+       .ssl_shutdown = ssl_undefined_function,
+       .ssl_renegotiate = ssl_undefined_function,
+       .ssl_renegotiate_check = ssl_ok,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl23_get_cipher_by_char,
+       .put_cipher_by_char = ssl23_put_cipher_by_char,
+       .ssl_pending = ssl_undefined_const_function,
+       .num_ciphers = ssl23_num_ciphers,
+       .get_cipher = ssl23_get_cipher,
+       .get_ssl_method = ssl23_get_client_method,
+       .get_timeout = ssl23_default_timeout,
+       .ssl3_enc = &ssl3_undef_enc_method,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+SSLv23_client_method(void)
+{
+       return &SSLv23_client_method_data;
+}
+
 static const SSL_METHOD *
 ssl23_get_client_method(int ver)
 {
@@ -133,9 +172,6 @@ ssl23_get_client_method(int ver)
        return (NULL);
 }
 
-IMPLEMENT_ssl23_meth_func(SSLv23_client_method,
-    ssl_undefined_function, ssl23_connect, ssl23_get_client_method)
-
 int
 ssl23_connect(SSL *s)
 {
index 1f17c19..94e669a 100644 (file)
 
 static const SSL_METHOD *ssl23_get_server_method(int ver);
 int ssl23_get_client_hello(SSL *s);
+
+const SSL_METHOD SSLv23_server_method_data = {
+       .version = TLS1_2_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl23_accept,
+       .ssl_connect = ssl_undefined_function,
+       .ssl_read = ssl23_read,
+       .ssl_peek = ssl23_peek,
+       .ssl_write = ssl23_write,
+       .ssl_shutdown = ssl_undefined_function,
+       .ssl_renegotiate = ssl_undefined_function,
+       .ssl_renegotiate_check = ssl_ok,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl23_get_cipher_by_char,
+       .put_cipher_by_char = ssl23_put_cipher_by_char,
+       .ssl_pending = ssl_undefined_const_function,
+       .num_ciphers = ssl23_num_ciphers,
+       .get_cipher = ssl23_get_cipher,
+       .get_ssl_method = ssl23_get_server_method,
+       .get_timeout = ssl23_default_timeout,
+       .ssl3_enc = &ssl3_undef_enc_method,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+SSLv23_server_method(void)
+{
+       return &SSLv23_server_method_data;
+}
+
 static const SSL_METHOD *
 ssl23_get_server_method(int ver)
 {
@@ -132,9 +171,6 @@ ssl23_get_server_method(int ver)
        return (NULL);
 }
 
-IMPLEMENT_ssl23_meth_func(SSLv23_server_method,
-    ssl23_accept, ssl_undefined_function, ssl23_get_server_method)
-
 int
 ssl23_accept(SSL *s)
 {
index 010f9e4..16d5dac 100644 (file)
 static const SSL_METHOD *ssl3_get_client_method(int ver);
 static int ca_dn_cmp(const X509_NAME * const *a, const X509_NAME * const *b);
 
+const SSL_METHOD SSLv3_client_method_data = {
+       .version = SSL3_VERSION,
+       .ssl_new = ssl3_new,
+       .ssl_clear = ssl3_clear,
+       .ssl_free = ssl3_free,
+       .ssl_accept = ssl_undefined_function,
+       .ssl_connect = ssl3_connect,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = ssl3_get_client_method,
+       .get_timeout = ssl3_default_timeout,
+       .ssl3_enc = &SSLv3_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+SSLv3_client_method(void)
+{
+       return &SSLv3_client_method_data;
+}
+
 static const SSL_METHOD *
 ssl3_get_client_method(int ver)
 {
@@ -174,9 +212,6 @@ ssl3_get_client_method(int ver)
        return (NULL);
 }
 
-IMPLEMENT_ssl3_meth_func(SSLv3_client_method,
-    ssl_undefined_function, ssl3_connect, ssl3_get_client_method)
-
 int
 ssl3_connect(SSL *s)
 {
index ff86ec3..6f788cd 100644 (file)
 
 static const SSL_METHOD *ssl3_get_server_method(int ver);
 
+const SSL_METHOD SSLv3_server_method_data = {
+       .version = SSL3_VERSION,
+       .ssl_new = ssl3_new,
+       .ssl_clear = ssl3_clear,
+       .ssl_free = ssl3_free,
+       .ssl_accept = ssl3_accept,
+       .ssl_connect = ssl_undefined_function,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = ssl3_get_server_method,
+       .get_timeout = ssl3_default_timeout,
+       .ssl3_enc = &SSLv3_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+SSLv3_server_method(void)
+{
+       return &SSLv3_server_method_data;
+}
+
 static const SSL_METHOD *
 ssl3_get_server_method(int ver)
 {
@@ -175,10 +213,6 @@ ssl3_get_server_method(int ver)
        return (NULL);
 }
 
-
-IMPLEMENT_ssl3_meth_func(SSLv3_server_method,
-    ssl3_accept, ssl_undefined_function, ssl3_get_server_method)
-
 int
 ssl3_accept(SSL *s)
 {
index 8967879..8f304a7 100644 (file)
 static const SSL_METHOD *dtls1_get_client_method(int ver);
 static int dtls1_get_hello_verify(SSL *s);
 
+const SSL_METHOD DTLSv1_client_method_data = {
+       .version = DTLS1_VERSION,
+       .ssl_new = dtls1_new,
+       .ssl_clear = dtls1_clear,
+       .ssl_free = dtls1_free,
+       .ssl_accept = ssl_undefined_function,
+       .ssl_connect = dtls1_connect,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = dtls1_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = dtls1_get_message,
+       .ssl_read_bytes = dtls1_read_bytes,
+       .ssl_write_bytes = dtls1_write_app_data_bytes,
+       .ssl_dispatch_alert = dtls1_dispatch_alert,
+       .ssl_ctrl = dtls1_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = dtls1_get_cipher,
+       .get_ssl_method = dtls1_get_client_method,
+       .get_timeout = dtls1_default_timeout,
+       .ssl3_enc = &DTLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+DTLSv1_client_method(void)
+{
+       return &DTLSv1_client_method_data;
+}
+
 static const SSL_METHOD *
 dtls1_get_client_method(int ver)
 {
@@ -136,9 +174,6 @@ dtls1_get_client_method(int ver)
        return (NULL);
 }
 
-IMPLEMENT_dtls1_meth_func(DTLSv1_client_method,
-    ssl_undefined_function, dtls1_connect, dtls1_get_client_method)
-
 int
 dtls1_connect(SSL *s)
 {
index 1140da6..5e4bf02 100644 (file)
 #include "ssl_locl.h"
 
 static const SSL_METHOD *dtls1_get_method(int ver);
+
+const SSL_METHOD DTLSv1_method_data = {
+       .version = DTLS1_VERSION,
+       .ssl_new = dtls1_new,
+       .ssl_clear = dtls1_clear,
+       .ssl_free = dtls1_free,
+       .ssl_accept = dtls1_accept,
+       .ssl_connect = dtls1_connect,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = dtls1_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = dtls1_get_message,
+       .ssl_read_bytes = dtls1_read_bytes,
+       .ssl_write_bytes = dtls1_write_app_data_bytes,
+       .ssl_dispatch_alert = dtls1_dispatch_alert,
+       .ssl_ctrl = dtls1_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = dtls1_get_cipher,
+       .get_ssl_method = dtls1_get_method,
+       .get_timeout = dtls1_default_timeout,
+       .ssl3_enc = &DTLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+DTLSv1_method(void)
+{
+       return &DTLSv1_method_data;
+}
+
 static const SSL_METHOD *
 dtls1_get_method(int ver)
 {
@@ -69,6 +108,3 @@ dtls1_get_method(int ver)
                return (DTLSv1_method());
        return (NULL);
 }
-
-IMPLEMENT_dtls1_meth_func(DTLSv1_method,
-    dtls1_accept, dtls1_connect, dtls1_get_method)
index 6183815..2c22a25 100644 (file)
 static const SSL_METHOD *dtls1_get_server_method(int ver);
 static int dtls1_send_hello_verify_request(SSL *s);
 
+const SSL_METHOD DTLSv1_server_method_data = {
+       .version = DTLS1_VERSION,
+       .ssl_new = dtls1_new,
+       .ssl_clear = dtls1_clear,
+       .ssl_free = dtls1_free,
+       .ssl_accept = dtls1_accept,
+       .ssl_connect = ssl_undefined_function,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = dtls1_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = dtls1_get_message,
+       .ssl_read_bytes = dtls1_read_bytes,
+       .ssl_write_bytes = dtls1_write_app_data_bytes,
+       .ssl_dispatch_alert = dtls1_dispatch_alert,
+       .ssl_ctrl = dtls1_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = dtls1_get_cipher,
+       .get_ssl_method = dtls1_get_server_method,
+       .get_timeout = dtls1_default_timeout,
+       .ssl3_enc = &DTLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+DTLSv1_server_method(void)
+{
+       return &DTLSv1_server_method_data;
+}
+
 static const SSL_METHOD *
 dtls1_get_server_method(int ver)
 {
@@ -137,9 +175,6 @@ dtls1_get_server_method(int ver)
        return (NULL);
 }
 
-IMPLEMENT_dtls1_meth_func(DTLSv1_server_method,
-    dtls1_accept, ssl_undefined_function, dtls1_get_server_method)
-
 int
 dtls1_accept(SSL *s)
 {
index 293b1e5..897ac7e 100644 (file)
 static const SSL_METHOD *ssl23_get_client_method(int ver);
 static int ssl23_client_hello(SSL *s);
 static int ssl23_get_server_hello(SSL *s);
+
+const SSL_METHOD SSLv23_client_method_data = {
+       .version = TLS1_2_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl_undefined_function,
+       .ssl_connect = ssl23_connect,
+       .ssl_read = ssl23_read,
+       .ssl_peek = ssl23_peek,
+       .ssl_write = ssl23_write,
+       .ssl_shutdown = ssl_undefined_function,
+       .ssl_renegotiate = ssl_undefined_function,
+       .ssl_renegotiate_check = ssl_ok,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl23_get_cipher_by_char,
+       .put_cipher_by_char = ssl23_put_cipher_by_char,
+       .ssl_pending = ssl_undefined_const_function,
+       .num_ciphers = ssl23_num_ciphers,
+       .get_cipher = ssl23_get_cipher,
+       .get_ssl_method = ssl23_get_client_method,
+       .get_timeout = ssl23_default_timeout,
+       .ssl3_enc = &ssl3_undef_enc_method,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+SSLv23_client_method(void)
+{
+       return &SSLv23_client_method_data;
+}
+
 static const SSL_METHOD *
 ssl23_get_client_method(int ver)
 {
@@ -133,9 +172,6 @@ ssl23_get_client_method(int ver)
        return (NULL);
 }
 
-IMPLEMENT_ssl23_meth_func(SSLv23_client_method,
-    ssl_undefined_function, ssl23_connect, ssl23_get_client_method)
-
 int
 ssl23_connect(SSL *s)
 {
index d19d96a..f26faf2 100644 (file)
 #include "ssl_locl.h"
 
 static const SSL_METHOD *ssl23_get_method(int ver);
+
+const SSL_METHOD SSLv23_method_data = {
+       .version = TLS1_2_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl23_accept,
+       .ssl_connect = ssl23_connect,
+       .ssl_read = ssl23_read,
+       .ssl_peek = ssl23_peek,
+       .ssl_write = ssl23_write,
+       .ssl_shutdown = ssl_undefined_function,
+       .ssl_renegotiate = ssl_undefined_function,
+       .ssl_renegotiate_check = ssl_ok,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl23_get_cipher_by_char,
+       .put_cipher_by_char = ssl23_put_cipher_by_char,
+       .ssl_pending = ssl_undefined_const_function,
+       .num_ciphers = ssl23_num_ciphers,
+       .get_cipher = ssl23_get_cipher,
+       .get_ssl_method = ssl23_get_method,
+       .get_timeout = ssl23_default_timeout,
+       .ssl3_enc = &ssl3_undef_enc_method,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+SSLv23_method(void)
+{
+       return &SSLv23_method_data;
+}
+
 static const SSL_METHOD *
 ssl23_get_method(int ver)
 {
@@ -74,7 +113,3 @@ ssl23_get_method(int ver)
                return (TLSv1_2_method());
        return (NULL);
 }
-
-IMPLEMENT_ssl23_meth_func(SSLv23_method,
-    ssl23_accept, ssl23_connect, ssl23_get_method)
-
index 1f17c19..94e669a 100644 (file)
 
 static const SSL_METHOD *ssl23_get_server_method(int ver);
 int ssl23_get_client_hello(SSL *s);
+
+const SSL_METHOD SSLv23_server_method_data = {
+       .version = TLS1_2_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl23_accept,
+       .ssl_connect = ssl_undefined_function,
+       .ssl_read = ssl23_read,
+       .ssl_peek = ssl23_peek,
+       .ssl_write = ssl23_write,
+       .ssl_shutdown = ssl_undefined_function,
+       .ssl_renegotiate = ssl_undefined_function,
+       .ssl_renegotiate_check = ssl_ok,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl23_get_cipher_by_char,
+       .put_cipher_by_char = ssl23_put_cipher_by_char,
+       .ssl_pending = ssl_undefined_const_function,
+       .num_ciphers = ssl23_num_ciphers,
+       .get_cipher = ssl23_get_cipher,
+       .get_ssl_method = ssl23_get_server_method,
+       .get_timeout = ssl23_default_timeout,
+       .ssl3_enc = &ssl3_undef_enc_method,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+SSLv23_server_method(void)
+{
+       return &SSLv23_server_method_data;
+}
+
 static const SSL_METHOD *
 ssl23_get_server_method(int ver)
 {
@@ -132,9 +171,6 @@ ssl23_get_server_method(int ver)
        return (NULL);
 }
 
-IMPLEMENT_ssl23_meth_func(SSLv23_server_method,
-    ssl23_accept, ssl_undefined_function, ssl23_get_server_method)
-
 int
 ssl23_accept(SSL *s)
 {
index 010f9e4..16d5dac 100644 (file)
 static const SSL_METHOD *ssl3_get_client_method(int ver);
 static int ca_dn_cmp(const X509_NAME * const *a, const X509_NAME * const *b);
 
+const SSL_METHOD SSLv3_client_method_data = {
+       .version = SSL3_VERSION,
+       .ssl_new = ssl3_new,
+       .ssl_clear = ssl3_clear,
+       .ssl_free = ssl3_free,
+       .ssl_accept = ssl_undefined_function,
+       .ssl_connect = ssl3_connect,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = ssl3_get_client_method,
+       .get_timeout = ssl3_default_timeout,
+       .ssl3_enc = &SSLv3_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+SSLv3_client_method(void)
+{
+       return &SSLv3_client_method_data;
+}
+
 static const SSL_METHOD *
 ssl3_get_client_method(int ver)
 {
@@ -174,9 +212,6 @@ ssl3_get_client_method(int ver)
        return (NULL);
 }
 
-IMPLEMENT_ssl3_meth_func(SSLv3_client_method,
-    ssl_undefined_function, ssl3_connect, ssl3_get_client_method)
-
 int
 ssl3_connect(SSL *s)
 {
index b6d6771..04a72d9 100644 (file)
 #include "ssl_locl.h"
 
 static const SSL_METHOD *ssl3_get_method(int ver);
+
+const SSL_METHOD SSLv3_method_data = {
+       .version = SSL3_VERSION,
+       .ssl_new = ssl3_new,
+       .ssl_clear = ssl3_clear,
+       .ssl_free = ssl3_free,
+       .ssl_accept = ssl3_accept,
+       .ssl_connect = ssl3_connect,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = ssl3_get_method,
+       .get_timeout = ssl3_default_timeout,
+       .ssl3_enc = &SSLv3_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+SSLv3_method(void)
+{
+       return &SSLv3_method_data;
+}
+
 static const SSL_METHOD *
 ssl3_get_method(int ver)
 {
@@ -68,7 +107,3 @@ ssl3_get_method(int ver)
                return (SSLv3_method());
        return (NULL);
 }
-
-IMPLEMENT_ssl3_meth_func(SSLv3_method,
-    ssl3_accept, ssl3_connect, ssl3_get_method)
-
index ff86ec3..6f788cd 100644 (file)
 
 static const SSL_METHOD *ssl3_get_server_method(int ver);
 
+const SSL_METHOD SSLv3_server_method_data = {
+       .version = SSL3_VERSION,
+       .ssl_new = ssl3_new,
+       .ssl_clear = ssl3_clear,
+       .ssl_free = ssl3_free,
+       .ssl_accept = ssl3_accept,
+       .ssl_connect = ssl_undefined_function,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = ssl3_get_server_method,
+       .get_timeout = ssl3_default_timeout,
+       .ssl3_enc = &SSLv3_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+SSLv3_server_method(void)
+{
+       return &SSLv3_server_method_data;
+}
+
 static const SSL_METHOD *
 ssl3_get_server_method(int ver)
 {
@@ -175,10 +213,6 @@ ssl3_get_server_method(int ver)
        return (NULL);
 }
 
-
-IMPLEMENT_ssl3_meth_func(SSLv3_server_method,
-    ssl3_accept, ssl_undefined_function, ssl3_get_server_method)
-
 int
 ssl3_accept(SSL *s)
 {
index fc9d6a1..3a4656e 100644 (file)
@@ -575,155 +575,6 @@ extern SSL3_ENC_METHOD DTLSv1_enc_data;
 
 #define SSL_IS_DTLS(s) (s->method->version == DTLS1_VERSION)
 
-#define IMPLEMENT_tls_meth_func(version, func_name, s_accept, s_connect, \
-                               s_get_meth) \
-const SSL_METHOD *func_name(void)  \
-       { \
-       static const SSL_METHOD func_name##_data= { \
-               version, \
-               tls1_new, \
-               tls1_clear, \
-               tls1_free, \
-               s_accept, \
-               s_connect, \
-               ssl3_read, \
-               ssl3_peek, \
-               ssl3_write, \
-               ssl3_shutdown, \
-               ssl3_renegotiate, \
-               ssl3_renegotiate_check, \
-               ssl3_get_message, \
-               ssl3_read_bytes, \
-               ssl3_write_bytes, \
-               ssl3_dispatch_alert, \
-               ssl3_ctrl, \
-               ssl3_ctx_ctrl, \
-               ssl3_get_cipher_by_char, \
-               ssl3_put_cipher_by_char, \
-               ssl3_pending, \
-               ssl3_num_ciphers, \
-               ssl3_get_cipher, \
-               s_get_meth, \
-               tls1_default_timeout, \
-               &TLSv1_enc_data, \
-               ssl_undefined_void_function, \
-               ssl3_callback_ctrl, \
-               ssl3_ctx_callback_ctrl, \
-       }; \
-       return &func_name##_data; \
-       }
-
-#define IMPLEMENT_ssl3_meth_func(func_name, s_accept, s_connect, s_get_meth) \
-const SSL_METHOD *func_name(void)  \
-       { \
-       static const SSL_METHOD func_name##_data= { \
-               SSL3_VERSION, \
-               ssl3_new, \
-               ssl3_clear, \
-               ssl3_free, \
-               s_accept, \
-               s_connect, \
-               ssl3_read, \
-               ssl3_peek, \
-               ssl3_write, \
-               ssl3_shutdown, \
-               ssl3_renegotiate, \
-               ssl3_renegotiate_check, \
-               ssl3_get_message, \
-               ssl3_read_bytes, \
-               ssl3_write_bytes, \
-               ssl3_dispatch_alert, \
-               ssl3_ctrl, \
-               ssl3_ctx_ctrl, \
-               ssl3_get_cipher_by_char, \
-               ssl3_put_cipher_by_char, \
-               ssl3_pending, \
-               ssl3_num_ciphers, \
-               ssl3_get_cipher, \
-               s_get_meth, \
-               ssl3_default_timeout, \
-               &SSLv3_enc_data, \
-               ssl_undefined_void_function, \
-               ssl3_callback_ctrl, \
-               ssl3_ctx_callback_ctrl, \
-       }; \
-       return &func_name##_data; \
-       }
-
-#define IMPLEMENT_ssl23_meth_func(func_name, s_accept, s_connect, s_get_meth) \
-const SSL_METHOD *func_name(void)  \
-       { \
-       static const SSL_METHOD func_name##_data= { \
-       TLS1_2_VERSION, \
-       tls1_new, \
-       tls1_clear, \
-       tls1_free, \
-       s_accept, \
-       s_connect, \
-       ssl23_read, \
-       ssl23_peek, \
-       ssl23_write, \
-       ssl_undefined_function, \
-       ssl_undefined_function, \
-       ssl_ok, \
-       ssl3_get_message, \
-       ssl3_read_bytes, \
-       ssl3_write_bytes, \
-       ssl3_dispatch_alert, \
-       ssl3_ctrl, \
-       ssl3_ctx_ctrl, \
-       ssl23_get_cipher_by_char, \
-       ssl23_put_cipher_by_char, \
-       ssl_undefined_const_function, \
-       ssl23_num_ciphers, \
-       ssl23_get_cipher, \
-       s_get_meth, \
-       ssl23_default_timeout, \
-       &ssl3_undef_enc_method, \
-       ssl_undefined_void_function, \
-       ssl3_callback_ctrl, \
-       ssl3_ctx_callback_ctrl, \
-       }; \
-       return &func_name##_data; \
-       }
-
-#define IMPLEMENT_dtls1_meth_func(func_name, s_accept, s_connect, s_get_meth) \
-const SSL_METHOD *func_name(void)  \
-       { \
-       static const SSL_METHOD func_name##_data= { \
-               DTLS1_VERSION, \
-               dtls1_new, \
-               dtls1_clear, \
-               dtls1_free, \
-               s_accept, \
-               s_connect, \
-               ssl3_read, \
-               ssl3_peek, \
-               ssl3_write, \
-               dtls1_shutdown, \
-               ssl3_renegotiate, \
-               ssl3_renegotiate_check, \
-               dtls1_get_message, \
-               dtls1_read_bytes, \
-               dtls1_write_app_data_bytes, \
-               dtls1_dispatch_alert, \
-               dtls1_ctrl, \
-               ssl3_ctx_ctrl, \
-               ssl3_get_cipher_by_char, \
-               ssl3_put_cipher_by_char, \
-               ssl3_pending, \
-               ssl3_num_ciphers, \
-               dtls1_get_cipher, \
-               s_get_meth, \
-               dtls1_default_timeout, \
-               &DTLSv1_enc_data, \
-               ssl_undefined_void_function, \
-               ssl3_callback_ctrl, \
-               ssl3_ctx_callback_ctrl, \
-       }; \
-       return &func_name##_data; \
-       }
-
 void ssl_clear_cipher_ctx(SSL *s);
 int ssl_clear_bad_session(SSL *s);
 CERT *ssl_cert_new(void);
@@ -926,8 +777,6 @@ int dtls1_send_server_key_exchange(SSL *s);
 int dtls1_send_certificate_request(SSL *s);
 int dtls1_send_server_done(SSL *s);
 
-
-
 int ssl23_accept(SSL *s);
 int ssl23_connect(SSL *s);
 int ssl23_read_bytes(SSL *s, int n);
@@ -940,8 +789,8 @@ long tls1_ctrl(SSL *s, int cmd, long larg, void *parg);
 long tls1_callback_ctrl(SSL *s, int cmd, void (*fp)(void));
 
 int dtls1_new(SSL *s);
-int    dtls1_accept(SSL *s);
-int    dtls1_connect(SSL *s);
+int dtls1_accept(SSL *s);
+int dtls1_connect(SSL *s);
 void dtls1_free(SSL *s);
 void dtls1_clear(SSL *s);
 long dtls1_ctrl(SSL *s, int cmd, long larg, void *parg);
index 180843c..2223422 100644 (file)
 
 static const SSL_METHOD *tls1_get_client_method(int ver);
 
+const SSL_METHOD TLSv1_client_method_data = {
+       .version = TLS1_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl_undefined_function,
+       .ssl_connect = ssl3_connect,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = tls1_get_client_method,
+       .get_timeout = tls1_default_timeout,
+       .ssl3_enc = &TLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD TLSv1_1_client_method_data = {
+       .version = TLS1_1_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl_undefined_function,
+       .ssl_connect = ssl3_connect,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = tls1_get_client_method,
+       .get_timeout = tls1_default_timeout,
+       .ssl3_enc = &TLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD TLSv1_2_client_method_data = {
+       .version = TLS1_2_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl_undefined_function,
+       .ssl_connect = ssl3_connect,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = tls1_get_client_method,
+       .get_timeout = tls1_default_timeout,
+       .ssl3_enc = &TLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+TLSv1_client_method(void)
+{
+       return &TLSv1_client_method_data;
+}
+
+const SSL_METHOD *
+TLSv1_1_client_method(void)
+{
+       return &TLSv1_1_client_method_data;
+}
+
+const SSL_METHOD *
+TLSv1_2_client_method(void)
+{
+       return &TLSv1_2_client_method_data;
+}
+
 static const SSL_METHOD *
 tls1_get_client_method(int ver)
 {
@@ -76,12 +190,3 @@ tls1_get_client_method(int ver)
                return (TLSv1_client_method());
        return (NULL);
 }
-
-IMPLEMENT_tls_meth_func(TLS1_2_VERSION, TLSv1_2_client_method,
-    ssl_undefined_function, ssl3_connect, tls1_get_client_method)
-
-IMPLEMENT_tls_meth_func(TLS1_1_VERSION, TLSv1_1_client_method,
-    ssl_undefined_function, ssl3_connect, tls1_get_client_method)
-
-IMPLEMENT_tls_meth_func(TLS1_VERSION, TLSv1_client_method,
-    ssl_undefined_function, ssl3_connect, tls1_get_client_method)
index 49fe962..b39303b 100644 (file)
 #include <openssl/objects.h>
 #include "ssl_locl.h"
 
+static const SSL_METHOD *tls1_get_method(int ver);
+
+const SSL_METHOD TLSv1_method_data = {
+       .version = TLS1_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl3_accept,
+       .ssl_connect = ssl3_connect,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = tls1_get_method,
+       .get_timeout = tls1_default_timeout,
+       .ssl3_enc = &TLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD TLSv1_1_method_data = {
+       .version = TLS1_1_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl3_accept,
+       .ssl_connect = ssl3_connect,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = tls1_get_method,
+       .get_timeout = tls1_default_timeout,
+       .ssl3_enc = &TLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD TLSv1_2_method_data = {
+       .version = TLS1_2_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl3_accept,
+       .ssl_connect = ssl3_connect,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = tls1_get_method,
+       .get_timeout = tls1_default_timeout,
+       .ssl3_enc = &TLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+TLSv1_method(void) 
+{
+       return &TLSv1_method_data; 
+}
+
+const SSL_METHOD *
+TLSv1_1_method(void) 
+{
+       return &TLSv1_1_method_data; 
+}
+
+const SSL_METHOD *
+TLSv1_2_method(void) 
+{
+       return &TLSv1_2_method_data; 
+}
+
 static const SSL_METHOD *
 tls1_get_method(int ver)
 {
@@ -71,12 +187,3 @@ tls1_get_method(int ver)
                return (TLSv1_method());
        return (NULL);
 }
-
-IMPLEMENT_tls_meth_func(TLS1_2_VERSION, TLSv1_2_method,
-    ssl3_accept, ssl3_connect, tls1_get_method)
-
-IMPLEMENT_tls_meth_func(TLS1_1_VERSION, TLSv1_1_method,
-    ssl3_accept, ssl3_connect, tls1_get_method)
-
-IMPLEMENT_tls_meth_func(TLS1_VERSION, TLSv1_method,
-    ssl3_accept, ssl3_connect, tls1_get_method)
index 0122007..d38afc5 100644 (file)
 
 static const SSL_METHOD *tls1_get_server_method(int ver);
 
+const SSL_METHOD TLSv1_server_method_data = {
+       .version = TLS1_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl3_accept,
+       .ssl_connect = ssl_undefined_function,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = tls1_get_server_method,
+       .get_timeout = tls1_default_timeout,
+       .ssl3_enc = &TLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD TLSv1_1_server_method_data = {
+       .version = TLS1_1_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl3_accept,
+       .ssl_connect = ssl_undefined_function,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = tls1_get_server_method,
+       .get_timeout = tls1_default_timeout,
+       .ssl3_enc = &TLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD TLSv1_2_server_method_data = {
+       .version = TLS1_2_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl3_accept,
+       .ssl_connect = ssl_undefined_function,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = tls1_get_server_method,
+       .get_timeout = tls1_default_timeout,
+       .ssl3_enc = &TLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+TLSv1_server_method(void) 
+{
+       return &TLSv1_server_method_data; 
+}
+
+const SSL_METHOD *
+TLSv1_1_server_method(void) 
+{
+       return &TLSv1_1_server_method_data; 
+}
+
+const SSL_METHOD *
+TLSv1_2_server_method(void) 
+{
+       return &TLSv1_2_server_method_data; 
+}
+
 static const SSL_METHOD *
 tls1_get_server_method(int ver)
 {
@@ -77,12 +191,3 @@ tls1_get_server_method(int ver)
                return (TLSv1_server_method());
        return (NULL);
 }
-
-IMPLEMENT_tls_meth_func(TLS1_2_VERSION, TLSv1_2_server_method,
-    ssl3_accept, ssl_undefined_function, tls1_get_server_method)
-
-IMPLEMENT_tls_meth_func(TLS1_1_VERSION, TLSv1_1_server_method,
-    ssl3_accept, ssl_undefined_function, tls1_get_server_method)
-
-IMPLEMENT_tls_meth_func(TLS1_VERSION, TLSv1_server_method,
-    ssl3_accept, ssl_undefined_function, tls1_get_server_method)
index fc9d6a1..3a4656e 100644 (file)
@@ -575,155 +575,6 @@ extern SSL3_ENC_METHOD DTLSv1_enc_data;
 
 #define SSL_IS_DTLS(s) (s->method->version == DTLS1_VERSION)
 
-#define IMPLEMENT_tls_meth_func(version, func_name, s_accept, s_connect, \
-                               s_get_meth) \
-const SSL_METHOD *func_name(void)  \
-       { \
-       static const SSL_METHOD func_name##_data= { \
-               version, \
-               tls1_new, \
-               tls1_clear, \
-               tls1_free, \
-               s_accept, \
-               s_connect, \
-               ssl3_read, \
-               ssl3_peek, \
-               ssl3_write, \
-               ssl3_shutdown, \
-               ssl3_renegotiate, \
-               ssl3_renegotiate_check, \
-               ssl3_get_message, \
-               ssl3_read_bytes, \
-               ssl3_write_bytes, \
-               ssl3_dispatch_alert, \
-               ssl3_ctrl, \
-               ssl3_ctx_ctrl, \
-               ssl3_get_cipher_by_char, \
-               ssl3_put_cipher_by_char, \
-               ssl3_pending, \
-               ssl3_num_ciphers, \
-               ssl3_get_cipher, \
-               s_get_meth, \
-               tls1_default_timeout, \
-               &TLSv1_enc_data, \
-               ssl_undefined_void_function, \
-               ssl3_callback_ctrl, \
-               ssl3_ctx_callback_ctrl, \
-       }; \
-       return &func_name##_data; \
-       }
-
-#define IMPLEMENT_ssl3_meth_func(func_name, s_accept, s_connect, s_get_meth) \
-const SSL_METHOD *func_name(void)  \
-       { \
-       static const SSL_METHOD func_name##_data= { \
-               SSL3_VERSION, \
-               ssl3_new, \
-               ssl3_clear, \
-               ssl3_free, \
-               s_accept, \
-               s_connect, \
-               ssl3_read, \
-               ssl3_peek, \
-               ssl3_write, \
-               ssl3_shutdown, \
-               ssl3_renegotiate, \
-               ssl3_renegotiate_check, \
-               ssl3_get_message, \
-               ssl3_read_bytes, \
-               ssl3_write_bytes, \
-               ssl3_dispatch_alert, \
-               ssl3_ctrl, \
-               ssl3_ctx_ctrl, \
-               ssl3_get_cipher_by_char, \
-               ssl3_put_cipher_by_char, \
-               ssl3_pending, \
-               ssl3_num_ciphers, \
-               ssl3_get_cipher, \
-               s_get_meth, \
-               ssl3_default_timeout, \
-               &SSLv3_enc_data, \
-               ssl_undefined_void_function, \
-               ssl3_callback_ctrl, \
-               ssl3_ctx_callback_ctrl, \
-       }; \
-       return &func_name##_data; \
-       }
-
-#define IMPLEMENT_ssl23_meth_func(func_name, s_accept, s_connect, s_get_meth) \
-const SSL_METHOD *func_name(void)  \
-       { \
-       static const SSL_METHOD func_name##_data= { \
-       TLS1_2_VERSION, \
-       tls1_new, \
-       tls1_clear, \
-       tls1_free, \
-       s_accept, \
-       s_connect, \
-       ssl23_read, \
-       ssl23_peek, \
-       ssl23_write, \
-       ssl_undefined_function, \
-       ssl_undefined_function, \
-       ssl_ok, \
-       ssl3_get_message, \
-       ssl3_read_bytes, \
-       ssl3_write_bytes, \
-       ssl3_dispatch_alert, \
-       ssl3_ctrl, \
-       ssl3_ctx_ctrl, \
-       ssl23_get_cipher_by_char, \
-       ssl23_put_cipher_by_char, \
-       ssl_undefined_const_function, \
-       ssl23_num_ciphers, \
-       ssl23_get_cipher, \
-       s_get_meth, \
-       ssl23_default_timeout, \
-       &ssl3_undef_enc_method, \
-       ssl_undefined_void_function, \
-       ssl3_callback_ctrl, \
-       ssl3_ctx_callback_ctrl, \
-       }; \
-       return &func_name##_data; \
-       }
-
-#define IMPLEMENT_dtls1_meth_func(func_name, s_accept, s_connect, s_get_meth) \
-const SSL_METHOD *func_name(void)  \
-       { \
-       static const SSL_METHOD func_name##_data= { \
-               DTLS1_VERSION, \
-               dtls1_new, \
-               dtls1_clear, \
-               dtls1_free, \
-               s_accept, \
-               s_connect, \
-               ssl3_read, \
-               ssl3_peek, \
-               ssl3_write, \
-               dtls1_shutdown, \
-               ssl3_renegotiate, \
-               ssl3_renegotiate_check, \
-               dtls1_get_message, \
-               dtls1_read_bytes, \
-               dtls1_write_app_data_bytes, \
-               dtls1_dispatch_alert, \
-               dtls1_ctrl, \
-               ssl3_ctx_ctrl, \
-               ssl3_get_cipher_by_char, \
-               ssl3_put_cipher_by_char, \
-               ssl3_pending, \
-               ssl3_num_ciphers, \
-               dtls1_get_cipher, \
-               s_get_meth, \
-               dtls1_default_timeout, \
-               &DTLSv1_enc_data, \
-               ssl_undefined_void_function, \
-               ssl3_callback_ctrl, \
-               ssl3_ctx_callback_ctrl, \
-       }; \
-       return &func_name##_data; \
-       }
-
 void ssl_clear_cipher_ctx(SSL *s);
 int ssl_clear_bad_session(SSL *s);
 CERT *ssl_cert_new(void);
@@ -926,8 +777,6 @@ int dtls1_send_server_key_exchange(SSL *s);
 int dtls1_send_certificate_request(SSL *s);
 int dtls1_send_server_done(SSL *s);
 
-
-
 int ssl23_accept(SSL *s);
 int ssl23_connect(SSL *s);
 int ssl23_read_bytes(SSL *s, int n);
@@ -940,8 +789,8 @@ long tls1_ctrl(SSL *s, int cmd, long larg, void *parg);
 long tls1_callback_ctrl(SSL *s, int cmd, void (*fp)(void));
 
 int dtls1_new(SSL *s);
-int    dtls1_accept(SSL *s);
-int    dtls1_connect(SSL *s);
+int dtls1_accept(SSL *s);
+int dtls1_connect(SSL *s);
 void dtls1_free(SSL *s);
 void dtls1_clear(SSL *s);
 long dtls1_ctrl(SSL *s, int cmd, long larg, void *parg);
index 180843c..2223422 100644 (file)
 
 static const SSL_METHOD *tls1_get_client_method(int ver);
 
+const SSL_METHOD TLSv1_client_method_data = {
+       .version = TLS1_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl_undefined_function,
+       .ssl_connect = ssl3_connect,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = tls1_get_client_method,
+       .get_timeout = tls1_default_timeout,
+       .ssl3_enc = &TLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD TLSv1_1_client_method_data = {
+       .version = TLS1_1_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl_undefined_function,
+       .ssl_connect = ssl3_connect,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = tls1_get_client_method,
+       .get_timeout = tls1_default_timeout,
+       .ssl3_enc = &TLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD TLSv1_2_client_method_data = {
+       .version = TLS1_2_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl_undefined_function,
+       .ssl_connect = ssl3_connect,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = tls1_get_client_method,
+       .get_timeout = tls1_default_timeout,
+       .ssl3_enc = &TLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+TLSv1_client_method(void)
+{
+       return &TLSv1_client_method_data;
+}
+
+const SSL_METHOD *
+TLSv1_1_client_method(void)
+{
+       return &TLSv1_1_client_method_data;
+}
+
+const SSL_METHOD *
+TLSv1_2_client_method(void)
+{
+       return &TLSv1_2_client_method_data;
+}
+
 static const SSL_METHOD *
 tls1_get_client_method(int ver)
 {
@@ -76,12 +190,3 @@ tls1_get_client_method(int ver)
                return (TLSv1_client_method());
        return (NULL);
 }
-
-IMPLEMENT_tls_meth_func(TLS1_2_VERSION, TLSv1_2_client_method,
-    ssl_undefined_function, ssl3_connect, tls1_get_client_method)
-
-IMPLEMENT_tls_meth_func(TLS1_1_VERSION, TLSv1_1_client_method,
-    ssl_undefined_function, ssl3_connect, tls1_get_client_method)
-
-IMPLEMENT_tls_meth_func(TLS1_VERSION, TLSv1_client_method,
-    ssl_undefined_function, ssl3_connect, tls1_get_client_method)
index 49fe962..b39303b 100644 (file)
 #include <openssl/objects.h>
 #include "ssl_locl.h"
 
+static const SSL_METHOD *tls1_get_method(int ver);
+
+const SSL_METHOD TLSv1_method_data = {
+       .version = TLS1_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl3_accept,
+       .ssl_connect = ssl3_connect,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = tls1_get_method,
+       .get_timeout = tls1_default_timeout,
+       .ssl3_enc = &TLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD TLSv1_1_method_data = {
+       .version = TLS1_1_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl3_accept,
+       .ssl_connect = ssl3_connect,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = tls1_get_method,
+       .get_timeout = tls1_default_timeout,
+       .ssl3_enc = &TLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD TLSv1_2_method_data = {
+       .version = TLS1_2_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl3_accept,
+       .ssl_connect = ssl3_connect,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = tls1_get_method,
+       .get_timeout = tls1_default_timeout,
+       .ssl3_enc = &TLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+TLSv1_method(void) 
+{
+       return &TLSv1_method_data; 
+}
+
+const SSL_METHOD *
+TLSv1_1_method(void) 
+{
+       return &TLSv1_1_method_data; 
+}
+
+const SSL_METHOD *
+TLSv1_2_method(void) 
+{
+       return &TLSv1_2_method_data; 
+}
+
 static const SSL_METHOD *
 tls1_get_method(int ver)
 {
@@ -71,12 +187,3 @@ tls1_get_method(int ver)
                return (TLSv1_method());
        return (NULL);
 }
-
-IMPLEMENT_tls_meth_func(TLS1_2_VERSION, TLSv1_2_method,
-    ssl3_accept, ssl3_connect, tls1_get_method)
-
-IMPLEMENT_tls_meth_func(TLS1_1_VERSION, TLSv1_1_method,
-    ssl3_accept, ssl3_connect, tls1_get_method)
-
-IMPLEMENT_tls_meth_func(TLS1_VERSION, TLSv1_method,
-    ssl3_accept, ssl3_connect, tls1_get_method)
index 0122007..d38afc5 100644 (file)
 
 static const SSL_METHOD *tls1_get_server_method(int ver);
 
+const SSL_METHOD TLSv1_server_method_data = {
+       .version = TLS1_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl3_accept,
+       .ssl_connect = ssl_undefined_function,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = tls1_get_server_method,
+       .get_timeout = tls1_default_timeout,
+       .ssl3_enc = &TLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD TLSv1_1_server_method_data = {
+       .version = TLS1_1_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl3_accept,
+       .ssl_connect = ssl_undefined_function,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = tls1_get_server_method,
+       .get_timeout = tls1_default_timeout,
+       .ssl3_enc = &TLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD TLSv1_2_server_method_data = {
+       .version = TLS1_2_VERSION,
+       .ssl_new = tls1_new,
+       .ssl_clear = tls1_clear,
+       .ssl_free = tls1_free,
+       .ssl_accept = ssl3_accept,
+       .ssl_connect = ssl_undefined_function,
+       .ssl_read = ssl3_read,
+       .ssl_peek = ssl3_peek,
+       .ssl_write = ssl3_write,
+       .ssl_shutdown = ssl3_shutdown,
+       .ssl_renegotiate = ssl3_renegotiate,
+       .ssl_renegotiate_check = ssl3_renegotiate_check,
+       .ssl_get_message = ssl3_get_message,
+       .ssl_read_bytes = ssl3_read_bytes,
+       .ssl_write_bytes = ssl3_write_bytes,
+       .ssl_dispatch_alert = ssl3_dispatch_alert,
+       .ssl_ctrl = ssl3_ctrl,
+       .ssl_ctx_ctrl = ssl3_ctx_ctrl,
+       .get_cipher_by_char = ssl3_get_cipher_by_char,
+       .put_cipher_by_char = ssl3_put_cipher_by_char,
+       .ssl_pending = ssl3_pending,
+       .num_ciphers = ssl3_num_ciphers,
+       .get_cipher = ssl3_get_cipher,
+       .get_ssl_method = tls1_get_server_method,
+       .get_timeout = tls1_default_timeout,
+       .ssl3_enc = &TLSv1_enc_data,
+       .ssl_version = ssl_undefined_void_function,
+       .ssl_callback_ctrl = ssl3_callback_ctrl,
+       .ssl_ctx_callback_ctrl = ssl3_ctx_callback_ctrl,
+};
+
+const SSL_METHOD *
+TLSv1_server_method(void) 
+{
+       return &TLSv1_server_method_data; 
+}
+
+const SSL_METHOD *
+TLSv1_1_server_method(void) 
+{
+       return &TLSv1_1_server_method_data; 
+}
+
+const SSL_METHOD *
+TLSv1_2_server_method(void) 
+{
+       return &TLSv1_2_server_method_data; 
+}
+
 static const SSL_METHOD *
 tls1_get_server_method(int ver)
 {
@@ -77,12 +191,3 @@ tls1_get_server_method(int ver)
                return (TLSv1_server_method());
        return (NULL);
 }
-
-IMPLEMENT_tls_meth_func(TLS1_2_VERSION, TLSv1_2_server_method,
-    ssl3_accept, ssl_undefined_function, tls1_get_server_method)
-
-IMPLEMENT_tls_meth_func(TLS1_1_VERSION, TLSv1_1_server_method,
-    ssl3_accept, ssl_undefined_function, tls1_get_server_method)
-
-IMPLEMENT_tls_meth_func(TLS1_VERSION, TLSv1_server_method,
-    ssl3_accept, ssl_undefined_function, tls1_get_server_method)