Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions test/constant_time/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,10 @@ webcpp.run dudect_bearssl : dudect_test.cpp
# family's constant_time on wasip2) and the constant-time section renders.
webcpp.run dudect_sodium : dudect_sodium_test.cpp
: <library>/third_party//sodium $(DUDECT) : native wasip2 ;
# The planted leak under dudect: X25519's agreement with an early-exit scan of
# its secret key before it, a few nanoseconds longer for the all-zero key; the
# program builds and runs only this case, not Ed25519's signing. It passes only
# The planted leak under dudect: X25519's agreement with early-exit scans of its
# secret key before it, a few hundred nanoseconds longer for the all-zero key
# (dudect_sodium_test.cpp says why not less); the program builds and runs only
# this case, not Ed25519's signing. It passes only
# when dudect finds the leak, natively. The scan runs inside the library's own
# guard, under DIT where the guard sets it (arm64 under macOS, Linux and
# Windows, where the CPU has it), so that the lane shows DIT does not hide a
Expand Down
8 changes: 5 additions & 3 deletions test/constant_time/dudect_sodium_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ test::t_statistic measure_agree(bool judged_case, std::array<std::uint8_t, 32>&
},
[&] {
#ifdef WEBCPP_TEST_CRYPTO_PLANTED_LEAK
// The planted leak: four early-exit scans of the secret key, 128 reads for the
// all-zero key and about four for a random one, some tens of nanoseconds. They run
// The planted leak: sixteen early-exit scans of the secret key, 512 reads for the
// all-zero key and about sixteen for a random one, a few hundred nanoseconds. Four
// scans, some tens of nanoseconds, sat at the threshold where the clock is coarse:
// |t| 9.88 on GitHub's AMD EPYC 9V45 (clock resolution 20 ns, 2026-12-05). They run
// inside the library's own guard, as a public operation's code would, so that DIT is
// set over them where the CPU has it and the lane shows it does not hide a leak of
// that size; the agreement's own guard then finds DIT set and leaves it so.
webcpp::secure::timing_guard const timing;
for (int scan = 0; scan < 4; ++scan) {
for (int scan = 0; scan < 16; ++scan) {
for (auto const& byte : secret_key) {
if (*static_cast<std::uint8_t const volatile*>(&byte) != 0) {
break;
Expand Down
Loading