Skip to content

Commit f306135

Browse files
committed
Improved fix for TLS1.3 to TLS1.2 client downgrade
1 parent 29df901 commit f306135

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

src/tls13.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5023,6 +5023,7 @@ typedef struct Dsh13Args {
50235023
int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
50245024
word32 helloSz, byte* extMsgType)
50255025
{
5026+
word32 inOutIdxCopy;
50265027
int ret;
50275028
byte suite[2];
50285029
byte tls12minor;
@@ -5298,13 +5299,6 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
52985299
return ret;
52995300
}
53005301
#endif /* WOLFSSL_DTLS13 */
5301-
5302-
#ifndef WOLFSSL_NO_TLS12
5303-
return DoServerHello(ssl, input, inOutIdx, helloSz);
5304-
#else
5305-
SendAlert(ssl, alert_fatal, wolfssl_alert_protocol_version);
5306-
return VERSION_ERROR;
5307-
#endif
53085302
}
53095303
}
53105304

@@ -5359,6 +5353,7 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
53595353
DtlsCIDOnExtensionsParsed(ssl);
53605354
#endif /* WOLFSSL_DTLS_CID */
53615355

5356+
inOutIdxCopy = *inOutIdx;
53625357
*inOutIdx = args->idx;
53635358

53645359
ssl->options.serverState = SERVER_HELLO_COMPLETE;
@@ -5403,8 +5398,9 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
54035398
else
54045399
ssl->chVersion.minor = TLSv1_2_MINOR;
54055400
/* Complete TLS v1.2 processing of ServerHello. */
5406-
ret = CompleteServerHello(ssl);
5401+
ret = DoServerHello(ssl, input, &inOutIdxCopy, helloSz);
54075402
#else
5403+
(void)inOutIdxCopy;
54085404
WOLFSSL_MSG("Client using higher version, fatal error");
54095405
WOLFSSL_ERROR_VERBOSE(VERSION_ERROR);
54105406
ret = VERSION_ERROR;

0 commit comments

Comments
 (0)