mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-23 15:55:10 +01:00
Ensure MD self_test ret codes are not hidden
Also fix a potential memory leak and an incorrect goto statement in sha1.c self_test
This commit is contained in:
parent
a21247ead7
commit
6a3f30514a
4 changed files with 42 additions and 25 deletions
|
|
@ -464,7 +464,7 @@ static const unsigned char ripemd160_test_md[TESTS][20] =
|
|||
*/
|
||||
int mbedtls_ripemd160_self_test( int verbose )
|
||||
{
|
||||
int i, ret;
|
||||
int i, ret = 0;
|
||||
unsigned char output[20];
|
||||
|
||||
memset( output, 0, sizeof output );
|
||||
|
|
@ -481,7 +481,10 @@ int mbedtls_ripemd160_self_test( int verbose )
|
|||
goto fail;
|
||||
|
||||
if( memcmp( output, ripemd160_test_md[i], 20 ) != 0 )
|
||||
{
|
||||
ret = 1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if( verbose != 0 )
|
||||
mbedtls_printf( "passed\n" );
|
||||
|
|
@ -496,7 +499,7 @@ fail:
|
|||
if( verbose != 0 )
|
||||
mbedtls_printf( "failed\n" );
|
||||
|
||||
return( 1 );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
#endif /* MBEDTLS_SELF_TEST */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue