Skip to content

Conversation

@mkannwischer
Copy link
Contributor

@mkannwischer mkannwischer commented Dec 31, 2025

This commit reduces the stack usage of signing by computing z = y + s1*cp
incrementally (one polynomial at a time) allowing to eliminate the polyvecl
z (at to cost of a single poly z).
The computation of z is moved into a separate function (compute_pack_z) to
vastly speed up the CBMC proofs.

De-facto this saves L-1 KB irrespective of MLD_CONFIG_REDUCE_RAM.

Practically, the same buffer was used early in the function too. Here we
instead introduce a new polyvecl buffer tmp, but that can be placed in a union
together with w1.
Unfortuantely, with the current struct workaround for
diffblue/cbmc#8813, this results in an increase in
stack space by L KB.
This gets eliminated when MLD_CONFIG_REDUCE_RAM is set.

@mkannwischer mkannwischer marked this pull request as ready for review December 31, 2025 10:13
@mkannwischer mkannwischer requested a review from a team as a code owner December 31, 2025 10:13
mkannwischer added a commit that referenced this pull request Jan 3, 2026
Alternative to #822 that
I hope to be less controversial.
Currently the constant time tests for verification rely on the signature
being declassified at the end of verification. This is not ideal.
This commit moves this declassification to the constant-time test instead.

As suggested in
#822 (review),
there is more work left to clean up the story around declassifications.
This PR is a first step towards cleaning up that story to unblock
#825 and
#821, but there is more
work left.

Signed-off-by: Matthias J. Kannwischer <[email protected]>
mkannwischer added a commit that referenced this pull request Jan 3, 2026
Alternative to #822 that
I hope to be less controversial.
Currently the constant time tests for verification rely on the signature
being declassified at the end of verification. This is not ideal.
This commit moves this declassification to the constant-time test instead.

As suggested in
#822 (review),
there is more work left to clean up the story around declassifications.
This PR is a first step towards cleaning up that story to unblock
#825 and
#821, but there is more
work left.

Signed-off-by: Matthias J. Kannwischer <[email protected]>
This commit reduces the stack usage of signing by computing z = y + s1*cp
incrementally (one polynomial at a time) allowing to eliminate the polyvecl
z (at to cost of a single poly z).
The computation of z is moved into a separate function (compute_pack_z) to
vastly speed up the CBMC proofs.

De-facto this saves L-1 KB irrespective of MLD_CONFIG_REDUCE_RAM.

Practically, the same buffer was used early in the function too. Here we
instead introduce a new polyvecl buffer tmp, but that can be placed in a union
together with w1.
Unfortuantely, with the current struct workaround for
diffblue/cbmc#8813, this results in an increase in
stack space by L KB.
This gets eliminated when MLD_CONFIG_REDUCE_RAM is set.

Hoisted out from #791

Signed-off-by: Matthias J. Kannwischer <[email protected]>
For some reason the previous (unrelated) commit caused the
verify_pre_hash_internal proof to fail due to extra functions in
USE_FUNCTION_CONTRACTS.
This commit removes the extra functions.

Signed-off-by: Matthias J. Kannwischer <[email protected]>
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.

2 participants