summaryrefslogtreecommitdiffstats
path: root/lib/libssl/t1_lib.c
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2014-06-18 04:49:40 +0000
committermiod <miod@openbsd.org>2014-06-18 04:49:40 +0000
commit32919421061040359867dbc09527788829f46a09 (patch)
tree923be4e284f96bff90c7188e15d3b3d37dc8da2f /lib/libssl/t1_lib.c
parentUse asprintf() instead of a fixed 128-byte size in SSL_CIPHER_description() (diff)
downloadwireguard-openbsd-32919421061040359867dbc09527788829f46a09.tar.xz
wireguard-openbsd-32919421061040359867dbc09527788829f46a09.zip
Make sure to always invoke EVP_CIPHER_CTX_cleanup() before returning in the
error paths from tls_decrypt_ticket(). ok tedu@
Diffstat (limited to 'lib/libssl/t1_lib.c')
-rw-r--r--lib/libssl/t1_lib.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/libssl/t1_lib.c b/lib/libssl/t1_lib.c
index b780faf603c..054de0ceef1 100644
--- a/lib/libssl/t1_lib.c
+++ b/lib/libssl/t1_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: t1_lib.c,v 1.46 2014/06/13 04:29:13 miod Exp $ */
+/* $OpenBSD: t1_lib.c,v 1.47 2014/06/18 04:49:40 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -1867,10 +1867,14 @@ tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen,
unsigned char *nctick = (unsigned char *)etick;
int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16,
&ctx, &hctx, 0);
- if (rv < 0)
+ if (rv < 0) {
+ EVP_CIPHER_CTX_cleanup(&ctx);
return -1;
- if (rv == 0)
+ }
+ if (rv == 0) {
+ EVP_CIPHER_CTX_cleanup(&ctx);
return 2;
+ }
if (rv == 2)
renew_ticket = 1;
} else {
@@ -1895,8 +1899,10 @@ tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen,
HMAC_Update(&hctx, etick, eticklen);
HMAC_Final(&hctx, tick_hmac, NULL);
HMAC_CTX_cleanup(&hctx);
- if (CRYPTO_memcmp(tick_hmac, etick + eticklen, mlen))
+ if (CRYPTO_memcmp(tick_hmac, etick + eticklen, mlen)) {
+ EVP_CIPHER_CTX_cleanup(&ctx);
return 2;
+ }
/* Attempt to decrypt session data */
/* Move p after IV to start of encrypted ticket, update length */
p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx);