Mbed TLS v2.28.9
|
This file contains the definitions and functions of the Mbed TLS platform abstraction layer. More...
#include "mbedtls/config.h"
#include "mbedtls/platform_time.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
Go to the source code of this file.
Data Structures | |
struct | mbedtls_platform_context |
The platform context structure. More... | |
Typedefs | |
typedef struct mbedtls_platform_context | mbedtls_platform_context |
The platform context structure. | |
Functions | |
int | mbedtls_platform_setup (mbedtls_platform_context *ctx) |
This function performs any platform-specific initialization operations. | |
void | mbedtls_platform_teardown (mbedtls_platform_context *ctx) |
This function performs any platform teardown operations. | |
This file contains the definitions and functions of the Mbed TLS platform abstraction layer.
The platform abstraction layer removes the need for the library to directly link to standard C library functions or operating system services, making the library easier to port and embed. Application developers and users of the library can provide their own implementations of these functions, or implementations specific to their platform, which can be statically linked to the library or dynamically configured at runtime.
When all compilation options related to platform abstraction are disabled, this header just defines mbedtls_xxx
function names as aliases to the standard xxx
function.
Most modules in the library and example programs are expected to include this header.
Definition in file platform.h.
#define mbedtls_calloc calloc |
Definition at line 172 of file platform.h.
#define MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED -0x0072 |
The requested feature is not supported by the platform
Definition at line 42 of file platform.h.
#define MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED -0x0070 |
Hardware accelerator failed
Definition at line 40 of file platform.h.
#define mbedtls_exit exit |
Definition at line 322 of file platform.h.
#define MBEDTLS_EXIT_FAILURE MBEDTLS_PLATFORM_STD_EXIT_FAILURE |
Definition at line 335 of file platform.h.
#define MBEDTLS_EXIT_SUCCESS MBEDTLS_PLATFORM_STD_EXIT_SUCCESS |
Definition at line 330 of file platform.h.
#define mbedtls_fprintf fprintf |
Definition at line 199 of file platform.h.
#define mbedtls_free free |
Definition at line 171 of file platform.h.
#define MBEDTLS_PLATFORM_STD_CALLOC calloc |
Default allocator to use, can be undefined. It must initialize the allocated buffer memory to zeroes. The size of the buffer is the product of the two parameters. The calloc function returns either a null pointer or a pointer to the allocated space. If the product is 0, the function may either return NULL or a valid pointer to an array of size 0 which is a valid input to the deallocation function. An uninitialized MBEDTLS_PLATFORM_STD_CALLOC always fails, returning a null pointer. See the description of #MBEDTLS_PLATFORM_MEMORY for more details. The corresponding deallocation function is MBEDTLS_PLATFORM_STD_FREE.
The default calloc
function to use.
Definition at line 92 of file platform.h.
#define MBEDTLS_PLATFORM_STD_EXIT exit |
The default exit
function to use.
Definition at line 98 of file platform.h.
#define MBEDTLS_PLATFORM_STD_EXIT_FAILURE EXIT_FAILURE |
The default exit value to use.
Definition at line 107 of file platform.h.
#define MBEDTLS_PLATFORM_STD_EXIT_SUCCESS EXIT_SUCCESS |
The default exit value to use.
Definition at line 104 of file platform.h.
#define MBEDTLS_PLATFORM_STD_FPRINTF fprintf |
The default fprintf
function to use.
Definition at line 89 of file platform.h.
#define MBEDTLS_PLATFORM_STD_FREE free |
Default free to use, can be undefined. NULL is a valid parameter, and the function must do nothing. A non-null parameter will always be a pointer previously returned by MBEDTLS_PLATFORM_STD_CALLOC and not yet freed. An uninitialized MBEDTLS_PLATFORM_STD_FREE does not do anything. See the description of #MBEDTLS_PLATFORM_MEMORY for more details (same principles as for MBEDTLS_PLATFORM_STD_CALLOC apply).
The default free
function to use.
Definition at line 95 of file platform.h.
#define MBEDTLS_PLATFORM_STD_NV_SEED_FILE "seedfile" |
Definition at line 117 of file platform.h.
#define MBEDTLS_PLATFORM_STD_NV_SEED_READ mbedtls_platform_std_nv_seed_read |
Definition at line 111 of file platform.h.
#define MBEDTLS_PLATFORM_STD_NV_SEED_WRITE mbedtls_platform_std_nv_seed_write |
Definition at line 114 of file platform.h.
#define MBEDTLS_PLATFORM_STD_PRINTF printf |
The default printf
function to use.
Definition at line 86 of file platform.h.
#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf |
The default snprintf
function to use.
Definition at line 75 of file platform.h.
#define MBEDTLS_PLATFORM_STD_TIME time |
The default time
function to use.
Definition at line 101 of file platform.h.
#define MBEDTLS_PLATFORM_STD_VSNPRINTF vsnprintf |
The default vsnprintf
function to use.
Definition at line 82 of file platform.h.
#define mbedtls_printf printf |
Definition at line 224 of file platform.h.
#define mbedtls_snprintf MBEDTLS_PLATFORM_STD_SNPRINTF |
Definition at line 260 of file platform.h.
#define mbedtls_vsnprintf vsnprintf |
Definition at line 297 of file platform.h.
typedef struct mbedtls_platform_context mbedtls_platform_context |
The platform context structure.
int mbedtls_platform_setup | ( | mbedtls_platform_context * | ctx | ) |
This function performs any platform-specific initialization operations.
Its implementation is platform-specific, and unless platform-specific code is provided, it does nothing.
ctx | The platform context. |
0
on success. void mbedtls_platform_teardown | ( | mbedtls_platform_context * | ctx | ) |
This function performs any platform teardown operations.
Its implementation is platform-specific, and unless platform-specific code is provided, it does nothing.
ctx | The platform context. |