Futuristic Gadgets Laboratory, Lead Researcher: Serexp
A C++20 cryptography library designed for the Pandragon framework.
- Compile-time string obfuscation, LCG-based XOR cipher with per-translation-unit seeds. Ciphertext lives in
.rodata; plaintext is never materialized at rest. Zero runtime overhead after first access with a decrypt-once caching layer. - XChaCha20 stream cipher, 20-round ChaCha20 with 24-byte nonce (DJB, IETF, and XChaCha20 variants).
- XChaCha20-Poly1305 AEAD, Authenticated encryption with associated data. Constant-time MAC verification.
- Poly1305 MAC, Incremental one-time message authentication.
- AES-128 (AES-NI accelerated), ECB and CTR modes using hardware
aesenc/aesdecinstructions. - Secure memory wiping,
crypto_wipewith volatile pointers and compiler barriers. - Standalone CLI, Build with
-DBASTIA_STANDALONEfor a command-line encrypt/decrypt tool.
Bastia delegates all platform-specific operations to a HAL, no OS-specific code or inline assembly lives in the library core.
Call bastia_init() once before using any Bastia function:
#include "bastia_hal.h"
int main(void) {
bastia_init(malloc, free, calloc,
my_csprng_seeder,
my_aes_ni_check,
"expand 32-byte k");
// Use Bastia crypto functions...
}| Parameter | Purpose | Required |
|---|---|---|
malloc_func / free_func / calloc_func |
Dynamic memory allocation | Yes |
seed_csprng_func |
Feed entropy into your CSPRNG | Yes (if nonces are needed) |
aes_ni_available_func |
Query AES-NI hardware support | Pass NULL to assume no AES-NI |
chacha20_constant |
16-byte ChaCha20 constant string | Yes (typically "expand 32-byte k") |
Returns 0 on success, -1 if already initialized. Check with bastia_is_initialized().
- C++20 compiler (Clang or GCC)
- CPU with AES-NI support (
-maes) - Windows x86-64 target (cross-compiled or native)
BUILD_TIME_RANDOM_SEEDdefined per translation unit
Constant-time operations are not implemented for this library.
contact Serexp