From 73eacd1b7e620743c0e0bdba0989d0acfb9e5afa Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Sat, 7 Apr 2018 17:02:35 +0000 Subject: Remove function pointers for ssl_{read,write,peek}. Now that everything goes through the same code path, we can remove a layer of indirection and just call ssl3_{read,write,peek} directly. ok beck@ inoguchi@ --- lib/libssl/d1_clnt.c | 5 +---- lib/libssl/d1_meth.c | 5 +---- lib/libssl/d1_srvr.c | 5 +---- lib/libssl/ssl_lib.c | 8 ++++---- lib/libssl/ssl_locl.h | 5 +---- lib/libssl/t1_clnt.c | 14 +------------- lib/libssl/t1_meth.c | 14 +------------- lib/libssl/t1_srvr.c | 14 +------------- 8 files changed, 11 insertions(+), 59 deletions(-) diff --git a/lib/libssl/d1_clnt.c b/lib/libssl/d1_clnt.c index f3a7e5ff22a..ee0e620ad80 100644 --- a/lib/libssl/d1_clnt.c +++ b/lib/libssl/d1_clnt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: d1_clnt.c,v 1.79 2017/10/10 15:13:26 jsing Exp $ */ +/* $OpenBSD: d1_clnt.c,v 1.80 2018/04/07 17:02:34 jsing Exp $ */ /* * DTLS implementation written by Nagendra Modadugu * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. @@ -136,9 +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_read = ssl3_read, - .ssl_peek = ssl3_peek, - .ssl_write = ssl3_write, .ssl_shutdown = dtls1_shutdown, .ssl_pending = ssl3_pending, .get_ssl_method = dtls1_get_client_method, diff --git a/lib/libssl/d1_meth.c b/lib/libssl/d1_meth.c index 9ecca0027cb..d2e8a3be60a 100644 --- a/lib/libssl/d1_meth.c +++ b/lib/libssl/d1_meth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: d1_meth.c,v 1.15 2017/10/12 15:52:50 jsing Exp $ */ +/* $OpenBSD: d1_meth.c,v 1.16 2018/04/07 17:02:34 jsing Exp $ */ /* * DTLS implementation written by Nagendra Modadugu * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. @@ -74,9 +74,6 @@ static const SSL_METHOD_INTERNAL DTLSv1_method_internal_data = { .ssl_free = dtls1_free, .ssl_accept = ssl3_accept, .ssl_connect = ssl3_connect, - .ssl_read = ssl3_read, - .ssl_peek = ssl3_peek, - .ssl_write = ssl3_write, .ssl_shutdown = dtls1_shutdown, .ssl_pending = ssl3_pending, .get_ssl_method = dtls1_get_method, diff --git a/lib/libssl/d1_srvr.c b/lib/libssl/d1_srvr.c index 57b8ea0e24a..3de0a72f27a 100644 --- a/lib/libssl/d1_srvr.c +++ b/lib/libssl/d1_srvr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: d1_srvr.c,v 1.91 2017/10/12 15:52:50 jsing Exp $ */ +/* $OpenBSD: d1_srvr.c,v 1.92 2018/04/07 17:02:34 jsing Exp $ */ /* * DTLS implementation written by Nagendra Modadugu * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. @@ -134,9 +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_read = ssl3_read, - .ssl_peek = ssl3_peek, - .ssl_write = ssl3_write, .ssl_shutdown = dtls1_shutdown, .ssl_pending = ssl3_pending, .get_ssl_method = dtls1_get_server_method, diff --git a/lib/libssl/ssl_lib.c b/lib/libssl/ssl_lib.c index 573e63c934a..30aea263f66 100644 --- a/lib/libssl/ssl_lib.c +++ b/lib/libssl/ssl_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_lib.c,v 1.182 2018/03/17 16:20:01 beck Exp $ */ +/* $OpenBSD: ssl_lib.c,v 1.183 2018/04/07 17:02:34 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -964,7 +964,7 @@ SSL_read(SSL *s, void *buf, int num) s->internal->rwstate = SSL_NOTHING; return (0); } - return (s->method->internal->ssl_read(s, buf, num)); + return ssl3_read(s, buf, num); } int @@ -978,7 +978,7 @@ SSL_peek(SSL *s, void *buf, int num) if (s->internal->shutdown & SSL_RECEIVED_SHUTDOWN) { return (0); } - return (s->method->internal->ssl_peek(s, buf, num)); + return ssl3_peek(s, buf, num); } int @@ -994,7 +994,7 @@ SSL_write(SSL *s, const void *buf, int num) SSLerror(s, SSL_R_PROTOCOL_IS_SHUTDOWN); return (-1); } - return (s->method->internal->ssl_write(s, buf, num)); + return ssl3_write(s, buf, num); } int diff --git a/lib/libssl/ssl_locl.h b/lib/libssl/ssl_locl.h index 64c68e324f8..1677377c642 100644 --- a/lib/libssl/ssl_locl.h +++ b/lib/libssl/ssl_locl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_locl.h,v 1.203 2018/04/07 16:55:13 jsing Exp $ */ +/* $OpenBSD: ssl_locl.h,v 1.204 2018/04/07 17:02:34 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -385,9 +385,6 @@ typedef struct ssl_method_internal_st { int (*ssl_accept)(SSL *s); int (*ssl_connect)(SSL *s); - int (*ssl_read)(SSL *s, void *buf, int len); - int (*ssl_peek)(SSL *s, void *buf, int len); - int (*ssl_write)(SSL *s, const void *buf, int len); int (*ssl_shutdown)(SSL *s); int (*ssl_renegotiate)(SSL *s); diff --git a/lib/libssl/t1_clnt.c b/lib/libssl/t1_clnt.c index 92b5efb11a2..90188e0ec34 100644 --- a/lib/libssl/t1_clnt.c +++ b/lib/libssl/t1_clnt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: t1_clnt.c,v 1.24 2017/01/26 05:31:25 jsing Exp $ */ +/* $OpenBSD: t1_clnt.c,v 1.25 2018/04/07 17:02:34 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -73,9 +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_read = ssl3_read, - .ssl_peek = ssl3_peek, - .ssl_write = ssl3_write, .ssl_shutdown = ssl3_shutdown, .ssl_pending = ssl3_pending, .get_ssl_method = tls1_get_client_method, @@ -107,9 +104,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_read = ssl3_read, - .ssl_peek = ssl3_peek, - .ssl_write = ssl3_write, .ssl_shutdown = ssl3_shutdown, .ssl_pending = ssl3_pending, .get_ssl_method = tls1_get_client_method, @@ -141,9 +135,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_read = ssl3_read, - .ssl_peek = ssl3_peek, - .ssl_write = ssl3_write, .ssl_shutdown = ssl3_shutdown, .ssl_pending = ssl3_pending, .get_ssl_method = tls1_get_client_method, @@ -175,9 +166,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_read = ssl3_read, - .ssl_peek = ssl3_peek, - .ssl_write = ssl3_write, .ssl_shutdown = ssl3_shutdown, .ssl_pending = ssl3_pending, .get_ssl_method = tls1_get_client_method, diff --git a/lib/libssl/t1_meth.c b/lib/libssl/t1_meth.c index 6a4a243b9df..2e76c09e5c4 100644 --- a/lib/libssl/t1_meth.c +++ b/lib/libssl/t1_meth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: t1_meth.c,v 1.23 2017/01/26 05:31:25 jsing Exp $ */ +/* $OpenBSD: t1_meth.c,v 1.24 2018/04/07 17:02:34 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -73,9 +73,6 @@ static const SSL_METHOD_INTERNAL TLS_method_internal_data = { .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_pending = ssl3_pending, .get_ssl_method = tls1_get_method, @@ -107,9 +104,6 @@ static const SSL_METHOD_INTERNAL TLSv1_method_internal_data = { .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_pending = ssl3_pending, .get_ssl_method = tls1_get_method, @@ -141,9 +135,6 @@ static const SSL_METHOD_INTERNAL TLSv1_1_method_internal_data = { .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_pending = ssl3_pending, .get_ssl_method = tls1_get_method, @@ -175,9 +166,6 @@ static const SSL_METHOD_INTERNAL TLSv1_2_method_internal_data = { .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_pending = ssl3_pending, .get_ssl_method = tls1_get_method, diff --git a/lib/libssl/t1_srvr.c b/lib/libssl/t1_srvr.c index 1fc0ebe6f74..c8b65086dc5 100644 --- a/lib/libssl/t1_srvr.c +++ b/lib/libssl/t1_srvr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: t1_srvr.c,v 1.25 2017/01/26 05:31:25 jsing Exp $ */ +/* $OpenBSD: t1_srvr.c,v 1.26 2018/04/07 17:02:34 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -74,9 +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_read = ssl3_read, - .ssl_peek = ssl3_peek, - .ssl_write = ssl3_write, .ssl_shutdown = ssl3_shutdown, .ssl_pending = ssl3_pending, .get_ssl_method = tls1_get_server_method, @@ -108,9 +105,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_read = ssl3_read, - .ssl_peek = ssl3_peek, - .ssl_write = ssl3_write, .ssl_shutdown = ssl3_shutdown, .ssl_pending = ssl3_pending, .get_ssl_method = tls1_get_server_method, @@ -142,9 +136,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_read = ssl3_read, - .ssl_peek = ssl3_peek, - .ssl_write = ssl3_write, .ssl_shutdown = ssl3_shutdown, .ssl_pending = ssl3_pending, .get_ssl_method = tls1_get_server_method, @@ -176,9 +167,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_read = ssl3_read, - .ssl_peek = ssl3_peek, - .ssl_write = ssl3_write, .ssl_shutdown = ssl3_shutdown, .ssl_pending = ssl3_pending, .get_ssl_method = tls1_get_server_method, -- cgit v1.2.3