Skip to content

Conversation

mkannwischer
Copy link
Contributor

No description provided.

This commit adds extensive constant-time tests for a large set of compilers
and compilation flags.
It also makes use of the KyberSlash valgrind patch allowing detection of
secret-dependent divisions (none were found in our code).

The approach works as follows: We mark all output of randombytes as undefined
and let valgrind trace through the program where values are derived from it.
It will produce an error if any branches, memory accesses, or divisions
depend on these undefined (secret) values.
Note that ALL secret values are derived from randomness in one way or another.
In places, where variable time code is detected we carefully check whether
that leakage is safe or not and add appropriate declassifications
(through MLD_CT_TESTING_DECLASSIFY). Comments are added explaining the
rationale for the declassification.

Note that compared to the mlkem-native tests, we omit the
--track-origins=yes valgrind flag as it resulted in valgrind errors on
AArch64 platforms for some compiler/flag combinations:
vex: priv/host_arm64_defs.c:2832 (genSpill_ARM64): Assertion `offsetB < 4096'
failed.
Removing the flag works around this.
This has no impact on the soundness of the tests - the flag merely helps
tracking down were secret values originate from.

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

1 participant