Commit f399c81
verify: Switch to constant-time memcmp
At the end of verify one has to compare the input challenge to the
re-computed challenge. If they are equal (and some previous checks on
h and z passed), the signature is valid.
Currently, our constant-time tests do not declassify the message and we,
hence, need to declassify in this final step. Before this commit, the
declassification would happen on the recomputed challenge just before
the memcmp.
Now that a constant-time memcmp was added in #714, we might as well
use that; that, plus a constant-time selection, allows us to not use
message-dependent branches.
For now, we still declassify the result of the verification itself to
allow branching on it, e.g. in crypto_sign_open. This may be further
improved in subsequent work, making crypto_sign_open constant flow
and leaving a potential declassification of the verification result
to the call-sites.
Signed-off-by: Matthias J. Kannwischer <[email protected]>
Signed-off-by: Hanno Becker <[email protected]>1 parent f519792 commit f399c81
2 files changed
+6
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
874 | 874 | | |
875 | 875 | | |
876 | 876 | | |
877 | | - | |
878 | 877 | | |
879 | 878 | | |
880 | 879 | | |
| |||
961 | 960 | | |
962 | 961 | | |
963 | 962 | | |
964 | | - | |
965 | | - | |
966 | | - | |
967 | | - | |
968 | | - | |
969 | | - | |
970 | | - | |
971 | | - | |
972 | | - | |
973 | | - | |
974 | | - | |
975 | | - | |
976 | | - | |
977 | | - | |
978 | | - | |
979 | | - | |
980 | | - | |
981 | | - | |
982 | | - | |
983 | | - | |
| 963 | + | |
| 964 | + | |
984 | 965 | | |
985 | | - | |
| 966 | + | |
| 967 | + | |
986 | 968 | | |
987 | 969 | | |
988 | 970 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
0 commit comments