-
Notifications
You must be signed in to change notification settings - Fork 27
Port: Use a single configuration file for internal and external headers #782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
mkannwischer
commented
Dec 10, 2025
- Ports Use a single configuration file for internal and external headers mlkem-native#1352
- Resolves Port: Use a single configuration file for internal and external headers #778
Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
dc3b495 to
9e73d34
Compare
examples/monolithic_build_multilevel/mldsa_native/mldsa_native_config.h
Outdated
Show resolved
Hide resolved
hanno-becker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good, thanks a lot @mkannwischer for working through this. There are still a few typos left, plus some minor issues which however we can defer if we have issues for them.
Previously, mldsa_native.h required users to set MLD_CONFIG_API_* macros
before including it, separate from the MLD_CONFIG_* macros used for the
build configuration. This distinction between internal and external
configuration it confusing.
Now, mldsa_native.h derives all API settings from the same
build configuration file used internally.
- The legacy configuration via MLD_CONFIG_API_XXX still works for
backwards compatibility, but will be removed in v2.
- New Config Options:
* MLD_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 MLD_CONFIG_PARAMETER_SET and
MLD_CONFIG_MULTILEVEL_{NO,WITH}_SHARED. However, the latter only
affect the build, not the API.
With MLD_CONFIG_MULTILEVEL_BUILD exposed as a separate option,
mldsa_native.h can use it to determine whether to suffix the
namespace prefix with the parameter set (44/65/87) or not,
so no adaptation of MLD_CONFIG_MULTILEVEL_{NO,WITH}_SHARED is
needed. Instead, a multi-level header simply becomes:
```c
#define MLD_CONFIG_PARAMETER_SET 44
#include "mldsa_native.h"
#undef MLD_CONFIG_PARAMETER_SET
#define MLD_CONFIG_PARAMETER_SET 65
#include "mldsa_native.h"
#undef MLD_CONFIG_PARAMETER_SET
#define MLD_CONFIG_PARAMETER_SET 87
#include "mldsa_native.h"
#undef MLD_CONFIG_PARAMETER_SET
```
For backwards compatibility, MLD_CONFIG_MULTILEVEL_BUILD is not
used in the build, which continues to detect multilevel builds
via the existing options MLD_CONFIG_MULTILEVEL_{WITH,NO}_SHARED.
* MLD_CONFIG_NO_SUPERCOP: We had this before in mldsa_native.h as
MLD_CONFIG_API_NO_SUPERCOP; it's now in the config and documented.
* MLD_CONFIG_CONSTANTS_ONLY: We had this before in mldsa_native.h as
MLD_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(MLD_BUILD_INTERNAL).
Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
- 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>
To avoid clashing with the symbols defined in mldsa_native.h, this commits aligns with mlkem-native, by using different symbol names (MLDSA_CRYPTO_XXX) Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
9e73d34 to
426a813
Compare
Thanks for catching those numerous typos. Should all be fixed now. |
75ca4d5 to
816961b
Compare
Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
816961b to
ae19b92
Compare
hanno-becker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's hope CI agrees. Thank you @mkannwischer, not a fun change.