Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tls extension sanity check #6412

Merged
merged 1 commit into from
May 17, 2023
Merged
Show file tree
Hide file tree
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
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