8.7.1.1 Crypto_Sym_ChaCha20_Init
crypto_Sym_Status_E Crypto_Sym_ChaCha20_Init(
st_Crypto_Sym_StreamCtx *ptr_chaChaCtx_st,
crypto_HandlerType_E handlerType_en,
uint8_t *ptr_key,
uint8_t *ptr_initVect,
uint32_t sessionID
);Description
This API is used to initiate the ChaCha20 algorithm parameters for the context.
Parameters
| No. | Argument Type | Argument Name | Type | Description |
|---|---|---|---|---|
| 1 | st_Crypto_Sym_StreamCtx* | ptr_chaChaCtx_st | Input | ChaCha20 algorithm context |
| 2 | crypto_HandlerType_E | handlerType_en | Input | Enum for crypto operation handler i.e., SW, HW |
| 3 | uint8_t* | ptr_key | Input | Key for the Symmetric operation (32 bytes for Chacha20) |
| 4 | uint8_t* | ptr_initVect | Input | Initialization vector where 96 bits are Nonce, and 32 bits are counter |
| 5 | uint32_t | sessionID | Input | It defines the session ID, must be more than zero |
Returns
| Return Type | Description |
|---|---|
| crypto_Sym_Status_E | Function returns the status of the API. |
Prerequisites
- To use the HW handler, the algorithm must be enabled in Crypto v4 in MPLAB® Code Configurator.
- To use the SW handler, the algorithm must be enabled in wolfCrypt, and linked to Crypto V4 in MPLAB® Code Configurator.
Example
Example provided in Crypto_Sym_ChaCha20_Cipher.
