Debian Codegraph @

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

raw
1 [//]: # (SPDX-License-Identifier: CC-BY-4.0)
2
3 # Bring Your Own FIPS-202
4
5 This directory contains a minimal example for using mldsa-native with a custom FIPS-202 (SHA-3/SHAKE)
6 implementation. We use tiny_sha3[^tiny_sha3] as an example.
7
8 ## Use Case
9
10 Use this approach when:
11 - You need only one ML-DSA parameter set (44, 65, or 87)
12 - Your application already has a FIPS-202 software/hardware implementation you want to reuse
13
14 ## Components
15
16 1. Arithmetic part of mldsa-native: [`mldsa/src/`](../../mldsa/src) (excluding `fips202/`)
17 2. A secure random number generator implementing [`randombytes.h`](../../mldsa/src/randombytes.h)
18 3. Custom FIPS-202 implementation with headers compatible with:
19 - [`fips202.h`](../../mldsa/src/fips202/fips202.h)
20 - [`fips202x4.h`](../../mldsa/src/fips202/fips202x4.h)
21 4. Your application source code
22
23 ## Configuration
24
25 The configuration file [mldsa_native_config.h](mldsa_native/mldsa_native_config.h) sets:
26 - `MLD_CONFIG_FIPS202_CUSTOM_HEADER`: Path to your custom `fips202.h`
27 - `MLD_CONFIG_FIPS202X4_CUSTOM_HEADER`: Path to your custom `fips202x4.h`
28
29 Your custom FIPS-202 implementation must impelement the API specified in [FIPS202.md](../../FIPS202.md).
30
31 ## Notes
32
33 - The 4x batched functions (`x4`) can fall back to 4 sequential calls if batching isn't available
34 - Structure definitions may differ from mldsa-native's defaults (e.g., for incremental hashing)
35
36 ## Usage
37
38 ```bash
39 make build # Build the example
40 make run # Run the example
41 ```
42
43 ## Warning
44
45 The `randombytes()` implementation in `test_only_rng/` is for TESTING ONLY.
46 You MUST provide a cryptographically secure RNG for production use.
47
48 <!--- bibliography --->
49 [^tiny_sha3]: Markku-Juhani O. Saarinen: tiny_sha3, [https://github.com/mjosaarinen/tiny_sha3](https://github.com/mjosaarinen/tiny_sha3)