Debian Codegraph @

others/mbedtls/tf-psa-crypto/drivers/pqcp/mldsa-native/test/configs/serial_fips202_config.h

raw symbols SCIP
1 /*
2 * Copyright (c) The mldsa-native project authors
3 * SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
4 */
5
6 /* References
7 * ==========
8 *
9 * - [FIPS140_3_IG]
10 * Implementation Guidance for FIPS 140-3 and the Cryptographic Module
11 * Validation Program
12 * National Institute of Standards and Technology
13 * https://csrc.nist.gov/projects/cryptographic-module-validation-program/fips-140-3-ig-announcements
14 *
15 * - [FIPS204]
16 * FIPS 204 Module-Lattice-Based Digital Signature Standard
17 * National Institute of Standards and Technology
18 * https://csrc.nist.gov/pubs/fips/204/final
19 */
20
21 /*
22 * WARNING: This file is auto-generated from scripts/autogen
23 * in the mldsa-native repository.
24 * Do not modify it directly.
25 */
26
27 /*
28 * Test configuration: Test configuration with serial FIPS202 only
29 *
30 * This configuration differs from the default mldsa/mldsa_native_config.h in
31 * the following places:
32 * - MLD_CONFIG_SERIAL_FIPS202_ONLY
33 */
34
35
36 #ifndef MLD_CONFIG_H
37 #define MLD_CONFIG_H
38
39 /******************************************************************************
40 * Name: MLD_CONFIG_PARAMETER_SET
41 *
42 * Description: Specifies the parameter set for ML-DSA
43 * - MLD_CONFIG_PARAMETER_SET=44 corresponds to ML-DSA-44
44 * - MLD_CONFIG_PARAMETER_SET=65 corresponds to ML-DSA-65
45 * - MLD_CONFIG_PARAMETER_SET=87 corresponds to ML-DSA-87
46 *
47 * If you want to support multiple parameter sets, build the
48 * library multiple times and set MLD_CONFIG_MULTILEVEL_BUILD.
49 * See MLD_CONFIG_MULTILEVEL_BUILD for how to do this while
50 * minimizing code duplication.
51 *
52 * This can also be set using CFLAGS.
53 *
54 *****************************************************************************/
55 #ifndef MLD_CONFIG_PARAMETER_SET
56 #define MLD_CONFIG_PARAMETER_SET \
57 44 /* Change this for different security strengths */
58 #endif
59
60 /******************************************************************************
61 * Name: MLD_CONFIG_FILE
62 *
63 * Description: If defined, this is a header that will be included instead
64 * of the default configuration file mldsa/mldsa_native_config.h.
65 *
66 * When you need to build mldsa-native in multiple configurations,
67 * using varying MLD_CONFIG_FILE can be more convenient
68 * then configuring everything through CFLAGS.
69 *
70 * To use, MLD_CONFIG_FILE _must_ be defined prior
71 * to the inclusion of any mldsa-native headers. For example,
72 * it can be set by passing `-DMLD_CONFIG_FILE="..."`
73 * on the command line.
74 *
75 *****************************************************************************/
76 /* #define MLD_CONFIG_FILE "mldsa_native_config.h" */
77
78 /******************************************************************************
79 * Name: MLD_CONFIG_NAMESPACE_PREFIX
80 *
81 * Description: The prefix to use to namespace global symbols from mldsa/.
82 *
83 * In a multi-level build, level-dependent symbols will
84 * additionally be prefixed with the parameter set (44/65/87).
85 *
86 * This can also be set using CFLAGS.
87 *
88 *****************************************************************************/
89 #if !defined(MLD_CONFIG_NAMESPACE_PREFIX)
90 #define MLD_CONFIG_NAMESPACE_PREFIX MLD_DEFAULT_NAMESPACE_PREFIX
91 #endif
92
93 /******************************************************************************
94 * Name: MLD_CONFIG_MULTILEVEL_BUILD
95 *
96 * Description: Set this if the build is part of a multi-level build supporting
97 * multiple parameter sets.
98 *
99 * If you need only a single parameter set, keep this unset.
100 *
101 * To build mldsa-native with support for all parameter sets,
102 * build it three times -- once per parameter set -- and set the
103 * option MLD_CONFIG_MULTILEVEL_WITH_SHARED for exactly one of
104 * them, and MLD_CONFIG_MULTILEVEL_NO_SHARED for the others.
105 * MLD_CONFIG_MULTILEVEL_BUILD should be set for all of them.
106 *
107 * See examples/multilevel_build for an example.
108 *
109 * This can also be set using CFLAGS.
110 *
111 *****************************************************************************/
112 /* #define MLD_CONFIG_MULTILEVEL_BUILD */
113
114 /******************************************************************************
115 * Name: MLD_CONFIG_EXTERNAL_API_QUALIFIER
116 *
117 * Description: If set, this option provides an additional function
118 * qualifier to be added to declarations of mldsa-native's
119 * public API.
120 *
121 * The primary use case for this option are single-CU builds
122 * where the public API exposed by mldsa-native is wrapped by
123 * another API in the consuming application. In this case,
124 * even mldsa-native's public API can be marked `static`.
125 *
126 *****************************************************************************/
127 /* #define MLD_CONFIG_EXTERNAL_API_QUALIFIER */
128
129 /******************************************************************************
130 * Name: MLD_CONFIG_NO_RANDOMIZED_API
131 *
132 * Description: If this option is set, mldsa-native will be built without the
133 * randomized API functions (crypto_sign_keypair,
134 * crypto_sign, crypto_sign_signature, and
135 * crypto_sign_signature_extmu).
136 * This allows users to build mldsa-native without providing a
137 * randombytes() implementation if they only need the
138 * internal deterministic API
139 * (crypto_sign_keypair_internal, crypto_sign_signature_internal).
140 *
141 * NOTE: This option is incompatible with MLD_CONFIG_KEYGEN_PCT
142 * as the current PCT implementation requires
143 * crypto_sign_signature().
144 *
145 *****************************************************************************/
146 /* #define MLD_CONFIG_NO_RANDOMIZED_API */
147
148 /******************************************************************************
149 * Name: MLD_CONFIG_NO_SUPERCOP
150 *
151 * Description: By default, mldsa_native.h exposes the mldsa-native API in the
152 * SUPERCOP naming convention (crypto_sign_xxx). If you don't need
153 * this, set MLD_CONFIG_NO_SUPERCOP.
154 *
155 * NOTE: You must set this for a multi-level build as the SUPERCOP
156 * naming does not disambiguate between the parameter sets.
157 *
158 *****************************************************************************/
159 /* #define MLD_CONFIG_NO_SUPERCOP */
160
161 /******************************************************************************
162 * Name: MLD_CONFIG_CONSTANTS_ONLY
163 *
164 * Description: If you only need the size constants (MLDSA_PUBLICKEYBYTES, etc.)
165 * but no function declarations, set MLD_CONFIG_CONSTANTS_ONLY.
166 *
167 * This only affects the public header mldsa_native.h, not
168 * the implementation.
169 *
170 *****************************************************************************/
171 /* #define MLD_CONFIG_CONSTANTS_ONLY */
172
173 /******************************************************************************
174 *
175 * Build-only configuration options
176 *
177 * The remaining configurations are build-options only.
178 * They do not affect the API described in mldsa_native.h.
179 *
180 *****************************************************************************/
181
182 #if defined(MLD_BUILD_INTERNAL)
183 /******************************************************************************
184 * Name: MLD_CONFIG_MULTILEVEL_WITH_SHARED
185 *
186 * Description: This is for multi-level builds of mldsa-native only. If you
187 * need only a single parameter set, keep this unset.
188 *
189 * If this is set, all MLD_CONFIG_PARAMETER_SET-independent
190 * code will be included in the build, including code needed only
191 * for other parameter sets.
192 *
193 * Example: TODO: add example
194 *
195 * To build mldsa-native with support for all parameter sets,
196 * build it three times -- once per parameter set -- and set the
197 * option MLD_CONFIG_MULTILEVEL_WITH_SHARED for exactly one of
198 * them, and MLD_CONFIG_MULTILEVEL_NO_SHARED for the others.
199 *
200 * See examples/multilevel_build_mldsa for an example.
201 *
202 * This can also be set using CFLAGS.
203 *
204 *****************************************************************************/
205 /* #define MLD_CONFIG_MULTILEVEL_WITH_SHARED */
206
207 /******************************************************************************
208 * Name: MLD_CONFIG_MULTILEVEL_NO_SHARED
209 *
210 * Description: This is for multi-level builds of mldsa-native only. If you
211 * need only a single parameter set, keep this unset.
212 *
213 * If this is set, no MLD_CONFIG_PARAMETER_SET-independent code
214 * will be included in the build.
215 *
216 * To build mldsa-native with support for all parameter sets,
217 * build it three times -- once per parameter set -- and set the
218 * option MLD_CONFIG_MULTILEVEL_WITH_SHARED for exactly one of
219 * them, and MLD_CONFIG_MULTILEVEL_NO_SHARED for the others.
220 *
221 * See examples/multilevel_build_mldsa for an example.
222 *
223 * This can also be set using CFLAGS.
224 *
225 *****************************************************************************/
226 /* #define MLD_CONFIG_MULTILEVEL_NO_SHARED */
227
228 /******************************************************************************
229 * Name: MLD_CONFIG_MONOBUILD_KEEP_SHARED_HEADERS
230 *
231 * Description: This is only relevant for single compilation unit (SCU)
232 * builds of mldsa-native. In this case, it determines whether
233 * directives defined in parameter-set-independent headers should
234 * be #undef'ined or not at the of the SCU file. This is needed
235 * in multilevel builds.
236 *
237 * See examples/multilevel_build_native for an example.
238 *
239 * This can also be set using CFLAGS.
240 *
241 *****************************************************************************/
242 /* #define MLD_CONFIG_MONOBUILD_KEEP_SHARED_HEADERS */
243
244 /******************************************************************************
245 * Name: MLD_CONFIG_USE_NATIVE_BACKEND_ARITH
246 *
247 * Description: Determines whether an native arithmetic backend should be used.
248 *
249 * The arithmetic backend covers performance critical functions
250 * such as the number-theoretic transform (NTT).
251 *
252 * If this option is unset, the C backend will be used.
253 *
254 * If this option is set, the arithmetic backend to be use is
255 * determined by MLD_CONFIG_ARITH_BACKEND_FILE: If the latter is
256 * unset, the default backend for your the target architecture
257 * will be used. If set, it must be the name of a backend metadata
258 * file.
259 *
260 * This can also be set using CFLAGS.
261 *
262 *****************************************************************************/
263 #if !defined(MLD_CONFIG_USE_NATIVE_BACKEND_ARITH)
264 /* #define MLD_CONFIG_USE_NATIVE_BACKEND_ARITH */
265 #endif
266
267 /******************************************************************************
268 * Name: MLD_CONFIG_ARITH_BACKEND_FILE
269 *
270 * Description: The arithmetic backend to use.
271 *
272 * If MLD_CONFIG_USE_NATIVE_BACKEND_ARITH is unset, this option
273 * is ignored.
274 *
275 * If MLD_CONFIG_USE_NATIVE_BACKEND_ARITH is set, this option must
276 * either be undefined or the filename of an arithmetic backend.
277 * If unset, the default backend will be used.
278 *
279 * This can be set using CFLAGS.
280 *
281 *****************************************************************************/
282 #if defined(MLD_CONFIG_USE_NATIVE_BACKEND_ARITH) && \
283 !defined(MLD_CONFIG_ARITH_BACKEND_FILE)
284 #define MLD_CONFIG_ARITH_BACKEND_FILE "native/meta.h"
285 #endif
286
287 /******************************************************************************
288 * Name: MLD_CONFIG_USE_NATIVE_BACKEND_FIPS202
289 *
290 * Description: Determines whether an native FIPS202 backend should be used.
291 *
292 * The FIPS202 backend covers 1x/2x/4x-fold Keccak-f1600, which is
293 * the performance bottleneck of SHA3 and SHAKE.
294 *
295 * If this option is unset, the C backend will be used.
296 *
297 * If this option is set, the FIPS202 backend to be use is
298 * determined by MLD_CONFIG_FIPS202_BACKEND_FILE: If the latter is
299 * unset, the default backend for your the target architecture
300 * will be used. If set, it must be the name of a backend metadata
301 * file.
302 *
303 * This can also be set using CFLAGS.
304 *
305 *****************************************************************************/
306 #if !defined(MLD_CONFIG_USE_NATIVE_BACKEND_FIPS202)
307 /* #define MLD_CONFIG_USE_NATIVE_BACKEND_FIPS202 */
308 #endif
309
310 /******************************************************************************
311 * Name: MLD_CONFIG_FIPS202_BACKEND_FILE
312 *
313 * Description: The FIPS-202 backend to use.
314 *
315 * If MLD_CONFIG_USE_NATIVE_BACKEND_FIPS202 is set, this option
316 * must either be undefined or the filename of a FIPS202 backend.
317 * If unset, the default backend will be used.
318 *
319 * This can be set using CFLAGS.
320 *
321 *****************************************************************************/
322 #if defined(MLD_CONFIG_USE_NATIVE_BACKEND_FIPS202) && \
323 !defined(MLD_CONFIG_FIPS202_BACKEND_FILE)
324 #define MLD_CONFIG_FIPS202_BACKEND_FILE "fips202/native/auto.h"
325 #endif
326
327 /******************************************************************************
328 * Name: MLD_CONFIG_FIPS202_CUSTOM_HEADER
329 *
330 * Description: Custom header to use for FIPS-202
331 *
332 * This should only be set if you intend to use a custom
333 * FIPS-202 implementation, different from the one shipped
334 * with mldsa-native.
335 *
336 * If set, it must be the name of a file serving as the
337 * replacement for mldsa/src/fips202/fips202.h, and exposing
338 * the same API (see FIPS202.md).
339 *
340 *****************************************************************************/
341 /* #define MLD_CONFIG_FIPS202_CUSTOM_HEADER "SOME_FILE.h" */
342
343 /******************************************************************************
344 * Name: MLD_CONFIG_FIPS202X4_CUSTOM_HEADER
345 *
346 * Description: Custom header to use for FIPS-202-X4
347 *
348 * This should only be set if you intend to use a custom
349 * FIPS-202 implementation, different from the one shipped
350 * with mldsa-native.
351 *
352 * If set, it must be the name of a file serving as the
353 * replacement for mldsa/src/fips202/fips202x4.h, and exposing
354 * the same API (see FIPS202.md).
355 *
356 *****************************************************************************/
357 /* #define MLD_CONFIG_FIPS202X4_CUSTOM_HEADER "SOME_FILE.h" */
358
359 /******************************************************************************
360 * Name: MLD_CONFIG_CUSTOM_ZEROIZE
361 *
362 * Description: In compliance with @[FIPS204, Section 3.6.3], mldsa-native,
363 * zeroizes intermediate stack buffers before returning from
364 * function calls.
365 *
366 * Set this option and define `mld_zeroize` if you want to
367 * use a custom method to zeroize intermediate stack buffers.
368 * The default implementation uses SecureZeroMemory on Windows
369 * and a memset + compiler barrier otherwise. If neither of those
370 * is available on the target platform, compilation will fail,
371 * and you will need to use MLD_CONFIG_CUSTOM_ZEROIZE to provide
372 * a custom implementation of `mld_zeroize()`.
373 *
374 * WARNING:
375 * The explicit stack zeroization conducted by mldsa-native
376 * reduces the likelihood of data leaking on the stack, but
377 * does not eliminate it! The C standard makes no guarantee about
378 * where a compiler allocates structures and whether/where it makes
379 * copies of them. Also, in addition to entire structures, there
380 * may also be potentially exploitable leakage of individual values
381 * on the stack.
382 *
383 * If you need bullet-proof zeroization of the stack, you need to
384 * consider additional measures instead of what this feature
385 * provides. In this case, you can set mld_zeroize to a
386 * no-op.
387 *
388 *****************************************************************************/
389 /* #define MLD_CONFIG_CUSTOM_ZEROIZE
390 #if !defined(__ASSEMBLER__)
391 #include <stdint.h>
392 #include "src/src.h"
393 static MLD_INLINE void mld_zeroize(void *ptr, size_t len)
394 {
395 ... your implementation ...
396 }
397 #endif
398 */
399
400 /******************************************************************************
401 * Name: MLD_CONFIG_CUSTOM_RANDOMBYTES
402 *
403 * Description: mldsa-native does not provide a secure randombytes
404 * implementation. Such an implementation has to provided by the
405 * consumer.
406 *
407 * If this option is not set, mldsa-native expects a function
408 * int randombytes(uint8_t *out, size_t outlen).
409 *
410 * Set this option and define `mld_randombytes` if you want to
411 * use a custom method to sample randombytes with a different name
412 * or signature.
413 *
414 *****************************************************************************/
415 /* #define MLD_CONFIG_CUSTOM_RANDOMBYTES
416 #if !defined(__ASSEMBLER__)
417 #include <stdint.h>
418 #include "src/src.h"
419 static MLD_INLINE int mld_randombytes(uint8_t *ptr, size_t len)
420 {
421 ... your implementation ...
422 return 0;
423 }
424 #endif
425 */
426
427 /******************************************************************************
428 * Name: MLD_CONFIG_CUSTOM_CAPABILITY_FUNC
429 *
430 * Description: mldsa-native backends may rely on specific hardware features.
431 * Those backends will only be included in an mldsa-native build
432 * if support for the respective features is enabled at
433 * compile-time. However, when building for a heteroneous set
434 * of CPUs to run the resulting binary/library on, feature
435 * detection at _runtime_ is needed to decided whether a backend
436 * can be used or not.
437 *
438 * Set this option and define `mld_sys_check_capability` if you
439 * want to use a custom method to dispatch between implementations.
440 *
441 * Return value 1 indicates that a capability is supported.
442 * Return value 0 indicates that a capability is not supported.
443 *
444 * If this option is not set, mldsa-native uses compile-time
445 * feature detection only to decide which backend to use.
446 *
447 * If you compile mldsa-native on a system with different
448 * capabilities than the system that the resulting binary/library
449 * will be run on, you must use this option.
450 *
451 *****************************************************************************/
452 /* #define MLD_CONFIG_CUSTOM_CAPABILITY_FUNC
453 static MLD_INLINE int mld_sys_check_capability(mld_sys_cap cap)
454 {
455 ... your implementation ...
456 }
457 */
458
459 /******************************************************************************
460 * Name: MLD_CONFIG_CUSTOM_ALLOC_FREE [EXPERIMENTAL]
461 *
462 * Description: Set this option and define `MLD_CUSTOM_ALLOC` and
463 * `MLD_CUSTOM_FREE` if you want to use custom allocation for
464 * large local structures or buffers.
465 *
466 * By default, all buffers/structures are allocated on the stack.
467 * If this option is set, most of them will be allocated via
468 * MLD_CUSTOM_ALLOC.
469 *
470 * Parameters to MLD_CUSTOM_ALLOC:
471 * - T* v: Target pointer to declare.
472 * - T: Type of structure to be allocated
473 * - N: Number of elements to be allocated.
474 *
475 * Parameters to MLD_CUSTOM_FREE:
476 * - T* v: Target pointer to free. May be NULL.
477 * - T: Type of structure to be freed.
478 * - N: Number of elements to be freed.
479 *
480 * WARNING: This option is experimental!
481 * Its scope, configuration and function/macro signatures may
482 * change at any time. We expect a stable API for v2.
483 *
484 * NOTE: Even if this option is set, some allocations further down
485 * the call stack will still be made from the stack. Those will
486 * likely be added to the scope of this option in the future.
487 *
488 * NOTE: MLD_CUSTOM_ALLOC need not guarantee a successful
489 * allocation nor include error handling. Upon failure, the
490 * target pointer should simply be set to NULL. The calling
491 * code will handle this case and invoke MLD_CUSTOM_FREE.
492 *
493 *****************************************************************************/
494 /* #define MLD_CONFIG_CUSTOM_ALLOC_FREE
495 #if !defined(__ASSEMBLER__)
496 #include <stdlib.h>
497 #define MLD_CUSTOM_ALLOC(v, T, N) \
498 T* (v) = (T *)aligned_alloc(MLD_DEFAULT_ALIGN, \
499 MLD_ALIGN_UP(sizeof(T) * (N)))
500 #define MLD_CUSTOM_FREE(v, T, N) free(v)
501 #endif
502 */
503
504 /******************************************************************************
505 * Name: MLD_CONFIG_CUSTOM_MEMCPY
506 *
507 * Description: Set this option and define `mld_memcpy` if you want to
508 * use a custom method to copy memory instead of the standard
509 * library memcpy function.
510 *
511 * The custom implementation must have the same signature and
512 * behavior as the standard memcpy function:
513 * void *mld_memcpy(void *dest, const void *src, size_t n)
514 *
515 *****************************************************************************/
516 /* #define MLD_CONFIG_CUSTOM_MEMCPY
517 #if !defined(__ASSEMBLER__)
518 #include <stdint.h>
519 #include "src/src.h"
520 static MLD_INLINE void *mld_memcpy(void *dest, const void *src, size_t n)
521 {
522 ... your implementation ...
523 }
524 #endif
525 */
526
527 /******************************************************************************
528 * Name: MLD_CONFIG_CUSTOM_MEMSET
529 *
530 * Description: Set this option and define `mld_memset` if you want to
531 * use a custom method to set memory instead of the standard
532 * library memset function.
533 *
534 * The custom implementation must have the same signature and
535 * behavior as the standard memset function:
536 * void *mld_memset(void *s, int c, size_t n)
537 *
538 *****************************************************************************/
539 /* #define MLD_CONFIG_CUSTOM_MEMSET
540 #if !defined(__ASSEMBLER__)
541 #include <stdint.h>
542 #include "src/src.h"
543 static MLD_INLINE void *mld_memset(void *s, int c, size_t n)
544 {
545 ... your implementation ...
546 }
547 #endif
548 */
549
550 /******************************************************************************
551 * Name: MLD_CONFIG_INTERNAL_API_QUALIFIER
552 *
553 * Description: If set, this option provides an additional function
554 * qualifier to be added to declarations of internal API.
555 *
556 * The primary use case for this option are single-CU builds,
557 * in which case this option can be set to `static`.
558 *
559 *****************************************************************************/
560 /* #define MLD_CONFIG_INTERNAL_API_QUALIFIER */
561
562 /******************************************************************************
563 * Name: MLD_CONFIG_CT_TESTING_ENABLED
564 *
565 * Description: If set, mldsa-native annotates data as secret / public using
566 * valgrind's annotations VALGRIND_MAKE_MEM_UNDEFINED and
567 * VALGRIND_MAKE_MEM_DEFINED, enabling various checks for secret-
568 * dependent control flow of variable time execution (depending
569 * on the exact version of valgrind installed).
570 *
571 *****************************************************************************/
572 /* #define MLD_CONFIG_CT_TESTING_ENABLED */
573
574 /******************************************************************************
575 * Name: MLD_CONFIG_NO_ASM
576 *
577 * Description: If this option is set, mldsa-native will be built without
578 * use of native code or inline assembly.
579 *
580 * By default, inline assembly is used to implement value barriers.
581 * Without inline assembly, mldsa-native will use a global volatile
582 * 'opt blocker' instead; see ct.h.
583 *
584 * Inline assembly is also used to implement a secure zeroization
585 * function on non-Windows platforms. If this option is set and
586 * the target platform is not Windows, you MUST set
587 * MLD_CONFIG_CUSTOM_ZEROIZE and provide a custom zeroization
588 * function.
589 *
590 * If this option is set, MLD_CONFIG_USE_NATIVE_BACKEND_FIPS202 and
591 * and MLD_CONFIG_USE_NATIVE_BACKEND_ARITH will be ignored, and no
592 * native backends will be used.
593 *
594 *****************************************************************************/
595 /* #define MLD_CONFIG_NO_ASM */
596
597 /******************************************************************************
598 * Name: MLD_CONFIG_NO_ASM_VALUE_BARRIER
599 *
600 * Description: If this option is set, mldsa-native will be built without
601 * use of native code or inline assembly for value barriers.
602 *
603 * By default, inline assembly (if available) is used to implement
604 * value barriers.
605 * Without inline assembly, mldsa-native will use a global volatile
606 * 'opt blocker' instead; see ct.h.
607 *
608 *****************************************************************************/
609 /* #define MLD_CONFIG_NO_ASM_VALUE_BARRIER */
610
611 /******************************************************************************
612 * Name: MLD_CONFIG_KEYGEN_PCT
613 *
614 * Description: Compliance with @[FIPS140_3_IG, p.87] requires a
615 * Pairwise Consistency Test (PCT) to be carried out on a freshly
616 * generated keypair before it can be exported.
617 *
618 * Set this option if such a check should be implemented.
619 * In this case, crypto_sign_keypair_internal and
620 * crypto_sign_keypair will return a non-zero error code if the
621 * PCT failed.
622 *
623 * NOTE: This feature will drastically lower the performance of
624 * key generation.
625 *
626 *****************************************************************************/
627 /* #define MLD_CONFIG_KEYGEN_PCT */
628
629 /******************************************************************************
630 * Name: MLD_CONFIG_KEYGEN_PCT_BREAKAGE_TEST
631 *
632 * Description: If this option is set, the user must provide a runtime
633 * function `static inline int mld_break_pct() { ... }` to
634 * indicate whether the PCT should be made fail.
635 *
636 * This option only has an effect if MLD_CONFIG_KEYGEN_PCT is set.
637 *
638 *****************************************************************************/
639 /* #define MLD_CONFIG_KEYGEN_PCT_BREAKAGE_TEST
640 #if !defined(__ASSEMBLER__)
641 #include "src/src.h"
642 static MLD_INLINE int mld_break_pct(void)
643 {
644 ... return 0/1 depending on whether PCT should be broken ...
645 }
646 #endif
647 */
648
649 /******************************************************************************
650 * Name: MLD_CONFIG_SERIAL_FIPS202_ONLY
651 *
652 * Description: Set this to use a FIPS202 implementation with global state
653 * that supports only one active Keccak computation at a time
654 * (e.g. some hardware accelerators).
655 *
656 * If this option is set, ML-DSA will use FIPS202 operations
657 * serially, ensuring that only one SHAKE context is active
658 * at any given time.
659 *
660 * This allows offloading Keccak computations to a hardware
661 * accelerator that holds only a single Keccak state locally,
662 * rather than requiring support for multiple concurrent
663 * Keccak states.
664 *
665 * NOTE: Depending on the target CPU, this may reduce
666 * performance when using software FIPS202 implementations.
667 * Only enable this when you have to.
668 *
669 *****************************************************************************/
670 #define MLD_CONFIG_SERIAL_FIPS202_ONLY
671
672 /******************************************************************************
673 * Name: MLD_CONFIG_CONTEXT_PARAMETER
674 *
675 * Description: Set this to add a context parameter that is provided to public
676 * API functions and is then available in custom callbacks.
677 *
678 * The type of the context parameter is configured via
679 * MLD_CONFIG_CONTEXT_PARAMETER_TYPE.
680 *
681 *****************************************************************************/
682 /* #define MLD_CONFIG_CONTEXT_PARAMETER */
683
684 /******************************************************************************
685 * Name: MLD_CONFIG_CONTEXT_PARAMETER_TYPE
686 *
687 * Description: Set this to define the type for the context parameter used by
688 * MLD_CONFIG_CONTEXT_PARAMETER.
689 *
690 * This is only relevant if MLD_CONFIG_CONTEXT_PARAMETER is set.
691 *
692 *****************************************************************************/
693 /* #define MLD_CONFIG_CONTEXT_PARAMETER_TYPE void* */
694
695 /******************************************************************************
696 * Name: MLD_CONFIG_REDUCE_RAM [EXPERIMENTAL]
697 *
698 * Description: Set this to reduce RAM usage.
699 * This trades memory for performance.
700 *
701 * For expected memory usage, see the MLD_TOTAL_ALLOC_* constants
702 * defined in mldsa_native.h.
703 *
704 * This option is useful for embedded systems with tight RAM
705 * constraints but relaxed performance requirements.
706 *
707 * WARNING: This option is experimental!
708 * CBMC proofs do not currently cover this configuration option.
709 * Its scope and configuration may change at any time.
710 *
711 *****************************************************************************/
712 /* #define MLD_CONFIG_REDUCE_RAM */
713
714 /************************* Config internals ********************************/
715
716 #endif /* MLD_BUILD_INTERNAL */
717
718 /* Default namespace
719 *
720 * Don't change this. If you need a different namespace, re-define
721 * MLD_CONFIG_NAMESPACE_PREFIX above instead, and remove the following.
722 *
723 * The default MLDSA namespace is
724 *
725 * PQCP_MLDSA_NATIVE_MLDSA<LEVEL>_
726 *
727 * e.g., PQCP_MLDSA_NATIVE_MLDSA44_
728 */
729
730 #if MLD_CONFIG_PARAMETER_SET == 44
731 #define MLD_DEFAULT_NAMESPACE_PREFIX PQCP_MLDSA_NATIVE_MLDSA44
732 #elif MLD_CONFIG_PARAMETER_SET == 65
733 #define MLD_DEFAULT_NAMESPACE_PREFIX PQCP_MLDSA_NATIVE_MLDSA65
734 #elif MLD_CONFIG_PARAMETER_SET == 87
735 #define MLD_DEFAULT_NAMESPACE_PREFIX PQCP_MLDSA_NATIVE_MLDSA87
736 #endif
737
738 #endif /* !MLD_CONFIG_H */