From 59244e87e1f04ad501b816797f7f1a2bea98435a Mon Sep 17 00:00:00 2001 From: Ryan LaPointe Date: Mon, 1 Mar 2021 10:02:35 -0500 Subject: [PATCH 1/2] Actually use the READ_TIMEOUT_MS in the sample DTLS client and server Signed-off-by: Ryan LaPointe --- ChangeLog.d/dtls_sample_use_read_timeout.txt | 2 ++ programs/ssl/dtls_client.c | 1 + programs/ssl/dtls_server.c | 1 + 3 files changed, 4 insertions(+) create mode 100644 ChangeLog.d/dtls_sample_use_read_timeout.txt diff --git a/ChangeLog.d/dtls_sample_use_read_timeout.txt b/ChangeLog.d/dtls_sample_use_read_timeout.txt new file mode 100644 index 000000000..e3150d6ef --- /dev/null +++ b/ChangeLog.d/dtls_sample_use_read_timeout.txt @@ -0,0 +1,2 @@ +Changes + * Fix the setting of the read timeout in the DTLS sample programs. diff --git a/programs/ssl/dtls_client.c b/programs/ssl/dtls_client.c index 03a06ff0a..8c302a0a5 100644 --- a/programs/ssl/dtls_client.c +++ b/programs/ssl/dtls_client.c @@ -191,6 +191,7 @@ int main( int argc, char *argv[] ) mbedtls_ssl_conf_ca_chain( &conf, &cacert, NULL ); mbedtls_ssl_conf_rng( &conf, mbedtls_ctr_drbg_random, &ctr_drbg ); mbedtls_ssl_conf_dbg( &conf, my_debug, stdout ); + mbedtls_ssl_conf_read_timeout( &conf, READ_TIMEOUT_MS ); if( ( ret = mbedtls_ssl_setup( &ssl, &conf ) ) != 0 ) { diff --git a/programs/ssl/dtls_server.c b/programs/ssl/dtls_server.c index 22e3fc5db..958b0b521 100644 --- a/programs/ssl/dtls_server.c +++ b/programs/ssl/dtls_server.c @@ -223,6 +223,7 @@ int main( void ) mbedtls_ssl_conf_rng( &conf, mbedtls_ctr_drbg_random, &ctr_drbg ); mbedtls_ssl_conf_dbg( &conf, my_debug, stdout ); + mbedtls_ssl_conf_read_timeout( &conf, READ_TIMEOUT_MS ); #if defined(MBEDTLS_SSL_CACHE_C) mbedtls_ssl_conf_session_cache( &conf, &cache, From dbb192d157537bff0a86ff87b0c061307aa68247 Mon Sep 17 00:00:00 2001 From: Ryan LaPointe Date: Mon, 1 Mar 2021 10:03:31 -0500 Subject: [PATCH 2/2] Fix inaccurate comment in sample DTLS server Signed-off-by: Ryan LaPointe --- programs/ssl/dtls_server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/ssl/dtls_server.c b/programs/ssl/dtls_server.c index 958b0b521..5f71ec950 100644 --- a/programs/ssl/dtls_server.c +++ b/programs/ssl/dtls_server.c @@ -87,7 +87,7 @@ int main( void ) #include "mbedtls/ssl_cache.h" #endif -#define READ_TIMEOUT_MS 10000 /* 5 seconds */ +#define READ_TIMEOUT_MS 10000 /* 10 seconds */ #define DEBUG_LEVEL 0