From: jsing Date: Thu, 30 Aug 2018 16:56:16 +0000 (+0000) Subject: Nuke ssl_pending/ssl_shutdown function pointers. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=364ba4a4e82c3433ff7ff4a1b8ceb7c4d2c54e72;p=openbsd Nuke ssl_pending/ssl_shutdown function pointers. 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@ --- diff --git a/lib/libssl/d1_both.c b/lib/libssl/d1_both.c index 074702153c8..0c436f1f319 100644 --- a/lib/libssl/d1_both.c +++ b/lib/libssl/d1_both.c @@ -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; -} diff --git a/lib/libssl/d1_clnt.c b/lib/libssl/d1_clnt.c index ee0e620ad80..8f60f4a8c48 100644 --- a/lib/libssl/d1_clnt.c +++ b/lib/libssl/d1_clnt.c @@ -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, diff --git a/lib/libssl/d1_meth.c b/lib/libssl/d1_meth.c index d2e8a3be60a..e157dc4d930 100644 --- a/lib/libssl/d1_meth.c +++ b/lib/libssl/d1_meth.c @@ -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, diff --git a/lib/libssl/d1_srvr.c b/lib/libssl/d1_srvr.c index 42175197834..c0ee0d00aa8 100644 --- a/lib/libssl/d1_srvr.c +++ b/lib/libssl/d1_srvr.c @@ -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, diff --git a/lib/libssl/ssl_lib.c b/lib/libssl/ssl_lib.c index 0dbc7b37071..938139e18ed 100644 --- a/lib/libssl/ssl_lib.c +++ b/lib/libssl/ssl_lib.c @@ -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 diff --git a/lib/libssl/ssl_locl.h b/lib/libssl/ssl_locl.h index 2592d56a613..b6d71492fd0 100644 --- a/lib/libssl/ssl_locl.h +++ b/lib/libssl/ssl_locl.h @@ -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); diff --git a/lib/libssl/t1_clnt.c b/lib/libssl/t1_clnt.c index 90188e0ec34..4e3b208743a 100644 --- a/lib/libssl/t1_clnt.c +++ b/lib/libssl/t1_clnt.c @@ -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, diff --git a/lib/libssl/t1_meth.c b/lib/libssl/t1_meth.c index 2e76c09e5c4..5ce8c9135b7 100644 --- a/lib/libssl/t1_meth.c +++ b/lib/libssl/t1_meth.c @@ -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, diff --git a/lib/libssl/t1_srvr.c b/lib/libssl/t1_srvr.c index c8b65086dc5..02c5cf46aeb 100644 --- a/lib/libssl/t1_srvr.c +++ b/lib/libssl/t1_srvr.c @@ -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,