Headers for the implementation of the AES cipher-algorithm. More...
Headers for the implementation of the AES cipher-algorithm.
The default key size is 128 bits. To use a different key size add USEMODULE += crypto_aes_192 and/or USEMODULE += crypto_aes_256 to your Makefile.
If only one key size is needed and that key size is not 128 bits, the 128 bit key size can be disabled with DISABLE_MODULE += crypto_aes_128 as an optimization.
Definition in file aes.h.
Go to the source code of this file.
Data Structures | |
struct | aes_context_t |
the cipher_context_t-struct adapted for AES More... | |
Functions | |
int | aes_init (cipher_context_t *context, const uint8_t *key, uint8_t keySize) |
initializes the AES Cipher-algorithm with the passed parameters | |
int | aes_encrypt (const cipher_context_t *context, const uint8_t *plain_block, uint8_t *cipher_block) |
encrypts one plainBlock-block and saves the result in cipherblock. | |
int | aes_decrypt (const cipher_context_t *context, const uint8_t *cipher_block, uint8_t *plain_block) |
decrypts one cipher-block and saves the plain-block in plainBlock. | |
#define | GETU32(pt) |
#define | PUTU32(ct, st) |
#define | AES_MAXNR 14 |
#define | AES_BLOCK_SIZE 16 |
typedef uint32_t | u32 |
typedef uint16_t | u16 |
typedef uint8_t | u8 |
AES key sizes | |
#define | AES_KEY_SIZE_128 16 |
#define | AES_KEY_SIZE_192 24 |
#define | AES_KEY_SIZE_256 32 |
#define GETU32 | ( | pt | ) |
#define PUTU32 | ( | ct, | |
st | |||
) |
int aes_decrypt | ( | const cipher_context_t * | context, |
const uint8_t * | cipher_block, | ||
uint8_t * | plain_block | ||
) |
decrypts one cipher-block and saves the plain-block in plainBlock.
decrypts one blocksize long block of ciphertext pointed to by cipherBlock to one blocksize long block of plaintext and stores the plaintext in the memory-area pointed to by plainBlock
context | the cipher_context_t-struct to use for this decryption |
cipher_block | a pointer to the ciphertext-block (of size blocksize) to be decrypted |
plain_block | a pointer to the place where the decrypted plaintext will be stored |
int aes_encrypt | ( | const cipher_context_t * | context, |
const uint8_t * | plain_block, | ||
uint8_t * | cipher_block | ||
) |
encrypts one plainBlock-block and saves the result in cipherblock.
encrypts one blocksize long block of plaintext pointed to by plainBlock to one blocksize long block of ciphertext which will be written to the the memory-area pointed to by cipherBlock
context | the cipher_context_t-struct to use for this encryption |
plain_block | a pointer to the plaintext-block (of size blocksize) |
cipher_block | a pointer to the place where the ciphertext will be stored |
int aes_init | ( | cipher_context_t * | context, |
const uint8_t * | key, | ||
uint8_t | keySize | ||
) |
initializes the AES Cipher-algorithm with the passed parameters
context | the cipher_context_t-struct to save the initialization of the cipher in |
keySize | the size of the key Must be 16, since this implementation does not support key lengths of 24 or 32 bytes |
key | a pointer to the key |