Documentation

Documentation

Includes

config.h

#include "config.h"
#include "config.h"

MBEDTLS_CONFIG_FILE

#include MBEDTLS_CONFIG_FILE
#include MBEDTLS_CONFIG_FILE

platform_time.h

#include "platform_time.h"
#include "platform_time.h"

stdio.h

#include <stdio.h>
#include 

stdlib.h

#include <stdlib.h>
#include 

time.h

#include <time.h>
#include 

MBEDTLS_PLATFORM_STD_MEM_HDR

#include MBEDTLS_PLATFORM_STD_MEM_HDR
#include MBEDTLS_PLATFORM_STD_MEM_HDR

stddef.h

#include <stddef.h>
#include 

stdio.h

#include <stdio.h>
#include 

platform_alt.h

#include "platform_alt.h"
#include "platform_alt.h"

Macros

Marco MBEDTLS_PLATFORM_H

#define MBEDTLS_PLATFORM_H


      

Marco MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED

#define MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED    -112 /**< Hardware accelerator failed */


      

Marco MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED

#define MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED -114 /**< The requested feature is not supported by the platform */


      

Marco MBEDTLS_PLATFORM_STD_SNPRINTF

#define MBEDTLS_PLATFORM_STD_SNPRINTF  mbedtls_platform_win32_snprintf /**< The default \c snprintf function to use.  */


      

Marco MBEDTLS_PLATFORM_STD_SNPRINTF

#define MBEDTLS_PLATFORM_STD_SNPRINTF  snprintf /**< The default \c snprintf function to use.  */


      

Marco MBEDTLS_PLATFORM_STD_PRINTF

#define MBEDTLS_PLATFORM_STD_PRINTF  printf /**< The default \c printf function to use. */


      

Marco MBEDTLS_PLATFORM_STD_FPRINTF

#define MBEDTLS_PLATFORM_STD_FPRINTF fprintf /**< The default \c fprintf function to use. */


      

Marco MBEDTLS_PLATFORM_STD_CALLOC

#define MBEDTLS_PLATFORM_STD_CALLOC  calloc /**< The default \c calloc function to use. */


      

Marco MBEDTLS_PLATFORM_STD_FREE

#define MBEDTLS_PLATFORM_STD_FREE      free /**< The default \c free function to use. */


      

Marco MBEDTLS_PLATFORM_STD_EXIT

#define MBEDTLS_PLATFORM_STD_EXIT     exit /**< The default \c exit function to use. */


      

Marco MBEDTLS_PLATFORM_STD_TIME

#define MBEDTLS_PLATFORM_STD_TIME      time   /**< The default \c time function to use. */


      

Marco MBEDTLS_PLATFORM_STD_EXIT_SUCCESS

#define MBEDTLS_PLATFORM_STD_EXIT_SUCCESS EXIT_SUCCESS /**< The default exit value to use. */


      

Marco MBEDTLS_PLATFORM_STD_EXIT_FAILURE

#define MBEDTLS_PLATFORM_STD_EXIT_FAILURE EXIT_FAILURE /**< The default exit value to use. */


      

Marco MBEDTLS_PLATFORM_STD_NV_SEED_READ

#define MBEDTLS_PLATFORM_STD_NV_SEED_READ  mbedtls_platform_std_nv_seed_read


      

Marco MBEDTLS_PLATFORM_STD_NV_SEED_WRITE

#define MBEDTLS_PLATFORM_STD_NV_SEED_WRITE mbedtls_platform_std_nv_seed_write


      

Marco MBEDTLS_PLATFORM_STD_NV_SEED_FILE

#define MBEDTLS_PLATFORM_STD_NV_SEED_FILE  "seedfile"


      

Marco mbedtls_free

#define mbedtls_free      MBEDTLS_PLATFORM_FREE_MACRO


      

Marco mbedtls_calloc

#define mbedtls_calloc    MBEDTLS_PLATFORM_CALLOC_MACRO


      

Marco mbedtls_free

#define mbedtls_free      free


      

Marco mbedtls_calloc

#define mbedtls_calloc    calloc


      

Marco mbedtls_fprintf

#define mbedtls_fprintf   MBEDTLS_PLATFORM_FPRINTF_MACRO


      

Marco mbedtls_fprintf

#define mbedtls_fprintf   fprintf


      

Marco mbedtls_printf

#define mbedtls_printf    MBEDTLS_PLATFORM_PRINTF_MACRO


      

Marco mbedtls_printf

#define mbedtls_printf    printf


      

Marco mbedtls_snprintf

#define mbedtls_snprintf  MBEDTLS_PLATFORM_SNPRINTF_MACRO


      

Marco mbedtls_snprintf

#define mbedtls_snprintf  MBEDTLS_PLATFORM_STD_SNPRINTF


      

Marco mbedtls_exit

#define mbedtls_exit  MBEDTLS_PLATFORM_EXIT_MACRO


      

Marco mbedtls_exit

#define mbedtls_exit  exit


      

Marco MBEDTLS_EXIT_SUCCESS

#define MBEDTLS_EXIT_SUCCESS MBEDTLS_PLATFORM_STD_EXIT_SUCCESS


      

Marco MBEDTLS_EXIT_SUCCESS

#define MBEDTLS_EXIT_SUCCESS 0


      

Marco MBEDTLS_EXIT_FAILURE

#define MBEDTLS_EXIT_FAILURE MBEDTLS_PLATFORM_STD_EXIT_FAILURE


      

Marco MBEDTLS_EXIT_FAILURE

#define MBEDTLS_EXIT_FAILURE 1


      

Marco mbedtls_nv_seed_read

#define mbedtls_nv_seed_read   MBEDTLS_PLATFORM_NV_SEED_READ_MACRO


      

Marco mbedtls_nv_seed_write

#define mbedtls_nv_seed_write  MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO


      

Marco mbedtls_nv_seed_read

#define mbedtls_nv_seed_read   mbedtls_platform_std_nv_seed_read


      

Marco mbedtls_nv_seed_write

#define mbedtls_nv_seed_write  mbedtls_platform_std_nv_seed_write

      

Functions

Func mbedtls_platform_set_calloc_free

int mbedtls_platform_set_calloc_free( void * (*calloc_func)( size_t, size_t ),
                             void (*free_func)( void * ) );
/**
 * \brief               This function dynamically sets the memory-management
 *                      functions used by the library, during runtime.
 *
 * \param calloc_func   The \c calloc function implementation.
 * \param free_func     The \c free function implementation.
 *
 * \return              \c 0.
 */

Func mbedtls_platform_set_fprintf

int mbedtls_platform_set_fprintf( int (*fprintf_func)( FILE *stream, const char *,
                                              ... ) );
/**
 * \brief                This function dynamically configures the fprintf
 *                       function that is called when the
 *                       mbedtls_fprintf() function is invoked by the library.
 *
 * \param fprintf_func   The \c fprintf function implementation.
 *
 * \return               \c 0.
 */

Func mbedtls_platform_set_printf

int mbedtls_platform_set_printf( int (*printf_func)( const char *, ... ) );
/**
 * \brief               This function dynamically configures the snprintf
 *                      function that is called when the mbedtls_snprintf()
 *                      function is invoked by the library.
 *
 * \param printf_func   The \c printf function implementation.
 *
 * \return              \c 0 on success.
 */

Func mbedtls_platform_win32_snprintf

int mbedtls_platform_win32_snprintf( char *s, size_t n, const char *fmt, ... );
/* For Windows (inc. MSYS2), we provide our own fixed implementation */

Func mbedtls_platform_set_snprintf

int mbedtls_platform_set_snprintf( int (*snprintf_func)( char * s, size_t n,
                                                const char * format, ... ) );
/**
 * \brief                 This function allows configuring a custom
 *                        \c snprintf function pointer.
 *
 * \param snprintf_func   The \c snprintf function implementation.
 *
 * \return                \c 0 on success.
 */

Func mbedtls_platform_set_exit

int mbedtls_platform_set_exit( void (*exit_func)( int status ) );
/**
 * \brief             This function dynamically configures the exit
 *                    function that is called when the mbedtls_exit()
 *                    function is invoked by the library.
 *
 * \param exit_func   The \c exit function implementation.
 *
 * \return            \c 0 on success.
 */

Func mbedtls_platform_std_nv_seed_read

int mbedtls_platform_std_nv_seed_read( unsigned char *buf, size_t buf_len );
/* Internal standard platform definitions */

Func mbedtls_platform_std_nv_seed_write

int mbedtls_platform_std_nv_seed_write( unsigned char *buf, size_t buf_len );


      

Func mbedtls_platform_set_nv_seed

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 )
           );
/**
 * \brief   This function allows configuring custom seed file writing and
 *          reading functions.
 *
 * \param   nv_seed_read_func   The seed reading function implementation.
 * \param   nv_seed_write_func  The seed writing function implementation.
 *
 * \return  \c 0 on success.
 */

Func mbedtls_platform_setup

int mbedtls_platform_setup( mbedtls_platform_context *ctx );
/**
 * \brief   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.
 *
 * \note    The usage and necessity of this function is dependent on the platform.
 *
 * \param   ctx     The platform context.
 *
 * \return  \c 0 on success.
 */

Func mbedtls_platform_teardown

void mbedtls_platform_teardown( mbedtls_platform_context *ctx );
/**
 * \brief   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.
 *
 * \param   ctx     The platform context.
 *
 */

Vars

Consts

Types

Typedefs

Typedef mbedtls_platform_context;

typedef struct mbedtls_platform_context
{
   char dummy; /**< A placeholder member, as empty structs are not portable. */
}
mbedtls_platform_context;
/**
 * \brief   The platform context structure.
 *
 * \note    This structure may be used to assist platform-specific
 *          setup or teardown operations.
 */