Fix error reporting in pkey/pk_* programs

This commit is contained in:
Manuel Pégourié-Gonnard 2015-08-27 22:03:33 +02:00
parent ce7a08ba49
commit cf9ab63863
4 changed files with 20 additions and 8 deletions

View File

@ -151,8 +151,11 @@ exit:
mbedtls_entropy_free( &entropy );
#if defined(MBEDTLS_ERROR_C)
mbedtls_strerror( ret, (char *) buf, sizeof(buf) );
mbedtls_printf( " ! Last error was: %s\n", buf );
if( ret != 0 )
{
mbedtls_strerror( ret, (char *) buf, sizeof(buf) );
mbedtls_printf( " ! Last error was: %s\n", buf );
}
#endif
#if defined(_WIN32)

View File

@ -151,8 +151,11 @@ exit:
mbedtls_entropy_free( &entropy );
#if defined(MBEDTLS_ERROR_C)
mbedtls_strerror( ret, (char *) buf, sizeof(buf) );
mbedtls_printf( " ! Last error was: %s\n", buf );
if( ret != 0 )
{
mbedtls_strerror( ret, (char *) buf, sizeof(buf) );
mbedtls_printf( " ! Last error was: %s\n", buf );
}
#endif
#if defined(_WIN32)

View File

@ -156,8 +156,11 @@ exit:
mbedtls_entropy_free( &entropy );
#if defined(MBEDTLS_ERROR_C)
mbedtls_strerror( ret, (char *) buf, sizeof(buf) );
mbedtls_printf( " ! Last error was: %s\n", buf );
if( ret != 0 )
{
mbedtls_strerror( ret, (char *) buf, sizeof(buf) );
mbedtls_printf( " ! Last error was: %s\n", buf );
}
#endif
#if defined(_WIN32)

View File

@ -132,8 +132,11 @@ exit:
mbedtls_pk_free( &pk );
#if defined(MBEDTLS_ERROR_C)
mbedtls_strerror( ret, (char *) buf, sizeof(buf) );
mbedtls_printf( " ! Last error was: %s\n", buf );
if( ret != 0 )
{
mbedtls_strerror( ret, (char *) buf, sizeof(buf) );
mbedtls_printf( " ! Last error was: %s\n", buf );
}
#endif
#if defined(_WIN32)