From: jsing Date: Sat, 24 May 2014 12:44:48 +0000 (+0000) Subject: DeIMPLEMENT libssl. Expand the IMPLEMENT_* macros since it is far more X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5f7556c6deb671241ce8dce34913485502ac6888;p=openbsd DeIMPLEMENT libssl. Expand the IMPLEMENT_* macros since it is far more 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...) --- diff --git a/lib/libssl/d1_clnt.c b/lib/libssl/d1_clnt.c index 8967879f70b..8f304a75ff8 100644 --- a/lib/libssl/d1_clnt.c +++ b/lib/libssl/d1_clnt.c @@ -128,6 +128,44 @@ 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) { diff --git a/lib/libssl/d1_meth.c b/lib/libssl/d1_meth.c index 1140da6825e..5e4bf0230c9 100644 --- a/lib/libssl/d1_meth.c +++ b/lib/libssl/d1_meth.c @@ -62,6 +62,45 @@ #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) diff --git a/lib/libssl/d1_srvr.c b/lib/libssl/d1_srvr.c index 6183815a6d1..2c22a25bce0 100644 --- a/lib/libssl/d1_srvr.c +++ b/lib/libssl/d1_srvr.c @@ -129,6 +129,44 @@ 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) { diff --git a/lib/libssl/s23_clnt.c b/lib/libssl/s23_clnt.c index 293b1e5da26..897ac7efe3b 100644 --- a/lib/libssl/s23_clnt.c +++ b/lib/libssl/s23_clnt.c @@ -119,6 +119,45 @@ 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) { diff --git a/lib/libssl/s23_srvr.c b/lib/libssl/s23_srvr.c index 1f17c19c06d..94e669ae141 100644 --- a/lib/libssl/s23_srvr.c +++ b/lib/libssl/s23_srvr.c @@ -118,6 +118,45 @@ 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) { diff --git a/lib/libssl/s3_clnt.c b/lib/libssl/s3_clnt.c index 010f9e4e12f..16d5dacfc4a 100644 --- a/lib/libssl/s3_clnt.c +++ b/lib/libssl/s3_clnt.c @@ -166,6 +166,44 @@ 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) { diff --git a/lib/libssl/s3_srvr.c b/lib/libssl/s3_srvr.c index ff86ec3f1a5..6f788cd0807 100644 --- a/lib/libssl/s3_srvr.c +++ b/lib/libssl/s3_srvr.c @@ -167,6 +167,44 @@ 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) { diff --git a/lib/libssl/src/ssl/d1_clnt.c b/lib/libssl/src/ssl/d1_clnt.c index 8967879f70b..8f304a75ff8 100644 --- a/lib/libssl/src/ssl/d1_clnt.c +++ b/lib/libssl/src/ssl/d1_clnt.c @@ -128,6 +128,44 @@ 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) { diff --git a/lib/libssl/src/ssl/d1_meth.c b/lib/libssl/src/ssl/d1_meth.c index 1140da6825e..5e4bf0230c9 100644 --- a/lib/libssl/src/ssl/d1_meth.c +++ b/lib/libssl/src/ssl/d1_meth.c @@ -62,6 +62,45 @@ #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) diff --git a/lib/libssl/src/ssl/d1_srvr.c b/lib/libssl/src/ssl/d1_srvr.c index 6183815a6d1..2c22a25bce0 100644 --- a/lib/libssl/src/ssl/d1_srvr.c +++ b/lib/libssl/src/ssl/d1_srvr.c @@ -129,6 +129,44 @@ 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) { diff --git a/lib/libssl/src/ssl/s23_clnt.c b/lib/libssl/src/ssl/s23_clnt.c index 293b1e5da26..897ac7efe3b 100644 --- a/lib/libssl/src/ssl/s23_clnt.c +++ b/lib/libssl/src/ssl/s23_clnt.c @@ -119,6 +119,45 @@ 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) { diff --git a/lib/libssl/src/ssl/s23_meth.c b/lib/libssl/src/ssl/s23_meth.c index d19d96a9b7e..f26faf296ea 100644 --- a/lib/libssl/src/ssl/s23_meth.c +++ b/lib/libssl/src/ssl/s23_meth.c @@ -61,6 +61,45 @@ #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) - diff --git a/lib/libssl/src/ssl/s23_srvr.c b/lib/libssl/src/ssl/s23_srvr.c index 1f17c19c06d..94e669ae141 100644 --- a/lib/libssl/src/ssl/s23_srvr.c +++ b/lib/libssl/src/ssl/s23_srvr.c @@ -118,6 +118,45 @@ 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) { diff --git a/lib/libssl/src/ssl/s3_clnt.c b/lib/libssl/src/ssl/s3_clnt.c index 010f9e4e12f..16d5dacfc4a 100644 --- a/lib/libssl/src/ssl/s3_clnt.c +++ b/lib/libssl/src/ssl/s3_clnt.c @@ -166,6 +166,44 @@ 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) { diff --git a/lib/libssl/src/ssl/s3_meth.c b/lib/libssl/src/ssl/s3_meth.c index b6d6771a21c..04a72d99d33 100644 --- a/lib/libssl/src/ssl/s3_meth.c +++ b/lib/libssl/src/ssl/s3_meth.c @@ -61,6 +61,45 @@ #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) - diff --git a/lib/libssl/src/ssl/s3_srvr.c b/lib/libssl/src/ssl/s3_srvr.c index ff86ec3f1a5..6f788cd0807 100644 --- a/lib/libssl/src/ssl/s3_srvr.c +++ b/lib/libssl/src/ssl/s3_srvr.c @@ -167,6 +167,44 @@ 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) { diff --git a/lib/libssl/src/ssl/ssl_locl.h b/lib/libssl/src/ssl/ssl_locl.h index fc9d6a10271..3a4656ef622 100644 --- a/lib/libssl/src/ssl/ssl_locl.h +++ b/lib/libssl/src/ssl/ssl_locl.h @@ -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); diff --git a/lib/libssl/src/ssl/t1_clnt.c b/lib/libssl/src/ssl/t1_clnt.c index 180843c1f53..2223422d93a 100644 --- a/lib/libssl/src/ssl/t1_clnt.c +++ b/lib/libssl/src/ssl/t1_clnt.c @@ -65,6 +65,120 @@ 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) diff --git a/lib/libssl/src/ssl/t1_meth.c b/lib/libssl/src/ssl/t1_meth.c index 49fe9624a28..b39303b369f 100644 --- a/lib/libssl/src/ssl/t1_meth.c +++ b/lib/libssl/src/ssl/t1_meth.c @@ -60,6 +60,122 @@ #include #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) diff --git a/lib/libssl/src/ssl/t1_srvr.c b/lib/libssl/src/ssl/t1_srvr.c index 01220072f1a..d38afc5a21c 100644 --- a/lib/libssl/src/ssl/t1_srvr.c +++ b/lib/libssl/src/ssl/t1_srvr.c @@ -66,6 +66,120 @@ 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) diff --git a/lib/libssl/ssl_locl.h b/lib/libssl/ssl_locl.h index fc9d6a10271..3a4656ef622 100644 --- a/lib/libssl/ssl_locl.h +++ b/lib/libssl/ssl_locl.h @@ -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); diff --git a/lib/libssl/t1_clnt.c b/lib/libssl/t1_clnt.c index 180843c1f53..2223422d93a 100644 --- a/lib/libssl/t1_clnt.c +++ b/lib/libssl/t1_clnt.c @@ -65,6 +65,120 @@ 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) diff --git a/lib/libssl/t1_meth.c b/lib/libssl/t1_meth.c index 49fe9624a28..b39303b369f 100644 --- a/lib/libssl/t1_meth.c +++ b/lib/libssl/t1_meth.c @@ -60,6 +60,122 @@ #include #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) diff --git a/lib/libssl/t1_srvr.c b/lib/libssl/t1_srvr.c index 01220072f1a..d38afc5a21c 100644 --- a/lib/libssl/t1_srvr.c +++ b/lib/libssl/t1_srvr.c @@ -66,6 +66,120 @@ 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)