From 9e42f6efd36a661f177da276487a5242fd1006fc Mon Sep 17 00:00:00 2001 From: Jerry Yu Date: Fri, 27 Aug 2021 15:14:01 +0800 Subject: [PATCH] Revert "Move random function check" This reverts commit cc88b34f7942f57ea0fd27ee4b3e29f49c91f10e. It causes many test fail. It should be re-considered. Signed-off-by: Jerry Yu --- library/ssl_tls.c | 6 ------ library/ssl_tls13_client.c | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 831cc52ac..c43f95ee1 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -3182,12 +3182,6 @@ static int ssl_conf_check(const mbedtls_ssl_context *ssl) if( ret != 0 ) return( ret ); - if( ssl->conf->f_rng == NULL ) - { - MBEDTLS_SSL_DEBUG_MSG( 1, ( "no RNG provided" ) ); - return( MBEDTLS_ERR_SSL_NO_RNG ); - } - /* Space for further checks */ return( 0 ); diff --git a/library/ssl_tls13_client.c b/library/ssl_tls13_client.c index 0a07e06c4..f5a6e20ca 100644 --- a/library/ssl_tls13_client.c +++ b/library/ssl_tls13_client.c @@ -116,6 +116,12 @@ static int ssl_tls13_prepare_client_hello( mbedtls_ssl_context *ssl ) { int ret; + if( ssl->conf->f_rng == NULL ) + { + MBEDTLS_SSL_DEBUG_MSG( 1, ( "no RNG provided" ) ); + return( MBEDTLS_ERR_SSL_NO_RNG ); + } + if( ( ret = ssl->conf->f_rng( ssl->conf->p_rng, ssl->handshake->randbytes, CLIENT_HELLO_RAND_BYTES_LEN ) ) != 0 )