mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-29 16:04:23 +01:00
add POLARSSL_PLATFORM_EXIT_ALT
This commit is contained in:
parent
6aa04bcd85
commit
c39cb4986b
@ -168,6 +168,7 @@
|
|||||||
//#define POLARSSL_PLATFORM_SNPRINTF_ALT
|
//#define POLARSSL_PLATFORM_SNPRINTF_ALT
|
||||||
//#define POLARSSL_PLATFORM_PRINTF_ALT
|
//#define POLARSSL_PLATFORM_PRINTF_ALT
|
||||||
//#define POLARSSL_PLATFORM_FPRINTF_ALT
|
//#define POLARSSL_PLATFORM_FPRINTF_ALT
|
||||||
|
//#define POLARSSL_PLATFORM_EXIT_ALT
|
||||||
/* \} name SECTION: System support */
|
/* \} name SECTION: System support */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1894,7 +1895,7 @@
|
|||||||
* \def POLARSSL_PLATFORM_C
|
* \def POLARSSL_PLATFORM_C
|
||||||
*
|
*
|
||||||
* Enable the platform abstraction layer that allows you to re-assign
|
* Enable the platform abstraction layer that allows you to re-assign
|
||||||
* functions like malloc(), free(), snprintf(), printf(), fprintf()
|
* functions like malloc(), free(), snprintf(), printf(), fprintf(), exit()
|
||||||
*
|
*
|
||||||
* Module: library/platform.c
|
* Module: library/platform.c
|
||||||
* Caller: Most other .c files
|
* Caller: Most other .c files
|
||||||
@ -2245,6 +2246,7 @@
|
|||||||
//#define POLARSSL_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */
|
//#define POLARSSL_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */
|
||||||
//#define POLARSSL_PLATFORM_STD_PRINTF printf /**< Default printf to use, can be undefined */
|
//#define POLARSSL_PLATFORM_STD_PRINTF printf /**< Default printf to use, can be undefined */
|
||||||
//#define POLARSSL_PLATFORM_STD_FPRINTF fprintf /**< Default fprintf to use, can be undefined */
|
//#define POLARSSL_PLATFORM_STD_FPRINTF fprintf /**< Default fprintf to use, can be undefined */
|
||||||
|
//#define POLARSSL_PLATFORM_STD_EXIT exit /**< Default exit to use, can be undefined */
|
||||||
|
|
||||||
/* SSL Cache options */
|
/* SSL Cache options */
|
||||||
//#define SSL_CACHE_DEFAULT_TIMEOUT 86400 /**< 1 day */
|
//#define SSL_CACHE_DEFAULT_TIMEOUT 86400 /**< 1 day */
|
||||||
|
@ -65,6 +65,9 @@ extern "C" {
|
|||||||
#if !defined(POLARSSL_PLATFORM_STD_FREE)
|
#if !defined(POLARSSL_PLATFORM_STD_FREE)
|
||||||
#define POLARSSL_PLATFORM_STD_FREE free /**< Default free to use */
|
#define POLARSSL_PLATFORM_STD_FREE free /**< Default free to use */
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(POLARSSL_PLATFORM_STD_EXIT)
|
||||||
|
#define POLARSSL_PLATFORM_STD_EXIT exit /**< Default free to use */
|
||||||
|
#endif
|
||||||
#else /* POLARSSL_PLATFORM_NO_STD_FUNCTIONS */
|
#else /* POLARSSL_PLATFORM_NO_STD_FUNCTIONS */
|
||||||
#if defined(POLARSSL_PLATFORM_STD_MEM_HDR)
|
#if defined(POLARSSL_PLATFORM_STD_MEM_HDR)
|
||||||
#include POLARSSL_PLATFORM_STD_MEM_HDR
|
#include POLARSSL_PLATFORM_STD_MEM_HDR
|
||||||
@ -138,11 +141,36 @@ int platform_set_printf( int (*printf_func)( const char *, ... ) );
|
|||||||
#if defined(POLARSSL_PLATFORM_FPRINTF_ALT)
|
#if defined(POLARSSL_PLATFORM_FPRINTF_ALT)
|
||||||
extern int (*polarssl_fprintf)( FILE *stream, const char *format, ... );
|
extern int (*polarssl_fprintf)( FILE *stream, const char *format, ... );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set your own fprintf function pointer
|
||||||
|
*
|
||||||
|
* \param fprintf_func the fprintf function implementation
|
||||||
|
*
|
||||||
|
* \return 0
|
||||||
|
*/
|
||||||
int platform_set_fprintf( int (*fprintf_func)( FILE *stream, const char *,
|
int platform_set_fprintf( int (*fprintf_func)( FILE *stream, const char *,
|
||||||
... ) );
|
... ) );
|
||||||
#else
|
#else
|
||||||
#define polarssl_fprintf fprintf
|
#define polarssl_fprintf fprintf
|
||||||
#endif
|
#endif /* POLARSSL_PLATFORM_FPRINTF_ALT */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The function pointers for exit
|
||||||
|
*/
|
||||||
|
#if defined(POLARSSL_PLATFORM_EXIT_ALT)
|
||||||
|
extern void (*polarssl_exit)( int status );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set your own exit function pointer
|
||||||
|
*
|
||||||
|
* \param exit_func the exit function implementation
|
||||||
|
*
|
||||||
|
* \return 0
|
||||||
|
*/
|
||||||
|
int platform_set_exit( void (*exit_func)( int status ) );
|
||||||
|
#else
|
||||||
|
#define polarssl_exit exit
|
||||||
|
#endif /* POLARSSL_PLATFORM_EXIT_ALT */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -140,4 +140,27 @@ int platform_set_fprintf( int (*fprintf_func)( FILE *, const char *, ... ) )
|
|||||||
}
|
}
|
||||||
#endif /* POLARSSL_PLATFORM_FPRINTF_ALT */
|
#endif /* POLARSSL_PLATFORM_FPRINTF_ALT */
|
||||||
|
|
||||||
|
#if defined(POLARSSL_PLATFORM_EXIT_ALT)
|
||||||
|
#if !defined(POLARSSL_STD_EXIT)
|
||||||
|
/*
|
||||||
|
* Make dummy function to prevent NULL pointer dereferences
|
||||||
|
*/
|
||||||
|
static void platform_exit_uninit( int status )
|
||||||
|
{
|
||||||
|
((void) status);
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
#define POLARSSL_STD_EXIT platform_exit_uninit
|
||||||
|
#endif /* !POLARSSL_STD_EXIT */
|
||||||
|
|
||||||
|
int (*polarssl_exit)( int status ) = POLARSSL_STD_EXIT;
|
||||||
|
|
||||||
|
int platform_set_exit( void (*exit_func)( int status ) )
|
||||||
|
{
|
||||||
|
polarssl_exit = exit_func;
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
#endif /* POLARSSL_PLATFORM_EXIT_ALT */
|
||||||
|
|
||||||
#endif /* POLARSSL_PLATFORM_C */
|
#endif /* POLARSSL_PLATFORM_C */
|
||||||
|
Loading…
Reference in New Issue
Block a user