Skip to content

Commit ef3020a

Browse files
committed
Update code to work with demos using latest mbedtls version
1 parent e343171 commit ef3020a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

source/portable/mbedtls/core_pkcs11_mbedtls.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@
9393
*/
9494
static const char * pNoLowLevelMbedTlsCodeStr = "<No-Low-Level-Code>";
9595

96+
#if defined(MBEDTLS_PSA_CRYPTO_C)
97+
extern mbedtls_threading_mutex_t mbedtls_threading_key_slot_mutex;
98+
extern mbedtls_threading_mutex_t mbedtls_threading_psa_globaldata_mutex;
99+
extern mbedtls_threading_mutex_t mbedtls_threading_psa_rngdata_mutex;
100+
#endif
101+
96102
/**
97103
* @brief Utility for converting the high-level code in an mbedTLS error to string,
98104
* if the code-contains a high-level code; otherwise, using a default string.
@@ -475,6 +481,12 @@ static CK_RV prvMbedTLS_Initialize( void )
475481
mbedtls_entropy_init( &xP11Context.xMbedEntropyContext );
476482
mbedtls_ctr_drbg_init( &xP11Context.xMbedDrbgCtx );
477483

484+
#if defined(MBEDTLS_PSA_CRYPTO_C)
485+
mbedtls_mutex_init(&mbedtls_threading_key_slot_mutex);
486+
mbedtls_mutex_init(&mbedtls_threading_psa_globaldata_mutex);
487+
mbedtls_mutex_init(&mbedtls_threading_psa_rngdata_mutex);
488+
#endif
489+
478490
lMbedTLSResult = mbedtls_ctr_drbg_seed( &xP11Context.xMbedDrbgCtx,
479491
mbedtls_entropy_func,
480492
&xP11Context.xMbedEntropyContext,

0 commit comments

Comments
 (0)