Skip to content

Commit

Permalink
Initialise driver wrappers as first step in psa_crypto_init()
Browse files Browse the repository at this point in the history
This patch amends the order of initialisations performed in psa_crypto_init()
to make sure that the driver wrappers based on the PSA driver API are initialised
before anything else.

Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>

Patch from TF-M mbedcrypto, applied using:
git am \
modules/tee/tf-m/trusted-firmware-m/lib/ext/mbedcrypto/\
0006-Initialise-driver-wrappers-as-first-step-in-psa_cryp.patch

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
  • Loading branch information
adeaarm authored and joerchan committed Mar 21, 2023
1 parent e83e898 commit a9c8221
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions library/psa_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -6327,6 +6327,11 @@ psa_status_t psa_crypto_init( void )
if( global_data.initialized != 0 )
return( PSA_SUCCESS );

/* Init drivers */
status = psa_driver_wrapper_init( );
if( status != PSA_SUCCESS )
goto exit;

/* Initialize and seed the random generator. */
mbedtls_psa_random_init( &global_data.rng );
global_data.rng_state = RNG_INITIALIZED;
Expand All @@ -6339,11 +6344,6 @@ psa_status_t psa_crypto_init( void )
if( status != PSA_SUCCESS )
goto exit;

/* Init drivers */
status = psa_driver_wrapper_init( );
if( status != PSA_SUCCESS )
goto exit;

#if defined(PSA_CRYPTO_STORAGE_HAS_TRANSACTIONS)
status = psa_crypto_load_transaction( );
if( status == PSA_SUCCESS )
Expand Down

0 comments on commit a9c8221

Please sign in to comment.