AESPlugin > 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
-
ctx
Context 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
-
ctx
Context variable of type AesContext_t key
Pointer to the AES key keySize
Size of the key in bits. Can be 128 or 256. encryptNotDecrypt
True 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
-
ctx
Context variable of type AesContext_t inputBlock
128-bit (16 byte) buffer/block of data to be en/decrypted outputBlock
128-bit (16 byte) buffer/block of data to put the result of the en/decryption in. encryptNotDecrypt
True 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
-
ctx
Context variable of type AesCtrContext_t flags
CCM flags nonce
12-byte nonce specific to this transmission counter
3-byte running block counter key
Pointer to the AES key keySize
Size 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
-
ctx
Context variable of type AesCtrContext_t input
Raw data to en/decrypt output
Output buffer to put en/decrypted data length
Size (in bytes) of the input/output buffers