summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormiod <>2014-06-18 04:49:40 +0000
committermiod <>2014-06-18 04:49:40 +0000
commit20af83337dca6c4b020a11ffff052a56fc8f3f59 (patch)
tree9a7a9d5eea76e6dabf5bc0d86327351e06813b89 /src
parent53197fa2c21b25bbe10c188ecc79010086749353 (diff)
downloadopenbsd-20af83337dca6c4b020a11ffff052a56fc8f3f59.tar.gz
openbsd-20af83337dca6c4b020a11ffff052a56fc8f3f59.tar.bz2
openbsd-20af83337dca6c4b020a11ffff052a56fc8f3f59.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 'src')
-rw-r--r--src/lib/libssl/src/ssl/t1_lib.c14
-rw-r--r--src/lib/libssl/t1_lib.c14
2 files changed, 20 insertions, 8 deletions
diff --git a/src/lib/libssl/src/ssl/t1_lib.c b/src/lib/libssl/src/ssl/t1_lib.c
index b780faf603..054de0ceef 100644
--- a/src/lib/libssl/src/ssl/t1_lib.c
+++ b/src/lib/libssl/src/ssl/t1_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t1_lib.c,v 1.46 2014/06/13 04:29:13 miod Exp $ */ 1/* $OpenBSD: t1_lib.c,v 1.47 2014/06/18 04:49:40 miod 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 *
@@ -1867,10 +1867,14 @@ tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen,
1867 unsigned char *nctick = (unsigned char *)etick; 1867 unsigned char *nctick = (unsigned char *)etick;
1868 int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16, 1868 int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16,
1869 &ctx, &hctx, 0); 1869 &ctx, &hctx, 0);
1870 if (rv < 0) 1870 if (rv < 0) {
1871 EVP_CIPHER_CTX_cleanup(&ctx);
1871 return -1; 1872 return -1;
1872 if (rv == 0) 1873 }
1874 if (rv == 0) {
1875 EVP_CIPHER_CTX_cleanup(&ctx);
1873 return 2; 1876 return 2;
1877 }
1874 if (rv == 2) 1878 if (rv == 2)
1875 renew_ticket = 1; 1879 renew_ticket = 1;
1876 } else { 1880 } else {
@@ -1895,8 +1899,10 @@ tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen,
1895 HMAC_Update(&hctx, etick, eticklen); 1899 HMAC_Update(&hctx, etick, eticklen);
1896 HMAC_Final(&hctx, tick_hmac, NULL); 1900 HMAC_Final(&hctx, tick_hmac, NULL);
1897 HMAC_CTX_cleanup(&hctx); 1901 HMAC_CTX_cleanup(&hctx);
1898 if (CRYPTO_memcmp(tick_hmac, etick + eticklen, mlen)) 1902 if (CRYPTO_memcmp(tick_hmac, etick + eticklen, mlen)) {
1903 EVP_CIPHER_CTX_cleanup(&ctx);
1899 return 2; 1904 return 2;
1905 }
1900 /* Attempt to decrypt session data */ 1906 /* Attempt to decrypt session data */
1901 /* Move p after IV to start of encrypted ticket, update length */ 1907 /* Move p after IV to start of encrypted ticket, update length */
1902 p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx); 1908 p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx);
diff --git a/src/lib/libssl/t1_lib.c b/src/lib/libssl/t1_lib.c
index b780faf603..054de0ceef 100644
--- a/src/lib/libssl/t1_lib.c
+++ b/src/lib/libssl/t1_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t1_lib.c,v 1.46 2014/06/13 04:29:13 miod Exp $ */ 1/* $OpenBSD: t1_lib.c,v 1.47 2014/06/18 04:49:40 miod 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 *
@@ -1867,10 +1867,14 @@ tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen,
1867 unsigned char *nctick = (unsigned char *)etick; 1867 unsigned char *nctick = (unsigned char *)etick;
1868 int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16, 1868 int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16,
1869 &ctx, &hctx, 0); 1869 &ctx, &hctx, 0);
1870 if (rv < 0) 1870 if (rv < 0) {
1871 EVP_CIPHER_CTX_cleanup(&ctx);
1871 return -1; 1872 return -1;
1872 if (rv == 0) 1873 }
1874 if (rv == 0) {
1875 EVP_CIPHER_CTX_cleanup(&ctx);
1873 return 2; 1876 return 2;
1877 }
1874 if (rv == 2) 1878 if (rv == 2)
1875 renew_ticket = 1; 1879 renew_ticket = 1;
1876 } else { 1880 } else {
@@ -1895,8 +1899,10 @@ tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen,
1895 HMAC_Update(&hctx, etick, eticklen); 1899 HMAC_Update(&hctx, etick, eticklen);
1896 HMAC_Final(&hctx, tick_hmac, NULL); 1900 HMAC_Final(&hctx, tick_hmac, NULL);
1897 HMAC_CTX_cleanup(&hctx); 1901 HMAC_CTX_cleanup(&hctx);
1898 if (CRYPTO_memcmp(tick_hmac, etick + eticklen, mlen)) 1902 if (CRYPTO_memcmp(tick_hmac, etick + eticklen, mlen)) {
1903 EVP_CIPHER_CTX_cleanup(&ctx);
1899 return 2; 1904 return 2;
1905 }
1900 /* Attempt to decrypt session data */ 1906 /* Attempt to decrypt session data */
1901 /* Move p after IV to start of encrypted ticket, update length */ 1907 /* Move p after IV to start of encrypted ticket, update length */
1902 p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx); 1908 p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx);