From 8e2532196df9869e7eb5dc63239e04d1265000c2 Mon Sep 17 00:00:00 2001 From: Jarno Lamsa Date: Thu, 13 Jun 2019 11:45:06 +0300 Subject: [PATCH] Set timer callbacks with serialization --- programs/ssl/ssl_client2.c | 5 +++++ programs/ssl/ssl_server2.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c index 9856744d4..41735af04 100644 --- a/programs/ssl/ssl_client2.c +++ b/programs/ssl/ssl_client2.c @@ -2975,6 +2975,11 @@ send_request: mbedtls_net_send, mbedtls_net_recv, opt.nbio == 0 ? mbedtls_net_recv_timeout : NULL ); +#if defined(MBEDTLS_TIMING_C) + if( opt.nbio != 0 && opt.read_timeout != 0 ) + mbedtls_ssl_set_timer_cb( &ssl, &timer, mbedtls_timing_set_delay, + mbedtls_timing_get_delay ); +#endif /* MBEDTLS_TIMING_C */ } mbedtls_printf( " Deserializing connection..." ); diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c index 9b836987b..42d1e77ea 100644 --- a/programs/ssl/ssl_server2.c +++ b/programs/ssl/ssl_server2.c @@ -3985,6 +3985,11 @@ data_exchange: mbedtls_ssl_set_bio( &ssl, &client_fd, mbedtls_net_send, mbedtls_net_recv, opt.nbio == 0 ? mbedtls_net_recv_timeout : NULL ); +#if defined(MBEDTLS_TIMING_C) + if( opt.nbio != 0 && opt.read_timeout != 0 ) + mbedtls_ssl_set_timer_cb( &ssl, &timer, mbedtls_timing_set_delay, + mbedtls_timing_get_delay ); +#endif /* MBEDTLS_TIMING_C */ } mbedtls_printf( " Deserializing connection..." );