NVM3 HAL CRYPTO#
NVM3 Crypto Hardware Abstraction Layer.
This module provides the interface to the NVM. By having all NVM access functions in a separate file, it is possible to support different hardware by substituting the functions in this module.
Note
These functions are used by the NVM3 and should not be used by any applications.
Modules#
Enumerations#
Typedefs#
Init the NVM3 HAL Crypto for usage.
This function is used to generate random number.
This function is used to perform encryption/authenticated encryption on NVM data.
This function is used to perform decryption/authenticated decryption of NVM data.
Variables#
The HAL crypto handle.
Functions#
SE manager initialization.
Generate true random number.
SE crypto encryption operation.
SE crypto decryption operation.
Enumeration Documentation#
nvm3_halCryptoAlgo_t#
nvm3_halCryptoAlgo_t
Enumerator | |
---|---|
NVM3_HAL_CRYPTO_ALGO_NONE | |
NVM3_HAL_CRYPTO_ALGO_AEAD | |
NVM3_HAL_CRYPTO_ALGO_ENC |
82
of file platform/emdrv/nvm3/inc/nvm3_hal_crypto.h
Typedef Documentation#
nvm3_HalCryptoInit_t#
typedef sl_status_t(* nvm3_HalCryptoInit_t) (void) )(void)
Init the NVM3 HAL Crypto for usage.
This function must be run at initialization, before any other functions are called. It is used to initialize the crypto before any crypto functionality can be accessed.
Returns
The result of the crypto init call. SL_STATUS_OK on success or a NVM3 sl_status_t on failure.
105
of file platform/emdrv/nvm3/inc/nvm3_hal_crypto.h
nvm3_HalCryptoGenRandNum_t#
typedef sl_status_t(* nvm3_HalCryptoGenRandNum_t) (uint8_t *output, size_t outputSize) )(uint8_t *output, size_t outputSize)
This function is used to generate random number.
[in] | outputSize | The length of the random number to be generated in number of bytes. |
[out] | output | A pointer to the random number generated. |
Returns
The result of the random number generator operation. SL_STATUS_OK on success or a NVM3 sl_status_t on failure.
121
of file platform/emdrv/nvm3/inc/nvm3_hal_crypto.h
nvm3_HalCryptoEncrypt_t#
typedef sl_status_t(* nvm3_HalCryptoEncrypt_t) (const uint8_t *nonce, const uint8_t *aad, size_t aadLen, const uint8_t *plainData, size_t plainDataLen, uint8_t *cipherData, uint8_t *tag, nvm3_halCryptoAlgo_t cryptoAlgo) )(const uint8_t *nonce, const uint8_t *aad, size_t aadLen, const uint8_t *plainData, size_t plainDataLen, uint8_t *cipherData, uint8_t *tag, nvm3_halCryptoAlgo_t cryptoAlgo)
This function is used to perform encryption/authenticated encryption on NVM data.
[in] | nonce | A pointer to the nonce value. |
[in] | aad | A pointer to the additional data to authenticate. |
[in] | aadLen | The length of the additional data to authenticate in number of bytes. |
[in] | plainData | A pointer to plain data to encrypt. |
[in] | plainDataLen | The length of the plain data in number of bytes. |
[out] | cipherData | A pointer to encrypted data. |
[out] | tag | A pointer to the tag. |
[in] | cryptoAlgo | Crypto algorithm to use. |
Returns
The result of the encryption operation. SL_STATUS_OK on success or a NVM3 sl_status_t on failure.
156
of file platform/emdrv/nvm3/inc/nvm3_hal_crypto.h
nvm3_HalCryptoDecrypt_t#
typedef sl_status_t(* nvm3_HalCryptoDecrypt_t) (const uint8_t *nonce, const uint8_t *aad, size_t aadLen, const uint8_t *cipherData, size_t cipherDataLen, uint8_t *plainData, const uint8_t *tag, nvm3_halCryptoAlgo_t cryptoAlgo) )(const uint8_t *nonce, const uint8_t *aad, size_t aadLen, const uint8_t *cipherData, size_t cipherDataLen, uint8_t *plainData, const uint8_t *tag, nvm3_halCryptoAlgo_t cryptoAlgo)
This function is used to perform decryption/authenticated decryption of NVM data.
[in] | nonce | A pointer to the nonce value. |
[in] | aad | A pointer to the additional data to authenticate. |
[in] | aadLen | The length of the additional data to authenticate in number of bytes. |
[in] | cipherData | A pointer to encrypted data to decrypt. |
[in] | cipherDataLen | The length of the encrypted data in number of bytes. |
[out] | plainData | A pointer to decrypted data. |
[in] | tag | A pointer to the tag to verify. |
[in] | cryptoAlgo | Crypto algorithm to use. |
Returns
The result of the decryption operation. SL_STATUS_OK on success or a NVM3 sl_status_t on failure.
191
of file platform/emdrv/nvm3/inc/nvm3_hal_crypto.h
Variable Documentation#
nvm3_halCryptoHandle#
const nvm3_HalCryptoHandle_t nvm3_halCryptoHandle
The HAL crypto handle.
211
of file platform/emdrv/nvm3/src/nvm3_hal_crypto_se.c
Function Documentation#
nvm3_halCryptoSeInit#
static sl_status_t nvm3_halCryptoSeInit (void )
SE manager initialization.
N/A |
102
of file platform/emdrv/nvm3/src/nvm3_hal_crypto_se.c
nvm3_halCryptoSeGenRandNum#
static sl_status_t nvm3_halCryptoSeGenRandNum (uint8_t * output, size_t outputSize)
Generate true random number.
N/A | output | |
N/A | outputSize |
116
of file platform/emdrv/nvm3/src/nvm3_hal_crypto_se.c
nvm3_halCryptoSeEncrypt#
static sl_status_t nvm3_halCryptoSeEncrypt (const uint8_t * nonce, const uint8_t * aad, size_t aadLen, const uint8_t * plainData, size_t plainDataLen, uint8_t * cipherData, uint8_t * tag, nvm3_halCryptoAlgo_t cryptoAlgo)
SE crypto encryption operation.
N/A | nonce | |
N/A | aad | |
N/A | aadLen | |
N/A | plainData | |
N/A | plainDataLen | |
N/A | cipherData | |
N/A | tag | |
N/A | cryptoAlgo |
129
of file platform/emdrv/nvm3/src/nvm3_hal_crypto_se.c
nvm3_halCryptoSeDecrypt#
static sl_status_t nvm3_halCryptoSeDecrypt (const uint8_t * nonce, const uint8_t * aad, size_t aadLen, const uint8_t * cipherData, size_t cipherDataLen, uint8_t * plainData, const uint8_t * tag, nvm3_halCryptoAlgo_t cryptoAlgo)
SE crypto decryption operation.
N/A | nonce | |
N/A | aad | |
N/A | aadLen | |
N/A | cipherData | |
N/A | cipherDataLen | |
N/A | plainData | |
N/A | tag | |
N/A | cryptoAlgo |
170
of file platform/emdrv/nvm3/src/nvm3_hal_crypto_se.c