diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 5ba60e1ae..329ee3dc5 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -1304,7 +1304,7 @@ psa_status_t psa_set_key_lifetime(psa_key_slot_t key, if ( slot->lifetime == PSA_KEY_LIFETIME_WRITE_ONCE ) return( PSA_ERROR_KEY_LIFETIME_CHANGE ); - slot->lifetime = liftime; + slot->lifetime = lifetime; return( PSA_SUCCESS ); } diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function index d8dddff2c..b4bf66060 100644 --- a/tests/suites/test_suite_psa_crypto.function +++ b/tests/suites/test_suite_psa_crypto.function @@ -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_get; - TEST_ASSERT( key != NULL ); - memset( key, 0x2a, sizeof( key ) ); 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, 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 ); exit: - mbedtls_free( key ); psa_destroy_key( key_slot ); 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 expected_status = expected_status_arg; - TEST_ASSERT( key != NULL ); - memset( key, 0x2a, sizeof( key ) ); 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 ); exit: - mbedtls_free( key ); psa_destroy_key( key_slot ); mbedtls_psa_crypto_free( ); }