Arcola / mbedtls

Fork of mbedtls by Mark Radbourne

Embed: (wiki syntax)

« Back to documentation index

platform.h File Reference

platform.h File Reference

mbed TLS Platform abstraction layer More...

Go to the source code of this file.

Data Structures

struct  mbedtls_platform_context
 Platform context structure. More...

Functions

int mbedtls_platform_set_calloc_free (void *(*calloc_func)(size_t, size_t), void(*free_func)(void *))
 Set your own memory implementation function pointers.
int mbedtls_platform_set_fprintf (int(*fprintf_func)(FILE *stream, const char *,...))
 Set your own fprintf function pointer.
int mbedtls_platform_set_printf (int(*printf_func)(const char *,...))
 Set your own printf function pointer.
int mbedtls_platform_set_snprintf (int(*snprintf_func)(char *s, size_t n, const char *format,...))
 Set your own snprintf function pointer.
int mbedtls_platform_set_exit (void(*exit_func)(int status))
 Set your own exit function pointer.
int mbedtls_platform_set_nv_seed (int(*nv_seed_read_func)(unsigned char *buf, size_t buf_len), int(*nv_seed_write_func)(unsigned char *buf, size_t buf_len))
 Set your own seed file writing/reading functions.
int mbedtls_platform_setup (mbedtls_platform_context *ctx)
 Perform any platform initialisation operations.
void mbedtls_platform_teardown (mbedtls_platform_context *ctx)
 Perform any platform teardown operations.

Detailed Description

mbed TLS Platform abstraction layer

Copyright (C) 2006-2016, ARM Limited, All Rights Reserved SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

This file is part of mbed TLS (https://tls.mbed.org)

Definition in file platform.h.


Function Documentation

int mbedtls_platform_set_calloc_free ( void *(*)(size_t, size_t)  calloc_func,
void(*)(void *)  free_func 
)

Set your own memory implementation function pointers.

Parameters:
calloc_functhe calloc function implementation
free_functhe free function implementation
Returns:
0 if successful

Definition at line 56 of file platform.c.

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

Set your own exit function pointer.

Parameters:
exit_functhe exit function implementation
Returns:
0

Definition at line 186 of file platform.c.

int mbedtls_platform_set_fprintf ( int(*)(FILE *stream, const char *,...)  fprintf_func )

Set your own fprintf function pointer.

Parameters:
fprintf_functhe fprintf function implementation
Returns:
0
int mbedtls_platform_set_nv_seed ( int(*)(unsigned char *buf, size_t buf_len)  nv_seed_read_func,
int(*)(unsigned char *buf, size_t buf_len)  nv_seed_write_func 
)

Set your own seed file writing/reading functions.

Parameters:
nv_seed_read_functhe seed reading function implementation
nv_seed_write_functhe seed writing function implementation
Returns:
0

Definition at line 296 of file platform.c.

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

Set your own printf function pointer.

Parameters:
printf_functhe printf function implementation
Returns:
0

Definition at line 139 of file platform.c.

int mbedtls_platform_set_snprintf ( int(*)(char *s, size_t n, const char *format,...)  snprintf_func )

Set your own snprintf function pointer.

Parameters:
snprintf_functhe snprintf function implementation
Returns:
0

Definition at line 114 of file platform.c.

int mbedtls_platform_setup ( mbedtls_platform_context ctx )

Perform any platform initialisation operations.

Parameters:
ctxmbed TLS context
Returns:
0 if successful
Note:
This function is intended to allow platform specific initialisation, and should be called before any other library functions. Its implementation is platform specific, and by default, unless platform specific code is provided, it does nothing.

Its use and whether its necessary to be called is dependent on the platform.

Definition at line 311 of file platform.c.

void mbedtls_platform_teardown ( mbedtls_platform_context ctx )

Perform any platform teardown operations.

Parameters:
ctxmbed TLS context
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 by default, unless platform specific code is provided, it does nothing.

Its use and whether its necessary to be called is dependent on the platform.

Definition at line 321 of file platform.c.