From 0983ea9a80fc2930cff419640e6c1e7b4a349e0f Mon Sep 17 00:00:00 2001 From: res0nance Date: Wed, 20 Sep 2023 15:45:26 +0800 Subject: [PATCH] pqc: fix memory type for shared secret storage server side This gets copied to preMasterSecret and freed in TLSX_KeyShare_ProcessPqc with the SECRET type but is allocated with the TLSX type. --- src/tls.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tls.c b/src/tls.c index 92bac11b5..8af5981cc 100644 --- a/src/tls.c +++ b/src/tls.c @@ -8925,7 +8925,7 @@ static int server_generate_pqc_ciphertext(WOLFSSL* ssl, if (ret == 0) { sharedSecret = (byte*)XMALLOC(ecc_kse->keyLen + ssSz, ssl->heap, - DYNAMIC_TYPE_TLSX); + DYNAMIC_TYPE_SECRET); ciphertext = (byte*)XMALLOC(ecc_kse->pubKeyLen + ctSz, ssl->heap, DYNAMIC_TYPE_TLSX); @@ -8999,7 +8999,7 @@ static int server_generate_pqc_ciphertext(WOLFSSL* ssl, TLSX_KeyShare_FreeAll(ecc_kse, ssl->heap); if (sharedSecret != NULL) - XFREE(sharedSecret, ssl->heap, DYNAMIC_TYPE_TLSX); + XFREE(sharedSecret, ssl->heap, DYNAMIC_TYPE_SECRET); if (ciphertext != NULL) XFREE(ciphertext, ssl->heap, DYNAMIC_TYPE_TLSX); wc_ecc_free(&eccpubkey);