Bug fix: don't start a transaction for non-SE keys

This commit is contained in:
Gilles Peskine 2019-07-25 17:38:34 +02:00
parent 340b127ed1
commit 4aea1036c6

View file

@ -1478,14 +1478,14 @@ static psa_status_t psa_start_key_creation(
&slot->data.se.slot_number );
if( status != PSA_SUCCESS )
return( status );
psa_crypto_prepare_transaction( PSA_CRYPTO_TRANSACTION_CREATE_KEY );
psa_crypto_transaction.key.lifetime = slot->lifetime;
psa_crypto_transaction.key.slot = slot->data.se.slot_number;
psa_crypto_transaction.key.id = slot->persistent_storage_id;
status = psa_crypto_save_transaction( );
if( status != PSA_SUCCESS )
return( status );
}
psa_crypto_prepare_transaction( PSA_CRYPTO_TRANSACTION_CREATE_KEY );
psa_crypto_transaction.key.lifetime = slot->lifetime;
psa_crypto_transaction.key.slot = slot->data.se.slot_number;
psa_crypto_transaction.key.id = slot->persistent_storage_id;
status = psa_crypto_save_transaction( );
if( status != PSA_SUCCESS )
return( status );
#endif /* MBEDTLS_PSA_CRYPTO_SE_C */
return( status );