Debian Codegraph @

others/mbedtls/tf-psa-crypto/drivers/pqcp/mldsa-native/examples/monolithic_build/README.md

raw
1 [//]: # (SPDX-License-Identifier: CC-BY-4.0)
2
3 # Monolithic Build (C Backend)
4
5 This directory contains a minimal example for building mldsa-native for a single
6 parameter set of ML-DSA as a single compilation unit using the auto-generated
7 `mldsa_native.c` file.
8
9 ## Use Case
10
11 Use this approach when:
12 - You want the simplest possible build integration (one `.c` file)
13 - You're using only C (no native backends)
14 - You need only one ML-DSA parameter set (44, 65, or 87)
15
16 ## Components
17
18 1. Source tree [mldsa_native/*](mldsa_native), including top-level compilation unit
19 [mldsa_native.c](mldsa_native/mldsa_native.c) (gathering all C sources)
20 and the mldsa-native API [mldsa_native.h](mldsa_native/mldsa_native.h).
21 2. A secure random number generator implementing [`randombytes.h`](../../mldsa/src/randombytes.h)
22 3. Your application source code
23
24 ## Configuration
25
26 The configuration file [mldsa_native_config.h](mldsa_native/mldsa_native_config.h) sets:
27 - `MLD_CONFIG_PARAMETER_SET`: Security level (default 65)
28 - `MLD_CONFIG_NAMESPACE_PREFIX`: Symbol prefix (set to `mldsa`)
29 - `MLD_CONFIG_INTERNAL_API_QUALIFIER=static`: Makes internal functions static for single-CU builds
30
31 The auto-generated `mldsa_native.c`:
32 - Includes all mldsa-native C source files
33 - Clears all internal `#define`s at the end, allowing multiple inclusion
34
35 ## Notes
36
37 - The monolithic `.c` file is auto-generated by `scripts/autogen`
38 - Internal functions become `static`, enabling better compiler optimization
39
40 ## Usage
41
42 ```bash
43 make build # Build the example
44 make run # Run the example
45 ```
46
47 ## Warning
48
49 The `randombytes()` implementation in `test_only_rng/` is for TESTING ONLY.
50 You MUST provide a cryptographically secure RNG for production use.