crypto_Sym_Status_E Crypto_Sym_AesKeyWrapDirect(
crypto_HandlerType_E handlerType_en,
uint8_t *ptr_inputData,
uint32_t inputLen,
uint8_t *ptr_outData,
uint8_t *ptr_key,
uint32_t keyLen,
uint8_t *ptr_initVect,
uint32_t sessionID
);
Description
This API is used to wrap the data using AES-KW in single step without initializing
context.
Parameters
No. | Argument Type | Argument Name | Type | Description |
---|
1 | crypto_HandlerType_E | handlerType_en | Input | Enum for
crypto operation handler i.e., SW, HW |
2 | uint8_t* | ptr_inputData | Input | Input data to
wrap |
3 | uint32_t | inputLen | Input | Input length
of plain data in bytes |
4 | uint8_t* | ptr_outData | Output | Pointer to
store cipher text as output |
5 | uint8_t* | ptr_key | Input | Key for the
Symmetric operation |
6 | uint32_t | keyLen | Input | Key length for
the Symmetric algorithm in bytes |
7 | uint8_t* | ptr_initVect | Input | Initialization
vector |
8 | 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
#define sessionID 1
crypto_Sym_Status_E status;
crypto_HandlerType_E handlerType_en = CRYPTO_HANDLER_SW_WOLFCRYPT;
uint8_t key[16] = {/*data*/};
uint32_t keyLen = sizeof(key);
uint8_t *ptr_initVect = {/*data*/};
uint8_t inputData[64] = {/*data*/};
uint32_t dataLen = sizeof(inputData);
uint8_t outData[64];
status = Crypto_Sym_AesKeyWrapDirect(
handlerType_en,
inputData,
dataLen,
outData,
key,
keyLen,
ptr_initVect,
sessionID
);