From fe7be3e15f09e5b7127ec4ff355b6ece5788195d Mon Sep 17 00:00:00 2001 From: John Safranek Date: Thu, 21 Jan 2021 14:48:10 -0800 Subject: [PATCH 1/2] Alerts Alerts the server sends between receiving the client's CCS message and before it sends its own CCS message should not be encrypted. --- src/internal.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/internal.c b/src/internal.c index e2fdbcc71..579a8e692 100644 --- a/src/internal.c +++ b/src/internal.c @@ -209,15 +209,14 @@ int IsAtLeastTLSv1_3(const ProtocolVersion pv) static WC_INLINE int IsEncryptionOn(WOLFSSL* ssl, int isSend) { - (void)isSend; - #ifdef WOLFSSL_DTLS /* For DTLS, epoch 0 is always not encrypted. */ if (ssl->options.dtls && !isSend && ssl->keys.curEpoch == 0) return 0; #endif /* WOLFSSL_DTLS */ - return ssl->keys.encryptionOn; + return ssl->keys.encryptionOn && + (isSend ? ssl->encrypt.setup : ssl->decrypt.setup); } From 6f21995ec53ab48f3e7e471a9640fe4a424567e0 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Thu, 21 Jan 2021 16:42:54 -0800 Subject: [PATCH 2/2] Alerts Expand the guard around sending the PSK identity alert with a more limited option than enabling it with all the other alerts. --- src/internal.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/internal.c b/src/internal.c index 579a8e692..0de6c4053 100644 --- a/src/internal.c +++ b/src/internal.c @@ -29559,7 +29559,8 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx, if (ssl->arrays->psk_keySz == 0 || ssl->arrays->psk_keySz > MAX_PSK_KEY_LEN) { - #ifdef WOLFSSL_EXTRA_ALERTS + #if defined(WOLFSSL_EXTRA_ALERTS) || \ + defined(WOLFSSL_PSK_IDENTITY_ALERT) SendAlert(ssl, alert_fatal, unknown_psk_identity); #endif @@ -30443,7 +30444,8 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx, if (ssl->arrays->psk_keySz == 0 || ssl->arrays->psk_keySz > MAX_PSK_KEY_LEN) { - #ifdef WOLFSSL_EXTRA_ALERTS + #if defined(WOLFSSL_EXTRA_ALERTS) || \ + defined(WOLFSSL_PSK_IDENTITY_ALERT) SendAlert(ssl, alert_fatal, unknown_psk_identity); #endif