diff options
author | jsing <> | 2015-03-27 12:29:54 +0000 |
---|---|---|
committer | jsing <> | 2015-03-27 12:29:54 +0000 |
commit | 87dfb52384d6fa9cdb7418cfc6f81f1a121e862b (patch) | |
tree | d1107e1e9c18e2392e54fb1e385c31262c4dbd2e /src/lib/libssl/d1_srvr.c | |
parent | ed007e156e0546eb8a587a5b57c7e0509ea52a2c (diff) | |
download | openbsd-87dfb52384d6fa9cdb7418cfc6f81f1a121e862b.tar.gz openbsd-87dfb52384d6fa9cdb7418cfc6f81f1a121e862b.tar.bz2 openbsd-87dfb52384d6fa9cdb7418cfc6f81f1a121e862b.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/d1_srvr.c')
-rw-r--r-- | src/lib/libssl/d1_srvr.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/lib/libssl/d1_srvr.c b/src/lib/libssl/d1_srvr.c index 4e6d0da3b3..1d3779f567 100644 --- a/src/lib/libssl/d1_srvr.c +++ b/src/lib/libssl/d1_srvr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: d1_srvr.c,v 1.49 2015/02/09 10:53:28 jsing Exp $ */ | 1 | /* $OpenBSD: d1_srvr.c,v 1.50 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. |
@@ -228,20 +228,10 @@ dtls1_accept(SSL *s) | |||
228 | } | 228 | } |
229 | s->type = SSL_ST_ACCEPT; | 229 | s->type = SSL_ST_ACCEPT; |
230 | 230 | ||
231 | if (s->init_buf == NULL) { | 231 | if (!ssl3_setup_init_buffer(s)) { |
232 | BUF_MEM *buf; | 232 | ret = -1; |
233 | if ((buf = BUF_MEM_new()) == NULL) { | 233 | goto end; |
234 | ret = -1; | ||
235 | goto end; | ||
236 | } | ||
237 | if (!BUF_MEM_grow(buf, SSL3_RT_MAX_PLAIN_LENGTH)) { | ||
238 | BUF_MEM_free(buf); | ||
239 | ret = -1; | ||
240 | goto end; | ||
241 | } | ||
242 | s->init_buf = buf; | ||
243 | } | 234 | } |
244 | |||
245 | if (!ssl3_setup_buffers(s)) { | 235 | if (!ssl3_setup_buffers(s)) { |
246 | ret = -1; | 236 | ret = -1; |
247 | goto end; | 237 | goto end; |