From f65f8be1767690c34513b12605076287785fd148 Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Mon, 27 Nov 2023 08:50:22 +1000 Subject: [PATCH] SSL: make temp X25519/X448 key failure On failure to make the temporary X25519/X448 key, free it as the type is stored in eccTempKeyPresent which also indicates a valid key is present. Otherwise on SSL free, it will default to freeing the key with ECC APIs. --- src/internal.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/internal.c b/src/internal.c index d69696f65..0aaef81eb 100644 --- a/src/internal.c +++ b/src/internal.c @@ -32894,6 +32894,10 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx, ssl->eccTempKeyPresent = DYNAMIC_TYPE_CURVE25519; } + else { + FreeKey(ssl, DYNAMIC_TYPE_CURVE25519, + (void**)&ssl->eccTempKey); + } } break; } @@ -32917,6 +32921,10 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx, ssl->eccTempKeyPresent = DYNAMIC_TYPE_CURVE448; } + else { + FreeKey(ssl, DYNAMIC_TYPE_CURVE448, + (void**)&ssl->eccTempKey); + } } break; }