58#ifndef MBEDTLS_PLATFORM_H
59#define MBEDTLS_PLATFORM_H
61#if !defined(MBEDTLS_CONFIG_FILE)
64#include MBEDTLS_CONFIG_FILE
67#if defined(MBEDTLS_HAVE_TIME)
71#define MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED -0x0070
72#define MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED -0x0072
86#if !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
90#if !defined(MBEDTLS_PLATFORM_STD_SNPRINTF)
92#define MBEDTLS_PLATFORM_STD_SNPRINTF mbedtls_platform_win32_snprintf
94#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf
97#if !defined(MBEDTLS_PLATFORM_STD_PRINTF)
98#define MBEDTLS_PLATFORM_STD_PRINTF printf
100#if !defined(MBEDTLS_PLATFORM_STD_FPRINTF)
101#define MBEDTLS_PLATFORM_STD_FPRINTF fprintf
103#if !defined(MBEDTLS_PLATFORM_STD_CALLOC)
104#define MBEDTLS_PLATFORM_STD_CALLOC calloc
106#if !defined(MBEDTLS_PLATFORM_STD_FREE)
107#define MBEDTLS_PLATFORM_STD_FREE free
109#if !defined(MBEDTLS_PLATFORM_STD_EXIT)
110#define MBEDTLS_PLATFORM_STD_EXIT exit
112#if !defined(MBEDTLS_PLATFORM_STD_TIME)
113#define MBEDTLS_PLATFORM_STD_TIME time
115#if !defined(MBEDTLS_PLATFORM_STD_EXIT_SUCCESS)
116#define MBEDTLS_PLATFORM_STD_EXIT_SUCCESS EXIT_SUCCESS
118#if !defined(MBEDTLS_PLATFORM_STD_EXIT_FAILURE)
119#define MBEDTLS_PLATFORM_STD_EXIT_FAILURE EXIT_FAILURE
121#if defined(MBEDTLS_FS_IO)
122#if !defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ)
123#define MBEDTLS_PLATFORM_STD_NV_SEED_READ mbedtls_platform_std_nv_seed_read
125#if !defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE)
126#define MBEDTLS_PLATFORM_STD_NV_SEED_WRITE mbedtls_platform_std_nv_seed_write
128#if !defined(MBEDTLS_PLATFORM_STD_NV_SEED_FILE)
129#define MBEDTLS_PLATFORM_STD_NV_SEED_FILE "seedfile"
133#if defined(MBEDTLS_PLATFORM_STD_MEM_HDR)
134#include MBEDTLS_PLATFORM_STD_MEM_HDR
144#if defined(MBEDTLS_PLATFORM_MEMORY)
145#if defined(MBEDTLS_PLATFORM_FREE_MACRO) && \
146 defined(MBEDTLS_PLATFORM_CALLOC_MACRO)
147#define mbedtls_free MBEDTLS_PLATFORM_FREE_MACRO
148#define mbedtls_calloc MBEDTLS_PLATFORM_CALLOC_MACRO
164int mbedtls_platform_set_calloc_free(
void * (*calloc_func)(
size_t,
size_t ),
168#define mbedtls_free free
169#define mbedtls_calloc calloc
175#if defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
189int mbedtls_platform_set_fprintf(
int (*fprintf_func)(
FILE *
stream,
const char *,
192#if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO)
193#define mbedtls_fprintf MBEDTLS_PLATFORM_FPRINTF_MACRO
195#define mbedtls_fprintf fprintf
202#if defined(MBEDTLS_PLATFORM_PRINTF_ALT)
214int mbedtls_platform_set_printf(
int (*printf_func)(
const char *, ... ) );
216#if defined(MBEDTLS_PLATFORM_PRINTF_MACRO)
217#define mbedtls_printf MBEDTLS_PLATFORM_PRINTF_MACRO
219#define mbedtls_printf printf
234int mbedtls_platform_win32_snprintf(
char *
s,
size_t n,
const char *
fmt, ... );
237#if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT)
248int mbedtls_platform_set_snprintf(
int (*snprintf_func)(
char *
s,
size_t n,
249 const char *
format, ... ) );
251#if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO)
252#define mbedtls_snprintf MBEDTLS_PLATFORM_SNPRINTF_MACRO
254#define mbedtls_snprintf MBEDTLS_PLATFORM_STD_SNPRINTF
261#if defined(MBEDTLS_PLATFORM_EXIT_ALT)
273int mbedtls_platform_set_exit(
void (*exit_func)(
int status ) );
275#if defined(MBEDTLS_PLATFORM_EXIT_MACRO)
276#define mbedtls_exit MBEDTLS_PLATFORM_EXIT_MACRO
278#define mbedtls_exit exit
285#if defined(MBEDTLS_PLATFORM_STD_EXIT_SUCCESS)
286#define MBEDTLS_EXIT_SUCCESS MBEDTLS_PLATFORM_STD_EXIT_SUCCESS
288#define MBEDTLS_EXIT_SUCCESS 0
290#if defined(MBEDTLS_PLATFORM_STD_EXIT_FAILURE)
291#define MBEDTLS_EXIT_FAILURE MBEDTLS_PLATFORM_STD_EXIT_FAILURE
293#define MBEDTLS_EXIT_FAILURE 1
302#if defined(MBEDTLS_ENTROPY_NV_SEED)
303#if !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS) && defined(MBEDTLS_FS_IO)
305int mbedtls_platform_std_nv_seed_read(
unsigned char *
buf,
size_t buf_len );
306int mbedtls_platform_std_nv_seed_write(
unsigned char *
buf,
size_t buf_len );
309#if defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
310extern int (*mbedtls_nv_seed_read)(
unsigned char *
buf,
size_t buf_len );
311extern int (*mbedtls_nv_seed_write)(
unsigned char *
buf,
size_t buf_len );
322int mbedtls_platform_set_nv_seed(
323 int (*nv_seed_read_func)(
unsigned char *
buf,
size_t buf_len ),
324 int (*nv_seed_write_func)(
unsigned char *
buf,
size_t buf_len )
327#if defined(MBEDTLS_PLATFORM_NV_SEED_READ_MACRO) && \
328 defined(MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO)
329#define mbedtls_nv_seed_read MBEDTLS_PLATFORM_NV_SEED_READ_MACRO
330#define mbedtls_nv_seed_write MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO
332#define mbedtls_nv_seed_read mbedtls_platform_std_nv_seed_read
333#define mbedtls_nv_seed_write mbedtls_platform_std_nv_seed_write
338#if !defined(MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT)
353#include "platform_alt.h"
void(* free_func)(voidpf opaque, voidpf address)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLenum GLuint GLenum GLsizei const GLchar * buf
The platform context structure.