From 4a23c98506658d73b04053a892b92b0266737241 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Wed, 3 Feb 2021 13:54:41 +0100 Subject: [PATCH] Fix exit status if the RNG seeding failed Signed-off-by: Gilles Peskine --- programs/ssl/ssl_client2.c | 3 ++- programs/ssl/ssl_server2.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c index 876555d93..706541284 100644 --- a/programs/ssl/ssl_client2.c +++ b/programs/ssl/ssl_client2.c @@ -1536,7 +1536,8 @@ int main( int argc, char *argv[] ) mbedtls_printf( "\n . Seeding the random number generator..." ); fflush( stdout ); - if( rng_seed( &rng, opt.reproducible, pers ) != 0 ) + ret = rng_seed( &rng, opt.reproducible, pers ); + if( ret != 0 ) goto exit; mbedtls_printf( " ok\n" ); diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c index 57c053ce9..5d86e3bf8 100644 --- a/programs/ssl/ssl_server2.c +++ b/programs/ssl/ssl_server2.c @@ -2295,7 +2295,8 @@ int main( int argc, char *argv[] ) mbedtls_printf( "\n . Seeding the random number generator..." ); fflush( stdout ); - if( rng_seed( &rng, opt.reproducible, pers ) != 0 ) + ret = rng_seed( &rng, opt.reproducible, pers ); + if( ret != 0 ) goto exit; mbedtls_printf( " ok\n" );