Skip to content

Commit

Permalink
add tls extension sanity check wolfSSL#6412
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobBarthelmeh authored and kojo1 committed Jul 9, 2024
1 parent b9b56d8 commit a6462c0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -7874,6 +7874,8 @@ static int TLSX_KeyShare_Parse(WOLFSSL* ssl, byte* input, word16 length,

/* Try to use the server's group. */
ret = TLSX_KeyShare_Use(ssl, group, 0, NULL, NULL);
if (ret == 0)
ssl->session.namedGroup = ssl->namedGroup = group;
}
else {
/* Not a message type that is allowed to have this extension. */
Expand Down
12 changes: 11 additions & 1 deletion src/tls13.c
Original file line number Diff line number Diff line change
Expand Up @@ -3320,10 +3320,20 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
}
}
#endif

if (*extMsgType == server_hello) {
/* 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 a6462c0

Please sign in to comment.