mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-12-24 17:41:01 +03:00
psa: Add driver initialization and termination
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
@@ -66,6 +66,44 @@
|
||||
#include "psa_crypto_se.h"
|
||||
#endif
|
||||
|
||||
psa_status_t psa_driver_wrapper_init( void )
|
||||
{
|
||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_SE_C)
|
||||
status = psa_init_all_se_drivers( );
|
||||
if( status != PSA_SUCCESS )
|
||||
return( status );
|
||||
#endif
|
||||
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
status = mbedtls_test_transparent_init( );
|
||||
if( status != PSA_SUCCESS )
|
||||
return( status );
|
||||
|
||||
status = mbedtls_test_opaque_init( );
|
||||
if( status != PSA_SUCCESS )
|
||||
return( status );
|
||||
#endif
|
||||
|
||||
(void) status;
|
||||
return( PSA_SUCCESS );
|
||||
}
|
||||
|
||||
void psa_driver_wrapper_free( void )
|
||||
{
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_SE_C)
|
||||
/* Unregister all secure element drivers, so that we restart from
|
||||
* a pristine state. */
|
||||
psa_unregister_all_se_drivers( );
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_SE_C */
|
||||
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
mbedtls_test_transparent_free( );
|
||||
mbedtls_test_opaque_free( );
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Start delegation functions */
|
||||
psa_status_t psa_driver_wrapper_sign_message(
|
||||
const psa_key_attributes_t *attributes,
|
||||
|
||||
Reference in New Issue
Block a user