This directory contains a minimal example for using mldsa-native with a custom FIPS-202 (SHA-3/SHAKE) implementation. We use tiny_sha31 as an example.
Use this approach when:
- You need only one ML-DSA parameter set (44, 65, or 87)
- Your application already has a FIPS-202 software/hardware implementation you want to reuse
- Arithmetic part of mldsa-native:
mldsa/src/(excludingfips202/) - A secure random number generator implementing
randombytes.h - Custom FIPS-202 implementation with headers compatible with:
- Your application source code
The configuration file mldsa_native_config.h sets:
MLD_CONFIG_FIPS202_CUSTOM_HEADER: Path to your customfips202.hMLD_CONFIG_FIPS202X4_CUSTOM_HEADER: Path to your customfips202x4.h
Your custom FIPS-202 implementation must impelement the API specified in FIPS202.md.
- The 4x batched functions (
x4) can fall back to 4 sequential calls if batching isn't available - Structure definitions may differ from mldsa-native's defaults (e.g., for incremental hashing)
make build # Build the example
make run # Run the exampleThe randombytes() implementation in test_only_rng/ is for TESTING ONLY.
You MUST provide a cryptographically secure RNG for production use.
Footnotes
-
Markku-Juhani O. Saarinen: tiny_sha3, https://github.com/mjosaarinen/tiny_sha3 ↩