BALTECH SDK wrapper functions reference
aes.h File Reference

AES (Advanced Encryption Standard) abstraction for brp_lib. More...

#include "common.h"

Go to the source code of this file.

Macros

#define AES_BLOCK_SIZE   16
 AES block size in bytes (128 bits) More...
 
#define AES_KEY_SIZE   16
 AES-128 key size in bytes. More...
 
#define AES_KEY_SIZE_BITS   128
 AES-128 key size in bits. More...
 
#define AES_OK   0
 AES operation return codes. More...
 
#define AES_ERR_INVALID_PARAM   1
 
#define AES_ERR_INVALID_LENGTH   2
 
#define AES_ERR_CRYPTO_FAILURE   3
 

Typedefs

typedef struct aes_ctx_t * aes_ctx
 Opaque AES key schedule type. More...
 

Functions

aes_ctx aes_create_ctx (const unsigned char key[AES_KEY_SIZE])
 Create and initialize an AES-128 context from a key. More...
 
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. More...
 
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. More...
 
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. More...
 
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). More...
 
void aes_destroy_ctx (aes_ctx ctx)
 Destroy an AES context and securely wipe its memory. More...
 

Detailed Description

AES (Advanced Encryption Standard) abstraction for brp_lib.

Provides AES-128 operations in ECB and CBC modes.

Definition in file aes.h.