std1.0.0-beta-7 SafeC docs

Module crypto

Modules

aesSafeC Standard Library — AES Block Cipher AES-128 and AES-256 in ECB, CBC and GCM modes. Pure software; no SIMD. Freestanding-safe.
asn1SafeC Standard Library — a minimal DER (ASN.1) reader for std's crypto.
bignumSafeC Standard Library — fixed-width modular arithmetic (Montgomery form).
bufSafeC Standard Library — std/crypto's slice-to-reference helpers. Internal: included by std/crypto's headers (std-private; not API).
chacha20SafeC Standard Library — ChaCha20, Poly1305 and the ChaCha20-Poly1305 AEAD (RFC 8439).
cryptoSafeC Standard Library — Cryptography Master Header
ctSafeC Standard Library — constant-time helpers for cryptographic code.
digestSafeC Standard Library — hash algorithms chosen at run time.
ecSafeC Standard Library — elliptic curves P-256 and P-384 (FIPS 186-4): ECDH key agreement and ECDSA signatures.
hashSafeC Standard Library — hash function traits.
hkdfSafeC Standard Library — HKDF (RFC 5869) over any hash.
hmacSafeC Standard Library — HMAC (RFC 2104) over any hash.
rngSafeC Standard Library — Cryptographic RNG A ChaCha20 keystream generator, seeded from the OS's random source (BCryptGenRandom on Windows, getentropy on macOS, getrandom on Linux), else rdrand (x86-64) or /dev/urandom, or from a caller-supplied 32-byte seed. Freestanding-safe with RngCtx::init_seed() or rdrand. Usage: struct RngCtx rng; rng.init(); rng.fill(buf, n);
rsaSafeC Standard Library — RSA signatures (RFC 8017).
secure_allocSafeC Standard Library — Secure Allocator Zeroes memory on free to prevent heap inspection / data remanence. Uses a slab allocator so object sizes are fixed — no fragmentation metadata can leak size information. Conforms to Allocator (std/alloc/allocator.h): typed allocation is alloc_t / dealloc_t there, and the zeroing on dealloc applies to them too.
sha1SafeC Standard Library — SHA-1 Hash (FIPS 180-4) Freestanding-safe. No dynamic allocation.
sha256SafeC Standard Library — SHA-256 / SHA-224 Hash Freestanding-safe. No dynamic allocation. Sha256Ctx conforms to hash.h's Hasher and BlockHash (generic hashing, Hmac).
sha512SafeC Standard Library — SHA-512 / SHA-384 Hash (FIPS 180-4) Freestanding-safe. No dynamic allocation. Sha512Ctx conforms to hash.h's Hasher and BlockHash (generic hashing, Hmac).
tlsSafeC Standard Library — TLS 1.3 Record Layer Implements the TLS 1.3 record protocol (RFC 8446 §5). Crypto operations are delegated to std/crypto/aes.h and std/crypto/sha256.h. This module handles record framing, the inner content type and alerts. There is no handshake here: keys come from install_keys(). For complete TLS connections (handshake, certificates, every TLS 1.3 cipher suite, the OS's TLS library when there is one) use std/tls/tls.h.
x25519SafeC Standard Library — X25519 Diffie-Hellman (RFC 7748).
x509SafeC Standard Library — X.509 Certificate Parsing (DER format, read-only) Parses the minimum fields needed for TLS: subject, issuer, validity, public key, SAN. Freestanding-safe; no dynamic allocation.