Expand description
Rust implementations of Ukrainian DSTU cryptographic standards (Kalyna, Kupyna, Strumok).
Pre-release and provisional — not independently audited. Kalyna and Kupyna are
dual-oracle-verified against official test vectors. The Kalyna-alone mode of operation
(hazmat::kalyna_ccm, hazmat::kalyna_gcm, and everything built on them) rests on an adopted
assumption, not a confirmation against the primary DSTU 7624:2014 text (docs/DECISIONS.md D-05).
Strumok is UAPKI-attributed only, not confirmed against the primary DSTU 8845:2019 text
(docs/DECISIONS.md D-15). This crate makes no claim of side-channel (SPA/DPA) resistance. See
docs/SECURITY.md and docs/DECISIONS.md in the project repository for the full threat model, citations,
and per-construction status.
Modules§
- crypto_
auth crypto_auth/crypto_onetimeauthequivalent (docs/dstu-crypto-project.md“Mapping onto the libsodium API”,docs/TASKS.mdT-105, roadmap Step 3 item 2 -docs/DECISIONS.mdD-66) - a thin libsodium-ergonomics wrapper overcrate::hazmat::kupyna_kmac::Kupyna256Kmac.- crypto_
box crypto_boxequivalent (docs/dstu-crypto-project.md“Mapping onto the libsodium API”,docs/TASKS.mdT-178) - public-key encryption overhazmat::dstu9041(l(p)=256, E256/1 only, T-177).- crypto_
box512 crypto_boxequivalent atl(p)=512(E512/1,docs/TASKS.mdT-193) - direct sibling ofcrate::crypto_box(l(p)=256, T-178) at this curve size’s own widths. Matches this project’s established per-curve-size sibling-module precedent (hazmat::dstu9041::curve512etc., D-181), not a generic-over-width merge.- crypto_
generichash crypto_generichashequivalent (docs/dstu-crypto-project.md“Mapping onto the libsodium API”,docs/TASKS.mdT-105, roadmap Step 3 item 2 -docs/DECISIONS.mdD-66) - a bare re-export ofcrate::hazmat::kupyna’s one-shot and streaming API under this crate’s top-levelcrypto_*namespace, for naming parity withcrypto_sign/crypto_secretbox/crypto_pwhashrather than a new wrapper.- crypto_
kdf crypto_kdfequivalent (docs/dstu-crypto-project.md“Mapping onto the libsodium API”,docs/TASKS.mdT-105, roadmap Step 3 item 2 -docs/DECISIONS.mdD-66) - a thin libsodium-ergonomics wrapper overKupyna256Kdf, matchingcrate::crypto_auth’s reasoning exactly: only the 256-bit variant is exposed here (D-47’s “delete the knob”, same ascrypto_auth’s choice amongKupyna{256,384,512}Kmac; the other two sizes stay available athazmat::kupyna_kdf), and the master key is an opaque,Zeroize-on-dropMasterKeytype rather than a raw[u8; 32].- crypto_
pwhash crypto_pwhashequivalent (docs/dstu-crypto-project.md“Mapping onto the libsodium API”,docs/TASKS.mdT-71,docs/DECISIONS.mdD-03/D-49/D-50) - plain Argon2id, the one deliberately non-DSTU component (no Ukrainian standard covers password hashing). Wraps theargon2crate (RustCrypto/password-hashes, vetted in D-49) with libsodium’s owncrypto_pwhash_str/crypto_pwhash_str_verifyshape: a self-describing PHC string that embeds algorithm, version, salt, and parameters, soverify_passwordneeds nothing but the password and that string back.- crypto_
secretbox crypto_secretboxequivalent (docs/dstu-crypto-project.md“Mapping onto the libsodium API”,docs/TASKS.mdT-37,docs/DECISIONS.mdD-51) - a single fixedhazmat::kalyna_gcm::Kalyna256_256Gcmconstruction (D-47’s tie-breaker rule: no algorithm knob when one safe default exists) with an internally-generated nonce (never caller-supplied, extending the patternuacrypt kalyna-ccm encrypt’s CLI layer already used, D-40/T-82) and a combinednonce || ciphertext || tagwire format, matching libsodium’s owncrypto_secretbox_easyergonomics.- crypto_
secretstream crypto_secretstreamequivalent (docs/dstu-crypto-project.md“Mapping onto the libsodium API”,docs/TASKS.mdT-40/T-70, roadmap Step 5 item 1 -docs/DECISIONS.mdD-68) - a chunked/streaming AEAD construction so a large message never needs to fit in memory all at once, unlikecrate::crypto_secretbox(whose underlying AEAD tag needs the whole plaintext/ciphertext up front).- crypto_
sign crypto_signequivalent (docs/dstu-crypto-project.md“Mapping onto the libsodium API”,docs/TASKS.mdT-48) - a libsodium-ergonomics wrapper overhazmat::dstu4145::signature. The first module in the high-level layer D-09 planned but never built (docs/release-readiness.mdstep 4) - this session’s shape for it:SigningKey/VerifyingKey/Signature,ed25519-dalek-style naming (docs/DECISIONS.mdD-04’s addendum cites that crate’s convention).- crypto_
sign257 crypto_signequivalent for DSTU 4145’sm=257curve - additive sibling ofcrate::crypto_sign, mirroring its shape exactly (SigningKey/VerifyingKey/Signature, deterministic nonce derivation,sign/sign_digest/verify/verify_digest), built onhazmat::dstu4145::{gf2m257, curve257, scalar257, signature257}instead of them=163modules.docs/TASKS.mdT-199,docs/DECISIONS.mdD-185/D-186.- crypto_
stream crypto_streamequivalent (docs/dstu-crypto-project.md“Mapping onto the libsodium API”,docs/TASKS.mdroadmap Step 3 item 3,docs/DECISIONS.mdD-67) - a libsodium-ergonomics wrapper overhazmat::strumok::Strumok256.- hazmat
- Low-level (“hazardous material”) primitives: direct DSTU algorithm implementations with no
forced RNG dependency and no safety rails — callers manage keys/nonces/IVs explicitly where
an algorithm needs them. Available in
no_stdbuilds. - randombytes
randombytesequivalent (docs/dstu-crypto-project.md“Mapping onto the libsodium API”,docs/TASKS.mdT-72,docs/DECISIONS.mdD-48) - not a DSTU primitive. Wraps the OS CSPRNG (getrandom), same as libsodium’s ownrandombytes_bufdoes.- selftest
- Runtime known-answer self-test (
docs/TASKS.mdT-161,docs/DECISIONS.mdD-117): re-runs one official vector per primitive against the live compiled implementation, so a caller can verify their exact installed build produces correct output on their exact platform before trusting it with real data - the same “don’t just trust it compiled” instinct this project already applies to itself via dual-oracle verification (docs/SECURITY.md, “Crypto engineering hard constraints”). This is a small, fast, embedded-in-the-binary spot check - one vector per primitive, not the full corpuscargo testalready runs againsttests/vectors/; it is not a substitute for that suite.