Nuke ssl_pending/ssl_shutdown function pointers.
authorjsing <jsing@openbsd.org>
Thu, 30 Aug 2018 16:56:16 +0000 (16:56 +0000)
committerjsing <jsing@openbsd.org>
Thu, 30 Aug 2018 16:56:16 +0000 (16:56 +0000)
ssl3_pending() is used for all protocols and dtls1_shutdown() just calls
ssl3_shutdown(), so just call the appropriate function directly instead.

ok beck@ inoguchi@ tb@

lib/libssl/d1_both.c
lib/libssl/d1_clnt.c
lib/libssl/d1_meth.c
lib/libssl/d1_srvr.c
lib/libssl/ssl_lib.c
lib/libssl/ssl_locl.h
lib/libssl/t1_clnt.c
lib/libssl/t1_meth.c
lib/libssl/t1_srvr.c

index 0747021..0c436f1 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: d1_both.c,v 1.53 2018/08/27 16:56:46 jsing Exp $ */
+/* $OpenBSD: d1_both.c,v 1.54 2018/08/30 16:56:16 jsing Exp $ */
 /*
  * DTLS implementation written by Nagendra Modadugu
  * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -1253,12 +1253,3 @@ dtls1_get_ccs_header(unsigned char *data, struct ccs_header_st *ccs_hdr)
 
        ccs_hdr->type = *(data++);
 }
-
-int
-dtls1_shutdown(SSL *s)
-{
-       int ret;
-
-       ret = ssl3_shutdown(s);
-       return ret;
-}
index ee0e620..8f60f4a 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: d1_clnt.c,v 1.80 2018/04/07 17:02:34 jsing Exp $ */
+/* $OpenBSD: d1_clnt.c,v 1.81 2018/08/30 16:56:16 jsing Exp $ */
 /*
  * DTLS implementation written by Nagendra Modadugu
  * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -136,8 +136,6 @@ static const SSL_METHOD_INTERNAL DTLSv1_client_method_internal_data = {
        .ssl_free = dtls1_free,
        .ssl_accept = ssl_undefined_function,
        .ssl_connect = ssl3_connect,
-       .ssl_shutdown = dtls1_shutdown,
-       .ssl_pending = ssl3_pending,
        .get_ssl_method = dtls1_get_client_method,
        .get_timeout = dtls1_default_timeout,
        .ssl_version = ssl_undefined_void_function,
index d2e8a3b..e157dc4 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: d1_meth.c,v 1.16 2018/04/07 17:02:34 jsing Exp $ */
+/* $OpenBSD: d1_meth.c,v 1.17 2018/08/30 16:56:16 jsing Exp $ */
 /*
  * DTLS implementation written by Nagendra Modadugu
  * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -74,8 +74,6 @@ static const SSL_METHOD_INTERNAL DTLSv1_method_internal_data = {
        .ssl_free = dtls1_free,
        .ssl_accept = ssl3_accept,
        .ssl_connect = ssl3_connect,
-       .ssl_shutdown = dtls1_shutdown,
-       .ssl_pending = ssl3_pending,
        .get_ssl_method = dtls1_get_method,
        .get_timeout = dtls1_default_timeout,
        .ssl_version = ssl_undefined_void_function,
index 4217519..c0ee0d0 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: d1_srvr.c,v 1.93 2018/08/24 17:30:32 jsing Exp $ */
+/* $OpenBSD: d1_srvr.c,v 1.94 2018/08/30 16:56:16 jsing Exp $ */
 /*
  * DTLS implementation written by Nagendra Modadugu
  * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -134,8 +134,6 @@ static const SSL_METHOD_INTERNAL DTLSv1_server_method_internal_data = {
        .ssl_free = dtls1_free,
        .ssl_accept = ssl3_accept,
        .ssl_connect = ssl_undefined_function,
-       .ssl_shutdown = dtls1_shutdown,
-       .ssl_pending = ssl3_pending,
        .get_ssl_method = dtls1_get_server_method,
        .get_timeout = dtls1_default_timeout,
        .ssl_version = ssl_undefined_void_function,
index 0dbc7b3..938139e 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl_lib.c,v 1.186 2018/08/24 20:30:21 tb Exp $ */
+/* $OpenBSD: ssl_lib.c,v 1.187 2018/08/30 16:56:16 jsing Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -809,7 +809,7 @@ SSL_pending(const SSL *s)
         * (Note that SSL_pending() is often used as a boolean value,
         * so we'd better not return -1.)
         */
-       return (s->method->internal->ssl_pending(s));
+       return (ssl3_pending(s));
 }
 
 X509 *
@@ -1015,10 +1015,10 @@ SSL_shutdown(SSL *s)
                return (-1);
        }
 
-       if ((s != NULL) && !SSL_in_init(s))
-               return (s->method->internal->ssl_shutdown(s));
-       else
-               return (1);
+       if (s != NULL && !SSL_in_init(s))
+               return (ssl3_shutdown(s));
+
+       return (1);
 }
 
 int
index 2592d56..b6d7149 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl_locl.h,v 1.211 2018/08/27 17:11:32 jsing Exp $ */
+/* $OpenBSD: ssl_locl.h,v 1.212 2018/08/30 16:56:16 jsing Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -379,7 +379,6 @@ typedef struct ssl_method_internal_st {
 
        int (*ssl_accept)(SSL *s);
        int (*ssl_connect)(SSL *s);
-       int (*ssl_shutdown)(SSL *s);
 
        int (*ssl_renegotiate)(SSL *s);
        int (*ssl_renegotiate_check)(SSL *s);
@@ -390,7 +389,6 @@ typedef struct ssl_method_internal_st {
            int len, int peek);
        int (*ssl_write_bytes)(SSL *s, int type, const void *buf_, int len);
 
-       int (*ssl_pending)(const SSL *s);
        const struct ssl_method_st *(*get_ssl_method)(int version);
 
        long (*get_timeout)(void);
@@ -1221,7 +1219,6 @@ int dtls1_new(SSL *s);
 void dtls1_free(SSL *s);
 void dtls1_clear(SSL *s);
 long dtls1_ctrl(SSL *s, int cmd, long larg, void *parg);
-int dtls1_shutdown(SSL *s);
 
 long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok);
 int dtls1_get_record(SSL *s);
index 90188e0..4e3b208 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: t1_clnt.c,v 1.25 2018/04/07 17:02:34 jsing Exp $ */
+/* $OpenBSD: t1_clnt.c,v 1.26 2018/08/30 16:56:16 jsing Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -73,8 +73,6 @@ static const SSL_METHOD_INTERNAL TLS_client_method_internal_data = {
        .ssl_free = tls1_free,
        .ssl_accept = ssl_undefined_function,
        .ssl_connect = ssl3_connect,
-       .ssl_shutdown = ssl3_shutdown,
-       .ssl_pending = ssl3_pending,
        .get_ssl_method = tls1_get_client_method,
        .get_timeout = tls1_default_timeout,
        .ssl_version = ssl_undefined_void_function,
@@ -104,8 +102,6 @@ static const SSL_METHOD_INTERNAL TLSv1_client_method_internal_data = {
        .ssl_free = tls1_free,
        .ssl_accept = ssl_undefined_function,
        .ssl_connect = ssl3_connect,
-       .ssl_shutdown = ssl3_shutdown,
-       .ssl_pending = ssl3_pending,
        .get_ssl_method = tls1_get_client_method,
        .get_timeout = tls1_default_timeout,
        .ssl_version = ssl_undefined_void_function,
@@ -135,8 +131,6 @@ static const SSL_METHOD_INTERNAL TLSv1_1_client_method_internal_data = {
        .ssl_free = tls1_free,
        .ssl_accept = ssl_undefined_function,
        .ssl_connect = ssl3_connect,
-       .ssl_shutdown = ssl3_shutdown,
-       .ssl_pending = ssl3_pending,
        .get_ssl_method = tls1_get_client_method,
        .get_timeout = tls1_default_timeout,
        .ssl_version = ssl_undefined_void_function,
@@ -166,8 +160,6 @@ static const SSL_METHOD_INTERNAL TLSv1_2_client_method_internal_data = {
        .ssl_free = tls1_free,
        .ssl_accept = ssl_undefined_function,
        .ssl_connect = ssl3_connect,
-       .ssl_shutdown = ssl3_shutdown,
-       .ssl_pending = ssl3_pending,
        .get_ssl_method = tls1_get_client_method,
        .get_timeout = tls1_default_timeout,
        .ssl_version = ssl_undefined_void_function,
index 2e76c09..5ce8c91 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: t1_meth.c,v 1.24 2018/04/07 17:02:34 jsing Exp $ */
+/* $OpenBSD: t1_meth.c,v 1.25 2018/08/30 16:56:16 jsing Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -73,8 +73,6 @@ static const SSL_METHOD_INTERNAL TLS_method_internal_data = {
        .ssl_free = tls1_free,
        .ssl_accept = ssl3_accept,
        .ssl_connect = ssl3_connect,
-       .ssl_shutdown = ssl3_shutdown,
-       .ssl_pending = ssl3_pending,
        .get_ssl_method = tls1_get_method,
        .get_timeout = tls1_default_timeout,
        .ssl_version = ssl_undefined_void_function,
@@ -104,8 +102,6 @@ static const SSL_METHOD_INTERNAL TLSv1_method_internal_data = {
        .ssl_free = tls1_free,
        .ssl_accept = ssl3_accept,
        .ssl_connect = ssl3_connect,
-       .ssl_shutdown = ssl3_shutdown,
-       .ssl_pending = ssl3_pending,
        .get_ssl_method = tls1_get_method,
        .get_timeout = tls1_default_timeout,
        .ssl_version = ssl_undefined_void_function,
@@ -135,8 +131,6 @@ static const SSL_METHOD_INTERNAL TLSv1_1_method_internal_data = {
        .ssl_free = tls1_free,
        .ssl_accept = ssl3_accept,
        .ssl_connect = ssl3_connect,
-       .ssl_shutdown = ssl3_shutdown,
-       .ssl_pending = ssl3_pending,
        .get_ssl_method = tls1_get_method,
        .get_timeout = tls1_default_timeout,
        .ssl_version = ssl_undefined_void_function,
@@ -166,8 +160,6 @@ static const SSL_METHOD_INTERNAL TLSv1_2_method_internal_data = {
        .ssl_free = tls1_free,
        .ssl_accept = ssl3_accept,
        .ssl_connect = ssl3_connect,
-       .ssl_shutdown = ssl3_shutdown,
-       .ssl_pending = ssl3_pending,
        .get_ssl_method = tls1_get_method,
        .get_timeout = tls1_default_timeout,
        .ssl_version = ssl_undefined_void_function,
index c8b6508..02c5cf4 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: t1_srvr.c,v 1.26 2018/04/07 17:02:34 jsing Exp $ */
+/* $OpenBSD: t1_srvr.c,v 1.27 2018/08/30 16:56:16 jsing Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -74,8 +74,6 @@ static const SSL_METHOD_INTERNAL TLS_server_method_internal_data = {
        .ssl_free = tls1_free,
        .ssl_accept = ssl3_accept,
        .ssl_connect = ssl_undefined_function,
-       .ssl_shutdown = ssl3_shutdown,
-       .ssl_pending = ssl3_pending,
        .get_ssl_method = tls1_get_server_method,
        .get_timeout = tls1_default_timeout,
        .ssl_version = ssl_undefined_void_function,
@@ -105,8 +103,6 @@ static const SSL_METHOD_INTERNAL TLSv1_server_method_internal_data = {
        .ssl_free = tls1_free,
        .ssl_accept = ssl3_accept,
        .ssl_connect = ssl_undefined_function,
-       .ssl_shutdown = ssl3_shutdown,
-       .ssl_pending = ssl3_pending,
        .get_ssl_method = tls1_get_server_method,
        .get_timeout = tls1_default_timeout,
        .ssl_version = ssl_undefined_void_function,
@@ -136,8 +132,6 @@ static const SSL_METHOD_INTERNAL TLSv1_1_server_method_internal_data = {
        .ssl_free = tls1_free,
        .ssl_accept = ssl3_accept,
        .ssl_connect = ssl_undefined_function,
-       .ssl_shutdown = ssl3_shutdown,
-       .ssl_pending = ssl3_pending,
        .get_ssl_method = tls1_get_server_method,
        .get_timeout = tls1_default_timeout,
        .ssl_version = ssl_undefined_void_function,
@@ -167,8 +161,6 @@ static const SSL_METHOD_INTERNAL TLSv1_2_server_method_internal_data = {
        .ssl_free = tls1_free,
        .ssl_accept = ssl3_accept,
        .ssl_connect = ssl_undefined_function,
-       .ssl_shutdown = ssl3_shutdown,
-       .ssl_pending = ssl3_pending,
        .get_ssl_method = tls1_get_server_method,
        .get_timeout = tls1_default_timeout,
        .ssl_version = ssl_undefined_void_function,