diff options
| author | jsing <> | 2015-03-27 12:29:54 +0000 |
|---|---|---|
| committer | jsing <> | 2015-03-27 12:29:54 +0000 |
| commit | e4bb8802504ce04db08be8266b9377e800301e84 (patch) | |
| tree | d1107e1e9c18e2392e54fb1e385c31262c4dbd2e /src/lib/libssl/s23_srvr.c | |
| parent | 3c33e1429e1b0d6e6a121c97b536af97a1fd8e0a (diff) | |
| download | openbsd-e4bb8802504ce04db08be8266b9377e800301e84.tar.gz openbsd-e4bb8802504ce04db08be8266b9377e800301e84.tar.bz2 openbsd-e4bb8802504ce04db08be8266b9377e800301e84.zip | |
Factor out the init_buf initialisation code, rather than duplicating it
in four different places.
ok doug@ guenther@
Diffstat (limited to 'src/lib/libssl/s23_srvr.c')
| -rw-r--r-- | src/lib/libssl/s23_srvr.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/lib/libssl/s23_srvr.c b/src/lib/libssl/s23_srvr.c index 9e0ee453db..99bfaf07e4 100644 --- a/src/lib/libssl/s23_srvr.c +++ b/src/lib/libssl/s23_srvr.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: s23_srvr.c,v 1.38 2015/02/06 08:30:23 jsing Exp $ */ | 1 | /* $OpenBSD: s23_srvr.c,v 1.39 2015/03/27 12:29:54 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -207,20 +207,10 @@ ssl23_accept(SSL *s) | |||
| 207 | /* s->version=SSL3_VERSION; */ | 207 | /* s->version=SSL3_VERSION; */ |
| 208 | s->type = SSL_ST_ACCEPT; | 208 | s->type = SSL_ST_ACCEPT; |
| 209 | 209 | ||
| 210 | if (s->init_buf == NULL) { | 210 | if (!ssl3_setup_init_buffer(s)) { |
| 211 | BUF_MEM *buf; | 211 | ret = -1; |
| 212 | if ((buf = BUF_MEM_new()) == NULL) { | 212 | goto end; |
| 213 | ret = -1; | ||
| 214 | goto end; | ||
| 215 | } | ||
| 216 | if (!BUF_MEM_grow(buf, SSL3_RT_MAX_PLAIN_LENGTH)) { | ||
| 217 | BUF_MEM_free(buf); | ||
| 218 | ret = -1; | ||
| 219 | goto end; | ||
| 220 | } | ||
| 221 | s->init_buf = buf; | ||
| 222 | } | 213 | } |
| 223 | |||
| 224 | if (!ssl3_init_finished_mac(s)) { | 214 | if (!ssl3_init_finished_mac(s)) { |
| 225 | ret = -1; | 215 | ret = -1; |
| 226 | goto end; | 216 | goto end; |
| @@ -255,10 +245,12 @@ ssl23_accept(SSL *s) | |||
| 255 | s->state = new_state; | 245 | s->state = new_state; |
| 256 | } | 246 | } |
| 257 | } | 247 | } |
| 248 | |||
| 258 | end: | 249 | end: |
| 259 | s->in_handshake--; | 250 | s->in_handshake--; |
| 260 | if (cb != NULL) | 251 | if (cb != NULL) |
| 261 | cb(s, SSL_CB_ACCEPT_EXIT, ret); | 252 | cb(s, SSL_CB_ACCEPT_EXIT, ret); |
| 253 | |||
| 262 | return (ret); | 254 | return (ret); |
| 263 | } | 255 | } |
| 264 | 256 | ||
