Test suites: cope with psa_crypto_init failure

psa_crypto_init() can fail. Do check its return code. Don't call it
before initializing local objects that are going to be cleaned up.
This commit is contained in:
Gilles Peskine 2019-06-07 15:38:59 +02:00
parent b6229e304e
commit 69c0ea26c7

View File

@ -124,11 +124,11 @@ void pk_psa_utils( )
size_t len;
mbedtls_pk_debug_item dbg;
TEST_ASSERT( psa_crypto_init() == 0 );
mbedtls_pk_init( &pk );
mbedtls_pk_init( &pk2 );
TEST_ASSERT( psa_crypto_init() == 0 );
TEST_ASSERT( mbedtls_pk_setup_opaque( &pk, 0 ) ==
MBEDTLS_ERR_PK_BAD_INPUT_DATA );