Skip to content

Commit 18d5fa5

Browse files
committed
mldsa_native.h: Remove MLD_MAX_TOTAL_ALLOC constants
Remove MLD_MAX_TOTAL_ALLOC and MLD_MAX_TOTAL_ALLOC_{KEYPAIR,SIGN,VERIFY} constants. These exposed the maximum allocation across all security levels even in single-level builds, which was confusing. Users should instead use the explicitly security-level-labeled constants such as MLD_TOTAL_ALLOC_87_KEYPAIR. The per-level MLD_TOTAL_ALLOC_{44,65,87}_{KEYPAIR,SIGN,VERIFY} and aggregate MLD_TOTAL_ALLOC_{44,65,87} constants remain available. Signed-off-by: Matthias J. Kannwischer <[email protected]>
1 parent c2882aa commit 18d5fa5

File tree

4 files changed

+0
-32
lines changed

4 files changed

+0
-32
lines changed

mldsa/mldsa_native.S

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,6 @@
177177
#undef MLD_ERR_RNG_FAIL
178178
#undef MLD_H
179179
#undef MLD_MAX3_
180-
#undef MLD_MAX_TOTAL_ALLOC
181-
#undef MLD_MAX_TOTAL_ALLOC_KEYPAIR
182-
#undef MLD_MAX_TOTAL_ALLOC_SIGN
183-
#undef MLD_MAX_TOTAL_ALLOC_VERIFY
184180
#undef MLD_PREHASH_NONE
185181
#undef MLD_PREHASH_SHA2_224
186182
#undef MLD_PREHASH_SHA2_256

mldsa/mldsa_native.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,6 @@
173173
#undef MLD_ERR_RNG_FAIL
174174
#undef MLD_H
175175
#undef MLD_MAX3_
176-
#undef MLD_MAX_TOTAL_ALLOC
177-
#undef MLD_MAX_TOTAL_ALLOC_KEYPAIR
178-
#undef MLD_MAX_TOTAL_ALLOC_SIGN
179-
#undef MLD_MAX_TOTAL_ALLOC_VERIFY
180176
#undef MLD_PREHASH_NONE
181177
#undef MLD_PREHASH_SHA2_224
182178
#undef MLD_PREHASH_SHA2_256

mldsa/mldsa_native.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -945,22 +945,12 @@ int MLD_API_NAMESPACE(pk_from_sk)(
945945
#define MLD_TOTAL_ALLOC_87_KEYPAIR MLD_TOTAL_ALLOC_87_KEYPAIR_NO_PCT
946946
#endif
947947

948-
/*
949-
* `MLD_MAX_TOTAL_ALLOC_{KEYPAIR,SIGN,VERIFY}` is the maximum across all
950-
* parameter sets for each operation.
951-
*/
952-
#define MLD_MAX_TOTAL_ALLOC_KEYPAIR MLD_TOTAL_ALLOC_87_KEYPAIR
953-
#define MLD_MAX_TOTAL_ALLOC_SIGN MLD_TOTAL_ALLOC_87_SIGN
954-
#define MLD_MAX_TOTAL_ALLOC_VERIFY MLD_TOTAL_ALLOC_87_VERIFY
955-
956948
#define MLD_MAX3_(a, b, c) \
957949
((a) > (b) ? ((a) > (c) ? (a) : (c)) : ((b) > (c) ? (b) : (c)))
958950

959951
/*
960952
* `MLD_TOTAL_ALLOC_{44,65,87}` is the maximum across all operations for each
961953
* parameter set.
962-
* `MLD_MAX_TOTAL_ALLOC` is the maximum across all parameter sets and
963-
* operations.
964954
*/
965955
#define MLD_TOTAL_ALLOC_44 \
966956
MLD_MAX3_(MLD_TOTAL_ALLOC_44_KEYPAIR, MLD_TOTAL_ALLOC_44_SIGN, \
@@ -972,6 +962,4 @@ int MLD_API_NAMESPACE(pk_from_sk)(
972962
MLD_MAX3_(MLD_TOTAL_ALLOC_87_KEYPAIR, MLD_TOTAL_ALLOC_87_SIGN, \
973963
MLD_TOTAL_ALLOC_87_VERIFY)
974964

975-
#define MLD_MAX_TOTAL_ALLOC MLD_TOTAL_ALLOC_87
976-
977965
#endif /* !MLD_H */

test/src/test_alloc.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -666,17 +666,5 @@ int main(void)
666666
CHECK_ALLOC_MATCH(ctx.global_high_mark_verify, MLD_TOTAL_ALLOC_VERIFY);
667667
CHECK_ALLOC_MATCH(ctx.global_high_mark, MLD_TOTAL_ALLOC);
668668

669-
/*
670-
* For parameter set 87, also check that the high watermarks match
671-
* the MLD_MAX_TOTAL_ALLOC_* constants (which are defined as the 87 values).
672-
* MLD_MAX_TOTAL_ALLOC_KEYPAIR adapts based on MLD_CONFIG_KEYGEN_PCT.
673-
*/
674-
#if MLD_CONFIG_API_PARAMETER_SET == 87
675-
CHECK_ALLOC_MATCH(ctx.global_high_mark_keypair, MLD_MAX_TOTAL_ALLOC_KEYPAIR);
676-
CHECK_ALLOC_MATCH(ctx.global_high_mark_sign, MLD_MAX_TOTAL_ALLOC_SIGN);
677-
CHECK_ALLOC_MATCH(ctx.global_high_mark_verify, MLD_MAX_TOTAL_ALLOC_VERIFY);
678-
CHECK_ALLOC_MATCH(ctx.global_high_mark, MLD_MAX_TOTAL_ALLOC);
679-
#endif /* MLD_CONFIG_API_PARAMETER_SET == 87 */
680-
681669
return 0;
682670
}

0 commit comments

Comments
 (0)