Expand description
Rust FFI bindings over the extracted, deduplicated SUPERCOP Streamlined
NTRU Prime sources in vendor/. Every module wraps one parameter set,
all sharing one compiled copy of vendor/common/ (see
vendor/NOTICE.md for why the split between shared and per-parameter-
set code is drawn where it is). Each enabled parameter set gets its own
module (gated by the matching Cargo feature), exposing keypair(),
encapsulate(pk), and decapsulate(c, sk).
§Randomness
The vendored C code calls a single external randombytes C function for
all key generation and encapsulation randomness. This crate implements
it here using getrandom (the OS CSPRNG), satisfying the one external
symbol every vendored directory expects (see vendor/NOTICE.md).
§Zeroization
The secret key (from keypair()) and the shared secret (from
encapsulate()/decapsulate()) are returned as
Zeroizing<[u8; N]> (from the zeroize crate): a fixed-size,
stack-allocated buffer that’s wiped on drop. The FFI call writes
directly into that buffer – there’s no intermediate Vec the secret
passes through first, so there’s nothing left unzeroized after the
Zeroizing wrapper does its job. decapsulate() also takes sk as
&Zeroizing<[u8; SECRET_KEY_BYTES]> rather than &[u8], so a secret
key that was never wrapped in Zeroizing in the first place can’t be
passed in by accident – the type is part of the contract, not just a
runtime length check. The public key and ciphertext are not secret and
stay plain Vec<u8>/&[u8].
Modules§
Functions§
- randombytes⚠
- Safety