Cleanup ctxs if callback fail to retrieve session ticket
authorJ Mohan Rao Arisankala <mohan@computer.org>
Fri, 21 Apr 2017 16:03:46 +0000 (21:33 +0530)
committerMatt Caswell <matt@openssl.org>
Wed, 24 Jan 2018 12:17:11 +0000 (12:17 +0000)
If tlsext ticket decrypt callback returns error, cleanup ctxs

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3273)

ssl/t1_lib.c

index 1a4387b78eb93fed1ca17e2dd805af9aaa6494c9..82ad601924e5d83936249f8e5430b977770ead1f 100644 (file)
@@ -3513,9 +3513,12 @@ static int tls_decrypt_ticket(SSL *s, const unsigned char *etick,
         int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16,
                                             &ctx, &hctx, 0);
         if (rv < 0)
-            return -1;
-        if (rv == 0)
+            goto err;
+        if (rv == 0) {
+            HMAC_CTX_cleanup(&hctx);
+            EVP_CIPHER_CTX_cleanup(&ctx);
             return 2;
+        }
         if (rv == 2)
             renew_ticket = 1;
     } else {