mbed TLS v2.2.0
Data Structures | Macros | Functions | Variables
slcl_device.h File Reference
#include <config-sl-crypto-all-acceleration.h>
#include "em_device.h"
#include "mbedtls_ecode.h"
#include "slpal.h"
Include dependency graph for slcl_device.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mbedtls_device_context
 Device context structure. More...
 

Macros

#define MBEDTLS_ERR_DEVICE_NOT_SUPPORTED   ((int)MBEDTLS_ERR_DEVICE_BASE | 0x1)
 
#define MBEDTLS_DEVICE_COUNT   CRYPTO_COUNT
 

Functions

void mbedtls_device_init (mbedtls_device_context *ctx)
 Initialize an mbedtls device context. More...
 
void mbedtls_device_free (mbedtls_device_context *ctx)
 Free an mbedtls device context. More...
 
int mbedtls_device_set_instance (mbedtls_device_context *ctx, unsigned int devno)
 Set the device instance of an mbedtls device context. More...
 

Variables

mbedtls_device_contextp_mbedtls_device_context [MBEDTLS_DEVICE_COUNT]
 

Macro Definition Documentation

#define MBEDTLS_DEVICE_COUNT   CRYPTO_COUNT

Definition at line 59 of file slcl_device.h.

#define MBEDTLS_ERR_DEVICE_NOT_SUPPORTED   ((int)MBEDTLS_ERR_DEVICE_BASE | 0x1)

Definition at line 52 of file slcl_device.h.

Function Documentation

void mbedtls_device_free ( mbedtls_device_context ctx)

Free an mbedtls device context.

This function frees the resources kept by an mbedtls device context, and removes the pointer to the mbedtls context from the internal device table.

Parameters
[in]ctxmbedtls device context.
void mbedtls_device_init ( mbedtls_device_context ctx)

Initialize an mbedtls device context.

This function initializes an mbedtls device context. By default the mbedtls_device_init function is called internally in order for backwards compatibility. However the internal initialization consumes some RAM because the device structures are instantiated statically inside the mbedTLS library. The user application may define MBEDTLS_DEVICE_INIT_INTERNAL_DISABLE in order to disable the internal device initialization, and take responsibility of allocating and initializing the device context structures itself. If MBEDTLS_DEVICE_INIT_INTERNAL_DISABLE is defined the user application is required to call mbedtls_device_init and mbedtls_device_set_instance before any subsequent calls to mbedtls APIs involving SLCL plugins. The mbedtls_device_set_instance function will store a pointer to the mbedtls context in the internal device table in in order to retrieve context and corresponding attributes in subsequent calls to mbedtls.

Note
The user should only initialize one mbedtls device context per CRYPTO/AES hardware device.
Parameters
[in]ctxmbedtls device context.
int mbedtls_device_set_instance ( mbedtls_device_context ctx,
unsigned int  devno 
)

Set the device instance of an mbedtls device context.

This function sets the AES/CRYPTO device instance of an mbedtls device context. Subsequent calls to API functions with this context will use the given AES/CRYPTO device instance. mbedtls_device_set_instance will store a pointer to the mbedtls context in the internal device table in in order to retrieve context and corresponding attributes in subsequent calls to mbedtls. By default the mbedtls_device_set_instance function is called internally for backwards compatibility, and the user application will not need to call mbedtls_device_set_instance. If MBEDTLS_DEVICE_INIT_INTERNAL_DISABLE is defined the user is required to call mbedtls_device_init and mbedtls_device_set_instance before any other mbedTLS API calls in order to initialize the CRYPTO device context structure(s) (mbedtls_device_context) Please refer to mbedtls_device_init for more information.

Parameters
[in]ctxmbedtls device context.
[in]devnoAES/CRYPTO hardware device instance to use.
Returns
0 if success. Error code if failure.

Variable Documentation

mbedtls_device_context* p_mbedtls_device_context[MBEDTLS_DEVICE_COUNT]