Commit 024d2fb
committed
Derive mlkem_native.h configuration from config file
Previously, mlkem_native.h required users to set MLK_CONFIG_API_* macros
before including it, separate from the MLK_CONFIG_* macros used for the
build configuration. This distinction between internal and external
configuration it confusing.
Now, mlkem_native.h derives all API settings from the same
build configuration file used internally.
- The legacy configuration via MLK_CONFIG_API_XXX still works for
backwards compatibility, but will be removed in v2.
- New Config Options:
* MLK_CONFIG_MULTILEVEL_BUILD: Explicit flag for multi-level builds
This makes it simpler to get headers for multi-level builds.
In the common case, the configs used in a multi-level build are
identical except for the setting of MLK_CONFIG_PARAMETER_SET and
MLK_CONFIG_MULTILEVEL_{NO,WITH}_SHARED. However, the latter only
affect the build, not the API.
With MLK_CONFIG_MULTILEVEL_BUILD exposed as a separate option,
mlkem_native.h can use it to determine whether to suffix the
namespace prefix with the parameter set (512/768/1024) or not,
so no adaptation of MLK_CONFIG_MULTILEVEL_{NO,WITH}_SHARED is
needed. Instead, a multi-level header simply becomes:
```c
#define MLK_CONFIG_PARAMETER_SET 512
#include "mlkem_native.h"
#undef MLK_CONFIG_PARAMETER_SET
#define MLK_CONFIG_PARAMETER_SET 768
#include "mlkem_native.h"
#undef MLK_CONFIG_PARAMETER_SET
#define MLK_CONFIG_PARAMETER_SET 1024
#include "mlkem_native.h"
#undef MLK_CONFIG_PARAMETER_SET
```
For backwards compatibility, MLK_CONFIG_MULTILEVEL_BUILD is not
used in the build, which continues to detect multilevel builds
via the existing options MLK_CONFIG_MULTILEVEL_{WITH,NO}_SHARED.
* MLK_CONFIG_NO_SUPERCOP: We had this before in mlkem_native.h as
MLK_CONFIG_API_NO_SUPERCOP; it's now in the config and documented.
* MLK_CONFIG_CONSTANTS_ONLY: We had this before in mlkem_native.h as
MLK_CONFIG_API_CONSTANTS_ONLY; it's now in the config and documented.
- Build-Internal vs API Config Separation: Config file now guards
build-only options with #if defined(MLK_BUILD_INTERNAL).
- Example Directory Restructuring: All examples refactored with mlkem/
subdirectories renamed to mlkem_native/ and CFLAGS configuration
replaced by custom configs.
Updated READMEs to reflect new paths and clarify which options are
set in config files vs passed via CFLAGS.
Signed-off-by: Hanno Becker <beckphan@amazon.co.uk>1 parent 742db86 commit 024d2fb
File tree
200 files changed
+5155
-1893
lines changed- .github/actions/config-variations
- examples
- basic_deterministic
- mlkem_native
- basic
- mlkem_native
- bring_your_own_fips202_static
- mlkem_native
- bring_your_own_fips202
- mlkem_native
- src
- custom_backend
- mlkem_native
- mlkem
- src
- fips202
- native
- src
- fips202
- native
- custom
- src
- monolithic_build_multilevel_native
- mlkem_native
- monolithic_build_multilevel
- mlkem_native
- monolithic_build_native
- mlkem_native
- monolithic_build
- mlkem_native
- src
- fips202
- mlkem
- multilevel_build_native
- mlkem_native
- multilevel_build
- mlkem_native
- mlkem
- src
- proofs/cbmc
- polyvec_basemul_acc_montgomery_cached_k2_native_aarch64
- polyvec_basemul_acc_montgomery_cached_k3_native_aarch64
- polyvec_basemul_acc_montgomery_cached_k4_native_aarch64
- scripts
- test
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
200 files changed
+5155
-1893
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
| 134 | + | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
| 147 | + | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
| 173 | + | |
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
44 | 46 | | |
45 | | - | |
46 | | - | |
47 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
51 | | - | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| |||
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
90 | 94 | | |
91 | | - | |
92 | | - | |
93 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
94 | 98 | | |
| 99 | + | |
95 | 100 | | |
96 | 101 | | |
97 | | - | |
98 | 102 | | |
99 | 103 | | |
100 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
| 14 | + | |
| 15 | + | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
This file was deleted.
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 78 | + | |
83 | 79 | | |
84 | 80 | | |
85 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
0 commit comments