forked from wolfSSL/wolfssl
Improved fix for TLS1.3 to TLS1.2 client downgrade
This commit is contained in:
12
src/tls13.c
12
src/tls13.c
@ -5023,6 +5023,7 @@ typedef struct Dsh13Args {
|
|||||||
int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
|
int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
|
||||||
word32 helloSz, byte* extMsgType)
|
word32 helloSz, byte* extMsgType)
|
||||||
{
|
{
|
||||||
|
word32 inOutIdxCopy;
|
||||||
int ret;
|
int ret;
|
||||||
byte suite[2];
|
byte suite[2];
|
||||||
byte tls12minor;
|
byte tls12minor;
|
||||||
@ -5298,13 +5299,6 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif /* WOLFSSL_DTLS13 */
|
#endif /* WOLFSSL_DTLS13 */
|
||||||
|
|
||||||
#ifndef WOLFSSL_NO_TLS12
|
|
||||||
return DoServerHello(ssl, input, inOutIdx, helloSz);
|
|
||||||
#else
|
|
||||||
SendAlert(ssl, alert_fatal, wolfssl_alert_protocol_version);
|
|
||||||
return VERSION_ERROR;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5359,6 +5353,7 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
|
|||||||
DtlsCIDOnExtensionsParsed(ssl);
|
DtlsCIDOnExtensionsParsed(ssl);
|
||||||
#endif /* WOLFSSL_DTLS_CID */
|
#endif /* WOLFSSL_DTLS_CID */
|
||||||
|
|
||||||
|
inOutIdxCopy = *inOutIdx;
|
||||||
*inOutIdx = args->idx;
|
*inOutIdx = args->idx;
|
||||||
|
|
||||||
ssl->options.serverState = SERVER_HELLO_COMPLETE;
|
ssl->options.serverState = SERVER_HELLO_COMPLETE;
|
||||||
@ -5403,8 +5398,9 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
|
|||||||
else
|
else
|
||||||
ssl->chVersion.minor = TLSv1_2_MINOR;
|
ssl->chVersion.minor = TLSv1_2_MINOR;
|
||||||
/* Complete TLS v1.2 processing of ServerHello. */
|
/* Complete TLS v1.2 processing of ServerHello. */
|
||||||
ret = CompleteServerHello(ssl);
|
ret = DoServerHello(ssl, input, &inOutIdxCopy, helloSz);
|
||||||
#else
|
#else
|
||||||
|
(void)inOutIdxCopy;
|
||||||
WOLFSSL_MSG("Client using higher version, fatal error");
|
WOLFSSL_MSG("Client using higher version, fatal error");
|
||||||
WOLFSSL_ERROR_VERBOSE(VERSION_ERROR);
|
WOLFSSL_ERROR_VERBOSE(VERSION_ERROR);
|
||||||
ret = VERSION_ERROR;
|
ret = VERSION_ERROR;
|
||||||
|
Reference in New Issue
Block a user