fix import_export_public_key test to use policy

This commit is contained in:
Moran Peker 2018-05-29 16:45:14 +03:00 committed by itayzafrir
parent 338a0cf569
commit b34879b61a

View File

@ -545,6 +545,7 @@ void import_export_public_key( char *hex,
size_t exported_length; size_t exported_length;
psa_key_type_t got_type; psa_key_type_t got_type;
size_t got_bits; size_t got_bits;
psa_key_policy_t policy = {0};
data = unhexify_alloc( hex, &data_size ); data = unhexify_alloc( hex, &data_size );
TEST_ASSERT( data != NULL ); TEST_ASSERT( data != NULL );
@ -554,6 +555,13 @@ void import_export_public_key( char *hex,
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS ); TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
psa_key_policy_init( &policy );
psa_key_policy_set_usage( &policy, PSA_KEY_USAGE_EXPORT,
PSA_ALG_VENDOR_FLAG );
TEST_ASSERT( psa_set_key_policy( slot, &policy ) == PSA_SUCCESS );
/* Import the key */ /* Import the key */
TEST_ASSERT( psa_import_key( slot, type, TEST_ASSERT( psa_import_key( slot, type,
data, data_size ) == PSA_SUCCESS ); data, data_size ) == PSA_SUCCESS );