mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Add conditional platform context creation & usage
Add another layer of abstraction before calling platform setup and teardown.
This commit is contained in:
@ -109,7 +109,9 @@ static struct
|
||||
}
|
||||
test_info;
|
||||
|
||||
#if defined(MBEDTLS_PLATFORM_C)
|
||||
mbedtls_platform_context platform_ctx;
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Helper flags for complex dependencies */
|
||||
@ -128,6 +130,23 @@ mbedtls_platform_context platform_ctx;
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Helper Functions */
|
||||
static int platform_setup()
|
||||
{
|
||||
#if defined(MBEDTLS_PLATFORM_C)
|
||||
if( mbedtls_platform_setup( &platform_ctx ) )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif /* MBEDTLS_PLATFORM_C */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void platform_teardown()
|
||||
{
|
||||
#if defined(MBEDTLS_PLATFORM_C)
|
||||
mbedtls_platform_teardown( &platform_ctx );
|
||||
#endif /* MBEDTLS_PLATFORM_C */
|
||||
}
|
||||
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
static int redirect_output( FILE** out_stream, const char* path )
|
||||
|
Reference in New Issue
Block a user