mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-03-24 10:35:12 +00:00
Unregister drivers on library deinitialization
This commit is contained in:
parent
a899a72fd0
commit
d089021128
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
#include "psa_crypto_core.h"
|
#include "psa_crypto_core.h"
|
||||||
#include "psa_crypto_invasive.h"
|
#include "psa_crypto_invasive.h"
|
||||||
|
#include "psa_crypto_se.h"
|
||||||
#include "psa_crypto_slot_management.h"
|
#include "psa_crypto_slot_management.h"
|
||||||
/* Include internal declarations that are useful for implementing persistently
|
/* Include internal declarations that are useful for implementing persistently
|
||||||
* stored keys. */
|
* stored keys. */
|
||||||
|
@ -5211,6 +5212,9 @@ void mbedtls_psa_crypto_free( void )
|
||||||
* In particular, this sets all state indicator to the value
|
* In particular, this sets all state indicator to the value
|
||||||
* indicating "uninitialized". */
|
* indicating "uninitialized". */
|
||||||
mbedtls_platform_zeroize( &global_data, sizeof( global_data ) );
|
mbedtls_platform_zeroize( &global_data, sizeof( global_data ) );
|
||||||
|
/* Unregister all secure element drivers, so that we restart from
|
||||||
|
* a pristine state. */
|
||||||
|
psa_unregister_all_se_drivers( );
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_status_t psa_crypto_init( void )
|
psa_status_t psa_crypto_init( void )
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "psa_crypto_se.h"
|
#include "psa_crypto_se.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -69,4 +71,9 @@ psa_status_t psa_register_se_driver(
|
||||||
return( PSA_SUCCESS );
|
return( PSA_SUCCESS );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void psa_unregister_all_se_drivers( void )
|
||||||
|
{
|
||||||
|
memset( driver_table, 0, sizeof( driver_table ) );
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* MBEDTLS_PSA_CRYPTO_C */
|
#endif /* MBEDTLS_PSA_CRYPTO_C */
|
||||||
|
|
|
@ -34,4 +34,12 @@
|
||||||
/** The maximum number of registered secure element driver lifetimes. */
|
/** The maximum number of registered secure element driver lifetimes. */
|
||||||
#define PSA_MAX_SE_DRIVERS 4
|
#define PSA_MAX_SE_DRIVERS 4
|
||||||
|
|
||||||
|
/** Unregister all secure element drivers.
|
||||||
|
*
|
||||||
|
* \warning Do not call this function while the library is in the initialized
|
||||||
|
* state. This function is only intended to be called at the end
|
||||||
|
* of mbedtls_psa_crypto_free().
|
||||||
|
*/
|
||||||
|
void psa_unregister_all_se_drivers( void );
|
||||||
|
|
||||||
#endif /* PSA_CRYPTO_SE_H */
|
#endif /* PSA_CRYPTO_SE_H */
|
||||||
|
|
Loading…
Reference in a new issue