Skip to content

Commit 8ce29c7

Browse files
Avoid sending duplicate protocol_version alert in DoTls13ServerHello.
DoTls13ServerHello was explicitly sending a protocol_version alert, then returning VERSION_ERROR which TranslateErrorToAlert then mapped to protocol_version, causing a duplicate alert to be sent. Remove all protocol_version alerts from DoTls13ServerHello itself and instead return VERSION_ERROR and allow TranslateErrorToAlert to handle sending the alerts. Fixes #10746.
1 parent ed8d4a8 commit 8ce29c7

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

src/tls13.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5473,7 +5473,6 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
54735473

54745474
if (args->pv.major != ssl->version.major ||
54755475
args->pv.minor != tls12minor) {
5476-
SendAlert(ssl, alert_fatal, wolfssl_alert_protocol_version);
54775476
WOLFSSL_ERROR_VERBOSE(VERSION_ERROR);
54785477
return VERSION_ERROR;
54795478
}
@@ -5610,14 +5609,14 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
56105609
#endif
56115610
ssl->options.haveEMS = 0;
56125611
if (args->pv.minor < ssl->options.minDowngrade) {
5613-
SendAlert(ssl, alert_fatal, wolfssl_alert_protocol_version);
5612+
WOLFSSL_ERROR_VERBOSE(VERSION_ERROR);
56145613
return VERSION_ERROR;
56155614
}
56165615
#ifndef WOLFSSL_NO_TLS12
56175616
ssl->options.tls1_3 = 0;
56185617
return DoServerHello(ssl, input, inOutIdx, helloSz);
56195618
#else
5620-
SendAlert(ssl, alert_fatal, wolfssl_alert_protocol_version);
5619+
WOLFSSL_ERROR_VERBOSE(VERSION_ERROR);
56215620
return VERSION_ERROR;
56225621
#endif
56235622
}
@@ -5657,7 +5656,6 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
56575656
if (!ssl->options.downgrade) {
56585657
WOLFSSL_MSG("Server trying to downgrade to version less than "
56595658
"TLS v1.3");
5660-
SendAlert(ssl, alert_fatal, wolfssl_alert_protocol_version);
56615659
WOLFSSL_ERROR_VERBOSE(VERSION_ERROR);
56625660
return VERSION_ERROR;
56635661
}
@@ -5691,14 +5689,12 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
56915689

56925690
if (!ssl->options.dtls &&
56935691
args->pv.minor < ssl->options.minDowngrade) {
5694-
SendAlert(ssl, alert_fatal, wolfssl_alert_protocol_version);
56955692
WOLFSSL_ERROR_VERBOSE(VERSION_ERROR);
56965693
return VERSION_ERROR;
56975694
}
56985695

56995696
if (ssl->options.dtls &&
57005697
args->pv.minor > ssl->options.minDowngrade) {
5701-
SendAlert(ssl, alert_fatal, wolfssl_alert_protocol_version);
57025698
WOLFSSL_ERROR_VERBOSE(VERSION_ERROR);
57035699
return VERSION_ERROR;
57045700
}

0 commit comments

Comments
 (0)