From a0f64f60885ea14a05c7274f1e930b19a0e458f4 Mon Sep 17 00:00:00 2001 From: R Date: Fri, 4 Dec 2026 06:27:56 -0300 Subject: [PATCH] crypto: dudect_bearssl is printed, not judged, on WASI The owner's decision of 2026-12-04: under wasmtime the timing of dudect_bearssl's cases follows the runner's processor (GitHub's AMD EPYC 9V74 read |t| 30 to 150 on constant_time_equal and 11 to 12 on gcm_seal and ctaes_encrypt), so on a target that defines __wasi__ the program measures every case once, prints it judged=no with a line saying why, and passes; the CI's judge measures none of them again. One rule, case_results made with the reason, replaces base58_decode's wasip2 exception. Native runs, memcheck, MemorySanitizer, dudect_sodium and dudect_secp256k1 keep their verdicts. The tables show dudect on wasip2 for BearSSL, ctaes and secure::constant_time_equal as printed, not judged, with no result (crypto.json's unjudged_checkers). --- doc/backends.adoc | 17 ++++- doc/generated/constant-time.adoc | 6 +- doc/generated/namespace-ciphers.adoc | 6 +- doc/generated/namespace-curves.adoc | 2 +- doc/llms.txt | 8 +-- doc/tables/crypto.json | 15 ++-- doc/tables/generate.py | 23 ++++-- doc/tables/generate_test.py | 32 +++++++++ doc/testing.adoc | 8 ++- test/constant_time/Jamfile | 6 +- test/constant_time/dudect.hpp | 42 +++++++++-- test/constant_time/dudect_harness_test.cpp | 37 +++++++++- test/constant_time/dudect_test.cpp | 83 +++++++++++++--------- 13 files changed, 213 insertions(+), 72 deletions(-) diff --git a/doc/backends.adoc b/doc/backends.adoc index 576f427..1033e60 100644 --- a/doc/backends.adoc +++ b/doc/backends.adoc @@ -197,8 +197,18 @@ One measurement is an open finding, listed under the table with its numbers: libsodium's X25519 `agree` under wasmtime, on wasip2. Its cause is measured: wasmtime does not set DIT, and with DIT set in wasmtime's main thread, an experiment and not the lane, the case passes. The WebAssembly cannot set it, -so the lane prints its value on wasip2 without judging it, and judges -everything else. +so the lane prints its value on wasip2 without judging it. + +On a WASI target the lane prints every case of `dudect_bearssl` (BearSSL's +AEADs and P-256, ctaes, `secure::constant_time_equal` and hash's Base58Check +decode) and judges none of them, by the owner's decision of 2026-12-04: under +wasmtime their timing follows the processor of the runner, not the code +measured. On GitHub's hosted AMD EPYC 9V74, wasip2 runs read |t| 30 to 150 on +`secure::constant_time_equal` and 11 to 12 on AES-GCM's seal and on ctaes, +failing changes that touched none of them, so a verdict there would pass or +fail with the machine drawn. The lane judges everything else: every program +natively, and under wasmtime `dudect_sodium` (X25519's agreement excepted) and +`dudect_secp256k1`. dudect's two classes differ in the secret's bytes and in nothing else: the preparation of each measurement reads both inputs and writes the secret with @@ -217,7 +227,8 @@ program but `dudect_planted` also measures an A/A control case, whose classes are prepared by the same instructions with the same value: it shows what the machine itself does. Valgrind's memcheck and MemorySanitizer, which do not measure time, are judged there; dudect is judged by the program itself -wherever else the lane runs, on a machine of one's own, in one process. +wherever else the lane runs, on a machine of one's own, in one process, except +`dudect_bearssl` on a WASI target, which judges none of its cases. Whether a tag matched, or a shared secret came out all zero, is public by design, since the operation reports it, but it is computed from the secrets: it diff --git a/doc/generated/constant-time.adoc b/doc/generated/constant-time.adoc index 0fd9a27..de55c3c 100644 --- a/doc/generated/constant-time.adoc +++ b/doc/generated/constant-time.adoc @@ -14,7 +14,7 @@ |BearSSL |by design: `+aes_ct64+` and `+ghash_ctmul64+`, or AES-NI and PCLMUL where the CPU has them; on a 32-bit host a 64-bit multiplication may not be constant time, which BearSSL documents; ECDSA signing at webcpp's pin, whose patch submitted upstream closes upstream's leak of the RFC 6979 nonce's bit length (link:https://www.bearssl.org/gitweb/?p=BearSSL;a=blob;f=src/ec/ecdsa_i31_bits.c;hb=7bea48e5e850ab4cafbe68d3765cdaba13a86d6f#l44[BearSSL's ecdsa_i31_bits.c at upstream 7bea48e, lines 44 and 45: the nonce decoded with its actual bit length in the integer's header, then shifted over the words that length needs]; link:https://minerva.crocs.fi.muni.cz/[Minerva: the leak of an ECDSA nonce's bit length through timing, and the lattice that recovers the key (CVE-2019-15809)]; the patch: link:https://github.com/webcpporg/bearssl/commit/ae63032d9f30bf53674db5445875adf71b8626b7[webcpporg/bearssl, commit ae63032 on its branch upstream/ecdsa-bits2int-constant-time, webcpp's pin: upstream 7bea48e plus exactly the patch submitted upstream, br_ecdsa_i31_bits2int and br_ecdsa_i15_bits2int setting the integer's header, before the right shift, to the larger of the decoded bit length and the order's, both public; the pin returns to upstream once upstream applies it]); link:https://www.bearssl.org/constanttime.html[BearSSL, constant-time crypto]; link:https://www.bearssl.org/ctmul.html[BearSSL, constant-time multiplications] |Valgrind's memcheck (Linux): AES-GCM, ChaCha20-Poly1305, P-256 (the key pair's making, `+sign+` of a digest (`+crypto::signing_schemes::prehashed+`), which makes its signature low S without a branch, then `+low_s()+` and `+is_low_s()+` of it, `+agree+` and the private formats, `+pkcs8+`, `+raw+` and `+pem(pkcs8)+` both ways; BearSSL's own branches on its signing's verdicts listed in `+bearssl_verdicts.supp+`; nothing found at webcpp's pin ae63032, whose patch submitted upstream closes upstream's leak of the nonce's bit length in `+sign+` that this checker found on 2026-11-21, `+sign+` with its low-S step included (Valgrind 3.22, arm64 Linux container, 2026-12-02)); MemorySanitizer (Linux, clang): AES-GCM, ChaCha20-Poly1305, P-256 (the same paths as memcheck's; the same leak in `+sign+` on 2026-11-21 on upstream's BearSSL, nothing at webcpp's pin ae63032, `+sign+` with its low-S step included (clang 18, arm64 Linux container, 2026-12-02)); dudect (judged; on a runner GitHub hosts, by two of three runs): AES-GCM, ChaCha20-Poly1305, P-256 (`+sign+` of a digest and `+agree+`, each against the key pair's scalar; `+sign+` with its low-S step judged constant time, \|t\| 1.70 on Linux and 1.63 natively on an Apple M5 Max (release, one run each, 2026-11-22; provisional, measured again in the final quiet pass)) -|dudect (judged; on a runner GitHub hosts, by two of three runs): AES-GCM, ChaCha20-Poly1305, P-256 (`+sign+` of a digest and `+agree+`, each against the key pair's scalar; `+sign+` with its low-S step judged constant time, \|t\| 1.70 on Linux and 1.63 natively on an Apple M5 Max (release, one run each, 2026-11-22; provisional, measured again in the final quiet pass)) +|dudect (printed, not judged: under wasmtime its timing follows the runner's processor): AES-GCM, ChaCha20-Poly1305, P-256 |not measured yet |not measured yet @@ -28,7 +28,7 @@ |ctaes |by design: bitsliced, no table and no branch on secret data; link:https://github.com/bitcoin/bitcoin/tree/master/src/crypto/ctaes[ctaes, constant-time AES] |Valgrind's memcheck (Linux): AES block cipher; MemorySanitizer (Linux, clang): AES block cipher; dudect (judged; on a runner GitHub hosts, by two of three runs): AES block cipher -|dudect (judged; on a runner GitHub hosts, by two of three runs): AES block cipher +|dudect (printed, not judged: under wasmtime its timing follows the runner's processor): AES block cipher |not measured yet |not measured yet @@ -56,7 +56,7 @@ |no backend |webcpp::secure's `+secure::constant_time_equal+`, which crypto's code calls, is constant time in the contents: every byte is read, no branch and no index depends on one |Valgrind's memcheck (Linux): `+secure::constant_time_equal+`, `+is_all_zero+` and the wipe of `+secure::secret+`; MemorySanitizer (Linux, clang): `+secure::constant_time_equal+`, `+is_all_zero+` and the wipe of `+secure::secret+`; dudect (judged; on a runner GitHub hosts, by two of three runs): `+secure::constant_time_equal+` -|dudect (judged; on a runner GitHub hosts, by two of three runs): `+secure::constant_time_equal+` +|dudect (printed, not judged: under wasmtime its timing follows the runner's processor): `+secure::constant_time_equal+` |not measured yet |not measured yet |=== diff --git a/doc/generated/namespace-ciphers.adoc b/doc/generated/namespace-ciphers.adoc index ddafec7..18195ae 100644 --- a/doc/generated/namespace-ciphers.adoc +++ b/doc/generated/namespace-ciphers.adoc @@ -41,8 +41,8 @@ |ctaes: yes (link:https://github.com/bitcoin/bitcoin/tree/master/src/crypto/ctaes[ctaes, constant-time AES]); OpenSSL with assembly: yes (link:https://github.com/openssl/openssl/tree/master/crypto/aes/asm[OpenSSL's AES assembly for ARMv8 and x86-64]); OpenSSL no-asm: no (link:https://github.com/openssl/openssl/blob/master/crypto/aes/aes_core.c[OpenSSL's crypto/aes/aes_core.c, OPENSSL_AES_CONST_TIME]) |Constant time, measured -|BearSSL: native, Valgrind's memcheck (Linux), MemorySanitizer (Linux, clang) and dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; wasip2, dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; not measured yet on wasip3, emscripten. OpenSSL (seal alone: its open branches on the verdict inside OpenSSL): native, Valgrind's memcheck (Linux), nothing found; not measured yet on wasip2, wasip3 (<>) -|OpenSSL: not measured yet. ctaes: native, Valgrind's memcheck (Linux), MemorySanitizer (Linux, clang) and dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; wasip2, dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; not measured yet on wasip3, emscripten (<>) +|BearSSL: native, Valgrind's memcheck (Linux), MemorySanitizer (Linux, clang) and dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; wasip2, dudect (printed, not judged: under wasmtime its timing follows the runner's processor); not measured yet on wasip3, emscripten. OpenSSL (seal alone: its open branches on the verdict inside OpenSSL): native, Valgrind's memcheck (Linux), nothing found; not measured yet on wasip2, wasip3 (<>) +|OpenSSL: not measured yet. ctaes: native, Valgrind's memcheck (Linux), MemorySanitizer (Linux, clang) and dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; wasip2, dudect (printed, not judged: under wasmtime its timing follows the runner's processor); not measured yet on wasip3, emscripten (<>) |Standards |link:https://csrc.nist.gov/pubs/sp/800/38/d/final[NIST SP 800-38D, GCM and GMAC] @@ -102,7 +102,7 @@ |libsodium: yes (link:https://doc.libsodium.org/secret-key_cryptography/aead[libsodium's documentation, AEAD constructions: ChaCha20 and timing attacks]) |Constant time, measured -|libsodium: native, Valgrind's memcheck (Linux) and MemorySanitizer (Linux, clang), nothing found; not measured yet on wasip2, wasip3, emscripten. BearSSL: native, Valgrind's memcheck (Linux), MemorySanitizer (Linux, clang) and dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; wasip2, dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; not measured yet on wasip3, emscripten. OpenSSL (seal alone: its open branches on the verdict inside OpenSSL): native, Valgrind's memcheck (Linux), nothing found; not measured yet on wasip2, wasip3 (<>) +|libsodium: native, Valgrind's memcheck (Linux) and MemorySanitizer (Linux, clang), nothing found; not measured yet on wasip2, wasip3, emscripten. BearSSL: native, Valgrind's memcheck (Linux), MemorySanitizer (Linux, clang) and dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; wasip2, dudect (printed, not judged: under wasmtime its timing follows the runner's processor); not measured yet on wasip3, emscripten. OpenSSL (seal alone: its open branches on the verdict inside OpenSSL): native, Valgrind's memcheck (Linux), nothing found; not measured yet on wasip2, wasip3 (<>) |libsodium: native, Valgrind's memcheck (Linux) and MemorySanitizer (Linux, clang), nothing found; not measured yet on wasip2, wasip3, emscripten (<>) |libsodium: native, Valgrind's memcheck (Linux) and MemorySanitizer (Linux, clang), nothing found; not measured yet on wasip2, wasip3, emscripten (<>) diff --git a/doc/generated/namespace-curves.adoc b/doc/generated/namespace-curves.adoc index 07f0f98..6ab6a13 100644 --- a/doc/generated/namespace-curves.adoc +++ b/doc/generated/namespace-curves.adoc @@ -45,7 +45,7 @@ |libsecp256k1: native, Valgrind's memcheck (Linux; libsecp256k1's own `+ctime_tests.c+`, and webcpp's code around it: the key pair's making and `+secret()+`, its signatures and x-only tweak, ECDH in three forms (`+agree+`, `+agree_hashed+` and `+agree_point+`), the secret key's tweaks and negation, and PKCS#8), MemorySanitizer (Linux, clang; the same paths as memcheck's) and dudect (judged; on a runner GitHub hosts, by two of three runs; `+agree+`), nothing found; wasip2, dudect (judged; on a runner GitHub hosts, by two of three runs; `+agree+`), nothing found; not measured yet on wasip3, emscripten (<>) |libsodium: native, Valgrind's memcheck (Linux), MemorySanitizer (Linux, clang) and dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; wasip2, dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; not measured yet on wasip3, emscripten (<>) |libsodium: native, Valgrind's memcheck (Linux) and MemorySanitizer (Linux, clang), nothing found, and dudect (judged; on a runner GitHub hosts, by two of three runs): nothing found with arm64's DIT (data-independent timing) bit set, which webcpp sets around every call on 64-bit ARM under macOS, iOS, Linux, Android and Windows where the CPU has it, as Apple requires of constant-time code (link:https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms#Enable-DIT-for-constant-time-cryptographic-operations[Apple, Writing ARM64 code for Apple platforms: enable DIT for constant-time cryptographic operations]); the lane's dudect sets nothing itself and measures what a program gets: \|t\| 1.8 to 2.8 against the threshold 10 (2026-11-21, five runs), while its `dudect_planted`, an early-exit scan of the secret key run inside the same guard, reads \|t\| 66.72 and 65.53 (2026-11-21): DIT does not hide a leak. Without DIT, dudect times `agree` with an all-zero secret key against random ones at \|t\| 6.7 to 14.5 (2026-11-19) and 4.3 to 7.8 (2026-11-21, three runs): about one nanosecond in 15 µs. Each on an Apple M5 Max, from a release build. libsodium does not set DIT, and webcpp sets nothing on x86 or WebAssembly; wasip2, dudect (judged; on a runner GitHub hosts, by two of three runs): an open finding, its cause measured: dudect times `agree` with an all-zero secret key against random ones at \|t\| 13 to 32 (2026-11-18; a fixed key against another fixed key: 22.9) and 107 to 260 (2026-11-19), and 25.25 in the lane on 2026-11-21, against the threshold 10, under wasmtime 47 on an Apple M5 Max, from a release build. The cause is Apple silicon's DIT (data-independent timing), which wasmtime does not set (link:https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms#Enable-DIT-for-constant-time-cryptographic-operations[Apple, Writing ARM64 code for Apple platforms: enable DIT for constant-time cryptographic operations]): with DIT set in wasmtime's main thread, an experiment and not the lane, the same case reads \|t\| 1.5 to 2.1; no branch on a secret was found in the WebAssembly or in wasmtime's compiled code. The lane cannot set DIT from inside the WebAssembly, so it prints this value on wasip2 without judging it; the CI's x86-64 run measures it next; not measured yet on wasip3, emscripten (<>) -|BearSSL: native, Valgrind's memcheck (Linux; the key pair's making, `+sign+` of a digest (`+crypto::signing_schemes::prehashed+`), which makes its signature low S without a branch, then `+low_s()+` and `+is_low_s()+` of it, `+agree+` and the private formats, `+pkcs8+`, `+raw+` and `+pem(pkcs8)+` both ways; BearSSL's own branches on its signing's verdicts listed in `+bearssl_verdicts.supp+`; nothing found at webcpp's pin ae63032, whose patch submitted upstream closes upstream's leak of the nonce's bit length in `+sign+` that this checker found on 2026-11-21, `+sign+` with its low-S step included (Valgrind 3.22, arm64 Linux container, 2026-12-02)), MemorySanitizer (Linux, clang; the same paths as memcheck's; the same leak in `+sign+` on 2026-11-21 on upstream's BearSSL, nothing at webcpp's pin ae63032, `+sign+` with its low-S step included (clang 18, arm64 Linux container, 2026-12-02)) and dudect (judged; on a runner GitHub hosts, by two of three runs; `+sign+` of a digest and `+agree+`, each against the key pair's scalar; `+sign+` with its low-S step judged constant time, \|t\| 1.70 on Linux and 1.63 natively on an Apple M5 Max (release, one run each, 2026-11-22; provisional, measured again in the final quiet pass)), nothing found; wasip2, dudect (judged; on a runner GitHub hosts, by two of three runs; `+sign+` of a digest and `+agree+`, each against the key pair's scalar; `+sign+` with its low-S step judged constant time, \|t\| 1.70 on Linux and 1.63 natively on an Apple M5 Max (release, one run each, 2026-11-22; provisional, measured again in the final quiet pass)), nothing found; not measured yet on wasip3, emscripten (<>) +|BearSSL: native, Valgrind's memcheck (Linux; the key pair's making, `+sign+` of a digest (`+crypto::signing_schemes::prehashed+`), which makes its signature low S without a branch, then `+low_s()+` and `+is_low_s()+` of it, `+agree+` and the private formats, `+pkcs8+`, `+raw+` and `+pem(pkcs8)+` both ways; BearSSL's own branches on its signing's verdicts listed in `+bearssl_verdicts.supp+`; nothing found at webcpp's pin ae63032, whose patch submitted upstream closes upstream's leak of the nonce's bit length in `+sign+` that this checker found on 2026-11-21, `+sign+` with its low-S step included (Valgrind 3.22, arm64 Linux container, 2026-12-02)), MemorySanitizer (Linux, clang; the same paths as memcheck's; the same leak in `+sign+` on 2026-11-21 on upstream's BearSSL, nothing at webcpp's pin ae63032, `+sign+` with its low-S step included (clang 18, arm64 Linux container, 2026-12-02)) and dudect (judged; on a runner GitHub hosts, by two of three runs; `+sign+` of a digest and `+agree+`, each against the key pair's scalar; `+sign+` with its low-S step judged constant time, \|t\| 1.70 on Linux and 1.63 natively on an Apple M5 Max (release, one run each, 2026-11-22; provisional, measured again in the final quiet pass)), nothing found; wasip2, dudect (printed, not judged: under wasmtime its timing follows the runner's processor); not measured yet on wasip3, emscripten (<>) |Standards |link:https://www.secg.org/sec2-v2.pdf[SEC 2, Recommended Elliptic Curve Domain Parameters], link:https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki[BIP 340, Schnorr signatures for secp256k1], link:https://www.rfc-editor.org/rfc/rfc6979[RFC 6979, deterministic ECDSA nonces], link:https://github.com/bitcoin/bips/blob/master/bip-0324.mediawiki[BIP 324, version 2 P2P encrypted transport protocol], link:https://github.com/bitcoin/bips/blob/master/bip-0327.mediawiki[BIP 327, MuSig2 for BIP340-compatible multi-signatures], link:https://github.com/bitcoin/bips/blob/master/bip-0352.mediawiki[BIP 352, Silent Payments] diff --git a/doc/llms.txt b/doc/llms.txt index 856359d..dea1d85 100644 --- a/doc/llms.txt +++ b/doc/llms.txt @@ -321,13 +321,13 @@ Generated by doc/tables/generate.py with the page's tables. Page: https://webcpp ## Constant time, measured -- AES-GCM: BearSSL: native, Valgrind's memcheck (Linux), MemorySanitizer (Linux, clang) and dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; wasip2, dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; not measured yet on wasip3, emscripten. OpenSSL (seal alone: its open branches on the verdict inside OpenSSL): native, Valgrind's memcheck (Linux), nothing found; not measured yet on wasip2, wasip3. -- AES block cipher: OpenSSL: not measured yet. ctaes: native, Valgrind's memcheck (Linux), MemorySanitizer (Linux, clang) and dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; wasip2, dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; not measured yet on wasip3, emscripten. +- AES-GCM: BearSSL: native, Valgrind's memcheck (Linux), MemorySanitizer (Linux, clang) and dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; wasip2, dudect (printed, not judged: under wasmtime its timing follows the runner's processor); not measured yet on wasip3, emscripten. OpenSSL (seal alone: its open branches on the verdict inside OpenSSL): native, Valgrind's memcheck (Linux), nothing found; not measured yet on wasip2, wasip3. +- AES block cipher: OpenSSL: not measured yet. ctaes: native, Valgrind's memcheck (Linux), MemorySanitizer (Linux, clang) and dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; wasip2, dudect (printed, not judged: under wasmtime its timing follows the runner's processor); not measured yet on wasip3, emscripten. - secp256k1: libsecp256k1: native, Valgrind's memcheck (Linux; libsecp256k1's own `ctime_tests.c`, and webcpp's code around it: the key pair's making and `secret()`, its signatures and x-only tweak, ECDH in three forms (`agree`, `agree_hashed` and `agree_point`), the secret key's tweaks and negation, and PKCS#8), MemorySanitizer (Linux, clang; the same paths as memcheck's) and dudect (judged; on a runner GitHub hosts, by two of three runs; `agree`), nothing found; wasip2, dudect (judged; on a runner GitHub hosts, by two of three runs; `agree`), nothing found; not measured yet on wasip3, emscripten. - Ed25519: libsodium: native, Valgrind's memcheck (Linux), MemorySanitizer (Linux, clang) and dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; wasip2, dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; not measured yet on wasip3, emscripten. - X25519: libsodium: native, Valgrind's memcheck (Linux) and MemorySanitizer (Linux, clang), nothing found, and dudect (judged; on a runner GitHub hosts, by two of three runs): nothing found with arm64's DIT (data-independent timing) bit set, which webcpp sets around every call on 64-bit ARM under macOS, iOS, Linux, Android and Windows where the CPU has it, as Apple requires of constant-time code ([Apple, Writing ARM64 code for Apple platforms: enable DIT for constant-time cryptographic operations](https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms#Enable-DIT-for-constant-time-cryptographic-operations)); the lane's dudect sets nothing itself and measures what a program gets: |t| 1.8 to 2.8 against the threshold 10 (2026-11-21, five runs), while its `dudect_planted`, an early-exit scan of the secret key run inside the same guard, reads |t| 66.72 and 65.53 (2026-11-21): DIT does not hide a leak. Without DIT, dudect times `agree` with an all-zero secret key against random ones at |t| 6.7 to 14.5 (2026-11-19) and 4.3 to 7.8 (2026-11-21, three runs): about one nanosecond in 15 µs. Each on an Apple M5 Max, from a release build. libsodium does not set DIT, and webcpp sets nothing on x86 or WebAssembly; wasip2, dudect (judged; on a runner GitHub hosts, by two of three runs): an open finding, its cause measured: dudect times `agree` with an all-zero secret key against random ones at |t| 13 to 32 (2026-11-18; a fixed key against another fixed key: 22.9) and 107 to 260 (2026-11-19), and 25.25 in the lane on 2026-11-21, against the threshold 10, under wasmtime 47 on an Apple M5 Max, from a release build. The cause is Apple silicon's DIT (data-independent timing), which wasmtime does not set ([Apple, Writing ARM64 code for Apple platforms: enable DIT for constant-time cryptographic operations](https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms#Enable-DIT-for-constant-time-cryptographic-operations)): with DIT set in wasmtime's main thread, an experiment and not the lane, the same case reads |t| 1.5 to 2.1; no branch on a secret was found in the WebAssembly or in wasmtime's compiled code. The lane cannot set DIT from inside the WebAssembly, so it prints this value on wasip2 without judging it; the CI's x86-64 run measures it next; not measured yet on wasip3, emscripten. - crypto_kx: libsodium: native, Valgrind's memcheck (Linux) and MemorySanitizer (Linux, clang), nothing found; not measured yet on wasip2, wasip3, emscripten. -- ChaCha20-Poly1305: libsodium: native, Valgrind's memcheck (Linux) and MemorySanitizer (Linux, clang), nothing found; not measured yet on wasip2, wasip3, emscripten. BearSSL: native, Valgrind's memcheck (Linux), MemorySanitizer (Linux, clang) and dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; wasip2, dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; not measured yet on wasip3, emscripten. OpenSSL (seal alone: its open branches on the verdict inside OpenSSL): native, Valgrind's memcheck (Linux), nothing found; not measured yet on wasip2, wasip3. +- ChaCha20-Poly1305: libsodium: native, Valgrind's memcheck (Linux) and MemorySanitizer (Linux, clang), nothing found; not measured yet on wasip2, wasip3, emscripten. BearSSL: native, Valgrind's memcheck (Linux), MemorySanitizer (Linux, clang) and dudect (judged; on a runner GitHub hosts, by two of three runs), nothing found; wasip2, dudect (printed, not judged: under wasmtime its timing follows the runner's processor); not measured yet on wasip3, emscripten. OpenSSL (seal alone: its open branches on the verdict inside OpenSSL): native, Valgrind's memcheck (Linux), nothing found; not measured yet on wasip2, wasip3. - original ChaCha20-Poly1305: libsodium: native, Valgrind's memcheck (Linux) and MemorySanitizer (Linux, clang), nothing found; not measured yet on wasip2, wasip3, emscripten. - XChaCha20-Poly1305: libsodium: native, Valgrind's memcheck (Linux) and MemorySanitizer (Linux, clang), nothing found; not measured yet on wasip2, wasip3, emscripten. - XSalsa20-Poly1305 secret box: libsodium: native, Valgrind's memcheck (Linux) and MemorySanitizer (Linux, clang), nothing found; not measured yet on wasip2, wasip3, emscripten. @@ -338,7 +338,7 @@ Generated by doc/tables/generate.py with the page's tables. Page: https://webcpp - ElligatorSwift: libsecp256k1: native, Valgrind's memcheck (Linux; libsecp256k1's own `ctime_tests.c`, and webcpp's `ellswift_create` and `ellswift_xdh` around it) and MemorySanitizer (Linux, clang; the same paths as memcheck's), nothing found; not measured yet on wasip2, wasip3, emscripten. - MuSig2: libsecp256k1: native, Valgrind's memcheck (Linux; libsecp256k1's own `ctime_tests.c`, and webcpp's `generate_nonce` and `partial_sign` around it) and MemorySanitizer (Linux, clang; the same paths as memcheck's), nothing found; not measured yet on wasip2, wasip3, emscripten. - BIP 352 silent payments: libsecp256k1: native, Valgrind's memcheck (Linux; libsecp256k1's own `ctime_tests.c`, and webcpp's `create_outputs`, `create_label` and `scan_outputs` around it, each workspace's wipe included) and MemorySanitizer (Linux, clang; the same paths as memcheck's), nothing found; not measured yet on wasip2, wasip3, emscripten. -- P-256: BearSSL: native, Valgrind's memcheck (Linux; the key pair's making, `sign` of a digest (`crypto::signing_schemes::prehashed`), which makes its signature low S without a branch, then `low_s()` and `is_low_s()` of it, `agree` and the private formats, `pkcs8`, `raw` and `pem(pkcs8)` both ways; BearSSL's own branches on its signing's verdicts listed in `bearssl_verdicts.supp`; nothing found at webcpp's pin ae63032, whose patch submitted upstream closes upstream's leak of the nonce's bit length in `sign` that this checker found on 2026-11-21, `sign` with its low-S step included (Valgrind 3.22, arm64 Linux container, 2026-12-02)), MemorySanitizer (Linux, clang; the same paths as memcheck's; the same leak in `sign` on 2026-11-21 on upstream's BearSSL, nothing at webcpp's pin ae63032, `sign` with its low-S step included (clang 18, arm64 Linux container, 2026-12-02)) and dudect (judged; on a runner GitHub hosts, by two of three runs; `sign` of a digest and `agree`, each against the key pair's scalar; `sign` with its low-S step judged constant time, |t| 1.70 on Linux and 1.63 natively on an Apple M5 Max (release, one run each, 2026-11-22; provisional, measured again in the final quiet pass)), nothing found; wasip2, dudect (judged; on a runner GitHub hosts, by two of three runs; `sign` of a digest and `agree`, each against the key pair's scalar; `sign` with its low-S step judged constant time, |t| 1.70 on Linux and 1.63 natively on an Apple M5 Max (release, one run each, 2026-11-22; provisional, measured again in the final quiet pass)), nothing found; not measured yet on wasip3, emscripten. +- P-256: BearSSL: native, Valgrind's memcheck (Linux; the key pair's making, `sign` of a digest (`crypto::signing_schemes::prehashed`), which makes its signature low S without a branch, then `low_s()` and `is_low_s()` of it, `agree` and the private formats, `pkcs8`, `raw` and `pem(pkcs8)` both ways; BearSSL's own branches on its signing's verdicts listed in `bearssl_verdicts.supp`; nothing found at webcpp's pin ae63032, whose patch submitted upstream closes upstream's leak of the nonce's bit length in `sign` that this checker found on 2026-11-21, `sign` with its low-S step included (Valgrind 3.22, arm64 Linux container, 2026-12-02)), MemorySanitizer (Linux, clang; the same paths as memcheck's; the same leak in `sign` on 2026-11-21 on upstream's BearSSL, nothing at webcpp's pin ae63032, `sign` with its low-S step included (clang 18, arm64 Linux container, 2026-12-02)) and dudect (judged; on a runner GitHub hosts, by two of three runs; `sign` of a digest and `agree`, each against the key pair's scalar; `sign` with its low-S step judged constant time, |t| 1.70 on Linux and 1.63 natively on an Apple M5 Max (release, one run each, 2026-11-22; provisional, measured again in the final quiet pass)), nothing found; wasip2, dudect (printed, not judged: under wasmtime its timing follows the runner's processor); not measured yet on wasip3, emscripten. ## Rules of use diff --git a/doc/tables/crypto.json b/doc/tables/crypto.json index 9d9ba46..b7b8bff 100644 --- a/doc/tables/crypto.json +++ b/doc/tables/crypto.json @@ -1,10 +1,11 @@ { - "comment": "The data of crypto's generated tables and of llms.txt; doc/tables/generate.py reads it with the test Jamfiles, the message tests and the superproject's Jamfile fixtures, and writes doc/generated/, doc/llms.txt, include/webcpp/crypto/detail/capabilities.hpp, include/webcpp/crypto/detail/defaults.hpp and test/capabilities_test.cpp. The capability table is `families`: per family its algorithms, the targets on which each backend has it (each claimed only where a test of the family's operations on that backend runs), constant time per target where it differs from the backend's own `constant_time` (X25519 on wasip2, an open finding, and natively without arm64's DIT, the cause of both), with `constant_time_checker` naming the checker, or the list of checkers, that measured it where that is not every checker of the target, and the default per target, one whatever the program links (design D32), with its reason and the tests that fix it (a row of some of `compilers` restates its target's default for them, with a reason of their own, and each compiler of a target has one row), from which come include/webcpp/crypto/detail/defaults.hpp and the refusal that says what a program whose default is not linked needs; a backend with `targets`, where it is built, is a tag of `backends`. A name in a text is written between backticks, as Markdown writes code: the tables show it as code and llms.txt keeps the backticks. A comparison table's cell {speed:} or {constant_time:} is written from doc/performance.json or from the family's `constant_time`, and each cell of a column a namespace lists in `cited` cites a source or begins with \"none\". Edit this file, then run python3 libs/crypto/doc/tables/generate.py; the doc build runs it with --check.", + "comment": "The data of crypto's generated tables and of llms.txt; doc/tables/generate.py reads it with the test Jamfiles, the message tests and the superproject's Jamfile fixtures, and writes doc/generated/, doc/llms.txt, include/webcpp/crypto/detail/capabilities.hpp, include/webcpp/crypto/detail/defaults.hpp and test/capabilities_test.cpp. The capability table is `families`: per family its algorithms, the targets on which each backend has it (each claimed only where a test of the family's operations on that backend runs), constant time per target where it differs from the backend's own `constant_time` (X25519 on wasip2, an open finding, and natively without arm64's DIT, the cause of both), with `constant_time_checker` naming the checker, or the list of checkers, that measured it where that is not every checker of the target, and the default per target, one whatever the program links (design D32), with its reason and the tests that fix it (a row of some of `compilers` restates its target's default for them, with a reason of their own, and each compiler of a target has one row), from which come include/webcpp/crypto/detail/defaults.hpp and the refusal that says what a program whose default is not linked needs; a backend with `targets`, where it is built, is a tag of `backends`. A name in a text is written between backticks, as Markdown writes code: the tables show it as code and llms.txt keeps the backticks. A comparison table's cell {speed:} or {constant_time:} is written from doc/performance.json or from the family's `constant_time`, and each cell of a column a namespace lists in `cited` cites a source or begins with \"none\". `checkers` names the constant-time lane's checkers; one of `unjudged_checkers` prints what it measures and judges nothing, so a table gives it no result: dudect of the program `dudect_bearssl` (BearSSL, ctaes, `secure::constant_time_equal` and hash's Base58Check) on a WASI target, which judges none of its cases there by the owner's decision of 2026-12-04, as their timing under wasmtime follows the runner's processor. Edit this file, then run python3 libs/crypto/doc/tables/generate.py; the doc build runs it with --check.", "page": "https://webcpporg.github.io/libs/crypto/", "llms": "Cryptographic primitives for C++20 on native, wasip2, wasip3 and Emscripten: AES-GCM, the AES block cipher, secp256k1 (BIP 340 Schnorr, ECDSA and recoverable signatures, ECDH, tweaks, ElligatorSwift, MuSig2, silent payments), Ed25519 and Ed25519ph (RFC 8032), X25519 (RFC 7748), their keys in SPKI, PKCS#8 (RFC 8410) and PEM, P-256 key pairs, ECDSA and ECDH on BearSSL, libsodium's crypto_kx, the ChaCha20-Poly1305 AEADs, libsodium's secret boxes, boxes and sealed boxes, a random_device on the system's generator, each over a widely used, reviewed C library (BearSSL, OpenSSL, ctaes, libsecp256k1, libsodium) that the program names in its Jamfile. Hashing and HMAC are Boost.Hash2's; HKDF and password hashing are webcpp::hash's; the constant-time comparison, the erasure of a buffer and secret are webcpp::secure's. Every failure is a boost::system::result value. Protocols (Bitcoin, Ethereum, Nostr) belong to domain libraries built on these primitives.", "targets": ["native", "wasip2", "wasip3", "emscripten"], "compilers": {"clang": "Clang", "gcc": "GCC", "msvc": "MSVC"}, - "checkers": {"memcheck": "Valgrind's memcheck (Linux)", "msan": "MemorySanitizer (Linux, clang)", "dudect": "dudect (judged; on a runner GitHub hosts, by two of three runs)"}, + "checkers": {"memcheck": "Valgrind's memcheck (Linux)", "msan": "MemorySanitizer (Linux, clang)", "dudect": "dudect (judged; on a runner GitHub hosts, by two of three runs)", "dudect_printed": "dudect (printed, not judged: under wasmtime its timing follows the runner's processor)"}, + "unjudged_checkers": ["dudect_printed"], "sources": { "fips197": ["FIPS 197, the Advanced Encryption Standard", "https://csrc.nist.gov/pubs/fips/197/final"], "sp800-38d": ["NIST SP 800-38D, GCM and GMAC", "https://csrc.nist.gov/pubs/sp/800/38/d/final"], @@ -231,7 +232,7 @@ "constant_time": "webcpp::secure's `secure::constant_time_equal`, which crypto's code calls, is constant time in the contents: every byte is read, no branch and no index depends on one", "constant_time_sources": [], "lane_paths": [ - {"what": "`secure::constant_time_equal`", "lane": {"native": ["memcheck", "msan", "dudect"], "wasip2": ["dudect"]}}, + {"what": "`secure::constant_time_equal`", "lane": {"native": ["memcheck", "msan", "dudect"], "wasip2": ["dudect_printed"]}}, {"what": "`is_all_zero` and the wipe of `secure::secret`", "lane": {"native": ["memcheck", "msan"]}} ] } @@ -825,7 +826,7 @@ {"targets": ["emscripten"], "backend": "bearssl", "tests": ["default_bearssl", "default_backend_all_linked_emscripten"], "why": "the only AES-GCM backend there: webcpp does not build OpenSSL for Emscripten"} ], "backends": { - "bearssl": {"targets": "all", "lane": {"native": ["memcheck", "msan", "dudect"], "wasip2": ["dudect"]}}, + "bearssl": {"targets": "all", "lane": {"native": ["memcheck", "msan", "dudect"], "wasip2": ["dudect_printed"]}}, "openssl": {"targets": "all", "lane": {"native": ["memcheck"]}, "lane_note": "seal alone: its open branches on the verdict inside OpenSSL"} } }, @@ -849,7 +850,7 @@ ], "backends": { "openssl": {"targets": "all"}, - "ctaes": {"targets": "all", "lane": {"native": ["memcheck", "msan", "dudect"], "wasip2": ["dudect"]}} + "ctaes": {"targets": "all", "lane": {"native": ["memcheck", "msan", "dudect"], "wasip2": ["dudect_printed"]}} } }, { @@ -938,7 +939,7 @@ ], "backends": { "sodium": {"targets": "all", "lane": {"native": ["memcheck", "msan"]}}, - "bearssl": {"targets": "all", "lane": {"native": ["memcheck", "msan", "dudect"], "wasip2": ["dudect"]}}, + "bearssl": {"targets": "all", "lane": {"native": ["memcheck", "msan", "dudect"], "wasip2": ["dudect_printed"]}}, "openssl": {"targets": "all", "lane": {"native": ["memcheck"]}, "lane_note": "seal alone: its open branches on the verdict inside OpenSSL"} } }, @@ -1129,7 +1130,7 @@ {"targets": ["native", "wasip2", "wasip3", "emscripten"], "backend": "bearssl", "tests": ["p256_keys_bearssl", "p256_ecdsa_bearssl", "p256_ecdh_bearssl", "default_backend_none_linked"], "why": "the one backend of the P-curves on all four targets, constant time by design and allocating nothing ({bearssl}); OpenSSL and Botan join in increments 8 and 7"} ], "backends": { - "bearssl": {"targets": "all", "lane": {"native": ["memcheck", "msan", "dudect"], "wasip2": ["dudect"]}, "lane_note": {"memcheck": "the key pair's making, `sign` of a digest (`crypto::signing_schemes::prehashed`), which makes its signature low S without a branch, then `low_s()` and `is_low_s()` of it, `agree` and the private formats, `pkcs8`, `raw` and `pem(pkcs8)` both ways; BearSSL's own branches on its signing's verdicts listed in `bearssl_verdicts.supp`; nothing found at webcpp's pin ae63032, whose patch submitted upstream closes upstream's leak of the nonce's bit length in `sign` that this checker found on 2026-11-21, `sign` with its low-S step included (Valgrind 3.22, arm64 Linux container, 2026-12-02)", "msan": "the same paths as memcheck's; the same leak in `sign` on 2026-11-21 on upstream's BearSSL, nothing at webcpp's pin ae63032, `sign` with its low-S step included (clang 18, arm64 Linux container, 2026-12-02)", "dudect": "`sign` of a digest and `agree`, each against the key pair's scalar; `sign` with its low-S step judged constant time, |t| 1.70 on Linux and 1.63 natively on an Apple M5 Max (release, one run each, 2026-11-22; provisional, measured again in the final quiet pass)"}} + "bearssl": {"targets": "all", "lane": {"native": ["memcheck", "msan", "dudect"], "wasip2": ["dudect_printed"]}, "lane_note": {"memcheck": "the key pair's making, `sign` of a digest (`crypto::signing_schemes::prehashed`), which makes its signature low S without a branch, then `low_s()` and `is_low_s()` of it, `agree` and the private formats, `pkcs8`, `raw` and `pem(pkcs8)` both ways; BearSSL's own branches on its signing's verdicts listed in `bearssl_verdicts.supp`; nothing found at webcpp's pin ae63032, whose patch submitted upstream closes upstream's leak of the nonce's bit length in `sign` that this checker found on 2026-11-21, `sign` with its low-S step included (Valgrind 3.22, arm64 Linux container, 2026-12-02)", "msan": "the same paths as memcheck's; the same leak in `sign` on 2026-11-21 on upstream's BearSSL, nothing at webcpp's pin ae63032, `sign` with its low-S step included (clang 18, arm64 Linux container, 2026-12-02)", "dudect": "`sign` of a digest and `agree`, each against the key pair's scalar; `sign` with its low-S step judged constant time, |t| 1.70 on Linux and 1.63 natively on an Apple M5 Max (release, one run each, 2026-11-22; provisional, measured again in the final quiet pass)"}} } } ], diff --git a/doc/tables/generate.py b/doc/tables/generate.py index aaaa4af..d85cbe1 100644 --- a/doc/tables/generate.py +++ b/doc/tables/generate.py @@ -628,6 +628,10 @@ def check_families(data: Data, declared: Dict[str, List[str]]) -> None: raise Fault(f'crypto.json: the operation {operation["id"]} names the family ' f'{operation["family"]}, which crypto.json does not list') tags = tags_of(data) + for checker in data.get('unjudged_checkers', []): + if checker not in data.get('checkers', {}): + raise Fault(f'crypto.json: unjudged_checkers names the checker {checker}, which ' + 'checkers does not list') for family in data['families']: name = family['name'] for backend, entry in family['backends'].items(): @@ -1271,11 +1275,13 @@ def lane_text(data: Data, family: Data, cite_with: Any, names_with: Any = None) """What the constant-time lane covers of a family, per backend and target, from crypto.json's `lane` of each backend: the checkers on each target, then nothing found, or the family's measured `constant_time` there, given to the checkers `constant_time_checker` names, the others - nothing found; not measured yet on the targets the lane does not run; a + nothing found; a checker of `unjudged_checkers`, which prints and judges nothing, after them, + with no result of its own; not measured yet on the targets the lane does not run; a backend's `lane_note` beside its name, or, a note of one checker, beside that checker's. Names between backticks are written by names_with, inline code by default; llms.txt keeps the backticks.""" names_with = names_with or marked + printing_only = data.get('unjudged_checkers', []) sentences: List[str] = [] for backend, entry in family['backends'].items(): title = data['backends'][backend]['title'] @@ -1291,16 +1297,25 @@ def titled(names: List[str]) -> str: for name in names]) for target in data['targets']: if target in lane: + # A checker that prints and judges nothing finds nothing: it follows the others, + # and alone it has no result. + unjudged = [name for name in lane[target] if name in printing_only] + judging = [name for name in lane[target] if name not in unjudged] + also = f', and {titled(unjudged)}' if unjudged else '' + if not judging: + result = f': {cite_with(data, found[target])}' if target in found else '' + pieces.append(f'{target}, {titled(unjudged)}{result}') + continue found_by = finders(entry, target) - others = [name for name in lane[target] if name not in (found_by or [])] + others = [name for name in judging if name not in (found_by or [])] if target in found and found_by is not None and others: # A finding of some checkers is theirs: the others found nothing. pieces.append(f'{target}, {titled(others)}, nothing found, and ' - f'{titled(found_by)}: {cite_with(data, found[target])}') + f'{titled(found_by)}: {cite_with(data, found[target])}{also}') continue result = (f': {cite_with(data, found[target])}' if target in found else ', nothing found') - pieces.append(f'{target}, {titled(lane[target])}{result}') + pieces.append(f'{target}, {titled(judging)}{result}{also}') rest = [target for target in cell_targets(data, family, backend) if target not in lane] if rest and pieces: pieces.append(f'not measured yet on {", ".join(rest)}') diff --git a/doc/tables/generate_test.py b/doc/tables/generate_test.py index 723fb12..383e40c 100644 --- a/doc/tables/generate_test.py +++ b/doc/tables/generate_test.py @@ -1704,6 +1704,36 @@ def test_a_lane_note_of_one_checker_is_written_beside_that_checker_alone(_: Path assert text.startswith('libsodium (its own tests): native, memcheck (Linux) and dudect'), text +def test_an_unjudged_checker_is_written_with_no_result(_: Path) -> None: + data = two_ciphers() + data['checkers']['printed'] = 'dudect (printed, not judged)' + data['unjudged_checkers'] = ['printed'] + for backend in data['backends'].values(): + backend.update({'library': 'l', 'constant_time': 'by design', 'constant_time_sources': []}) + entry = data['families'][0]['backends']['sodium'] + del entry['constant_time'] + entry['lane'] = {'native': ['memcheck', 'printed'], 'wasip2': ['printed']} + text = generate.lane_text(data, data['families'][0], generate.cite) + # Alone it has no result; beside a judging checker, nothing found is that checker's alone. + assert text.startswith('libsodium: native, memcheck (Linux), nothing found, and dudect ' + '(printed, not judged); wasip2, dudect (printed, not judged); not ' + 'measured yet on wasip3'), text + page = generate.constant_time_page(data) + assert '|dudect (printed, not judged): ChaCha20-Poly1305\n' in page, page + # A finding stays its own where the only checker prints. + entry['constant_time'] = {'wasip2': 'over the threshold ({rfc8439})'} + text = generate.lane_text(data, data['families'][0], generate.cite) + assert 'wasip2, dudect (printed, not judged): over the threshold' in text, text + + +def test_an_unjudged_checker_must_be_a_checker(_: Path) -> None: + data = small_table() + data['checkers'] = {'dudect': 'dudect'} + data['unjudged_checkers'] = ['printed'] + a_fault(data, {'ed25519': EVERY_TARGET}, + 'unjudged_checkers names the checker printed, which checkers does not list') + + def test_a_lane_note_of_a_checker_the_lane_does_not_run_is_a_fault(_: Path) -> None: data = small_table() data['checkers'] = {'memcheck': 'memcheck (Linux)', 'dudect': 'dudect'} @@ -1913,6 +1943,8 @@ def test_a_namespace_table_is_split_into_its_parts(_: Path) -> None: test_a_finding_s_checker_must_measure_it_there, test_a_lane_note_of_one_checker_is_written_beside_that_checker_alone, test_a_lane_note_of_a_checker_the_lane_does_not_run_is_a_fault, + test_an_unjudged_checker_is_written_with_no_result, + test_an_unjudged_checker_must_be_a_checker, test_llms_gives_no_default_where_the_family_has_none, test_a_cipher_has_its_own_default_apart_from_the_mode_built_on_it, test_a_namespace_table_is_split_into_its_parts, diff --git a/doc/testing.adoc b/doc/testing.adoc index a391f44..24aa67e 100644 --- a/doc/testing.adoc +++ b/doc/testing.adoc @@ -51,9 +51,11 @@ two fresh processes, failing when two of the three values exceed 10 native lane's command with `libs/crypto/test/constant_time//constant-time` in place of the two directories. Its paths include webcpp::hash's Base58Check, the secret encode and decode of a WIF key's payload, which hash leaves to crypto's -lane; on wasip2 dudect prints that decode's |t| without judging it, an open -finding of codecs' secret base58 conversion under wasmtime, as X25519's -agreement is there (<>). +lane; on wasip2 that decode's |t| is an open finding of codecs' secret base58 +conversion under wasmtime, as X25519's agreement is there. On a WASI target +`dudect_bearssl`, which measures BearSSL, ctaes, `secure::constant_time_equal` +and that decode, prints each case and judges none, as their timing under +wasmtime follows the runner's processor (<>). The own lane `fuzz` runs libFuzzer natively on Linux, with clang, AddressSanitizer and UndefinedBehaviorSanitizer, for 60 seconds a target from a diff --git a/test/constant_time/Jamfile b/test/constant_time/Jamfile index 6cdc989..30f5f59 100644 --- a/test/constant_time/Jamfile +++ b/test/constant_time/Jamfile @@ -262,9 +262,9 @@ if [ os.environ RUNNER_ENVIRONMENT ] = github-hosted { DUDECT += WEBCPP_TEST_DUDECT_UNJUDGED ; } -# On wasip2, hash's Base58Check secret decode (base58_decode) is measured and -# printed but not judged: an open finding of codecs' secret base58 conversion -# under wasmtime, which dudect_test.cpp's header describes. +# On a WASI target every case of dudect_bearssl is measured and printed but +# none is judged, by the owner's decision of 2026-12-04: under wasmtime their +# timing follows the runner's processor (dudect_test.cpp, unjudged_here). webcpp.run dudect_bearssl : dudect_test.cpp : /third_party//bearssl /third_party//ctaes /webcpp/hash//base58_with_checksum $(DUDECT) diff --git a/test/constant_time/dudect.hpp b/test/constant_time/dudect.hpp index 981f356..103457f 100644 --- a/test/constant_time/dudect.hpp +++ b/test/constant_time/dudect.hpp @@ -625,21 +625,43 @@ inline std::optional select_case(int argc, char const* const* ar /** * The cases a program measured: each one's lines printed as it is recorded, the human line that - * lists them, and whether every judged one passes. + * lists them, and whether every judged one passes. A program that judges none of its cases on + * the target it runs on says why once, and each of its cases is printed `judged=no`, whatever + * the case's own flag, so that the CI's judge measures none of them again. */ class case_results { public: + /** + * Results that judge each case by its own flag, or none of them. + * @param unjudged Why the program judges no case here, which `print` writes; nullptr, the + * default, where each case's own flag decides. + */ + explicit case_results(char const* unjudged = nullptr) noexcept : unjudged_(unjudged) {} + + /** + * Whether a case counts in the verdict: its own flag, unless the program judges no case here. + * A program measures a case through `measure_case` with this value, so that a case not judged + * runs once. + * @param judged_case The case's own flag. + * @return Whether its |t| counts. + */ + [[nodiscard]] bool judges(bool judged_case) const noexcept { + return judged_case && unjudged_ == nullptr; + } + /** * Prints a case's lines (`report_case`) and adds it to the human line and to the verdict. * @param name The case's name, as `--case` takes it. * @param label Its name in the human line. * @param result Its statistic. - * @param judged_case Whether its |t| counts in the verdict. + * @param judged_case Whether its |t| counts in the verdict, where the program judges its + * cases (`judges`). * @param buffers The buffers it measures: its input, its output and its object. * @param note Printed after its value in the human line. */ void record(char const* name, char const* label, t_statistic const& result, bool judged_case, std::initializer_list
buffers, char const* note = "") { + judged_case = judges(judged_case); report_case(name, result, judged_case, buffers); std::array value{}; static_cast(std::snprintf(value.data(), value.size(), "%s%s %.2f%s", @@ -649,8 +671,16 @@ class case_results { passes_ = passes_ && (!judged_case || printed(result.t) < 10); } - /** Prints the human line: `|t|