mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-23 02:55:41 +01:00
psa: export_public_key: Check for all zero on error
This commit is contained in:
parent
e7edf7bb20
commit
2a671e9031
@ -425,7 +425,7 @@ void import_export_public_key( data_t *data,
|
||||
psa_status_t status;
|
||||
unsigned char *exported = NULL;
|
||||
size_t export_size;
|
||||
size_t exported_length;
|
||||
size_t exported_length = INVALID_EXPORT_LENGTH;
|
||||
psa_key_type_t got_type;
|
||||
size_t got_bits;
|
||||
psa_key_policy_t policy;
|
||||
@ -458,11 +458,12 @@ void import_export_public_key( data_t *data,
|
||||
exported, export_size,
|
||||
&exported_length );
|
||||
TEST_ASSERT( status == expected_export_status );
|
||||
TEST_ASSERT( exported_length == (size_t) public_key_expected_length );
|
||||
TEST_ASSERT( mem_is_zero( exported + exported_length,
|
||||
export_size - exported_length ) );
|
||||
if( status != PSA_SUCCESS )
|
||||
goto destroy;
|
||||
|
||||
TEST_ASSERT( exported_length == (size_t) public_key_expected_length );
|
||||
|
||||
destroy:
|
||||
/* Destroy the key */
|
||||
TEST_ASSERT( psa_destroy_key( slot ) == PSA_SUCCESS );
|
||||
|
Loading…
Reference in New Issue
Block a user