Deinitialize the PSA subsystem

The PSA subsystem may consume global resources. It currently doesn't
consume any heap when no keys are registered, but it may do so in the
future. It does consume mutexes, which are reported as leaks when
mutex usage checking is enabled.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2021-02-03 00:04:08 +01:00
parent e374b95fe1
commit 414e717036
2 changed files with 8 additions and 0 deletions

View file

@ -3038,6 +3038,10 @@ exit:
mbedtls_free( context_buf );
#endif
#if defined(MBEDTLS_USE_PSA_CRYPTO)
mbedtls_psa_crypto_free( );
#endif
if( test_hooks_failure_detected( ) )
{
if( ret == 0 )

View file

@ -4000,6 +4000,10 @@ exit:
mbedtls_free( context_buf );
#endif
#if defined(MBEDTLS_USE_PSA_CRYPTO)
mbedtls_psa_crypto_free( );
#endif
/* Let test hooks detect errors such as resource leaks.
* Don't do it in query_config mode, because some test code prints
* information to stdout and this gets mixed with the regular output. */