Skip to content

Commit

Permalink
Merge pull request #6412 from JacobBarthelmeh/tls13
Browse files Browse the repository at this point in the history
add tls extension sanity check
  • Loading branch information
SparkiDev authored May 17, 2023
2 parents 0530ee7 + 00f1edd commit 5f1ce09
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -8475,6 +8475,9 @@ int TLSX_KeyShare_Parse(WOLFSSL* ssl, const byte* input, word16 length,
if (!WOLFSSL_NAMED_GROUP_IS_PQC(group))
#endif
ret = TLSX_KeyShare_Use(ssl, group, 0, NULL, NULL, &ssl->extensions);

if (ret == 0)
ssl->session->namedGroup = ssl->namedGroup = group;
}
else {
/* Not a message type that is allowed to have this extension. */
Expand Down
10 changes: 10 additions & 0 deletions src/tls13.c
Original file line number Diff line number Diff line change
Expand Up @@ -5236,8 +5236,18 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
}
#endif

/* sanity check on PSK / KSE */
if (
#if defined(HAVE_SESSION_TICKET) || !defined(NO_PSK)
ssl->options.pskNegotiated == 0 &&
#endif
ssl->session->namedGroup == 0) {
return EXT_MISSING;
}

ssl->keys.encryptionOn = 1;
ssl->options.serverState = SERVER_HELLO_COMPLETE;

}
else {
ssl->options.tls1_3 = 1;
Expand Down

0 comments on commit 5f1ce09

Please sign in to comment.