summaryrefslogtreecommitdiffstats
path: root/lib/libssl/src/ssl/s23_clnt.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2015-03-27 12:29:54 +0000
committerjsing <jsing@openbsd.org>2015-03-27 12:29:54 +0000
commit4c5ec7da26a11a298d79cded54aa76d431fdda94 (patch)
tree59e19ccbcd28ea53aebc59248e7f35610a5d20e4 /lib/libssl/src/ssl/s23_clnt.c
parentBUF_MEM_free() has its own explicit NULL check. (diff)
downloadwireguard-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@
Diffstat (limited to 'lib/libssl/src/ssl/s23_clnt.c')
-rw-r--r--lib/libssl/src/ssl/s23_clnt.c23
1 files changed, 6 insertions, 17 deletions
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);
}