Clear collected_seed after freeing it
authorPauli <paul.dale@oracle.com>
Tue, 3 Sep 2019 04:28:47 +0000 (14:28 +1000)
committerPauli <paul.dale@oracle.com>
Fri, 6 Sep 2019 09:27:57 +0000 (19:27 +1000)
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9662)

crypto/evp/pkey_kdf.c

index f4cf40e..c13bb20 100644 (file)
@@ -127,8 +127,10 @@ static int pkey_kdf_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
          * Perform the semantics described in
          * EVP_PKEY_CTX_add1_tls1_prf_seed(3)
          */
-        if (ctx->pmeth->pkey_id == NID_tls1_prf)
+        if (ctx->pmeth->pkey_id == NID_tls1_prf) {
             BUF_MEM_free(pkctx->collected_seed);
+            pkctx->collected_seed = NULL;
+        }
         break;
     case EVP_PKEY_CTRL_TLS_SEED:
         cmd = T_OCTET_STRING;