1717 * https://csrc.nist.gov/pubs/fips/204/final
1818 */
1919
20+ /*
21+ * WARNING: This file is auto-generated from scripts/autogen
22+ * in the mldsa-native repository.
23+ * Do not modify it directly.
24+ */
25+
26+ /*
27+ * Test configuration: Test configuration for PCT breakage testing
28+ *
29+ * This configuration differs from the default mldsa/src/config.h in the
30+ * following places:
31+ * - MLD_CONFIG_KEYGEN_PCT
32+ * - MLD_CONFIG_KEYGEN_PCT_BREAKAGE_TEST
33+ */
34+
35+
2036#ifndef MLD_CONFIG_H
2137#define MLD_CONFIG_H
2238
103119 * Name: MLD_CONFIG_FILE
104120 *
105121 * Description: If defined, this is a header that will be included instead
106- * of this default configuration file mldsa/config.h.
122+ * of the default configuration file mldsa/config.h.
107123 *
108124 * When you need to build mldsa-native in multiple configurations,
109125 * using varying MLD_CONFIG_FILE can be more convenient
153169 !defined(MLD_CONFIG_FIPS202_BACKEND_FILE )
154170#define MLD_CONFIG_FIPS202_BACKEND_FILE "fips202/native/auto.h"
155171#endif
156-
157172/******************************************************************************
158173 * Name: MLD_CONFIG_FIPS202_CUSTOM_HEADER
159174 *
189204/******************************************************************************
190205 * Name: MLD_CONFIG_CUSTOM_ZEROIZE
191206 *
192- * Description: In compliance with @[FIPS204, Section 3.6.3], mldsa-native
207+ * Description: In compliance with @[FIPS204, Section 3.6.3], mldsa-native,
193208 * zeroizes intermediate stack buffers before returning from
194- *. function calls.
209+ * function calls.
195210 *
196211 * Set this option and define `mld_zeroize_native` if you want to
197212 * use a custom method to zeroize intermediate stack buffers.
227242 #endif
228243*/
229244
245+ /******************************************************************************
246+ * Name: MLD_CONFIG_CUSTOM_MEMCPY
247+ *
248+ * Description: Set this option and define `mld_memcpy` if you want to
249+ * use a custom method to copy memory instead of the standard
250+ * library memcpy function.
251+ *
252+ * The custom implementation must have the same signature and
253+ * behavior as the standard memcpy function:
254+ * void *mld_memcpy(void *dest, const void *src, size_t n)
255+ *
256+ *****************************************************************************/
257+ /* #define MLD_CONFIG_CUSTOM_MEMCPY
258+ #if !defined(__ASSEMBLER__)
259+ #include <stdint.h>
260+ #include "sys.h"
261+ static MLD_INLINE void *mld_memcpy(void *dest, const void *src, size_t n)
262+ {
263+ ... your implementation ...
264+ }
265+ #endif
266+ */
267+
268+ /******************************************************************************
269+ * Name: MLD_CONFIG_CUSTOM_MEMSET
270+ *
271+ * Description: Set this option and define `mld_memset` if you want to
272+ * use a custom method to set memory instead of the standard
273+ * library memset function.
274+ *
275+ * The custom implementation must have the same signature and
276+ * behavior as the standard memset function:
277+ * void *mld_memset(void *s, int c, size_t n)
278+ *
279+ *****************************************************************************/
280+ /* #define MLD_CONFIG_CUSTOM_MEMSET
281+ #if !defined(__ASSEMBLER__)
282+ #include <stdint.h>
283+ #include "sys.h"
284+ static MLD_INLINE void *mld_memset(void *s, int c, size_t n)
285+ {
286+ ... your implementation ...
287+ }
288+ #endif
289+ */
290+
291+ /******************************************************************************
292+ * Name: MLD_CONFIG_CUSTOM_RANDOMBYTES
293+ *
294+ * Description: mldsa-native does not provide a secure randombytes
295+ * implementation. Such an implementation has to provided by the
296+ * consumer.
297+ *
298+ * If this option is not set, mldsa-native expects a function
299+ * void randombytes(uint8_t *out, size_t outlen).
300+ *
301+ * Set this option and define `mld_randombytes` if you want to
302+ * use a custom method to sample randombytes with a different name
303+ * or signature.
304+ *
305+ *****************************************************************************/
306+ /* #define MLD_CONFIG_CUSTOM_RANDOMBYTES
307+ #if !defined(__ASSEMBLER__)
308+ #include <stdint.h>
309+ #include "sys.h"
310+ static MLD_INLINE void mld_randombytes(uint8_t *ptr, size_t len)
311+ {
312+ ... your implementation ...
313+ }
314+ #endif
315+ */
316+
230317/******************************************************************************
231318 * Name: MLD_CONFIG_KEYGEN_PCT
232319 *
@@ -266,8 +353,47 @@ static MLD_INLINE int mld_break_pct(void)
266353 const char * val = getenv ("MLD_BREAK_PCT" );
267354 return val != NULL && strcmp (val , "1" ) == 0 ;
268355}
269- #endif
356+ #endif /* !__ASSEMBLER__ */
357+
270358
359+ /******************************************************************************
360+ * Name: MLD_CONFIG_INTERNAL_API_QUALIFIER
361+ *
362+ * Description: If set, this option provides an additional function
363+ * qualifier to be added to declarations of internal API.
364+ *
365+ * The primary use case for this option are single-CU builds,
366+ * in which case this option can be set to `static`.
367+ *
368+ *****************************************************************************/
369+ /* #define MLD_CONFIG_INTERNAL_API_QUALIFIER */
370+
371+ /******************************************************************************
372+ * Name: MLD_CONFIG_EXTERNAL_API_QUALIFIER
373+ *
374+ * Description: If set, this option provides an additional function
375+ * qualifier to be added to declarations of mldsa-native's
376+ * public API.
377+ *
378+ * The primary use case for this option are single-CU builds
379+ * where the public API exposed by mldsa-native is wrapped by
380+ * another API in the consuming application. In this case,
381+ * even mldsa-native's public API can be marked `static`.
382+ *
383+ *****************************************************************************/
384+ /* #define MLD_CONFIG_EXTERNAL_API_QUALIFIER */
385+
386+ /******************************************************************************
387+ * Name: MLD_CONFIG_CT_TESTING_ENABLED
388+ *
389+ * Description: If set, mldsa-native annotates data as secret / public using
390+ * valgrind's annotations VALGRIND_MAKE_MEM_UNDEFINED and
391+ * VALGRIND_MAKE_MEM_DEFINED, enabling various checks for secret-
392+ * dependent control flow of variable time execution (depending
393+ * on the exact version of valgrind installed).
394+ *
395+ *****************************************************************************/
396+ /* #define MLD_CONFIG_CT_TESTING_ENABLED */
271397
272398/******************************************************************************
273399 * Name: MLD_CONFIG_NO_ASM
@@ -306,6 +432,8 @@ static MLD_INLINE int mld_break_pct(void)
306432 *****************************************************************************/
307433/* #define MLD_CONFIG_NO_ASM_VALUE_BARRIER */
308434
435+
436+
309437/************************* Config internals ********************************/
310438
311439/* Default namespace
@@ -317,7 +445,7 @@ static MLD_INLINE int mld_break_pct(void)
317445 *
318446 * PQCP_MLDSA_NATIVE_MLDSA<LEVEL>_
319447 *
320- * e.g., PQCP_MLDSA_NATIVE_MLDSA65_
448+ * e.g., PQCP_MLDSA_NATIVE_MLDSA44_
321449 */
322450
323451#if MLD_CONFIG_PARAMETER_SET == 44
0 commit comments