Skip to content

Commit 4aea103

Browse files
Bug fix: don't start a transaction for non-SE keys
1 parent 340b127 commit 4aea103

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

library/psa_crypto.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,14 +1478,14 @@ static psa_status_t psa_start_key_creation(
14781478
&slot->data.se.slot_number );
14791479
if( status != PSA_SUCCESS )
14801480
return( status );
1481+
psa_crypto_prepare_transaction( PSA_CRYPTO_TRANSACTION_CREATE_KEY );
1482+
psa_crypto_transaction.key.lifetime = slot->lifetime;
1483+
psa_crypto_transaction.key.slot = slot->data.se.slot_number;
1484+
psa_crypto_transaction.key.id = slot->persistent_storage_id;
1485+
status = psa_crypto_save_transaction( );
1486+
if( status != PSA_SUCCESS )
1487+
return( status );
14811488
}
1482-
psa_crypto_prepare_transaction( PSA_CRYPTO_TRANSACTION_CREATE_KEY );
1483-
psa_crypto_transaction.key.lifetime = slot->lifetime;
1484-
psa_crypto_transaction.key.slot = slot->data.se.slot_number;
1485-
psa_crypto_transaction.key.id = slot->persistent_storage_id;
1486-
status = psa_crypto_save_transaction( );
1487-
if( status != PSA_SUCCESS )
1488-
return( status );
14891489
#endif /* MBEDTLS_PSA_CRYPTO_SE_C */
14901490

14911491
return( status );

0 commit comments

Comments
 (0)