5.11.0.0R3
Software Development Kit
 
Loading...
Searching...
No Matches
platform.h File Reference

This file contains the definitions and functions of the Mbed TLS platform abstraction layer. More...

Data Structures

struct  mbedtls_platform_context
 The platform context structure. More...
 

Macros

#define MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED   -0x0072
 
#define MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED   -0x0070
 

SECTION: Module settings

The configuration options you can set for this module are in this section. Either change them in config.h or define them on the compiler command line.

typedef struct mbedtls_platform_context mbedtls_platform_context
 The platform context structure.
 
int mbedtls_platform_set_exit (void(*exit_func)(int status))
 This function dynamically configures the exit function that is called when the mbedtls_exit() function is invoked by the library.
 
int mbedtls_platform_set_printf (int(*printf_func)(const char *,...))
 This function dynamically configures the snprintf function that is called when the mbedtls_snprintf() function is invoked by the library.
 
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.
 

Detailed Description

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.

Macro Definition Documentation

◆ MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED

#define MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED   -0x0072

The requested feature is not supported by the platform

◆ MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED

#define MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED   -0x0070

Hardware accelerator failed

Typedef Documentation

◆ mbedtls_platform_context

typedef struct mbedtls_platform_context mbedtls_platform_context

The platform context structure.

Note
This structure may be used to assist platform-specific setup or teardown operations.

Function Documentation

◆ mbedtls_platform_set_exit()

int mbedtls_platform_set_exit ( void(* exit_func )(int status))

This function dynamically configures the exit function that is called when the mbedtls_exit() function is invoked by the library.

Parameters
exit_funcThe exit function implementation.
Returns
0 on success.

◆ mbedtls_platform_set_printf()

int mbedtls_platform_set_printf ( int(* printf_func )(const char *,...))

This function dynamically configures the snprintf function that is called when the mbedtls_snprintf() function is invoked by the library.

Parameters
printf_funcThe printf function implementation.
Returns
0 on success.

◆ mbedtls_platform_setup()

int mbedtls_platform_setup ( mbedtls_platform_context * ctx)

This function performs any platform-specific initialization operations.

Note
This function should be called before any other library functions.
    Its implementation is platform-specific, and unless
    platform-specific code is provided, it does nothing.
The usage and necessity of this function is dependent on the platform.
Parameters
ctxThe platform context.
Returns
0 on success.

◆ mbedtls_platform_teardown()

void mbedtls_platform_teardown ( mbedtls_platform_context * ctx)

This function performs any platform teardown operations.

Note
This function should be called after every other Mbed TLS module has been correctly freed using the appropriate free function.

Its implementation is platform-specific, and unless platform-specific code is provided, it does nothing.

Note
The usage and necessity of this function is dependent on the platform.
Parameters
ctxThe platform context.