Skip to content

Commit f12b611

Browse files
authored
Merge pull request #7029 from julek-wolfssl/zd/17108-fix
Additional TLS checks
2 parents 3b75a41 + 493bb17 commit f12b611

5 files changed

Lines changed: 389 additions & 16 deletions

File tree

src/dtls13.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,14 @@ int Dtls13ProcessBufferedMessages(WOLFSSL* ssl)
363363
if (!msg->ready)
364364
break;
365365

366+
#ifndef WOLFSSL_DISABLE_EARLY_SANITY_CHECKS
367+
ret = MsgCheckEncryption(ssl, msg->type, msg->encrypted);
368+
if (ret != 0) {
369+
SendAlert(ssl, alert_fatal, unexpected_message);
370+
break;
371+
}
372+
#endif
373+
366374
/* We may have DTLS <=1.2 msgs stored from before we knew which version
367375
* we were going to use. Interpret correctly. */
368376
if (IsAtLeastTLSv1_3(ssl->version)) {
@@ -1622,6 +1630,13 @@ static int _Dtls13HandshakeRecv(WOLFSSL* ssl, byte* input, word32 size,
16221630
if (ret != 0)
16231631
return PARSE_ERROR;
16241632

1633+
/* Need idx + fragLength as we don't advance the inputBuffer idx value */
1634+
ret = EarlySanityCheckMsgReceived(ssl, handshakeType, idx + fragLength);
1635+
if (ret != 0) {
1636+
WOLFSSL_ERROR(ret);
1637+
return ret;
1638+
}
1639+
16251640
if (ssl->options.side == WOLFSSL_SERVER_END &&
16261641
ssl->options.acceptState < TLS13_ACCEPT_FIRST_REPLY_DONE) {
16271642
if (handshakeType != client_hello) {

0 commit comments

Comments
 (0)