20 #define AES_BLOCK_SIZE 16 25 #define AES_KEY_SIZE 16 30 #define AES_KEY_SIZE_BITS 128 35 #define AES_OK 0 // Success 36 #define AES_ERR_INVALID_PARAM 1 // NULL pointer or invalid parameter 37 #define AES_ERR_INVALID_LENGTH 2 // Invalid data length (not block-aligned or zero) 38 #define AES_ERR_CRYPTO_FAILURE 3 // Underlying crypto operation failed 71 unsigned char ciphertext[AES_BLOCK_SIZE]
87 const unsigned char * plaintext,
89 unsigned char * ciphertext,
106 const unsigned char * ciphertext,
107 size_t ciphertext_len,
108 unsigned char * plaintext,
126 const unsigned char * plaintext,
127 size_t plaintext_len,
int aes_cbc_decrypt(aes_ctx ctx, const unsigned char *ciphertext, size_t ciphertext_len, unsigned char *plaintext, const unsigned char iv[AES_BLOCK_SIZE])
Decrypt data using AES-128 in CBC mode.
aes_ctx aes_create_ctx(const unsigned char key[AES_KEY_SIZE])
Create and initialize an AES-128 context from a key.
int aes_cbc_encrypt(aes_ctx ctx, const unsigned char *plaintext, size_t plaintext_len, unsigned char *ciphertext, const unsigned char iv[AES_BLOCK_SIZE])
Encrypt data using AES-128 in CBC mode.
#define AES_BLOCK_SIZE
AES block size in bytes (128 bits)
void aes_destroy_ctx(aes_ctx ctx)
Destroy an AES context and securely wipe its memory.
int aes_encrypt_block(aes_ctx ctx, const unsigned char plaintext[AES_BLOCK_SIZE], unsigned char ciphertext[AES_BLOCK_SIZE])
Encrypt a single 16-byte block using AES-128 in ECB mode.
#define AES_KEY_SIZE
AES-128 key size in bytes.
Contains the basic defines that are required throughout the BRP library.
int aes_cbc_mac(aes_ctx ctx, const unsigned char *plaintext, size_t plaintext_len, unsigned char mac[AES_BLOCK_SIZE])
Calculate CBC-MAC (Cipher Block Chaining Message Authentication Code).
struct aes_ctx_t * aes_ctx
Opaque AES key schedule type.