Skip to content

Commit fe1c783

Browse files
mkannwischerhanno-becker
authored andcommitted
Restructure examples
- Example Directory Restructuring: All examples refactored with mldsa/ subdirectories renamed to mldsa_native/ and CFLAGS configuration replaced by custom configs. Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
1 parent 41a3ad0 commit fe1c783

File tree

153 files changed

+2242
-1672
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+2242
-1672
lines changed

BIBLIOGRAPHY.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ source code and documentation.
2323
- National Institute of Standards and Technology
2424
* URL: https://csrc.nist.gov/projects/cryptographic-module-validation-program/fips-140-3-ig-announcements
2525
* Referenced from:
26-
- [examples/custom_backend/mldsa_native/custom_config.h](examples/custom_backend/mldsa_native/custom_config.h)
27-
- [examples/monolithic_build/mldsa/config_44.h](examples/monolithic_build/mldsa/config_44.h)
28-
- [examples/monolithic_build/mldsa/config_65.h](examples/monolithic_build/mldsa/config_65.h)
29-
- [examples/monolithic_build/mldsa/config_87.h](examples/monolithic_build/mldsa/config_87.h)
30-
- [examples/monolithic_build_multilevel/mldsa/multilevel_config.h](examples/monolithic_build_multilevel/mldsa/multilevel_config.h)
31-
- [examples/monolithic_build_multilevel_native/mldsa/multilevel_config.h](examples/monolithic_build_multilevel_native/mldsa/multilevel_config.h)
32-
- [examples/monolithic_build_native/mldsa/config_44.h](examples/monolithic_build_native/mldsa/config_44.h)
33-
- [examples/monolithic_build_native/mldsa/config_65.h](examples/monolithic_build_native/mldsa/config_65.h)
34-
- [examples/monolithic_build_native/mldsa/config_87.h](examples/monolithic_build_native/mldsa/config_87.h)
26+
- [examples/basic_deterministic/mldsa_native/mldsa_native_config.h](examples/basic_deterministic/mldsa_native/mldsa_native_config.h)
27+
- [examples/bring_your_own_fips202/mldsa_native/mldsa_native_config.h](examples/bring_your_own_fips202/mldsa_native/mldsa_native_config.h)
28+
- [examples/bring_your_own_fips202_static/mldsa_native/mldsa_native_config.h](examples/bring_your_own_fips202_static/mldsa_native/mldsa_native_config.h)
29+
- [examples/custom_backend/mldsa_native/mldsa_native_config.h](examples/custom_backend/mldsa_native/mldsa_native_config.h)
30+
- [examples/monolithic_build/mldsa_native/mldsa_native_config.h](examples/monolithic_build/mldsa_native/mldsa_native_config.h)
31+
- [examples/monolithic_build_multilevel/mldsa_native/mldsa_native_config.h](examples/monolithic_build_multilevel/mldsa_native/mldsa_native_config.h)
32+
- [examples/monolithic_build_native/mldsa_native/mldsa_native_config.h](examples/monolithic_build_native/mldsa_native/mldsa_native_config.h)
33+
- [examples/multilevel_build/mldsa_native/mldsa_native_config.h](examples/multilevel_build/mldsa_native/mldsa_native_config.h)
34+
- [examples/multilevel_build_native/mldsa_native/mldsa_native_config.h](examples/multilevel_build_native/mldsa_native/mldsa_native_config.h)
3535
- [integration/liboqs/config_aarch64.h](integration/liboqs/config_aarch64.h)
3636
- [integration/liboqs/config_c.h](integration/liboqs/config_c.h)
3737
- [integration/liboqs/config_x86_64.h](integration/liboqs/config_x86_64.h)
@@ -68,15 +68,15 @@ source code and documentation.
6868
* URL: https://csrc.nist.gov/pubs/fips/204/final
6969
* Referenced from:
7070
- [README.md](README.md)
71-
- [examples/custom_backend/mldsa_native/custom_config.h](examples/custom_backend/mldsa_native/custom_config.h)
72-
- [examples/monolithic_build/mldsa/config_44.h](examples/monolithic_build/mldsa/config_44.h)
73-
- [examples/monolithic_build/mldsa/config_65.h](examples/monolithic_build/mldsa/config_65.h)
74-
- [examples/monolithic_build/mldsa/config_87.h](examples/monolithic_build/mldsa/config_87.h)
75-
- [examples/monolithic_build_multilevel/mldsa/multilevel_config.h](examples/monolithic_build_multilevel/mldsa/multilevel_config.h)
76-
- [examples/monolithic_build_multilevel_native/mldsa/multilevel_config.h](examples/monolithic_build_multilevel_native/mldsa/multilevel_config.h)
77-
- [examples/monolithic_build_native/mldsa/config_44.h](examples/monolithic_build_native/mldsa/config_44.h)
78-
- [examples/monolithic_build_native/mldsa/config_65.h](examples/monolithic_build_native/mldsa/config_65.h)
79-
- [examples/monolithic_build_native/mldsa/config_87.h](examples/monolithic_build_native/mldsa/config_87.h)
71+
- [examples/basic_deterministic/mldsa_native/mldsa_native_config.h](examples/basic_deterministic/mldsa_native/mldsa_native_config.h)
72+
- [examples/bring_your_own_fips202/mldsa_native/mldsa_native_config.h](examples/bring_your_own_fips202/mldsa_native/mldsa_native_config.h)
73+
- [examples/bring_your_own_fips202_static/mldsa_native/mldsa_native_config.h](examples/bring_your_own_fips202_static/mldsa_native/mldsa_native_config.h)
74+
- [examples/custom_backend/mldsa_native/mldsa_native_config.h](examples/custom_backend/mldsa_native/mldsa_native_config.h)
75+
- [examples/monolithic_build/mldsa_native/mldsa_native_config.h](examples/monolithic_build/mldsa_native/mldsa_native_config.h)
76+
- [examples/monolithic_build_multilevel/mldsa_native/mldsa_native_config.h](examples/monolithic_build_multilevel/mldsa_native/mldsa_native_config.h)
77+
- [examples/monolithic_build_native/mldsa_native/mldsa_native_config.h](examples/monolithic_build_native/mldsa_native/mldsa_native_config.h)
78+
- [examples/multilevel_build/mldsa_native/mldsa_native_config.h](examples/multilevel_build/mldsa_native/mldsa_native_config.h)
79+
- [examples/multilevel_build_native/mldsa_native/mldsa_native_config.h](examples/multilevel_build_native/mldsa_native/mldsa_native_config.h)
8080
- [mldsa/mldsa_native.h](mldsa/mldsa_native.h)
8181
- [mldsa/mldsa_native_config.h](mldsa/mldsa_native_config.h)
8282
- [mldsa/src/ct.h](mldsa/src/ct.h)

examples/basic/Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ endif
5555
# In this example, we compile the individual mldsa-native source files directly.
5656
# Alternatively, you can compile the 'monobuild' source file mldsa_native.c.
5757
# See examples/monolithic_build for that.
58-
MLD_SOURCE=$(wildcard \
59-
mldsa_native/mldsa/src/*.c \
60-
mldsa_native/mldsa/src/**/*.c \
61-
mldsa_native/mldsa/src/**/**/*.c \
62-
mldsa_native/mldsa/src/**/**/**/*.c)
58+
MLD_SOURCE=$(wildcard \
59+
mldsa_native/src/*.c \
60+
mldsa_native/src/**/*.c \
61+
mldsa_native/src/**/**/*.c \
62+
mldsa_native/src/**/**/**/*.c)
6363

64-
INC=-Imldsa_native/mldsa/
64+
INC=-Imldsa_native
6565

6666
# Part B:
6767
#

examples/basic/expected_signatures.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* The PCT modifies the PRNG state, so the KAT tests don't work.
1616
* We run KAT tests only for disabled PCT. */
1717
#if !defined(MLD_CONFIG_KEYGEN_PCT)
18-
#if MLD_CONFIG_API_PARAMETER_SET == 44
18+
#if MLD_CONFIG_PARAMETER_SET == 44
1919
const uint8_t expected_signature[] = {
2020
0x27, 0x5e, 0xbe, 0x2d, 0x23, 0x1a, 0x76, 0xc5, 0xd9, 0x77, 0xcb, 0x62,
2121
0x25, 0x04, 0xdb, 0x23, 0x31, 0xa9, 0xa8, 0xcd, 0xbc, 0xde, 0xf2, 0x20,
@@ -219,7 +219,7 @@ const uint8_t expected_signature[] = {
219219
0x1f, 0x24, 0x38, 0x41, 0x45, 0x54, 0x5f, 0x69, 0x85, 0x8d, 0x93, 0x9e,
220220
0xc5, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
221221
0x00, 0x00, 0x00, 0x00, 0x16, 0x25, 0x32, 0x42};
222-
#elif MLD_CONFIG_API_PARAMETER_SET == 65
222+
#elif MLD_CONFIG_PARAMETER_SET == 65
223223
const uint8_t expected_signature[] = {
224224
0x8b, 0x6f, 0x79, 0x00, 0xcc, 0x79, 0x57, 0xee, 0x16, 0x86, 0x87, 0xd5,
225225
0xcf, 0xb6, 0x90, 0x2c, 0xc6, 0x30, 0xeb, 0x8d, 0x39, 0xae, 0x9b, 0xf1,
@@ -497,7 +497,7 @@ const uint8_t expected_signature[] = {
497497
0xdf, 0x0e, 0x1a, 0x20, 0x50, 0xf5, 0x02, 0x21, 0x30, 0x35, 0x3c, 0x60,
498498
0x71, 0xad, 0xd0, 0xe3, 0xed, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
499499
0x00, 0x00, 0x00, 0x0c, 0x10, 0x17, 0x1d, 0x22, 0x2d};
500-
#elif MLD_CONFIG_API_PARAMETER_SET == 87
500+
#elif MLD_CONFIG_PARAMETER_SET == 87
501501
const uint8_t expected_signature[] = {
502502
0xdf, 0xe6, 0xe1, 0xa5, 0x20, 0xc1, 0xac, 0x98, 0x55, 0x2c, 0xf2, 0x13,
503503
0x65, 0x42, 0xe2, 0xb0, 0x77, 0x5f, 0x15, 0x00, 0x8f, 0x14, 0x48, 0xa1,
@@ -885,6 +885,6 @@ const uint8_t expected_signature[] = {
885885
0xce, 0xd5, 0x44, 0x49, 0x8b, 0xab, 0xbc, 0xca, 0xd3, 0x1c, 0x34, 0x4a,
886886
0xaa, 0xc7, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c,
887887
0x17, 0x22, 0x2a, 0x2f, 0x36, 0x3d, 0x43};
888-
#endif /* MLD_CONFIG_API_PARAMETER_SET == 87 */
888+
#endif /* MLD_CONFIG_PARAMETER_SET == 87 */
889889
#endif /* !MLD_CONFIG_KEYGEN_PCT */
890890
#endif /* !EXPECTED_SIGNATURES_H */

examples/basic/main.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
* This requires specifying the parameter set and namespace prefix
1414
* used for the build.
1515
*/
16-
#define MLD_CONFIG_API_PARAMETER_SET MLD_CONFIG_PARAMETER_SET
17-
#define MLD_CONFIG_API_NAMESPACE_PREFIX mldsa
1816
#include <mldsa_native.h>
1917
#include "expected_signatures.h"
2018
#include "test_only_rng/notrandombytes.h"

examples/basic/mldsa_native/mldsa

Lines changed: 0 additions & 1 deletion
This file was deleted.
File renamed without changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../mldsa/mldsa_native_config.h
File renamed without changes.

examples/basic_deterministic/Makefile

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ endif
5555
# In this example, we compile the individual mldsa-native source files directly.
5656
# Alternatively, you can compile the 'monobuild' source file mldsa_native.c.
5757
# See examples/monolithic_build for that.
58-
MLD_SOURCE=$(wildcard \
59-
mldsa_native/mldsa/src/*.c \
60-
mldsa_native/mldsa/src/**/*.c \
61-
mldsa_native/mldsa/src/**/**/*.c \
62-
mldsa_native/mldsa/src/**/**/**/*.c)
58+
MLD_SOURCE=$(wildcard \
59+
mldsa_native/src/*.c \
60+
mldsa_native/src/**/*.c \
61+
mldsa_native/src/**/**/*.c \
62+
mldsa_native/src/**/**/**/*.c)
6363

64-
INC=-Imldsa_native/mldsa/
64+
INC=-Imldsa_native
6565

6666
# Part B:
6767
#
@@ -73,15 +73,6 @@ ALL_SOURCE=$(MLD_SOURCE) $(APP_SOURCE)
7373
BUILD_DIR=build
7474
BIN=test_binary
7575

76-
#
77-
# Configuration adjustments
78-
#
79-
80-
# Pick prefix
81-
CFLAGS += -DMLD_CONFIG_NAMESPACE_PREFIX=mldsa
82-
# Set configuration option for deterministic build
83-
CFLAGS += -DMLD_CONFIG_NO_RANDOMIZED_API
84-
8576
BINARY_NAME_FULL_44=$(BUILD_DIR)/$(BIN)44
8677
BINARY_NAME_FULL_65=$(BUILD_DIR)/$(BIN)65
8778
BINARY_NAME_FULL_87=$(BUILD_DIR)/$(BIN)87

examples/basic_deterministic/main.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
* This requires specifying the parameter set and namespace prefix
1414
* used for the build.
1515
*/
16-
#define MLD_CONFIG_API_PARAMETER_SET MLD_CONFIG_PARAMETER_SET
17-
#define MLD_CONFIG_API_NAMESPACE_PREFIX mldsa
1816
#include <mldsa_native.h>
1917
#include "expected_signatures.h"
2018

0 commit comments

Comments
 (0)