23 #ifndef MBEDTLS_PLATFORM_H
24 #define MBEDTLS_PLATFORM_H
26 #if !defined(MBEDTLS_CONFIG_FILE)
29 #include MBEDTLS_CONFIG_FILE
44 #if !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
47 #if !defined(MBEDTLS_PLATFORM_STD_SNPRINTF)
49 #define MBEDTLS_PLATFORM_STD_SNPRINTF mbedtls_platform_win32_snprintf
51 #define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf
54 #if !defined(MBEDTLS_PLATFORM_STD_PRINTF)
55 #define MBEDTLS_PLATFORM_STD_PRINTF printf
57 #if !defined(MBEDTLS_PLATFORM_STD_FPRINTF)
58 #define MBEDTLS_PLATFORM_STD_FPRINTF fprintf
60 #if !defined(MBEDTLS_PLATFORM_STD_CALLOC)
61 #define MBEDTLS_PLATFORM_STD_CALLOC calloc
63 #if !defined(MBEDTLS_PLATFORM_STD_FREE)
64 #define MBEDTLS_PLATFORM_STD_FREE free
66 #if !defined(MBEDTLS_PLATFORM_STD_EXIT)
67 #define MBEDTLS_PLATFORM_STD_EXIT exit
70 #if defined(MBEDTLS_PLATFORM_STD_MEM_HDR)
71 #include MBEDTLS_PLATFORM_STD_MEM_HDR
80 #if defined(MBEDTLS_PLATFORM_MEMORY)
81 #if defined(MBEDTLS_PLATFORM_FREE_MACRO) && \
82 defined(MBEDTLS_PLATFORM_CALLOC_MACRO)
83 #define mbedtls_free MBEDTLS_PLATFORM_FREE_MACRO
84 #define mbedtls_calloc MBEDTLS_PLATFORM_CALLOC_MACRO
88 extern void * (*mbedtls_calloc)(
size_t n,
size_t size );
99 int mbedtls_platform_set_calloc_free(
void * (*calloc_func)(
size_t,
size_t ),
100 void (*free_func)(
void * ) );
103 #define mbedtls_free free
104 #define mbedtls_calloc calloc
110 #if defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
113 extern int (*
mbedtls_fprintf)( FILE *stream,
const char *format, ... );
122 int mbedtls_platform_set_fprintf(
int (*fprintf_func)( FILE *stream,
const char *,
125 #if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO)
126 #define mbedtls_fprintf MBEDTLS_PLATFORM_FPRINTF_MACRO
128 #define mbedtls_fprintf fprintf
135 #if defined(MBEDTLS_PLATFORM_PRINTF_ALT)
145 int mbedtls_platform_set_printf(
int (*printf_func)(
const char *, ... ) );
147 #if defined(MBEDTLS_PLATFORM_PRINTF_MACRO)
148 #define mbedtls_printf MBEDTLS_PLATFORM_PRINTF_MACRO
150 #define mbedtls_printf printf
165 int mbedtls_platform_win32_snprintf(
char *s,
size_t n,
const char *fmt, ... );
168 #if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT)
169 extern int (*
mbedtls_snprintf)(
char * s,
size_t n,
const char * format, ... );
178 int mbedtls_platform_set_snprintf(
int (*snprintf_func)(
char * s,
size_t n,
179 const char * format, ... ) );
181 #if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO)
182 #define mbedtls_snprintf MBEDTLS_PLATFORM_SNPRINTF_MACRO
184 #define mbedtls_snprintf snprintf
191 #if defined(MBEDTLS_PLATFORM_EXIT_ALT)
201 int mbedtls_platform_set_exit(
void (*exit_func)(
int status ) );
203 #if defined(MBEDTLS_PLATFORM_EXIT_MACRO)
204 #define mbedtls_exit MBEDTLS_PLATFORM_EXIT_MACRO
206 #define mbedtls_exit exit
Compatibility names (set of defines)