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
17 changes: 14 additions & 3 deletions doc/backends.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,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
Expand All @@ -247,7 +257,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
Expand Down
6 changes: 3 additions & 3 deletions doc/generated/constant-time.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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, one of the two patches of webcpp's pin f8a2f3d (upstream 7bea48e plus exactly the patches 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]); P-256's `+mul+`, which ECDH calls, at webcpp's pin, whose other patch submitted upstream removes the jump on the secret scalar that Clang makes on x86-64 of upstream's scalar check (link:https://www.bearssl.org/gitweb/?p=BearSSL;a=blob;f=src/ec/ec_p256_m62.c;hb=7bea48e5e850ab4cafbe68d3765cdaba13a86d6f#l1623[BearSSL's ec_p256_m62.c at upstream 7bea48e, lines 1623 to 1627: the scalar compared with the order through masks that Clang on x86-64 compiles into a conditional jump on the comparison so far]; the patch: link:https://github.com/webcpporg/bearssl/commit/ec57f886ee0a0783acfca1b465b43ccd62b71046[webcpporg/bearssl, commit ec57f88 on its branch upstream/ec-p256-check-scalar-constant-time, the other patch of webcpp's pin f8a2f3d: check_scalar in ec_p256_m62.c and ec_p256_m64.c computing 0 < k < n as k - 1 < n - 1 with two borrow chains, no select for a compiler to turn into a jump; 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 f8a2f3d, whose patches submitted upstream close upstream's leak of the nonce's bit length in `+sign+` that this checker found on 2026-11-21 and the jump on the scalar in P-256's scalar check that it found under `+agree+` on the x86-64 runner on 2026-12-03, `+sign+` with its low-S step included (Valgrind 3.22, arm64 Linux container, 2026-12-02; x86-64, `+ctgrind+` and `+ctgrind_space+`, 2026-12-04)); 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); MemorySanitizer checks the select of P-256's scalar check before the code generator makes it a jump, so the second patch changes nothing it sees); 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

Expand All @@ -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

Expand Down Expand Up @@ -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<N>+`; MemorySanitizer (Linux, clang): `+secure::constant_time_equal+`, `+is_all_zero+` and the wipe of `+secure::secret<N>+`; 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
|===
Expand Down
36 changes: 18 additions & 18 deletions doc/generated/messages.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1307,19 +1307,19 @@ On each target, the build's output contains:
+
* native, macOS:
** `+Undefined symbols for architecture+`
** `+_webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link+`
** `+_webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link+`
* native, Linux:
** `+webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link+`
** `pass:[undefined reference to &#96;webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link']`
** `+webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link+`
** `pass:[undefined reference to &#96;webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link']`
* wasip2:
** `+wasm-ld: error:+`
** `+undefined symbol: webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link+`
** `+undefined symbol: webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link+`
* wasip3:
** `+wasm-ld: error:+`
** `+undefined symbol: webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link+`
** `+undefined symbol: webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link+`
* emscripten:
** `+wasm-ld: error:+`
** `+undefined symbol: webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link+`
** `+undefined symbol: webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link+`
** `pass:[em++: error:]`

`+canary_other_commit+`:: A BearSSL of another commit than the headers'. The fix: Build the library at the commit of webcpp's submodule, or link it through b2.
Expand Down Expand Up @@ -1363,19 +1363,19 @@ On each target, the build's output contains:
+
* native, macOS:
** `+Undefined symbols for architecture+`
** `+_webcpp_crypto_bearssl_f8a2f3d_sysrng__add_third_party_bearssl_to_your_link+`
** `+_webcpp_crypto_bearssl_ae63032_sysrng__add_third_party_bearssl_to_your_link+`
* native, Linux:
** `+webcpp_crypto_bearssl_f8a2f3d_sysrng__add_third_party_bearssl_to_your_link+`
** `pass:[undefined reference to &#96;webcpp_crypto_bearssl_f8a2f3d_sysrng__add_third_party_bearssl_to_your_link']`
** `+webcpp_crypto_bearssl_ae63032_sysrng__add_third_party_bearssl_to_your_link+`
** `pass:[undefined reference to &#96;webcpp_crypto_bearssl_ae63032_sysrng__add_third_party_bearssl_to_your_link']`
* wasip2:
** `+wasm-ld: error:+`
** `+undefined symbol: webcpp_crypto_bearssl_f8a2f3d_sysrng__add_third_party_bearssl_to_your_link+`
** `+undefined symbol: webcpp_crypto_bearssl_ae63032_sysrng__add_third_party_bearssl_to_your_link+`
* wasip3:
** `+wasm-ld: error:+`
** `+undefined symbol: webcpp_crypto_bearssl_f8a2f3d_sysrng__add_third_party_bearssl_to_your_link+`
** `+undefined symbol: webcpp_crypto_bearssl_ae63032_sysrng__add_third_party_bearssl_to_your_link+`
* emscripten:
** `+wasm-ld: error:+`
** `+undefined symbol: webcpp_crypto_bearssl_f8a2f3d_sysrng__add_third_party_bearssl_to_your_link+`
** `+undefined symbol: webcpp_crypto_bearssl_ae63032_sysrng__add_third_party_bearssl_to_your_link+`
** `pass:[em++: error:]`

`+canary_secp256k1_missing+`:: libsecp256k1's headers used without its library. The fix: Link `+/third_party//secp256k1+`.
Expand Down Expand Up @@ -1475,19 +1475,19 @@ On each target, the build's output contains:
+
* native, macOS:
** `+Undefined symbols for architecture+`
** `+_webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link+`
** `+_webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link+`
* native, Linux:
** `+webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link+`
** `pass:[undefined reference to &#96;webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link']`
** `+webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link+`
** `pass:[undefined reference to &#96;webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link']`
* wasip2:
** `+wasm-ld: error:+`
** `+undefined symbol: webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link+`
** `+undefined symbol: webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link+`
* wasip3:
** `+wasm-ld: error:+`
** `+undefined symbol: webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link+`
** `+undefined symbol: webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link+`
* emscripten:
** `+wasm-ld: error:+`
** `+undefined symbol: webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link+`
** `+undefined symbol: webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link+`
** `pass:[em++: error:]`

`+chacha_default_not_linked_on_emscripten+`:: A program for Emscripten that calls the three ChaCha20-Poly1305 AEADs on their default, libsodium, and links none. The fix: As `+chacha_default_not_linked+`.
Expand Down
6 changes: 3 additions & 3 deletions doc/generated/namespace-ciphers.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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 (<<crypto-backends-constant-time>>)
|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 (<<crypto-backends-constant-time>>)
|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 (<<crypto-backends-constant-time>>)
|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 (<<crypto-backends-constant-time>>)

|Standards
|link:https://csrc.nist.gov/pubs/sp/800/38/d/final[NIST SP 800-38D, GCM and GMAC]
Expand Down Expand Up @@ -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 (<<crypto-backends-constant-time>>)
|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 (<<crypto-backends-constant-time>>)
|libsodium: native, Valgrind's memcheck (Linux) and MemorySanitizer (Linux, clang), nothing found; not measured yet on wasip2, wasip3, emscripten (<<crypto-backends-constant-time>>)
|libsodium: native, Valgrind's memcheck (Linux) and MemorySanitizer (Linux, clang), nothing found; not measured yet on wasip2, wasip3, emscripten (<<crypto-backends-constant-time>>)

Expand Down
Loading
Loading