From ff7b8d3715430a8e00a58fa76b12d46ee70d951d Mon Sep 17 00:00:00 2001 From: Juliusz Sosinowicz Date: Mon, 10 Aug 2020 20:40:16 +0200 Subject: [PATCH] Don't attempt TLS 1.3 if server options disable it --- src/internal.c | 8 ++++++-- wolfssl/internal.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/internal.c b/src/internal.c index 811a539ae..f74a3f979 100644 --- a/src/internal.c +++ b/src/internal.c @@ -15578,7 +15578,11 @@ int ProcessReply(WOLFSSL* ssl) ssl->buffers.inputBuffer.length); #endif } - else if (!IsAtLeastTLSv1_3(ssl->version)) { + else if (!IsAtLeastTLSv1_3(ssl->version) +#if defined(WOLFSSL_TLS13) && !defined(WOLFSSL_NO_TLS12) + || !TLSv1_3_Capable(ssl) +#endif + ) { #ifndef WOLFSSL_NO_TLS12 ret = DoHandShakeMsg(ssl, ssl->buffers.inputBuffer.buffer, @@ -20435,7 +20439,7 @@ exit_dpk: #if defined(WOLFSSL_TLS13) && !defined(WOLFSSL_NO_TLS12) /* returns 1 if able to do TLS 1.3 otherwise 0 */ - static int TLSv1_3_Capable(WOLFSSL* ssl) + int TLSv1_3_Capable(WOLFSSL* ssl) { #ifndef WOLFSSL_TLS13 return 0; diff --git a/wolfssl/internal.h b/wolfssl/internal.h index 62ed053ef..4c398e4bf 100644 --- a/wolfssl/internal.h +++ b/wolfssl/internal.h @@ -4456,6 +4456,7 @@ WOLFSSL_LOCAL int StoreKeys(WOLFSSL* ssl, const byte* keyData, int side); WOLFSSL_LOCAL int IsTLS(const WOLFSSL* ssl); WOLFSSL_LOCAL int IsAtLeastTLSv1_2(const WOLFSSL* ssl); WOLFSSL_LOCAL int IsAtLeastTLSv1_3(const ProtocolVersion pv); +WOLFSSL_LOCAL int TLSv1_3_Capable(WOLFSSL* ssl); WOLFSSL_LOCAL void FreeHandshakeResources(WOLFSSL* ssl); WOLFSSL_LOCAL void ShrinkInputBuffer(WOLFSSL* ssl, int forcedFree);