From da609130f37fff9a778094271ce2d0f3ce086a0e Mon Sep 17 00:00:00 2001 From: YxC Date: Mon, 22 May 2023 12:08:12 -0700 Subject: [PATCH] fix: correct calling to time function in tls13 client&server Call `mbedtls_time` to handle the case when MBEDTLS_PLATFORM_TIME_MACRO is defined Signed-off-by: Yuxiang Cao --- library/ssl_tls13_client.c | 2 +- library/ssl_tls13_server.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/ssl_tls13_client.c b/library/ssl_tls13_client.c index e1d0c6ced060..e34785381803 100644 --- a/library/ssl_tls13_client.c +++ b/library/ssl_tls13_client.c @@ -1696,7 +1696,7 @@ static int ssl_tls13_parse_server_hello(mbedtls_ssl_context *ssl, cipher_suite, ciphersuite_info->name)); #if defined(MBEDTLS_HAVE_TIME) - ssl->session_negotiate->start = time(NULL); + ssl->session_negotiate->start = mbedtls_time(NULL); #endif /* MBEDTLS_HAVE_TIME */ /* ... diff --git a/library/ssl_tls13_server.c b/library/ssl_tls13_server.c index 33121afa73c8..dc3c2f070d39 100644 --- a/library/ssl_tls13_server.c +++ b/library/ssl_tls13_server.c @@ -1846,7 +1846,7 @@ static int ssl_tls13_prepare_server_hello(mbedtls_ssl_context *ssl) MBEDTLS_SERVER_HELLO_RANDOM_LEN); #if defined(MBEDTLS_HAVE_TIME) - ssl->session_negotiate->start = time(NULL); + ssl->session_negotiate->start = mbedtls_time(NULL); #endif /* MBEDTLS_HAVE_TIME */ return ret;