diff --git a/src/internal.c b/src/internal.c index 63923406b..d4b320e32 100755 --- a/src/internal.c +++ b/src/internal.c @@ -4811,7 +4811,8 @@ void SSL_ResourceFree(WOLFSSL* ssl) FreeKey(ssl, DYNAMIC_TYPE_ECC, (void**)&ssl->peerEccDsaKey); ssl->peerEccDsaKeyPresent = 0; #ifdef HAVE_CURVE25519 - if (!ssl->peerX25519KeyPresent) + if (!ssl->peerX25519KeyPresent && + ssl->eccTempKeyPresent != DYNAMIC_TYPE_CURVE25519) #endif /* HAVE_CURVE25519 */ { FreeKey(ssl, DYNAMIC_TYPE_ECC, (void**)&ssl->eccTempKey); @@ -20693,7 +20694,8 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx, ret = X25519MakeKey(ssl, (curve25519_key*)ssl->eccTempKey, NULL); if (ret == 0 || ret == WC_PENDING_E) { - ssl->eccTempKeyPresent = 1; + ssl->eccTempKeyPresent = + DYNAMIC_TYPE_CURVE25519; } } break; @@ -20715,7 +20717,7 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx, then we know curve dp */ ret = EccMakeKey(ssl, ssl->eccTempKey, NULL); if (ret == 0 || ret == WC_PENDING_E) { - ssl->eccTempKeyPresent = 1; + ssl->eccTempKeyPresent = DYNAMIC_TYPE_ECC; } } #endif diff --git a/wolfssl/internal.h b/wolfssl/internal.h index 17690ee68..9818ebda7 100755 --- a/wolfssl/internal.h +++ b/wolfssl/internal.h @@ -3312,7 +3312,7 @@ struct WOLFSSL { #if defined(HAVE_ECC) || defined(HAVE_CURVE25519) word32 ecdhCurveOID; /* curve Ecc_Sum */ ecc_key* eccTempKey; /* private ECDHE key */ - byte eccTempKeyPresent; + byte eccTempKeyPresent; /* also holds type */ byte peerEccKeyPresent; #endif #ifdef HAVE_ECC