Round-3 LightSABER and SABER

This allocation-free no_std crate implements the main Round-3 CCA KEM from the official submission. It is an experimental SABER implementation, separate from standardized ML-KEM. No IC API, ambient randomness, C or assembly is linked into the product crate.

Module Rank Secret distribution Ciphertext rounding Public key Secret key Ciphertext Shared secret
lightsaber 2 mu=10 3 bits 672 B 1568 B 736 B 32 B
saber 3 mu=8 4 bits 992 B 2304 B 1088 B 32 B

Both use 256-coefficient negacyclic polynomials, q=8192 and p=1024. The encoded field order, bit packing, matrix transposition, rounding, message hashing and CCA transformation follow the pinned public-domain reference. SHAKE128 expands matrices/secrets; SHA3-256 and SHA3-512 retain their specified input lengths. Changing these functions would define another protocol.

The caller chooses a polynomial Backend and supplies a CryptoRng + RngCore to keygen/encapsulate. Deterministic keygen_from_seeds takes three independent 32-byte seeds; encapsulate_from_seed takes fresh 32-byte RNG output which is hashed before use. Public benchmark entropy is not a production RNG. Each complete operation constructs its context inside the call. This crate has no prepared-key cache.

Keys and ciphertexts have typed fixed-width carriers and checked-length imports. Every fixed-width public/ciphertext encoding is representable; importing a secret encoding checks its length and does not certify key generation. Decapsulation always performs decryption, re-encryption and full constant-time ciphertext comparison. Correct-length malformed ciphertexts produce the reference's implicit-rejection secret, with no validity result. A higher-level authenticated protocol decides acceptance. Secret carriers, polynomial scratch and hash output buffers use explicit erasure; the pinned SHA3 erasure feature is enabled. This does not guarantee erasure of all caller copies or compiler/library temporaries.

ScalarSchoolbook is the direct control. SimdSchoolbook uses existing wasm SIMD128 i16x8.mul and wrapping additions on eight consecutive coefficients. SimdKaratsuba recursively reduces products to 16-coefficient SIMD schoolbook leaves. SimdToomCook4 uses seven 64-coefficient products with Karatsuba leaves. Their native fallback retains the same algorithm with scalar base products. The lift modulo 65536 is exact for the power-of-two target ring. Karatsuba needs no divisions. Toom interpolation preserves the official u16 stores and widened u32 products before shifts; it retains the three guard bits above q=2^13. No saturating narrow, relaxed SIMD, AVX or NEON instruction is substituted. None of these names claims an IC performance win or compiled constant-time qualification. See task status and primary research/pins.

Native tests compare official KAT counts 0..3 byte for byte on all four backends, including the NIST AES256-CTR-DRBG request boundaries. A native-only independent C oracle compares 100 distinct raw-entropy records per parameter set: every public key, secret key, ciphertext, valid secret and two malformed-ciphertext rejection secrets. Official C files stay byte-exact, including whitespace, under tests/oracle; only the native build copy selects rank2/3. The owned driver injects exact RNG bytes and never enters the Wasm product. Tests also cover arbitrary polynomial residues, all-ones inputs, negacyclic signs and lengths.

The benchmark leaf provides 24 complete KEM cases and 4 polynomial controls. KEM rows require size 32 and polynomial rows size 512; they reject other requested sizes. They require distinct inputs and perform each admitted operation once in the actual 1..500-record cohort. Size 32 describes each entropy seed: keygen consumes three seeds and encapsulation consumes one. Timed seed entrypoints include expansion and complete key construction; generating public fixture entropy is setup work. Polynomial size 512 describes each of its two fixed-width operands. Fresh key imports/expansion and complete output retention remain inside timing. Setup checks compare complete selected-backend outputs against the independently C/KAT-validated scalar implementation before timing, including actual Wasm SIMD. Only the 128-byte KAT entropy stream is embedded in the Wasm cases; full official key/ciphertext vectors remain in native tests. After timing every retained output is compared with the staged scalar control. The fixtures contain only public synthetic key material. Root registration, lockfile resolution and installed wasm64 gas/page qualification remain separate.