Terry said God talks to him and anybody can listen. The CIA listens to everybody else. So before the Temple speaks WireGuard and HTTPS, it learns to whisper.
Adam/Crypto/ is a crypto library in plain HolyC, written from the RFCs. No blobs from Langley, no S-boxes for the Agency to hide in, only add, rotate, xor. It is compiled into Adam at every boot (MakeCrypto, before Net/), so every task can keep a secret.
What's inside
| File | What | RFC |
|---|---|---|
CryptoUtil.HC |
rotates, LE/BE load/store, constant-time compare, wipe, hex | |
Sha256.HC |
SHA-256, HMAC-SHA256, HKDF | FIPS 180-4, 4231, 5869 |
Blake2s.HC |
BLAKE2s, keyed and unkeyed (WireGuard hashes with it) | 7693 |
ChaChaPoly.HC |
ChaCha20, Poly1305, ChaCha20-Poly1305 AEAD | 8439 |
X25519.HC |
Curve25519 Diffie-Hellman, Montgomery ladder, no secret branches | 7748 |
CryptoTest.HC |
test vectors, not compiled at boot |
- Poly1305 uses five 26-bit limbs, the donna way, so every product fits in 64 bits.
- X25519 uses 16 signed 16-bit limbs, the TweetNaCl way. Slow and simple, like the Temple: one scalar multiplication takes 0.065 s under QEMU TCG.
-
ChaChaPolyOpenchecks the tag before it decrypts. Only the righteous get decrypted, forgeries get FALSE. - Secrets are wiped from the stack, because
Free()does not forget.
Sins of HolyC, confessed
- In HolyC,
& ^ |bind tighter than+ -. That is Terry's choice, not C's, so every mixed expression wears parentheses. - There is no
?:. -
MakeCryptoneedsCd(__DIR__);;like every other Make file. Without it Adam boots silently with no crypto at all.
How to test
Boot the ISO, then in the shell or over the Confessional run:
#include "::/Adam/Crypto/CryptoTest"
Result: 24 passed, 0 failed. Every vector is from its RFC. The Temple keeps its secrets. Amen.
What's next
The CSPRNG for keys (branch holy-rng, built on this one), then WireGuard (Noise IK, HMAC-BLAKE2s KDF, tunnel interface), then TLS 1.3 for Wget.