diff options
Diffstat (limited to 'src/lib/libssl/d1_clnt.c')
| -rw-r--r-- | src/lib/libssl/d1_clnt.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/src/lib/libssl/d1_clnt.c b/src/lib/libssl/d1_clnt.c index cf25183de5..e44c8a0c94 100644 --- a/src/lib/libssl/d1_clnt.c +++ b/src/lib/libssl/d1_clnt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: d1_clnt.c,v 1.43 2015/02/09 10:53:28 jsing Exp $ */ | 1 | /* $OpenBSD: d1_clnt.c,v 1.44 2015/03/27 12:29:54 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * DTLS implementation written by Nagendra Modadugu | 3 | * DTLS implementation written by Nagendra Modadugu |
| 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. | 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. |
| @@ -176,7 +176,6 @@ dtls1_get_client_method(int ver) | |||
| 176 | int | 176 | int |
| 177 | dtls1_connect(SSL *s) | 177 | dtls1_connect(SSL *s) |
| 178 | { | 178 | { |
| 179 | BUF_MEM *buf = NULL; | ||
| 180 | void (*cb)(const SSL *ssl, int type, int val) = NULL; | 179 | void (*cb)(const SSL *ssl, int type, int val) = NULL; |
| 181 | int ret = -1; | 180 | int ret = -1; |
| 182 | int new_state, state, skip = 0; | 181 | int new_state, state, skip = 0; |
| @@ -223,25 +222,14 @@ dtls1_connect(SSL *s) | |||
| 223 | /* s->version=SSL3_VERSION; */ | 222 | /* s->version=SSL3_VERSION; */ |
| 224 | s->type = SSL_ST_CONNECT; | 223 | s->type = SSL_ST_CONNECT; |
| 225 | 224 | ||
| 226 | if (s->init_buf == NULL) { | 225 | if (!ssl3_setup_init_buffer(s)) { |
| 227 | if ((buf = BUF_MEM_new()) == NULL) { | 226 | ret = -1; |
| 228 | ret = -1; | 227 | goto end; |
| 229 | goto end; | ||
| 230 | } | ||
| 231 | if (!BUF_MEM_grow(buf, SSL3_RT_MAX_PLAIN_LENGTH)) { | ||
| 232 | ret = -1; | ||
| 233 | goto end; | ||
| 234 | } | ||
| 235 | s->init_buf = buf; | ||
| 236 | buf = NULL; | ||
| 237 | } | 228 | } |
| 238 | |||
| 239 | if (!ssl3_setup_buffers(s)) { | 229 | if (!ssl3_setup_buffers(s)) { |
| 240 | ret = -1; | 230 | ret = -1; |
| 241 | goto end; | 231 | goto end; |
| 242 | } | 232 | } |
| 243 | |||
| 244 | /* setup buffing BIO */ | ||
| 245 | if (!ssl_init_wbio_buffer(s, 0)) { | 233 | if (!ssl_init_wbio_buffer(s, 0)) { |
| 246 | ret = -1; | 234 | ret = -1; |
| 247 | goto end; | 235 | goto end; |
| @@ -603,14 +591,12 @@ dtls1_connect(SSL *s) | |||
| 603 | } | 591 | } |
| 604 | skip = 0; | 592 | skip = 0; |
| 605 | } | 593 | } |
| 594 | |||
| 606 | end: | 595 | end: |
| 607 | s->in_handshake--; | 596 | s->in_handshake--; |
| 608 | |||
| 609 | |||
| 610 | if (buf != NULL) | ||
| 611 | BUF_MEM_free(buf); | ||
| 612 | if (cb != NULL) | 597 | if (cb != NULL) |
| 613 | cb(s, SSL_CB_CONNECT_EXIT, ret); | 598 | cb(s, SSL_CB_CONNECT_EXIT, ret); |
| 599 | |||
| 614 | return (ret); | 600 | return (ret); |
| 615 | } | 601 | } |
| 616 | 602 | ||
