-
Notifications
You must be signed in to change notification settings - Fork 25
Closed
Milestone
Description
Currently we are using an enum to specify which pre-hashing hash function to be used:
Lines 495 to 499 in 1d7ed8d
| int crypto_sign_verify_pre_hash_internal(const uint8_t *sig, size_t siglen, | |
| const uint8_t *ph, size_t phlen, | |
| const uint8_t *ctx, size_t ctxlen, | |
| const uint8_t *pk, | |
| mld_hash_alg_t hashAlg) |
Lines 48 to 62 in 1d7ed8d
| typedef enum | |
| { | |
| MLD_SHA2_224, | |
| MLD_SHA2_256, | |
| MLD_SHA2_384, | |
| MLD_SHA2_512, | |
| MLD_SHA2_512_224, | |
| MLD_SHA2_512_256, | |
| MLD_SHA3_224, | |
| MLD_SHA3_256, | |
| MLD_SHA3_384, | |
| MLD_SHA3_512, | |
| MLD_SHAKE_128, | |
| MLD_SHAKE_256 | |
| } mld_hash_alg_t; |
This leads to problems when introducing a separate mldsa_native.h specifying the public API that can be included multiple times as it introduces clashes. #537 works around this guarding it by an #ifndef to only define it once.
Futhermore, there is a (theoretical) concern about the type of the enum being implementation-defined in C90: #537 (comment).
We should eliminate the enum and instead use #defines to define numerical values for each possible value.
Metadata
Metadata
Assignees
Labels
No labels