From 78e4cb967dcb05d45152d2fbc33c3858d752e24f Mon Sep 17 00:00:00 2001 From: Ron Eldor Date: Wed, 20 Jun 2018 18:40:21 +0300 Subject: [PATCH 1/3] Fix hmac_drbg failure in benchmark, with threading Remove redunadnat calls to `hmac_drbg_free()` between seeding operations, which make the mutex invalid. Fixes #1095 --- ChangeLog | 6 ++++++ programs/test/benchmark.c | 5 +---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e28f39bd1..b7946c3c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ mbed TLS ChangeLog (Sorted per branch, date) += mbed TLS x.x.x branch released xxxx-xx-xx + +Bugfix + * Fix efailure in hmac_drbg in the benchmark sample application, when + MBEDTLS_THREADING_C is defined. Found by TrinityTonic, #1095 + = mbed TLS 2.1.14 branch released 2018-07-25 Security diff --git a/programs/test/benchmark.c b/programs/test/benchmark.c index 078299319..b43816cd8 100644 --- a/programs/test/benchmark.c +++ b/programs/test/benchmark.c @@ -536,7 +536,6 @@ int main( int argc, char *argv[] ) TIME_AND_TSC( "HMAC_DRBG SHA-1 (NOPR)", if( mbedtls_hmac_drbg_random( &hmac_drbg, buf, BUFSIZE ) != 0 ) mbedtls_exit(1) ); - mbedtls_hmac_drbg_free( &hmac_drbg ); if( mbedtls_hmac_drbg_seed( &hmac_drbg, md_info, myrand, NULL, NULL, 0 ) != 0 ) mbedtls_exit(1); @@ -545,7 +544,6 @@ int main( int argc, char *argv[] ) TIME_AND_TSC( "HMAC_DRBG SHA-1 (PR)", if( mbedtls_hmac_drbg_random( &hmac_drbg, buf, BUFSIZE ) != 0 ) mbedtls_exit(1) ); - mbedtls_hmac_drbg_free( &hmac_drbg ); #endif #if defined(MBEDTLS_SHA256_C) @@ -557,7 +555,6 @@ int main( int argc, char *argv[] ) TIME_AND_TSC( "HMAC_DRBG SHA-256 (NOPR)", if( mbedtls_hmac_drbg_random( &hmac_drbg, buf, BUFSIZE ) != 0 ) mbedtls_exit(1) ); - mbedtls_hmac_drbg_free( &hmac_drbg ); if( mbedtls_hmac_drbg_seed( &hmac_drbg, md_info, myrand, NULL, NULL, 0 ) != 0 ) mbedtls_exit(1); @@ -566,8 +563,8 @@ int main( int argc, char *argv[] ) TIME_AND_TSC( "HMAC_DRBG SHA-256 (PR)", if( mbedtls_hmac_drbg_random( &hmac_drbg, buf, BUFSIZE ) != 0 ) mbedtls_exit(1) ); - mbedtls_hmac_drbg_free( &hmac_drbg ); #endif + mbedtls_hmac_drbg_free( &hmac_drbg ); } #endif From 7b93b6af2fe0009bcf6246b724e117f8dd0d92d4 Mon Sep 17 00:00:00 2001 From: Ron Eldor Date: Wed, 4 Jul 2018 17:35:29 +0300 Subject: [PATCH 2/3] Fix typo Fix typo in ChangeLog entry. --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b7946c3c0..b50d22384 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,7 +3,7 @@ mbed TLS ChangeLog (Sorted per branch, date) = mbed TLS x.x.x branch released xxxx-xx-xx Bugfix - * Fix efailure in hmac_drbg in the benchmark sample application, when + * Fix failure in hmac_drbg in the benchmark sample application, when MBEDTLS_THREADING_C is defined. Found by TrinityTonic, #1095 = mbed TLS 2.1.14 branch released 2018-07-25 From a4d836b4036e584686c35e56721256977a3229c6 Mon Sep 17 00:00:00 2001 From: Ron Eldor Date: Wed, 1 Aug 2018 14:35:11 +0300 Subject: [PATCH 3/3] Style fix Add space in the ChangeLog. --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b50d22384..2ebde9870 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,7 +4,7 @@ mbed TLS ChangeLog (Sorted per branch, date) Bugfix * Fix failure in hmac_drbg in the benchmark sample application, when - MBEDTLS_THREADING_C is defined. Found by TrinityTonic, #1095 + MBEDTLS_THREADING_C is defined. Found by TrinityTonic, #1095 = mbed TLS 2.1.14 branch released 2018-07-25