@@ -188,13 +188,6 @@ parse_priv_enckey(uint8_t **p, uint8_t *end, uint8_t *private_key)
188188
189189void bootutil_aes_ctr_init (bootutil_aes_ctr_context * ctx )
190190{
191- psa_status_t psa_ret = psa_crypto_init ();
192-
193- if (psa_ret != PSA_SUCCESS ) {
194- BOOT_LOG_ERR ("AES init PSA crypto init failed %d" , psa_ret );
195- assert (0 );
196- }
197-
198191 ctx -> key = PSA_KEY_ID_NULL ;
199192}
200193
@@ -266,12 +259,6 @@ boot_decrypt_key(const uint8_t *buf, uint8_t *enckey)
266259
267260 BOOT_LOG_DBG ("boot_decrypt_key: PSA ED25519" );
268261
269- psa_ret = psa_crypto_init ();
270- if (psa_ret != PSA_SUCCESS ) {
271- BOOT_LOG_ERR ("PSA crypto init failed %d" , psa_ret );
272- return -1 ;
273- }
274-
275262 /*
276263 * * Load the stored decryption private key
277264 */
@@ -431,16 +418,6 @@ int bootutil_aes_ctr_encrypt(bootutil_aes_ctr_context *ctx, uint8_t *counter,
431418 psa_cipher_operation_t psa_op ;
432419 size_t elen = 0 ; /* Decrypted length */
433420
434- /* Fixme: calling psa_crypto_init multiple times is not a problem,
435- * yet the code here is only present because there is not general
436- * crypto init. */
437- psa_ret = psa_crypto_init ();
438- if (psa_ret != PSA_SUCCESS ) {
439- BOOT_LOG_ERR ("PSA crypto init failed %d" , psa_ret );
440- ret = -1 ;
441- goto gone ;
442- }
443-
444421 psa_op = psa_cipher_operation_init ();
445422
446423 /* This could be done with psa_cipher_decrypt one-shot operation, but
@@ -488,16 +465,6 @@ int bootutil_aes_ctr_decrypt(bootutil_aes_ctr_context *ctx, uint8_t *counter,
488465 psa_cipher_operation_t psa_op ;
489466 size_t dlen = 0 ; /* Decrypted length */
490467
491- /* Fixme: the init should already happen before calling the function, but
492- * somehow it does not, for example when recovering in swap.
493- */
494- psa_ret = psa_crypto_init ();
495- if (psa_ret != PSA_SUCCESS ) {
496- BOOT_LOG_ERR ("PSA crypto init failed %d" , psa_ret );
497- ret = -1 ;
498- goto gone ;
499- }
500-
501468 psa_op = psa_cipher_operation_init ();
502469
503470 /* This could be done with psa_cipher_decrypt one-shot operation, but
0 commit comments