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#

nvm3_HalCryptoHandle_t

Enumerations#

enum
NVM3_HAL_CRYPTO_ALGO_NONE = 0
NVM3_HAL_CRYPTO_ALGO_AEAD = 1
NVM3_HAL_CRYPTO_ALGO_ENC = 2
}

Typedefs#

typedef sl_status_t(*

Init the NVM3 HAL Crypto for usage.

typedef sl_status_t(*
nvm3_HalCryptoGenRandNum_t)(uint8_t *output, size_t outputSize)

This function is used to generate random number.

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)

This function is used to perform encryption/authenticated encryption on NVM data.

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)

This function is used to perform decryption/authenticated decryption of NVM data.

Variables#

The HAL crypto handle.

Functions#

sl_status_t

SE manager initialization.

sl_status_t
nvm3_halCryptoSeGenRandNum(uint8_t *output, size_t outputSize)

Generate true random number.

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.

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.

Enumeration Documentation#

nvm3_halCryptoAlgo_t#

nvm3_halCryptoAlgo_t
Enumerator
NVM3_HAL_CRYPTO_ALGO_NONE
NVM3_HAL_CRYPTO_ALGO_AEAD
NVM3_HAL_CRYPTO_ALGO_ENC

Definition at line 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.


Definition at line 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.

Parameters
[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.


Definition at line 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.

Parameters
[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.


Definition at line 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.

Parameters
[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.


Definition at line 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.


Definition at line 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.

Parameters
N/A

Definition at line 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.

Parameters
N/Aoutput
N/AoutputSize

Definition at line 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.

Parameters
N/Anonce
N/Aaad
N/AaadLen
N/AplainData
N/AplainDataLen
N/AcipherData
N/Atag
N/AcryptoAlgo

Definition at line 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.

Parameters
N/Anonce
N/Aaad
N/AaadLen
N/AcipherData
N/AcipherDataLen
N/AplainData
N/Atag
N/AcryptoAlgo

Definition at line 170 of file platform/emdrv/nvm3/src/nvm3_hal_crypto_se.c