Skip to content

Commit afaee1c

Browse files
Catch AES failure in mbedtls_ctr_drbg_random
The functions mbedtls_ctr_drbg_random() and mbedtls_ctr_drbg_random_with_add() could return 0 if an AES function failed. This could only happen with alternative AES implementations (the built-in implementation of the AES functions involved never fail), typically due to a failure in a hardware accelerator. Bug reported and fix proposed by Johan Uppman Bruce and Christoffer Lauri, Sectra.
1 parent a428ced commit afaee1c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/ctr_drbg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ int mbedtls_ctr_drbg_random_with_add( void *p_rng,
584584
exit:
585585
mbedtls_platform_zeroize( add_input, sizeof( add_input ) );
586586
mbedtls_platform_zeroize( tmp, sizeof( tmp ) );
587-
return( 0 );
587+
return( ret );
588588
}
589589

590590
int mbedtls_ctr_drbg_random( void *p_rng, unsigned char *output,

0 commit comments

Comments
 (0)