1.5.4.25 AL_PerformECB Function
C
AL_RESULT AL_PerformECB (
uint8_t *dataIn,
uint8_t dataLen,
uint8_t *dataOut,
uint8_t *key,
uint8_t keyLen
);
Summary
The AL_PerformECB primitive provides AES-ECB Encryption capabilities.
Description
This function is provided for the upper layers to take advantage of encryption capabilities of AL.
It performs an AES-ECB Encryption to a data buffer using provided input parameters and returns the encrypted data in the provided output parameter.
Parameters
| Param | Description |
|---|---|
|
dataIn |
Pointer to data to be encrypted |
|
dataLen |
Length of data buffer to be encrypted (in bytes) |
|
dataOut |
Pointer to buffer where encrypted data will be written |
| key | Pointer to key to be used for encryption |
| keyLen | Length of key to be used for encryption (in bytes) |
Returns
AL_SUCCESS if encryption succeeds. AL_ERROR otherwise.
Example
bool result;
uint8 rawData[64];
uint8 encryptedData[64];
uint8 aesKey[16];
memcpy(rawData, appData, sizeof(rawData));
memcpy(aesKey, appKey, sizeof(aesKey));
result = AL_PerformECB(rawData, 64, encryptedData, aesKey, 16);
if (result == AL_SUCCESS)
{
sendData(encryptedData);
}
Remarks
None.
