Skip to content

Conversation

@mkannwischer
Copy link
Contributor

Currently we have an enum for the 12 different pre-hash functions for HashML-DSA. This leads to problems in multi-level builds as we must only define the enum once. Currently we work around this by guarding the enum definition with a pre-processor conditional.
However, there is also a (theoretical) concern about the type of the enum being implementation-defined in C90:
#537 (comment)

It seems cleaner to not use an enum here, but instead use #defines avoiding all the above problems.
This commit implements that change.

We also eliminate the camel case hashAlg - that was inconsistent with the remaining code base from the start.

@mkannwischer mkannwischer marked this pull request as ready for review November 4, 2025 09:29
@mkannwischer mkannwischer requested a review from a team as a code owner November 4, 2025 09:29
Copy link
Contributor

@jakemas jakemas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Currently we have an enum for the 12 different pre-hash functions for
HashML-DSA. This leads to problems in multi-level builds as we must only
define the enum once. Currently we work around this by guarding the enum
definition with a pre-processor conditional.
However, there is also a (theoretical) concern about the type of the enum
being implementation-defined in C90:
#537 (comment)

It seems cleaner to not use an enum here, but instead use #defines avoiding all
the above problems.
This commit implements that change.

We also eliminate the camel case hashAlg - that was inconsistent with the
remaining code base from the start.

Resolves
#591

Signed-off-by: Matthias J. Kannwischer <[email protected]>
Copy link
Contributor

@hanno-becker hanno-becker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @mkannwischer. An enum would conceptually be the right choice here, but we don't use them anywhere else and (further) complicating the multilevel build for it does not seem worth it.

@hanno-becker hanno-becker merged commit 6a4e9c3 into main Nov 5, 2025
247 checks passed
@hanno-becker hanno-becker deleted the no-enum branch November 5, 2025 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HashML-DSA: Replace enum by #define

4 participants