mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-27 06:35:22 +00:00
ssl_client2, ssl_server2: add check for psa memory leaks
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
parent
f660c7c923
commit
fed825a9aa
@ -21,6 +21,11 @@
|
|||||||
|
|
||||||
#include "ssl_test_lib.h"
|
#include "ssl_test_lib.h"
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||||
|
#define SKIP_LIBRARY_HEADERS
|
||||||
|
#include "test/psa_crypto_helpers.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_TEST_IMPOSSIBLE)
|
#if defined(MBEDTLS_SSL_TEST_IMPOSSIBLE)
|
||||||
int main( void )
|
int main( void )
|
||||||
{
|
{
|
||||||
@ -3059,7 +3064,15 @@ exit:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||||
|
|
||||||
mbedtls_psa_crypto_free( );
|
mbedtls_psa_crypto_free( );
|
||||||
|
const char* message = mbedtls_test_helper_is_psa_leaking();
|
||||||
|
if( message )
|
||||||
|
{
|
||||||
|
if( ret == 0 )
|
||||||
|
ret = 1;
|
||||||
|
mbedtls_printf( "PSA memory leak detected: %s\n", message);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_TEST_HOOKS)
|
#if defined(MBEDTLS_TEST_HOOKS)
|
||||||
|
@ -65,6 +65,11 @@ int main( void )
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||||
|
#define SKIP_LIBRARY_HEADERS
|
||||||
|
#include "test/psa_crypto_helpers.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Size of memory to be allocated for the heap, when using the library's memory
|
/* Size of memory to be allocated for the heap, when using the library's memory
|
||||||
* management and MBEDTLS_MEMORY_BUFFER_ALLOC_C is enabled. */
|
* management and MBEDTLS_MEMORY_BUFFER_ALLOC_C is enabled. */
|
||||||
#define MEMORY_HEAP_SIZE 120000
|
#define MEMORY_HEAP_SIZE 120000
|
||||||
@ -4027,6 +4032,13 @@ exit:
|
|||||||
|
|
||||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||||
mbedtls_psa_crypto_free( );
|
mbedtls_psa_crypto_free( );
|
||||||
|
const char* message = mbedtls_test_helper_is_psa_leaking();
|
||||||
|
if( message )
|
||||||
|
{
|
||||||
|
if( ret == 0 )
|
||||||
|
ret = 1;
|
||||||
|
mbedtls_printf( "PSA memory leak detected: %s\n", message);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_TEST_HOOKS)
|
#if defined(MBEDTLS_TEST_HOOKS)
|
||||||
|
@ -28,7 +28,9 @@
|
|||||||
#include "test/psa_helpers.h"
|
#include "test/psa_helpers.h"
|
||||||
|
|
||||||
#include <psa/crypto.h>
|
#include <psa/crypto.h>
|
||||||
|
#if !defined(SKIP_LIBRARY_HEADERS)
|
||||||
#include <psa_crypto_slot_management.h>
|
#include <psa_crypto_slot_management.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||||
#include "mbedtls/psa_util.h"
|
#include "mbedtls/psa_util.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user