sign: Use MLD_ALLOC for all secret buffers in sign.c#1077
sign: Use MLD_ALLOC for all secret buffers in sign.c#1077mkannwischer wants to merge 1 commit intomainfrom
Conversation
CBMC Results (ML-DSA-44)Full Results (200 proofs)
|
CBMC Results (ML-DSA-44, REDUCE-RAM)Full Results (200 proofs)
|
CBMC Results (ML-DSA-87, REDUCE-RAM)Full Results (200 proofs)
|
CBMC Results (ML-DSA-65, REDUCE-RAM)Full Results (200 proofs)
|
CBMC Results (ML-DSA-87)Full Results (200 proofs)
|
CBMC Results (ML-DSA-65)Full Results (200 proofs)
|
hanno-becker
left a comment
There was a problem hiding this comment.
I'm not sure this is the right move -- the cost of an alloc/free is negligible, less important IMO than uniformity for the allocation mechanism. For the security-critical RNG bytes in particular, one could imagine a use case where the consumer has registered a dedicated allocator from a "special" -- in some sense -- to hold the security sensitive material.
Can we rather go the other way, and strive to use MLD_ALLOC/MLD_FREE exclusively?
I don't have a strong opinion which way - I just wanted it to be consistent and the majority of tiny buffers were on the stack. |
985c2d5 to
6ebd734
Compare
63c03d0 to
434f7e7
Compare
| MLD_ALLOC(pre, uint8_t, MLD_DOMAIN_SEPARATION_MAX_BYTES, context); | ||
|
|
There was a problem hiding this comment.
Let's follow the PR description "Fixed-size, non-secret stack buffers (hpk, ph, message[1] in PCT) are
left on the stack" and restrict the change to seed and rng for now.
hanno-becker
left a comment
There was a problem hiding this comment.
Thank you @mkannwischer! Good to have that unified for the secret seed and rng buffers. As per the PR description, I think the public, small + statically sized domain separation prefix can be continued to be allocated on the stack for now.
97ada0c to
2ef6c69
Compare
Convert the stack-allocated rnd/seed buffers in the public sign API wrappers to MLD_ALLOC so that consumers using a custom allocator (MLD_CONFIG_CUSTOM_ALLOC_FREE) place RNG-derived secret material through the same allocation path. Signed-off-by: Matthias J. Kannwischer <matthias@zerorisc.com>
2ef6c69 to
c58a86d
Compare
As a follow-up to 64067ca, vonvert the stack-allocated rnd/seed/pre buffers in the public sign API
wrappers to MLD_ALLOC so that consumers using a custom allocator
(MLD_CONFIG_CUSTOM_ALLOC_FREE) place all sensitive material through the
same allocation path.
Fixed-size, non-secret stack buffers (hpk, ph, message[1] in PCT) are
left on the stack so that all verify routines perform the same set of
MLD_ALLOC allocations (and likewise for sign), which keeps a single
MLD_TOTAL_ALLOC_*_VERIFY / *_SIGN constant accurate without one variant
inflating the bound for the others.