diff options
| author | jsing <> | 2020-09-24 18:12:00 +0000 |
|---|---|---|
| committer | jsing <> | 2020-09-24 18:12:00 +0000 |
| commit | 10841ee643f560678ff5ed0276c4da735ec37bdf (patch) | |
| tree | b00661458f11b9cebfbf0036bd7b8ae827375208 /src | |
| parent | 1328e78055c6ad087ebbec8484862dea13576ef5 (diff) | |
| download | openbsd-10841ee643f560678ff5ed0276c4da735ec37bdf.tar.gz openbsd-10841ee643f560678ff5ed0276c4da735ec37bdf.tar.bz2 openbsd-10841ee643f560678ff5ed0276c4da735ec37bdf.zip | |
Simplify the cleanup of init_buf via a ssl3_release_init_buffer() function.
ok beck@ inoguchi@ tb@
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libssl/ssl_both.c | 12 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_clnt.c | 8 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_lib.c | 7 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_locl.h | 3 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_srvr.c | 8 |
5 files changed, 22 insertions, 16 deletions
diff --git a/src/lib/libssl/ssl_both.c b/src/lib/libssl/ssl_both.c index dff44ecd41..5da450b5ce 100644 --- a/src/lib/libssl/ssl_both.c +++ b/src/lib/libssl/ssl_both.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_both.c,v 1.19 2020/09/24 17:59:54 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_both.c,v 1.20 2020/09/24 18:12:00 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 | * |
| @@ -686,6 +686,16 @@ err: | |||
| 686 | return (0); | 686 | return (0); |
| 687 | } | 687 | } |
| 688 | 688 | ||
| 689 | void | ||
| 690 | ssl3_release_init_buffer(SSL *s) | ||
| 691 | { | ||
| 692 | BUF_MEM_free(s->internal->init_buf); | ||
| 693 | s->internal->init_buf = NULL; | ||
| 694 | s->internal->init_msg = NULL; | ||
| 695 | s->internal->init_num = 0; | ||
| 696 | s->internal->init_off = 0; | ||
| 697 | } | ||
| 698 | |||
| 689 | int | 699 | int |
| 690 | ssl3_setup_read_buffer(SSL *s) | 700 | ssl3_setup_read_buffer(SSL *s) |
| 691 | { | 701 | { |
diff --git a/src/lib/libssl/ssl_clnt.c b/src/lib/libssl/ssl_clnt.c index d62928a093..f11dcaa107 100644 --- a/src/lib/libssl/ssl_clnt.c +++ b/src/lib/libssl/ssl_clnt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_clnt.c,v 1.72 2020/09/17 15:23:29 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_clnt.c,v 1.73 2020/09/24 18:12:00 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 | * |
| @@ -588,10 +588,8 @@ ssl3_connect(SSL *s) | |||
| 588 | goto end; | 588 | goto end; |
| 589 | } | 589 | } |
| 590 | 590 | ||
| 591 | if (!SSL_IS_DTLS(s)) { | 591 | if (!SSL_IS_DTLS(s)) |
| 592 | BUF_MEM_free(s->internal->init_buf); | 592 | ssl3_release_init_buffer(s); |
| 593 | s->internal->init_buf = NULL; | ||
| 594 | } | ||
| 595 | 593 | ||
| 596 | ssl_free_wbio_buffer(s); | 594 | ssl_free_wbio_buffer(s); |
| 597 | 595 | ||
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index 65d5614bfb..6e375e1c09 100644 --- a/src/lib/libssl/ssl_lib.c +++ b/src/lib/libssl/ssl_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_lib.c,v 1.233 2020/09/19 10:17:56 tb Exp $ */ | 1 | /* $OpenBSD: ssl_lib.c,v 1.234 2020/09/24 18:12:00 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 | * |
| @@ -196,8 +196,7 @@ SSL_clear(SSL *s) | |||
| 196 | tls13_ctx_free(s->internal->tls13); | 196 | tls13_ctx_free(s->internal->tls13); |
| 197 | s->internal->tls13 = NULL; | 197 | s->internal->tls13 = NULL; |
| 198 | 198 | ||
| 199 | BUF_MEM_free(s->internal->init_buf); | 199 | ssl3_release_init_buffer(s); |
| 200 | s->internal->init_buf = NULL; | ||
| 201 | 200 | ||
| 202 | ssl_clear_cipher_state(s); | 201 | ssl_clear_cipher_state(s); |
| 203 | 202 | ||
| @@ -531,7 +530,7 @@ SSL_free(SSL *s) | |||
| 531 | 530 | ||
| 532 | tls13_ctx_free(s->internal->tls13); | 531 | tls13_ctx_free(s->internal->tls13); |
| 533 | 532 | ||
| 534 | BUF_MEM_free(s->internal->init_buf); | 533 | ssl3_release_init_buffer(s); |
| 535 | 534 | ||
| 536 | sk_SSL_CIPHER_free(s->cipher_list); | 535 | sk_SSL_CIPHER_free(s->cipher_list); |
| 537 | sk_SSL_CIPHER_free(s->internal->cipher_list_tls13); | 536 | sk_SSL_CIPHER_free(s->internal->cipher_list_tls13); |
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h index d4ba7f66d4..9a9ef59282 100644 --- a/src/lib/libssl/ssl_locl.h +++ b/src/lib/libssl/ssl_locl.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_locl.h,v 1.294 2020/09/24 17:59:54 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_locl.h,v 1.295 2020/09/24 18:12:00 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 | * |
| @@ -1221,6 +1221,7 @@ SSL_CIPHER *ssl3_choose_cipher(SSL *ssl, STACK_OF(SSL_CIPHER) *clnt, | |||
| 1221 | STACK_OF(SSL_CIPHER) *srvr); | 1221 | STACK_OF(SSL_CIPHER) *srvr); |
| 1222 | int ssl3_setup_buffers(SSL *s); | 1222 | int ssl3_setup_buffers(SSL *s); |
| 1223 | int ssl3_setup_init_buffer(SSL *s); | 1223 | int ssl3_setup_init_buffer(SSL *s); |
| 1224 | void ssl3_release_init_buffer(SSL *s); | ||
| 1224 | int ssl3_setup_read_buffer(SSL *s); | 1225 | int ssl3_setup_read_buffer(SSL *s); |
| 1225 | int ssl3_setup_write_buffer(SSL *s); | 1226 | int ssl3_setup_write_buffer(SSL *s); |
| 1226 | void ssl3_release_buffer(SSL3_BUFFER_INTERNAL *b); | 1227 | void ssl3_release_buffer(SSL3_BUFFER_INTERNAL *b); |
diff --git a/src/lib/libssl/ssl_srvr.c b/src/lib/libssl/ssl_srvr.c index f69be70f04..0f448a2d38 100644 --- a/src/lib/libssl/ssl_srvr.c +++ b/src/lib/libssl/ssl_srvr.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_srvr.c,v 1.84 2020/09/17 15:23:29 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_srvr.c,v 1.85 2020/09/24 18:12:00 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 | * |
| @@ -691,10 +691,8 @@ ssl3_accept(SSL *s) | |||
| 691 | goto end; | 691 | goto end; |
| 692 | } | 692 | } |
| 693 | 693 | ||
| 694 | if (!SSL_IS_DTLS(s)) { | 694 | if (!SSL_IS_DTLS(s)) |
| 695 | BUF_MEM_free(s->internal->init_buf); | 695 | ssl3_release_init_buffer(s); |
| 696 | s->internal->init_buf = NULL; | ||
| 697 | } | ||
| 698 | 696 | ||
| 699 | /* remove buffering on output */ | 697 | /* remove buffering on output */ |
| 700 | ssl_free_wbio_buffer(s); | 698 | ssl_free_wbio_buffer(s); |
