Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -9985,6 +9985,17 @@ static int TLSX_KeyShare_ProcessPqcHybridClient(WOLFSSL* ssl,

ssl->arrays->preMasterSz = ssSzEcc + ssSzPqc;
}
else
#ifdef WOLFSSL_ASYNC_CRYPT
if (ret != WC_NO_ERR_TRACE(WC_PENDING_E))
#endif
{
/* Clear the pre master secret buffer to prevent leaking any
* intermediate keys in the error case. Do not use preMasterSz
* here as it may already been set to the ECC shared secret size,
* which would be too small due to the PQC offset case. */
ForceZero(ssl->arrays->preMasterSecret, ENCRYPT_LEN);
}

TLSX_KeyShare_FreeAll(ecc_kse, ssl->heap);
TLSX_KeyShare_FreeAll(pqc_kse, ssl->heap);
Expand Down Expand Up @@ -10721,6 +10732,17 @@ static int TLSX_KeyShare_HandlePqcHybridKeyServer(WOLFSSL* ssl,
* the server side. */
ssl->namedGroup = keyShareEntry->group;
}
else
#ifdef WOLFSSL_ASYNC_CRYPT
if (ret != WC_NO_ERR_TRACE(WC_PENDING_E))
#endif
{
/* Clear the pre master secret buffer to prevent leaking any
* intermediate keys in the error case. Do not use preMasterSz
* here as it may already been set to the ECC shared secret size,
* which would be too small due to the PQC offset case. */
ForceZero(ssl->arrays->preMasterSecret, ENCRYPT_LEN);
}

TLSX_KeyShare_FreeAll(ecc_kse, ssl->heap);
TLSX_KeyShare_FreeAll(pqc_kse, ssl->heap);
Expand Down