AESComponents > Security
Description
AES decryption functionality for bootloader.
Data Structures |
|
| struct | AesContext |
|
Context variable type for AES-ECB.
|
|
| struct | AesCtrContext |
|
Context variable type for AES-CTR (and AES-CCM)
|
|
Typedefs |
|
| typedef struct AesContext | AesContext_t |
|
Context variable type for AES-ECB.
|
|
| typedef struct AesCtrContext | AesCtrContext_t |
|
Context variable type for AES-CTR (and AES-CCM)
|
|
Functions |
|
| void | btl_initAesContext (void *ctx) |
| void | btl_setAesKey (void *ctx, const uint8_t *key, unsigned int keySize, bool encryptNotDecrypt) |
| void | btl_processAesBlock (void *ctx, uint8_t *inputBlock, uint8_t *outputBlock, bool encryptNotDecrypt) |
| void | btl_initAesCcm (void *ctx, uint8_t flags, uint8_t *nonce, uint32_t counter, const uint8_t *key, unsigned int keySize) |
| void | btl_processAesCtrData (void *ctx, const uint8_t *input, uint8_t *output, size_t length) |
Function Documentation
| void btl_initAesContext | ( | void * |
ctx
|
) |
Initialize AES context.
Wipes the AES context struct before use.
- Parameters
-
ctxContext variable of type AesContext_t
| void btl_setAesKey | ( | void * |
ctx,
|
| const uint8_t * |
key,
|
||
| unsigned int |
keySize,
|
||
| bool |
encryptNotDecrypt
|
||
| ) |
Set AES key to use for encryption/decryption.
Initializes the AES context struct with the key to use.
- Parameters
-
ctxContext variable of type AesContext_t keyPointer to the AES key keySizeSize of the key in bits. Can be 128 or 256. encryptNotDecryptTrue if using this context for encryption, false if using for decryption.
| void btl_processAesBlock | ( | void * |
ctx,
|
| uint8_t * |
inputBlock,
|
||
| uint8_t * |
outputBlock,
|
||
| bool |
encryptNotDecrypt
|
||
| ) |
Process one block of data using AES-ECB.
Runs one block of data through the AES algorithm. In-place encryption/ decryption is supported.
- Parameters
-
ctxContext variable of type AesContext_t inputBlock128-bit (16 byte) buffer/block of data to be en/decrypted outputBlock128-bit (16 byte) buffer/block of data to put the result of the en/decryption in. encryptNotDecryptTrue for encryption, false for decryption
| void btl_initAesCcm | ( | void * |
ctx,
|
| uint8_t |
flags,
|
||
| uint8_t * |
nonce,
|
||
| uint32_t |
counter,
|
||
| const uint8_t * |
key,
|
||
| unsigned int |
keySize
|
||
| ) |
Set up the AES-CTR context structure in CCM mode.
Initializes an AES-CTR context struct with parameters used in AES-CCM mode. Data can then be en/decrypted using btl_processAesCtrData.
- Parameters
-
ctxContext variable of type AesCtrContext_t flagsCCM flags nonce12-byte nonce specific to this transmission counter3-byte running block counter keyPointer to the AES key keySizeSize of the key in bits. Can be 128 or 256.
| void btl_processAesCtrData | ( | void * |
ctx,
|
| const uint8_t * |
input,
|
||
| uint8_t * |
output,
|
||
| size_t |
length
|
||
| ) |
Process data using AES-CTR.
Runs data for encryption or decryption (which uses the same function) through the AES-CTR algorithm. In-place encryption/decryption is supported.
- Parameters
-
ctxContext variable of type AesCtrContext_t inputRaw data to en/decrypt outputOutput buffer to put en/decrypted data lengthSize (in bytes) of the input/output buffers