Fix for TLS v1.3 client session ticket resumption where the server opts to do a new handshake. Fix to make sure preMasterSz is valid.

This commit is contained in:
David Garske
2021-12-22 14:30:00 -08:00
parent a92fb0eb42
commit 02186dbd23
3 changed files with 8 additions and 1 deletions

View File

@ -31417,6 +31417,7 @@ void wolfSSL_sk_pop_free(WOLF_STACK_OF(WOLFSSL_ASN1_OBJECT)* sk,
WOLFSSL_ENTER("wolfSSL_sk_pop_free");
if (sk == NULL) {
/* pop_free can be called with NULL, do not print bad argument */
return;
}
#if defined(WOLFSSL_QT)

View File

@ -7492,6 +7492,10 @@ static int TLSX_KeyShare_Process(WOLFSSL* ssl, KeyShareEntry* keyShareEntry)
#if defined(HAVE_SESSION_TICKET) || !defined(NO_PSK)
ssl->session.namedGroup = (byte)keyShareEntry->group;
#endif
/* reset the pre master secret size */
if (ssl->arrays->preMasterSz == 0)
ssl->arrays->preMasterSz = ENCRYPT_LEN;
/* Use Key Share Data from server. */
if (keyShareEntry->group >= MIN_FFHDE_GROUP &&
keyShareEntry->group <= MAX_FFHDE_GROUP)

View File

@ -4265,8 +4265,10 @@ static int CheckPreSharedKeys(WOLFSSL* ssl, const byte* input, word32 helloSz,
else
#endif
{
if ((modes & (1 << PSK_KE)) == 0)
if ((modes & (1 << PSK_KE)) == 0) {
WOLFSSL_MSG("psk_ke mode does not allow key share");
return PSK_KEY_ERROR;
}
ssl->options.noPskDheKe = 1;
ssl->arrays->preMasterSz = 0;