24 #ifndef POLARSSL_PLATFORM_H
25 #define POLARSSL_PLATFORM_H
27 #if !defined(POLARSSL_CONFIG_FILE)
30 #include POLARSSL_CONFIG_FILE
34 #if defined(POLARSSL_MEMORY_C) && !defined(POLARSSL_PLATFORM_MEMORY)
35 #define POLARSSL_PLATFORM_MEMORY
50 #if !defined(POLARSSL_PLATFORM_NO_STD_FUNCTIONS)
53 #if !defined(POLARSSL_PLATFORM_STD_SNPRINTF)
54 #define POLARSSL_PLATFORM_STD_SNPRINTF snprintf
56 #if !defined(POLARSSL_PLATFORM_STD_PRINTF)
57 #define POLARSSL_PLATFORM_STD_PRINTF printf
59 #if !defined(POLARSSL_PLATFORM_STD_FPRINTF)
60 #define POLARSSL_PLATFORM_STD_FPRINTF fprintf
62 #if !defined(POLARSSL_PLATFORM_STD_MALLOC)
63 #define POLARSSL_PLATFORM_STD_MALLOC malloc
65 #if !defined(POLARSSL_PLATFORM_STD_FREE)
66 #define POLARSSL_PLATFORM_STD_FREE free
68 #if !defined(POLARSSL_PLATFORM_STD_EXIT)
69 #define POLARSSL_PLATFORM_STD_EXIT exit
72 #if defined(POLARSSL_PLATFORM_STD_MEM_HDR)
73 #include POLARSSL_PLATFORM_STD_MEM_HDR
82 #if defined(POLARSSL_PLATFORM_MEMORY)
83 #if defined(POLARSSL_PLATFORM_FREE_MACRO) && \
84 defined(POLARSSL_PLATFORM_MALLOC_MACRO)
85 #define polarssl_free POLARSSL_PLATFORM_FREE_MACRO
86 #define polarssl_malloc POLARSSL_PLATFORM_MALLOC_MACRO
90 extern void * (*polarssl_malloc)(
size_t len );
101 int platform_set_malloc_free(
void * (*malloc_func)(
size_t ),
102 void (*free_func)(
void * ) );
105 #define polarssl_free free
106 #define polarssl_malloc malloc
112 #if defined(POLARSSL_PLATFORM_FPRINTF_ALT)
124 int platform_set_fprintf(
int (*fprintf_func)( FILE *stream,
const char *,
127 #if defined(POLARSSL_PLATFORM_FPRINTF_MACRO)
128 #define polarssl_fprintf POLARSSL_PLATFORM_FPRINTF_MACRO
130 #define polarssl_fprintf fprintf
137 #if defined(POLARSSL_PLATFORM_PRINTF_ALT)
147 int platform_set_printf(
int (*printf_func)(
const char *, ... ) );
149 #if defined(POLARSSL_PLATFORM_PRINTF_MACRO)
150 #define polarssl_printf POLARSSL_PLATFORM_PRINTF_MACRO
152 #define polarssl_printf printf
159 #if defined(POLARSSL_PLATFORM_SNPRINTF_ALT)
169 int platform_set_snprintf(
int (*snprintf_func)(
char * s,
size_t n,
170 const char * format, ... ) );
172 #if defined(POLARSSL_PLATFORM_SNPRINTF_MACRO)
173 #define polarssl_snprintf POLARSSL_PLATFORM_SNPRINTF_MACRO
175 #define polarssl_snprintf snprintf
182 #if defined(POLARSSL_PLATFORM_EXIT_ALT)
192 int platform_set_exit(
void (*exit_func)(
int status ) );
194 #if defined(POLARSSL_PLATFORM_EXIT_MACRO)
195 #define polarssl_exit POLARSSL_PLATFORM_EXIT_MACRO
197 #define polarssl_exit exit
Configuration options (set of defines)