File syn_aes128.h¶
FileList > src > syntropic > util > syn_aes128.h
Go to the source code of this file
AES-128 cipher engine (ECB & CBC mode with PKCS#7 padding). More...
#include "../common/syn_defs.h"#include <stdbool.h>#include <stddef.h>#include <stdint.h>
Classes¶
| Type | Name |
|---|---|
| struct | SYN_AES128_Context AES-128 Context — stores round keys. |
Public Functions¶
| Type | Name |
|---|---|
| SYN_Status | syn_aes128_cbc_decrypt (const SYN_AES128_Context * ctx, const uint8_t iv, const uint8_t * in, size_t in_len, uint8_t * out, size_t out_capacity, size_t * out_len) Decrypt data using AES-128-CBC with PKCS#7 padding removal. |
| SYN_Status | syn_aes128_cbc_encrypt (const SYN_AES128_Context * ctx, const uint8_t iv, const uint8_t * in, size_t in_len, uint8_t * out, size_t out_capacity, size_t * out_len) Encrypt data using AES-128-CBC with PKCS#7 padding. |
| void | syn_aes128_decrypt_block (const SYN_AES128_Context * ctx, const uint8_t in, uint8_t out) Decrypt a single 16-byte block (ECB mode). |
| void | syn_aes128_encrypt_block (const SYN_AES128_Context * ctx, const uint8_t in, uint8_t out) Encrypt a single 16-byte block (ECB mode). |
| SYN_Status | syn_aes128_init (SYN_AES128_Context * ctx, const uint8_t key) Initialize AES-128 context and expand 128-bit key. |
Macros¶
| Type | Name |
|---|---|
| define | SYN_AES128_BLOCK_SIZE 16 |
| define | SYN_AES128_EXPANDED_KEY_SIZE 176 |
| define | SYN_AES128_KEY_SIZE 16 |
Detailed Description¶
Constant-time, zero-heap implementation designed for embedded systems. Supports 128-bit key expansion and CBC cipher block chaining.
Public Functions Documentation¶
function syn_aes128_cbc_decrypt¶
Decrypt data using AES-128-CBC with PKCS#7 padding removal.
SYN_Status syn_aes128_cbc_decrypt (
const SYN_AES128_Context * ctx,
const uint8_t iv,
const uint8_t * in,
size_t in_len,
uint8_t * out,
size_t out_capacity,
size_t * out_len
)
Parameters:
ctxInitialized AES-128 context.iv16-byte initialization vector.inCiphertext buffer (multiple of 16 bytes).in_lenCiphertext length in bytes.outPlaintext output buffer.out_capacityOutput buffer size.out_lenDecrypted plaintext byte count written.
Returns:
SYN_OK on success, or SYN_INVALID_PARAM on invalid padding.
function syn_aes128_cbc_encrypt¶
Encrypt data using AES-128-CBC with PKCS#7 padding.
SYN_Status syn_aes128_cbc_encrypt (
const SYN_AES128_Context * ctx,
const uint8_t iv,
const uint8_t * in,
size_t in_len,
uint8_t * out,
size_t out_capacity,
size_t * out_len
)
Parameters:
ctxInitialized AES-128 context.iv16-byte initialization vector.inPlaintext buffer.in_lenPlaintext length in bytes.outCiphertext buffer (must be large enough for in_len + PKCS7 padding).out_capacityMaximum size of output buffer.out_lenOutput byte count written.
Returns:
SYN_OK on success.
function syn_aes128_decrypt_block¶
Decrypt a single 16-byte block (ECB mode).
Parameters:
ctxInitialized AES-128 context.in16-byte ciphertext block.out16-byte plaintext block.
function syn_aes128_encrypt_block¶
Encrypt a single 16-byte block (ECB mode).
Parameters:
ctxInitialized AES-128 context.in16-byte plaintext block.out16-byte ciphertext block.
function syn_aes128_init¶
Initialize AES-128 context and expand 128-bit key.
Parameters:
ctxAES-128 context instance.key16-byte key buffer.
Returns:
SYN_OK on success.
Macro Definition Documentation¶
define SYN_AES128_BLOCK_SIZE¶
define SYN_AES128_EXPANDED_KEY_SIZE¶
define SYN_AES128_KEY_SIZE¶
The documentation for this class was generated from the following file src/syntropic/util/syn_aes128.h