This directory contains a minimal example for building mldsa-native for a single
parameter set of ML-DSA as a single compilation unit using the auto-generated
mldsa_native.c file.
Use this approach when:
- You want the simplest possible build integration (one
.cfile) - You're using only C (no native backends)
- You need only one ML-DSA parameter set (44, 65, or 87)
- Source tree mldsa_native/*, including top-level compilation unit mldsa_native.c (gathering all C sources) and the mldsa-native API mldsa_native.h.
- A secure random number generator implementing
randombytes.h - Your application source code
The configuration file mldsa_native_config.h sets:
MLD_CONFIG_PARAMETER_SET: Security level (default 65)MLD_CONFIG_NAMESPACE_PREFIX: Symbol prefix (set tomldsa)MLD_CONFIG_INTERNAL_API_QUALIFIER=static: Makes internal functions static for single-CU builds
The auto-generated mldsa_native.c:
- Includes all mldsa-native C source files
- Clears all internal
#defines at the end, allowing multiple inclusion
- The monolithic
.cfile is auto-generated byscripts/autogen - Internal functions become
static, enabling better compiler optimization
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.