Headers for the implementation of the AES cipher-algorithm. More...
Headers for the implementation of the AES cipher-algorithm.
Definition in file aes.h.
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include "crypto/ciphers.h"
Go to the source code of this file.
Data Structures | |
struct | aes_key_st |
AES key. More... | |
struct | aes_context_t |
the cipher_context_t-struct adapted for AES More... | |
#define | GETU32(pt) |
#define | PUTU32(ct, st) |
#define | AES_MAXNR 14 |
#define | AES_BLOCK_SIZE 16 |
#define | AES_KEY_SIZE 16 |
typedef uint32_t | u32 |
typedef uint16_t | u16 |
typedef uint8_t | u8 |
typedef struct aes_key_st | AES_KEY |
int | aes_init (cipher_context_t *context, const uint8_t *key, uint8_t keySize) |
initializes the AES Cipher-algorithm with the passed parameters More... | |
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. More... | |
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. More... | |
#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 |