Fresh SIMD128 DHKEM and Base HPKE
Enable x25519-simd128 to use simd128. It composes the
selected X25519 agreement kernel with the existing RFC 9180 Base suite:
DHKEM(X25519, HKDF-SHA256), HKDF-SHA256 and ChaCha20Poly1305. The standalone
ladder and field kernels are unchanged. The module allocates nothing and keeps
no recipient, ephemeral-key or result cache between calls.
encap_with_ikm_batch and decap_batch produce independent KEM shared secrets.
setup_senders_with_ikm_batch and setup_receivers_batch produce independent
non-cloneable HPKE contexts. Each sender derives its own ephemeral key using
RFC DeriveKeyPair from caller-supplied IKM. Each receiver takes raw private
bytes and derives its matching public key within the call. Local public
construction uses the existing constant-time fixed-base operation with a
shared final map inversion; DH uses four independent SIMD ladders and one
global final inversion. Reusing an IKM repeats that sender's ephemeral key.
KEM extraction retains exact transcript bytes. Senders use their derived enc
and the supplied recipient encoding in enc || pkR; receivers use the original
received enc and their derived matching public encoding. RFC 7748 high-bit
and noncanonical-coordinate acceptance does not authorize rewriting the remote
transcript bytes. An all-zero DH rejects that record with
Error::NonContributory; other records still complete.
Workspace::new borrows five caller buffers. Public-key bytes, raw-DH bytes,
validity flags and PublicScratch each have N entries. AgreementScratch has
agreement_scratch_len(N) entries, currently ceil(N/4). Sender calls also
borrow N ephemeral 32-byte scalar slots. Inputs, encapsulations and returned
secret/context slots are separate caller-owned storage. Bounds errors leave
buffers and results untouched; admitted calls report every record's result.
KEM processing erases ephemeral scalar slots and raw DH bytes before returning. Both curve operations clear their secret-derived scratch. Dropping the workspace also erases its raw-DH buffer. Callers retain responsibility for raw IKM/private inputs and returned secrets/contexts. This covers owned storage, not every possible compiler register or expression temporary.
Base info preparation occurs once within each setup call. Every context has its own sequence starting at zero. Seal, open and export use the ordinary HPKE contract, including length preflight, error wiping, authentication-failure sequence behavior and caller nonce ownership for the separate exported-AEAD API. Base mode does not authenticate the sender.
The preferred paths and dated best-pick report record installed qualification, native/RFC gates and the actual staging and preparation boundaries. Complete DHKEM/HPKE costs include public derivation, KEM extraction, setup and required buffer lifetime; standalone DH measurements cover a different operation.