Skip to content

Commit eca69a8

Browse files
committed
break pct config change
Signed-off-by: Jake Massimo <[email protected]>
1 parent 0d3a40a commit eca69a8

File tree

1 file changed

+65
-2
lines changed

1 file changed

+65
-2
lines changed

test/break_pct_config.h

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,50 @@
77

88
#define MLD_RANDOMIZED_SIGNING
99

10-
#ifndef MLD_CONFIG_NAMESPACE_PREFIX
11-
#define MLD_CONFIG_NAMESPACE_PREFIX mld
10+
/******************************************************************************
11+
* Name: MLD_CONFIG_PARAMETER_SET
12+
*
13+
* Description: Specifies the parameter set for ML-DSA
14+
* - MLD_CONFIG_PARAMETER_SET=44 corresponds to ML-DSA-44
15+
* - MLD_CONFIG_PARAMETER_SET=65 corresponds to ML-DSA-65
16+
* - MLD_CONFIG_PARAMETER_SET=87 corresponds to ML-DSA-87
17+
*
18+
* This can also be set using CFLAGS.
19+
*
20+
*****************************************************************************/
21+
#ifndef MLD_CONFIG_PARAMETER_SET
22+
/* Map legacy MLDSA_MODE to new parameter set for backward compatibility */
23+
#ifndef MLDSA_MODE
24+
#define MLDSA_MODE 2
25+
#endif
26+
27+
#if MLDSA_MODE == 2
28+
#define MLD_CONFIG_PARAMETER_SET 44
29+
#elif MLDSA_MODE == 3
30+
#define MLD_CONFIG_PARAMETER_SET 65
31+
#elif MLDSA_MODE == 5
32+
#define MLD_CONFIG_PARAMETER_SET 87
33+
#else
34+
#define MLD_CONFIG_PARAMETER_SET 44 /* Default to ML-DSA-44 */
35+
#endif
36+
#endif /* !MLD_CONFIG_PARAMETER_SET */
37+
38+
/******************************************************************************
39+
* Name: MLD_CONFIG_NAMESPACE_PREFIX
40+
*
41+
* Description: The prefix to use to namespace global symbols from mldsa/.
42+
*
43+
* In a multi-level build (that is, if either
44+
* - MLD_CONFIG_MULTILEVEL_WITH_SHARED, or
45+
* - MLD_CONFIG_MULTILEVEL_NO_SHARED,
46+
* are set, level-dependent symbols will additionally be prefixed
47+
* with the parameter set (44/65/87).
48+
*
49+
* This can also be set using CFLAGS.
50+
*
51+
*****************************************************************************/
52+
#if !defined(MLD_CONFIG_NAMESPACE_PREFIX)
53+
#define MLD_CONFIG_NAMESPACE_PREFIX MLD_DEFAULT_NAMESPACE_PREFIX
1254
#endif
1355

1456

@@ -186,6 +228,27 @@ static MLD_INLINE int mld_break_pct(void)
186228
*****************************************************************************/
187229
/* #define MLD_CONFIG_NO_ASM_VALUE_BARRIER */
188230

231+
/************************* Config internals ********************************/
232+
233+
/* Default namespace
234+
*
235+
* Don't change this. If you need a different namespace, re-define
236+
* MLD_CONFIG_NAMESPACE_PREFIX above instead, and remove the following.
237+
*
238+
* The default MLDSA namespace is
239+
*
240+
* PQCP_MLDSA_NATIVE_MLDSA<LEVEL>_
241+
*
242+
* e.g., PQCP_MLDSA_NATIVE_MLDSA44_
243+
*/
244+
245+
#if MLD_CONFIG_PARAMETER_SET == 44
246+
#define MLD_DEFAULT_NAMESPACE_PREFIX PQCP_MLDSA_NATIVE_MLDSA44
247+
#elif MLD_CONFIG_PARAMETER_SET == 65
248+
#define MLD_DEFAULT_NAMESPACE_PREFIX PQCP_MLDSA_NATIVE_MLDSA65
249+
#elif MLD_CONFIG_PARAMETER_SET == 87
250+
#define MLD_DEFAULT_NAMESPACE_PREFIX PQCP_MLDSA_NATIVE_MLDSA87
251+
#endif
189252

190253

191254
#endif /* !MLD_CONFIG_H */

0 commit comments

Comments
 (0)