#include <config-sl-crypto-all-acceleration.h>
#include "em_device.h"
#include "mbedtls_ecode.h"
#include "slpal.h"
Go to the source code of this file.
#define MBEDTLS_DEVICE_COUNT CRYPTO_COUNT |
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] | ctx | mbedtls device context. |
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] | ctx | mbedtls device context. |
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] | ctx | mbedtls device context. |
[in] | devno | AES/CRYPTO hardware device instance to use. |
- Returns
- 0 if success. Error code if failure.