Skip to content

Commit 1ac9172

Browse files
committed
Examples: Set MLK_CONFIG_NO_SUPERCOP for multilevel builds
Multilevel builds require MLK_CONFIG_NO_SUPERCOP since the SUPERCOP naming convention (crypto_kem_xxx) does not disambiguate between parameter sets. Add MLK_CONFIG_NO_SUPERCOP to all multilevel build configs and propagate it to the API layer in the legacy config path. This also fixes problem with mlkem_native.h: On multiple inclusions of mlkem_native.h without NO_SUPERCOP set, mlkem_native.h would not undef the API_CONFIG macros in the end of the file causing the second inclusion of mlkem_native.h to set the LEGACY_CONFIG option. - Ported from pq-code-package/mldsa-native#869 Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
1 parent 8ed2e13 commit 1ac9172

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

examples/monolithic_build_multilevel/mlkem_native/mlkem_native_config.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
*
3030
* This configuration differs from the default mlkem/mlkem_native_config.h in
3131
* the following places:
32+
* - MLK_CONFIG_NO_SUPERCOP
3233
* - MLK_CONFIG_MULTILEVEL_BUILD
3334
* - MLK_CONFIG_NAMESPACE_PREFIX
3435
* - MLK_CONFIG_INTERNAL_API_QUALIFIER
@@ -156,7 +157,7 @@
156157
* naming does not disambiguate between the parameter sets.
157158
*
158159
*****************************************************************************/
159-
/* #define MLK_CONFIG_NO_SUPERCOP */
160+
#define MLK_CONFIG_NO_SUPERCOP
160161

161162
/******************************************************************************
162163
* Name: MLK_CONFIG_CONSTANTS_ONLY

examples/monolithic_build_multilevel_native/mlkem_native/mlkem_native_config.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
*
3030
* This configuration differs from the default mlkem/mlkem_native_config.h in
3131
* the following places:
32+
* - MLK_CONFIG_NO_SUPERCOP
3233
* - MLK_CONFIG_MULTILEVEL_BUILD
3334
* - MLK_CONFIG_NAMESPACE_PREFIX
3435
* - MLK_CONFIG_USE_NATIVE_BACKEND_ARITH
@@ -160,7 +161,7 @@
160161
* naming does not disambiguate between the parameter sets.
161162
*
162163
*****************************************************************************/
163-
/* #define MLK_CONFIG_NO_SUPERCOP */
164+
#define MLK_CONFIG_NO_SUPERCOP
164165

165166
/******************************************************************************
166167
* Name: MLK_CONFIG_CONSTANTS_ONLY

examples/multilevel_build/mlkem_native/mlkem_native_config.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
*
3030
* This configuration differs from the default mlkem/mlkem_native_config.h in
3131
* the following places:
32+
* - MLK_CONFIG_NO_SUPERCOP
3233
* - MLK_CONFIG_MULTILEVEL_BUILD
3334
* - MLK_CONFIG_NAMESPACE_PREFIX
3435
*/
@@ -155,7 +156,7 @@
155156
* naming does not disambiguate between the parameter sets.
156157
*
157158
*****************************************************************************/
158-
/* #define MLK_CONFIG_NO_SUPERCOP */
159+
#define MLK_CONFIG_NO_SUPERCOP
159160

160161
/******************************************************************************
161162
* Name: MLK_CONFIG_CONSTANTS_ONLY

examples/multilevel_build_native/mlkem_native/mlkem_native_config.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
*
3030
* This configuration differs from the default mlkem/mlkem_native_config.h in
3131
* the following places:
32+
* - MLK_CONFIG_NO_SUPERCOP
3233
* - MLK_CONFIG_MULTILEVEL_BUILD
3334
* - MLK_CONFIG_NAMESPACE_PREFIX
3435
* - MLK_CONFIG_USE_NATIVE_BACKEND_ARITH
@@ -157,7 +158,7 @@
157158
* naming does not disambiguate between the parameter sets.
158159
*
159160
*****************************************************************************/
160-
/* #define MLK_CONFIG_NO_SUPERCOP */
161+
#define MLK_CONFIG_NO_SUPERCOP
161162

162163
/******************************************************************************
163164
* Name: MLK_CONFIG_CONSTANTS_ONLY

test/configs/configs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ configs:
301301
- path: examples/monolithic_build_multilevel/mlkem_native/mlkem_native_config.h
302302
description: "Multilevel monolithic build config"
303303
defines:
304+
MLK_CONFIG_NO_SUPERCOP: true
304305
MLK_CONFIG_MULTILEVEL_BUILD: true
305306
MLK_CONFIG_NAMESPACE_PREFIX: mlkem
306307
MLK_CONFIG_INTERNAL_API_QUALIFIER: static
@@ -310,6 +311,7 @@ configs:
310311
- path: examples/multilevel_build/mlkem_native/mlkem_native_config.h
311312
description: "Multilevel build config"
312313
defines:
314+
MLK_CONFIG_NO_SUPERCOP: true
313315
MLK_CONFIG_MULTILEVEL_BUILD: true
314316
MLK_CONFIG_NAMESPACE_PREFIX: mlkem
315317
MLK_CONFIG_FILE:
@@ -318,6 +320,7 @@ configs:
318320
- path: examples/multilevel_build_native/mlkem_native/mlkem_native_config.h
319321
description: "Multilevel build config"
320322
defines:
323+
MLK_CONFIG_NO_SUPERCOP: true
321324
MLK_CONFIG_MULTILEVEL_BUILD: true
322325
MLK_CONFIG_NAMESPACE_PREFIX: mlkem
323326
MLK_CONFIG_USE_NATIVE_BACKEND_ARITH: true
@@ -328,6 +331,7 @@ configs:
328331
- path: examples/monolithic_build_multilevel_native/mlkem_native/mlkem_native_config.h
329332
description: "Multilevel monolithic build config with native backends"
330333
defines:
334+
MLK_CONFIG_NO_SUPERCOP: true
331335
MLK_CONFIG_MULTILEVEL_BUILD: true
332336
MLK_CONFIG_NAMESPACE_PREFIX: mlkem
333337
MLK_CONFIG_USE_NATIVE_BACKEND_ARITH: true

0 commit comments

Comments
 (0)