From 2d59dbc0323d30570a51d2ab36c067f9b3be6759 Mon Sep 17 00:00:00 2001 From: Andrzej Kurek Date: Thu, 13 Oct 2022 08:34:38 -0400 Subject: [PATCH] Use TLS prf only if TLS 1.2 is compiled in Signed-off-by: Andrzej Kurek --- library/ssl_tls.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 50a233ddb..779295739 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -4046,7 +4046,9 @@ static int ssl_context_load( mbedtls_ssl_context *ssl, const unsigned char * const end = buf + len; size_t session_len; int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; +#if defined(MBEDTLS_SSL_PROTO_TLS1_2) tls_prf_fn prf_func = NULL; +#endif /* * The context should have been freshly setup or reset. @@ -4132,6 +4134,7 @@ static int ssl_context_load( mbedtls_ssl_context *ssl, ssl->transform_out = ssl->transform; ssl->transform_negotiate = NULL; +#if defined(MBEDTLS_SSL_PROTO_TLS1_2) prf_func = ssl_tls12prf_from_cs( ssl->session->ciphersuite ); if( prf_func == NULL ) return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); @@ -4139,7 +4142,7 @@ static int ssl_context_load( mbedtls_ssl_context *ssl, /* Read random bytes and populate structure */ if( (size_t)( end - p ) < sizeof( ssl->transform->randbytes ) ) return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); -#if defined(MBEDTLS_SSL_PROTO_TLS1_2) + ret = ssl_tls12_populate_transform( ssl->transform, ssl->session->ciphersuite, ssl->session->master,