diff options
author | 2015-03-27 12:29:54 +0000 | |
---|---|---|
committer | 2015-03-27 12:29:54 +0000 | |
commit | 4c5ec7da26a11a298d79cded54aa76d431fdda94 (patch) | |
tree | 59e19ccbcd28ea53aebc59248e7f35610a5d20e4 | |
parent | BUF_MEM_free() has its own explicit NULL check. (diff) | |
download | wireguard-openbsd-4c5ec7da26a11a298d79cded54aa76d431fdda94.tar.xz wireguard-openbsd-4c5ec7da26a11a298d79cded54aa76d431fdda94.zip |
Factor out the init_buf initialisation code, rather than duplicating it
in four different places.
ok doug@ guenther@
-rw-r--r-- | lib/libssl/d1_clnt.c | 26 | ||||
-rw-r--r-- | lib/libssl/d1_srvr.c | 18 | ||||
-rw-r--r-- | lib/libssl/s23_clnt.c | 23 | ||||
-rw-r--r-- | lib/libssl/s23_srvr.c | 20 | ||||
-rw-r--r-- | lib/libssl/s3_both.c | 25 | ||||
-rw-r--r-- | lib/libssl/s3_clnt.c | 25 | ||||
-rw-r--r-- | lib/libssl/s3_srvr.c | 19 | ||||
-rw-r--r-- | lib/libssl/src/ssl/d1_clnt.c | 26 | ||||
-rw-r--r-- | lib/libssl/src/ssl/d1_srvr.c | 18 | ||||
-rw-r--r-- | lib/libssl/src/ssl/s23_clnt.c | 23 | ||||
-rw-r--r-- | lib/libssl/src/ssl/s23_srvr.c | 20 | ||||
-rw-r--r-- | lib/libssl/src/ssl/s3_both.c | 25 | ||||
-rw-r--r-- | lib/libssl/src/ssl/s3_clnt.c | 25 | ||||
-rw-r--r-- | lib/libssl/src/ssl/s3_srvr.c | 19 | ||||
-rw-r--r-- | lib/libssl/src/ssl/ssl_locl.h | 3 | ||||
-rw-r--r-- | lib/libssl/ssl_locl.h | 3 |
16 files changed, 112 insertions, 206 deletions
diff --git a/lib/libssl/d1_clnt.c b/lib/libssl/d1_clnt.c index cf25183de50..e44c8a0c94c 100644 --- a/lib/libssl/d1_clnt.c +++ b/lib/libssl/d1_clnt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: d1_clnt.c,v 1.43 2015/02/09 10:53:28 jsing Exp $ */ +/* $OpenBSD: d1_clnt.c,v 1.44 2015/03/27 12:29:54 jsing Exp $ */ /* * DTLS implementation written by Nagendra Modadugu * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. @@ -176,7 +176,6 @@ dtls1_get_client_method(int ver) int dtls1_connect(SSL *s) { - BUF_MEM *buf = NULL; void (*cb)(const SSL *ssl, int type, int val) = NULL; int ret = -1; int new_state, state, skip = 0; @@ -223,25 +222,14 @@ dtls1_connect(SSL *s) /* s->version=SSL3_VERSION; */ s->type = SSL_ST_CONNECT; - if (s->init_buf == NULL) { - if ((buf = BUF_MEM_new()) == NULL) { - ret = -1; - goto end; - } - if (!BUF_MEM_grow(buf, SSL3_RT_MAX_PLAIN_LENGTH)) { - ret = -1; - goto end; - } - s->init_buf = buf; - buf = NULL; + if (!ssl3_setup_init_buffer(s)) { + ret = -1; + goto end; } - if (!ssl3_setup_buffers(s)) { ret = -1; goto end; } - - /* setup buffing BIO */ if (!ssl_init_wbio_buffer(s, 0)) { ret = -1; goto end; @@ -603,14 +591,12 @@ dtls1_connect(SSL *s) } skip = 0; } + end: s->in_handshake--; - - - if (buf != NULL) - BUF_MEM_free(buf); if (cb != NULL) cb(s, SSL_CB_CONNECT_EXIT, ret); + return (ret); } diff --git a/lib/libssl/d1_srvr.c b/lib/libssl/d1_srvr.c index 4e6d0da3b39..1d3779f5671 100644 --- a/lib/libssl/d1_srvr.c +++ b/lib/libssl/d1_srvr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: d1_srvr.c,v 1.49 2015/02/09 10:53:28 jsing Exp $ */ +/* $OpenBSD: d1_srvr.c,v 1.50 2015/03/27 12:29:54 jsing Exp $ */ /* * DTLS implementation written by Nagendra Modadugu * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. @@ -228,20 +228,10 @@ dtls1_accept(SSL *s) } s->type = SSL_ST_ACCEPT; - if (s->init_buf == NULL) { - BUF_MEM *buf; - if ((buf = BUF_MEM_new()) == NULL) { - ret = -1; - goto end; - } - if (!BUF_MEM_grow(buf, SSL3_RT_MAX_PLAIN_LENGTH)) { - BUF_MEM_free(buf); - ret = -1; - goto end; - } - s->init_buf = buf; + if (!ssl3_setup_init_buffer(s)) { + ret = -1; + goto end; } - if (!ssl3_setup_buffers(s)) { ret = -1; goto end; diff --git a/lib/libssl/s23_clnt.c b/lib/libssl/s23_clnt.c index 4159ae05802..0ab56fa38d4 100644 --- a/lib/libssl/s23_clnt.c +++ b/lib/libssl/s23_clnt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s23_clnt.c,v 1.36 2015/02/06 08:30:23 jsing Exp $ */ +/* $OpenBSD: s23_clnt.c,v 1.37 2015/03/27 12:29:54 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -176,7 +176,6 @@ ssl23_get_client_method(int ver) int ssl23_connect(SSL *s) { - BUF_MEM *buf = NULL; void (*cb)(const SSL *ssl, int type, int val) = NULL; int ret = -1; int new_state, state; @@ -214,24 +213,14 @@ ssl23_connect(SSL *s) /* s->version=TLS1_VERSION; */ s->type = SSL_ST_CONNECT; - if (s->init_buf == NULL) { - if ((buf = BUF_MEM_new()) == NULL) { - ret = -1; - goto end; - } - if (!BUF_MEM_grow(buf, SSL3_RT_MAX_PLAIN_LENGTH)) { - ret = -1; - goto end; - } - s->init_buf = buf; - buf = NULL; + if (!ssl3_setup_init_buffer(s)) { + ret = -1; + goto end; } - if (!ssl3_setup_buffers(s)) { ret = -1; goto end; } - if (!ssl3_init_finished_mac(s)) { ret = -1; goto end; @@ -280,12 +269,12 @@ ssl23_connect(SSL *s) s->state = new_state; } } + end: s->in_handshake--; - if (buf != NULL) - BUF_MEM_free(buf); if (cb != NULL) cb(s, SSL_CB_CONNECT_EXIT, ret); + return (ret); } diff --git a/lib/libssl/s23_srvr.c b/lib/libssl/s23_srvr.c index 9e0ee453db3..99bfaf07e4b 100644 --- a/lib/libssl/s23_srvr.c +++ b/lib/libssl/s23_srvr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s23_srvr.c,v 1.38 2015/02/06 08:30:23 jsing Exp $ */ +/* $OpenBSD: s23_srvr.c,v 1.39 2015/03/27 12:29:54 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -207,20 +207,10 @@ ssl23_accept(SSL *s) /* s->version=SSL3_VERSION; */ s->type = SSL_ST_ACCEPT; - if (s->init_buf == NULL) { - BUF_MEM *buf; - if ((buf = BUF_MEM_new()) == NULL) { - ret = -1; - goto end; - } - if (!BUF_MEM_grow(buf, SSL3_RT_MAX_PLAIN_LENGTH)) { - BUF_MEM_free(buf); - ret = -1; - goto end; - } - s->init_buf = buf; + if (!ssl3_setup_init_buffer(s)) { + ret = -1; + goto end; } - if (!ssl3_init_finished_mac(s)) { ret = -1; goto end; @@ -255,10 +245,12 @@ ssl23_accept(SSL *s) s->state = new_state; } } + end: s->in_handshake--; if (cb != NULL) cb(s, SSL_CB_ACCEPT_EXIT, ret); + return (ret); } diff --git a/lib/libssl/s3_both.c b/lib/libssl/s3_both.c index a2ce9e9fa3a..633bf5bb7b9 100644 --- a/lib/libssl/s3_both.c +++ b/lib/libssl/s3_both.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s3_both.c,v 1.37 2014/12/14 21:49:29 bcook Exp $ */ +/* $OpenBSD: s3_both.c,v 1.38 2015/03/27 12:29:54 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -607,6 +607,27 @@ ssl_verify_alarm_type(long type) } int +ssl3_setup_init_buffer(SSL *s) +{ + BUF_MEM *buf = NULL; + + if (s->init_buf != NULL) + return (1); + + if ((buf = BUF_MEM_new()) == NULL) + goto err; + if (!BUF_MEM_grow(buf, SSL3_RT_MAX_PLAIN_LENGTH)) + goto err; + + s->init_buf = buf; + return (1); + +err: + BUF_MEM_free(buf); + return (0); +} + +int ssl3_setup_read_buffer(SSL *s) { unsigned char *p; @@ -673,7 +694,6 @@ err: return 0; } - int ssl3_setup_buffers(SSL *s) { @@ -699,4 +719,3 @@ ssl3_release_read_buffer(SSL *s) s->s3->rbuf.buf = NULL; return 1; } - diff --git a/lib/libssl/s3_clnt.c b/lib/libssl/s3_clnt.c index 5d9ac2e2e81..07d2eb583a7 100644 --- a/lib/libssl/s3_clnt.c +++ b/lib/libssl/s3_clnt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s3_clnt.c,v 1.109 2015/03/11 19:34:06 tedu Exp $ */ +/* $OpenBSD: s3_clnt.c,v 1.110 2015/03/27 12:29:54 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -218,7 +218,6 @@ ssl3_get_client_method(int ver) int ssl3_connect(SSL *s) { - BUF_MEM *buf = NULL; void (*cb)(const SSL *ssl, int type, int val) = NULL; int ret = -1; int new_state, state, skip = 0; @@ -263,26 +262,14 @@ ssl3_connect(SSL *s) /* s->version=SSL3_VERSION; */ s->type = SSL_ST_CONNECT; - if (s->init_buf == NULL) { - if ((buf = BUF_MEM_new()) == NULL) { - ret = -1; - goto end; - } - if (!BUF_MEM_grow(buf, - SSL3_RT_MAX_PLAIN_LENGTH)) { - ret = -1; - goto end; - } - s->init_buf = buf; - buf = NULL; + if (!ssl3_setup_init_buffer(s)) { + ret = -1; + goto end; } - if (!ssl3_setup_buffers(s)) { ret = -1; goto end; } - - /* setup buffing BIO */ if (!ssl_init_wbio_buffer(s, 0)) { ret = -1; goto end; @@ -631,12 +618,12 @@ ssl3_connect(SSL *s) } skip = 0; } + end: s->in_handshake--; - if (buf != NULL) - BUF_MEM_free(buf); if (cb != NULL) cb(s, SSL_CB_CONNECT_EXIT, ret); + return (ret); } diff --git a/lib/libssl/s3_srvr.c b/lib/libssl/s3_srvr.c index 0bff0204d96..ce48809f65b 100644 --- a/lib/libssl/s3_srvr.c +++ b/lib/libssl/s3_srvr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s3_srvr.c,v 1.100 2015/02/25 03:49:21 bcook Exp $ */ +/* $OpenBSD: s3_srvr.c,v 1.101 2015/03/27 12:29:54 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -265,21 +265,10 @@ ssl3_accept(SSL *s) } s->type = SSL_ST_ACCEPT; - if (s->init_buf == NULL) { - BUF_MEM *buf; - if ((buf = BUF_MEM_new()) == NULL) { - ret = -1; - goto end; - } - if (!BUF_MEM_grow(buf, - SSL3_RT_MAX_PLAIN_LENGTH)) { - BUF_MEM_free(buf); - ret = -1; - goto end; - } - s->init_buf = buf; + if (!ssl3_setup_init_buffer(s)) { + ret = -1; + goto end; } - if (!ssl3_setup_buffers(s)) { ret = -1; goto end; diff --git a/lib/libssl/src/ssl/d1_clnt.c b/lib/libssl/src/ssl/d1_clnt.c index cf25183de50..e44c8a0c94c 100644 --- a/lib/libssl/src/ssl/d1_clnt.c +++ b/lib/libssl/src/ssl/d1_clnt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: d1_clnt.c,v 1.43 2015/02/09 10:53:28 jsing Exp $ */ +/* $OpenBSD: d1_clnt.c,v 1.44 2015/03/27 12:29:54 jsing Exp $ */ /* * DTLS implementation written by Nagendra Modadugu * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. @@ -176,7 +176,6 @@ dtls1_get_client_method(int ver) int dtls1_connect(SSL *s) { - BUF_MEM *buf = NULL; void (*cb)(const SSL *ssl, int type, int val) = NULL; int ret = -1; int new_state, state, skip = 0; @@ -223,25 +222,14 @@ dtls1_connect(SSL *s) /* s->version=SSL3_VERSION; */ s->type = SSL_ST_CONNECT; - if (s->init_buf == NULL) { - if ((buf = BUF_MEM_new()) == NULL) { - ret = -1; - goto end; - } - if (!BUF_MEM_grow(buf, SSL3_RT_MAX_PLAIN_LENGTH)) { - ret = -1; - goto end; - } - s->init_buf = buf; - buf = NULL; + if (!ssl3_setup_init_buffer(s)) { + ret = -1; + goto end; } - if (!ssl3_setup_buffers(s)) { ret = -1; goto end; } - - /* setup buffing BIO */ if (!ssl_init_wbio_buffer(s, 0)) { ret = -1; goto end; @@ -603,14 +591,12 @@ dtls1_connect(SSL *s) } skip = 0; } + end: s->in_handshake--; - - - if (buf != NULL) - BUF_MEM_free(buf); if (cb != NULL) cb(s, SSL_CB_CONNECT_EXIT, ret); + return (ret); } diff --git a/lib/libssl/src/ssl/d1_srvr.c b/lib/libssl/src/ssl/d1_srvr.c index 4e6d0da3b39..1d3779f5671 100644 --- a/lib/libssl/src/ssl/d1_srvr.c +++ b/lib/libssl/src/ssl/d1_srvr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: d1_srvr.c,v 1.49 2015/02/09 10:53:28 jsing Exp $ */ +/* $OpenBSD: d1_srvr.c,v 1.50 2015/03/27 12:29:54 jsing Exp $ */ /* * DTLS implementation written by Nagendra Modadugu * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. @@ -228,20 +228,10 @@ dtls1_accept(SSL *s) } s->type = SSL_ST_ACCEPT; - if (s->init_buf == NULL) { - BUF_MEM *buf; - if ((buf = BUF_MEM_new()) == NULL) { - ret = -1; - goto end; - } - if (!BUF_MEM_grow(buf, SSL3_RT_MAX_PLAIN_LENGTH)) { - BUF_MEM_free(buf); - ret = -1; - goto end; - } - s->init_buf = buf; + if (!ssl3_setup_init_buffer(s)) { + ret = -1; + goto end; } - if (!ssl3_setup_buffers(s)) { ret = -1; goto end; diff --git a/lib/libssl/src/ssl/s23_clnt.c b/lib/libssl/src/ssl/s23_clnt.c index 4159ae05802..0ab56fa38d4 100644 --- a/lib/libssl/src/ssl/s23_clnt.c +++ b/lib/libssl/src/ssl/s23_clnt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s23_clnt.c,v 1.36 2015/02/06 08:30:23 jsing Exp $ */ +/* $OpenBSD: s23_clnt.c,v 1.37 2015/03/27 12:29:54 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -176,7 +176,6 @@ ssl23_get_client_method(int ver) int ssl23_connect(SSL *s) { - BUF_MEM *buf = NULL; void (*cb)(const SSL *ssl, int type, int val) = NULL; int ret = -1; int new_state, state; @@ -214,24 +213,14 @@ ssl23_connect(SSL *s) /* s->version=TLS1_VERSION; */ s->type = SSL_ST_CONNECT; - if (s->init_buf == NULL) { - if ((buf = BUF_MEM_new()) == NULL) { - ret = -1; - goto end; - } - if (!BUF_MEM_grow(buf, SSL3_RT_MAX_PLAIN_LENGTH)) { - ret = -1; - goto end; - } - s->init_buf = buf; - buf = NULL; + if (!ssl3_setup_init_buffer(s)) { + ret = -1; + goto end; } - if (!ssl3_setup_buffers(s)) { ret = -1; goto end; } - if (!ssl3_init_finished_mac(s)) { ret = -1; goto end; @@ -280,12 +269,12 @@ ssl23_connect(SSL *s) s->state = new_state; } } + end: s->in_handshake--; - if (buf != NULL) - BUF_MEM_free(buf); if (cb != NULL) cb(s, SSL_CB_CONNECT_EXIT, ret); + return (ret); } diff --git a/lib/libssl/src/ssl/s23_srvr.c b/lib/libssl/src/ssl/s23_srvr.c index 9e0ee453db3..99bfaf07e4b 100644 --- a/lib/libssl/src/ssl/s23_srvr.c +++ b/lib/libssl/src/ssl/s23_srvr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s23_srvr.c,v 1.38 2015/02/06 08:30:23 jsing Exp $ */ +/* $OpenBSD: s23_srvr.c,v 1.39 2015/03/27 12:29:54 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -207,20 +207,10 @@ ssl23_accept(SSL *s) /* s->version=SSL3_VERSION; */ s->type = SSL_ST_ACCEPT; - if (s->init_buf == NULL) { - BUF_MEM *buf; - if ((buf = BUF_MEM_new()) == NULL) { - ret = -1; - goto end; - } - if (!BUF_MEM_grow(buf, SSL3_RT_MAX_PLAIN_LENGTH)) { - BUF_MEM_free(buf); - ret = -1; - goto end; - } - s->init_buf = buf; + if (!ssl3_setup_init_buffer(s)) { + ret = -1; + goto end; } - if (!ssl3_init_finished_mac(s)) { ret = -1; goto end; @@ -255,10 +245,12 @@ ssl23_accept(SSL *s) s->state = new_state; } } + end: s->in_handshake--; if (cb != NULL) cb(s, SSL_CB_ACCEPT_EXIT, ret); + return (ret); } diff --git a/lib/libssl/src/ssl/s3_both.c b/lib/libssl/src/ssl/s3_both.c index a2ce9e9fa3a..633bf5bb7b9 100644 --- a/lib/libssl/src/ssl/s3_both.c +++ b/lib/libssl/src/ssl/s3_both.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s3_both.c,v 1.37 2014/12/14 21:49:29 bcook Exp $ */ +/* $OpenBSD: s3_both.c,v 1.38 2015/03/27 12:29:54 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -607,6 +607,27 @@ ssl_verify_alarm_type(long type) } int +ssl3_setup_init_buffer(SSL *s) +{ + BUF_MEM *buf = NULL; + + if (s->init_buf != NULL) + return (1); + + if ((buf = BUF_MEM_new()) == NULL) + goto err; + if (!BUF_MEM_grow(buf, SSL3_RT_MAX_PLAIN_LENGTH)) + goto err; + + s->init_buf = buf; + return (1); + +err: + BUF_MEM_free(buf); + return (0); +} + +int ssl3_setup_read_buffer(SSL *s) { unsigned char *p; @@ -673,7 +694,6 @@ err: return 0; } - int ssl3_setup_buffers(SSL *s) { @@ -699,4 +719,3 @@ ssl3_release_read_buffer(SSL *s) s->s3->rbuf.buf = NULL; return 1; } - diff --git a/lib/libssl/src/ssl/s3_clnt.c b/lib/libssl/src/ssl/s3_clnt.c index 5d9ac2e2e81..07d2eb583a7 100644 --- a/lib/libssl/src/ssl/s3_clnt.c +++ b/lib/libssl/src/ssl/s3_clnt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s3_clnt.c,v 1.109 2015/03/11 19:34:06 tedu Exp $ */ +/* $OpenBSD: s3_clnt.c,v 1.110 2015/03/27 12:29:54 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -218,7 +218,6 @@ ssl3_get_client_method(int ver) int ssl3_connect(SSL *s) { - BUF_MEM *buf = NULL; void (*cb)(const SSL *ssl, int type, int val) = NULL; int ret = -1; int new_state, state, skip = 0; @@ -263,26 +262,14 @@ ssl3_connect(SSL *s) /* s->version=SSL3_VERSION; */ s->type = SSL_ST_CONNECT; - if (s->init_buf == NULL) { - if ((buf = BUF_MEM_new()) == NULL) { - ret = -1; - goto end; - } - if (!BUF_MEM_grow(buf, - SSL3_RT_MAX_PLAIN_LENGTH)) { - ret = -1; - goto end; - } - s->init_buf = buf; - buf = NULL; + if (!ssl3_setup_init_buffer(s)) { + ret = -1; + goto end; } - if (!ssl3_setup_buffers(s)) { ret = -1; goto end; } - - /* setup buffing BIO */ if (!ssl_init_wbio_buffer(s, 0)) { ret = -1; goto end; @@ -631,12 +618,12 @@ ssl3_connect(SSL *s) } skip = 0; } + end: s->in_handshake--; - if (buf != NULL) - BUF_MEM_free(buf); if (cb != NULL) cb(s, SSL_CB_CONNECT_EXIT, ret); + return (ret); } diff --git a/lib/libssl/src/ssl/s3_srvr.c b/lib/libssl/src/ssl/s3_srvr.c index 0bff0204d96..ce48809f65b 100644 --- a/lib/libssl/src/ssl/s3_srvr.c +++ b/lib/libssl/src/ssl/s3_srvr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s3_srvr.c,v 1.100 2015/02/25 03:49:21 bcook Exp $ */ +/* $OpenBSD: s3_srvr.c,v 1.101 2015/03/27 12:29:54 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -265,21 +265,10 @@ ssl3_accept(SSL *s) } s->type = SSL_ST_ACCEPT; - if (s->init_buf == NULL) { - BUF_MEM *buf; - if ((buf = BUF_MEM_new()) == NULL) { - ret = -1; - goto end; - } - if (!BUF_MEM_grow(buf, - SSL3_RT_MAX_PLAIN_LENGTH)) { - BUF_MEM_free(buf); - ret = -1; - goto end; - } - s->init_buf = buf; + if (!ssl3_setup_init_buffer(s)) { + ret = -1; + goto end; } - if (!ssl3_setup_buffers(s)) { ret = -1; goto end; diff --git a/lib/libssl/src/ssl/ssl_locl.h b/lib/libssl/src/ssl/ssl_locl.h index c38aa3a90d0..cb1da576f4e 100644 --- a/lib/libssl/src/ssl/ssl_locl.h +++ b/lib/libssl/src/ssl/ssl_locl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_locl.h,v 1.88 2015/02/22 15:54:27 jsing Exp $ */ +/* $OpenBSD: ssl_locl.h,v 1.89 2015/03/27 12:29:54 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -637,6 +637,7 @@ unsigned long ssl3_output_cert_chain(SSL *s, X509 *x); SSL_CIPHER *ssl3_choose_cipher(SSL *ssl, STACK_OF(SSL_CIPHER) *clnt, STACK_OF(SSL_CIPHER) *srvr); int ssl3_setup_buffers(SSL *s); +int ssl3_setup_init_buffer(SSL *s); int ssl3_setup_read_buffer(SSL *s); int ssl3_setup_write_buffer(SSL *s); int ssl3_release_read_buffer(SSL *s); diff --git a/lib/libssl/ssl_locl.h b/lib/libssl/ssl_locl.h index c38aa3a90d0..cb1da576f4e 100644 --- a/lib/libssl/ssl_locl.h +++ b/lib/libssl/ssl_locl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_locl.h,v 1.88 2015/02/22 15:54:27 jsing Exp $ */ +/* $OpenBSD: ssl_locl.h,v 1.89 2015/03/27 12:29:54 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -637,6 +637,7 @@ unsigned long ssl3_output_cert_chain(SSL *s, X509 *x); SSL_CIPHER *ssl3_choose_cipher(SSL *ssl, STACK_OF(SSL_CIPHER) *clnt, STACK_OF(SSL_CIPHER) *srvr); int ssl3_setup_buffers(SSL *s); +int ssl3_setup_init_buffer(SSL *s); int ssl3_setup_read_buffer(SSL *s); int ssl3_setup_write_buffer(SSL *s); int ssl3_release_read_buffer(SSL *s); |