Skip to content

Commit 8d9af25

Browse files
committed
reject extensions in a TLS 1.3 Certificate message that were not offered in the prior ClientHello/CertificateRequest
per rfc 8446 4.4.2
1 parent 1c9555c commit 8d9af25

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/tls.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17387,6 +17387,20 @@ int TLSX_Parse(WOLFSSL* ssl, const byte* input, word16 length, byte msgType,
1738717387
break;
1738817388
}
1738917389

17390+
#ifdef WOLFSSL_TLS13
17391+
/* RFC 8446 4.4.2: extensions in a Certificate message MUST
17392+
* correspond to ones offered in our prior ClientHello (client) or
17393+
* CertificateRequest (server). Reject anything we did not offer. */
17394+
if (msgType == certificate &&
17395+
IsAtLeastTLSv1_3(ssl->version) &&
17396+
TLSX_Find(ssl->extensions, (TLSX_Type)type) == NULL) {
17397+
WOLFSSL_MSG("Cert-msg extension not offered in CH/CR");
17398+
SendAlert(ssl, alert_fatal, unsupported_extension);
17399+
WOLFSSL_ERROR_VERBOSE(UNSUPPORTED_EXTENSION);
17400+
return UNSUPPORTED_EXTENSION;
17401+
}
17402+
#endif
17403+
1739017404
switch (type) {
1739117405
#ifdef HAVE_SNI
1739217406
case TLSX_SERVER_NAME:

0 commit comments

Comments
 (0)