AES#

AES decryption functionality for bootloader.

Modules#

AesContext_t

AesCtrContext_t

Functions#

void

Initialize AES context.

void
btl_setAesKey(void *ctx, const uint8_t *key, unsigned int keySize, bool encryptNotDecrypt)

Set AES key to use for encryption/decryption.

void
btl_processAesBlock(void *ctx, uint8_t *inputBlock, uint8_t *outputBlock, bool encryptNotDecrypt)

Process one block of data using AES-ECB.

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.

void
btl_processAesCtrData(void *ctx, const uint8_t *input, uint8_t *output, size_t length)

Process data using AES-CTR.

Function Documentation#

btl_initAesContext#

void btl_initAesContext (void * ctx)

Initialize AES context.

Parameters
N/Actx

Context variable of type AesContext_t

Wipes the AES context struct before use.


Definition at line 45 of file platform/bootloader/security/btl_security_aes.h

btl_setAesKey#

void btl_setAesKey (void * ctx, const uint8_t * key, unsigned int keySize, bool encryptNotDecrypt)

Set AES key to use for encryption/decryption.

Parameters
N/Actx

Context variable of type AesContext_t

N/Akey

Pointer to the AES key

N/AkeySize

Size of the key in bits. Can be 128 or 256.

N/AencryptNotDecrypt

True if using this context for encryption, false if using for decryption.

Initializes the AES context struct with the key to use.


Definition at line 58 of file platform/bootloader/security/btl_security_aes.h

btl_processAesBlock#

void btl_processAesBlock (void * ctx, uint8_t * inputBlock, uint8_t * outputBlock, bool encryptNotDecrypt)

Process one block of data using AES-ECB.

Parameters
N/Actx

Context variable of type AesContext_t

N/AinputBlock

128-bit (16 byte) buffer/block of data to be en/decrypted

N/AoutputBlock

128-bit (16 byte) buffer/block of data to put the result of the en/decryption in.

N/AencryptNotDecrypt

True for encryption, false for decryption

Runs one block of data through the AES algorithm. In-place encryption/ decryption is supported.


Definition at line 76 of file platform/bootloader/security/btl_security_aes.h

btl_initAesCcm#

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.

Parameters
N/Actx

Context variable of type AesCtrContext_t

N/Aflags

CCM flags

N/Anonce

12-byte nonce specific to this transmission

N/Acounter

3-byte running block counter

N/Akey

Pointer to the AES key

N/AkeySize

Size of the key in bits. Can be 128 or 256.

Initializes an AES-CTR context struct with parameters used in AES-CCM mode. Data can then be en/decrypted using btl_processAesCtrData.


Definition at line 94 of file platform/bootloader/security/btl_security_aes.h

btl_processAesCtrData#

void btl_processAesCtrData (void * ctx, const uint8_t * input, uint8_t * output, size_t length)

Process data using AES-CTR.

Parameters
N/Actx

Context variable of type AesCtrContext_t

N/Ainput

Raw data to en/decrypt

N/Aoutput

Output buffer to put en/decrypted data

N/Alength

Size (in bytes) of the input/output buffers

Runs data for encryption or decryption (which uses the same function) through the AES-CTR algorithm. In-place encryption/decryption is supported.


Definition at line 112 of file platform/bootloader/security/btl_security_aes.h