diff --git a/test/constant_time/Jamfile b/test/constant_time/Jamfile index 30f5f59..984d639 100644 --- a/test/constant_time/Jamfile +++ b/test/constant_time/Jamfile @@ -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 : /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 diff --git a/test/constant_time/dudect_sodium_test.cpp b/test/constant_time/dudect_sodium_test.cpp index b6b922c..060b7d1 100644 --- a/test/constant_time/dudect_sodium_test.cpp +++ b/test/constant_time/dudect_sodium_test.cpp @@ -66,13 +66,15 @@ test::t_statistic measure_agree(bool judged_case, std::array& }, [&] { #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(&byte) != 0) { break;