Compilation and tests fixes

This commit is contained in:
mohammad1603 2018-03-20 14:28:38 -07:00 committed by itayzafrir
parent 804cd71bf8
commit 060ad8ac34
2 changed files with 5 additions and 9 deletions

View File

@ -1304,7 +1304,7 @@ psa_status_t psa_set_key_lifetime(psa_key_slot_t key,
if ( slot->lifetime == PSA_KEY_LIFETIME_WRITE_ONCE ) if ( slot->lifetime == PSA_KEY_LIFETIME_WRITE_ONCE )
return( PSA_ERROR_KEY_LIFETIME_CHANGE ); return( PSA_ERROR_KEY_LIFETIME_CHANGE );
slot->lifetime = liftime; slot->lifetime = lifetime;
return( PSA_SUCCESS ); return( PSA_SUCCESS );
} }

View File

@ -370,8 +370,6 @@ void key_lifetime( int lifetime_arg )
psa_key_lifetime_t lifetime_set = (psa_key_lifetime_t) lifetime_arg; psa_key_lifetime_t lifetime_set = (psa_key_lifetime_t) lifetime_arg;
psa_key_lifetime_t lifetime_get; psa_key_lifetime_t lifetime_get;
TEST_ASSERT( key != NULL );
memset( key, 0x2a, sizeof( key ) ); memset( key, 0x2a, sizeof( key ) );
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS ); TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
@ -379,14 +377,15 @@ void key_lifetime( int lifetime_arg )
TEST_ASSERT( psa_import_key( key_slot, key_type, TEST_ASSERT( psa_import_key( key_slot, key_type,
key, sizeof( key ) ) == PSA_SUCCESS ); key, sizeof( key ) ) == PSA_SUCCESS );
TEST_ASSERT( psa_set_key_lifetime( key_slot, lifetime_set )); TEST_ASSERT( psa_set_key_lifetime( key_slot,
lifetime_set ) == PSA_SUCCESS );
TEST_ASSERT( psa_get_key_lifetime( key_slot, &lifetime_get )); TEST_ASSERT( psa_get_key_lifetime( key_slot,
&lifetime_get ) == PSA_SUCCESS );
TEST_ASSERT( lifetime_get == lifetime_set ); TEST_ASSERT( lifetime_get == lifetime_set );
exit: exit:
mbedtls_free( key );
psa_destroy_key( key_slot ); psa_destroy_key( key_slot );
mbedtls_psa_crypto_free( ); mbedtls_psa_crypto_free( );
} }
@ -403,8 +402,6 @@ void key_lifetime_set_fail( int key_slot_arg, int lifetime_arg, int expected_sta
psa_status_t actual_status; psa_status_t actual_status;
psa_status_t expected_status = expected_status_arg; psa_status_t expected_status = expected_status_arg;
TEST_ASSERT( key != NULL );
memset( key, 0x2a, sizeof( key ) ); memset( key, 0x2a, sizeof( key ) );
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS ); TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
@ -420,7 +417,6 @@ void key_lifetime_set_fail( int key_slot_arg, int lifetime_arg, int expected_sta
TEST_ASSERT( expected_status == actual_status ); TEST_ASSERT( expected_status == actual_status );
exit: exit:
mbedtls_free( key );
psa_destroy_key( key_slot ); psa_destroy_key( key_slot );
mbedtls_psa_crypto_free( ); mbedtls_psa_crypto_free( );
} }