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
12 changes: 12 additions & 0 deletions doc/backends.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ 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.

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
the same instructions whatever the class, since anything a class does
differently before the measured call shows in its time. On a runner GitHub
hosts, a virtual machine shared with other tenants whose processor changes from
run to run, the lane prints each dudect |t| and judges none but
`dudect_planted`'s: measured there on 2026-11-20 on three processors, 23 runs of
24 stayed below 4.4 and one read 69.8, on both seeds, on a case below 4.4 in
every other run, so a verdict there would pass or fail with the machine drawn.
Valgrind's memcheck and MemorySanitizer, which do not measure time, are judged
there; dudect is judged wherever else the lane runs, on a machine of one's own.

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
is the one kind of value webcpp marks public, where webcpp's code first
Expand Down
20 changes: 10 additions & 10 deletions doc/generated/constant-time.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

|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; 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; MemorySanitizer (Linux, clang): AES-GCM, ChaCha20-Poly1305; dudect: AES-GCM, ChaCha20-Poly1305
|dudect: AES-GCM, ChaCha20-Poly1305
|Valgrind's memcheck (Linux): AES-GCM, ChaCha20-Poly1305; MemorySanitizer (Linux, clang): AES-GCM, ChaCha20-Poly1305; dudect (judged off the runners GitHub hosts): AES-GCM, ChaCha20-Poly1305
|dudect (judged off the runners GitHub hosts): AES-GCM, ChaCha20-Poly1305
|not measured yet
|not measured yet

Expand All @@ -27,22 +27,22 @@

|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: AES block cipher
|dudect: AES block cipher
|Valgrind's memcheck (Linux): AES block cipher; MemorySanitizer (Linux, clang): AES block cipher; dudect (judged off the runners GitHub hosts): AES block cipher
|dudect (judged off the runners GitHub hosts): AES block cipher
|not measured yet
|not measured yet

|libsecp256k1
|by design: signing and key generation are constant time and constant memory access; link:https://github.com/bitcoin-core/secp256k1#readme[libsecp256k1's README]
|Valgrind's memcheck (Linux): secp256k1 (libsecp256k1's own `+ctime_tests.c+`, and webcpp's code around it: the key pair's making, its signatures and x-only tweak, ECDH in three forms, the secret key's tweaks and negation, and PKCS#8), ElligatorSwift (libsecp256k1's own `+ctime_tests.c+`, and webcpp's `+ellswift_create+` and `+ellswift_xdh+` around it), MuSig2 (libsecp256k1's own `+ctime_tests.c+`, and webcpp's `+nonce_gen+` and `+partial_sign+` around it), BIP 352 silent payments (libsecp256k1's own `+ctime_tests.c+`, and webcpp's `+create_outputs+`, `+create_label+` and `+scan_outputs+` around it, each workspace's wipe included); MemorySanitizer (Linux, clang): secp256k1 (the same paths as memcheck's), ElligatorSwift (the same paths as memcheck's), MuSig2 (the same paths as memcheck's), BIP 352 silent payments (the same paths as memcheck's); dudect: secp256k1 (`+ecdh_x+`)
|dudect: secp256k1 (`+ecdh_x+`)
|Valgrind's memcheck (Linux): secp256k1 (libsecp256k1's own `+ctime_tests.c+`, and webcpp's code around it: the key pair's making, its signatures and x-only tweak, ECDH in three forms, the secret key's tweaks and negation, and PKCS#8), ElligatorSwift (libsecp256k1's own `+ctime_tests.c+`, and webcpp's `+ellswift_create+` and `+ellswift_xdh+` around it), MuSig2 (libsecp256k1's own `+ctime_tests.c+`, and webcpp's `+nonce_gen+` and `+partial_sign+` around it), BIP 352 silent payments (libsecp256k1's own `+ctime_tests.c+`, and webcpp's `+create_outputs+`, `+create_label+` and `+scan_outputs+` around it, each workspace's wipe included); MemorySanitizer (Linux, clang): secp256k1 (the same paths as memcheck's), ElligatorSwift (the same paths as memcheck's), MuSig2 (the same paths as memcheck's), BIP 352 silent payments (the same paths as memcheck's); dudect (judged off the runners GitHub hosts): secp256k1 (`+ecdh_x+`)
|dudect (judged off the runners GitHub hosts): secp256k1 (`+ecdh_x+`)
|not measured yet
|not measured yet

|libsodium
|by its documentation for the paths crypto calls, without a guarantee for the whole library: secrets are compared in constant time (link:https://doc.libsodium.org/internals#branches[libsodium's documentation, internals: branches]), ChaCha20 is not sensitive to timing attacks (link:https://doc.libsodium.org/secret-key_cryptography/aead[libsodium's documentation, AEAD constructions: ChaCha20 and timing attacks]), and Ed25519 and X25519 come from designs with no secret branch and no secret array index (link:https://ed25519.cr.yp.to/[Ed25519's design: no secret branch conditions, no secret array indices]); webcpp's lane checks each path it calls
|Valgrind's memcheck (Linux): Ed25519, X25519, crypto_kx, ChaCha20-Poly1305, original ChaCha20-Poly1305, XChaCha20-Poly1305, XSalsa20-Poly1305 secret box, XChaCha20-Poly1305 secret box, X25519-XSalsa20-Poly1305 box, X25519-XChaCha20-Poly1305 box, X25519-XSalsa20-Poly1305 sealed box; MemorySanitizer (Linux, clang): Ed25519, X25519, crypto_kx, ChaCha20-Poly1305, original ChaCha20-Poly1305, XChaCha20-Poly1305, XSalsa20-Poly1305 secret box, XChaCha20-Poly1305 secret box, X25519-XSalsa20-Poly1305 box, X25519-XChaCha20-Poly1305 box, X25519-XSalsa20-Poly1305 sealed box; dudect: Ed25519, X25519 (X25519 measured differently, below)
|dudect: Ed25519, X25519 (X25519 measured differently, below)
|Valgrind's memcheck (Linux): Ed25519, X25519, crypto_kx, ChaCha20-Poly1305, original ChaCha20-Poly1305, XChaCha20-Poly1305, XSalsa20-Poly1305 secret box, XChaCha20-Poly1305 secret box, X25519-XSalsa20-Poly1305 box, X25519-XChaCha20-Poly1305 box, X25519-XSalsa20-Poly1305 sealed box; MemorySanitizer (Linux, clang): Ed25519, X25519, crypto_kx, ChaCha20-Poly1305, original ChaCha20-Poly1305, XChaCha20-Poly1305, XSalsa20-Poly1305 secret box, XChaCha20-Poly1305 secret box, X25519-XSalsa20-Poly1305 box, X25519-XChaCha20-Poly1305 box, X25519-XSalsa20-Poly1305 sealed box; dudect (judged off the runners GitHub hosts): Ed25519, X25519 (X25519 measured differently, below)
|dudect (judged off the runners GitHub hosts): Ed25519, X25519 (X25519 measured differently, below)
|not measured yet
|not measured yet

Expand All @@ -55,8 +55,8 @@

|no backend
|`+equal+` is constant time in the contents: every byte is read, no branch and no index depends on one
|Valgrind's memcheck (Linux): `+equal+`, `+is_all_zero+` and the wipe of `+secret<N>+`; MemorySanitizer (Linux, clang): `+equal+`, `+is_all_zero+` and the wipe of `+secret<N>+`; dudect: `+equal+`
|dudect: `+equal+`
|Valgrind's memcheck (Linux): `+equal+`, `+is_all_zero+` and the wipe of `+secret<N>+`; MemorySanitizer (Linux, clang): `+equal+`, `+is_all_zero+` and the wipe of `+secret<N>+`; dudect (judged off the runners GitHub hosts): `+equal+`
|dudect (judged off the runners GitHub hosts): `+equal+`
|not measured yet
|not measured yet
|===
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, nothing found; wasip2, dudect, 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, nothing found; wasip2, dudect, nothing found; not measured yet on wasip3, emscripten (<<crypto-backends-constant-time>>)
|BearSSL: native, Valgrind's memcheck (Linux), MemorySanitizer (Linux, clang) and dudect (judged off the runners GitHub hosts), nothing found; wasip2, dudect (judged off the runners GitHub hosts), 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 off the runners GitHub hosts), nothing found; wasip2, dudect (judged off the runners GitHub hosts), nothing found; 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, nothing found; wasip2, dudect, 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 off the runners GitHub hosts), nothing found; wasip2, dudect (judged off the runners GitHub hosts), 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 (<<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
6 changes: 3 additions & 3 deletions doc/generated/namespace-curves.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
|agreement of a secret key and a public key: native, libsodium 15.9 µs; wasip2, libsodium 40.4 µs; wasip3, libsodium 40.4 µs; emscripten, libsodium 35.5 µs (2026-11-19, Apple M5 Max; <<crypto-performance>>)

|Constant time, measured
|libsecp256k1: native, Valgrind's memcheck (Linux; libsecp256k1's own `+ctime_tests.c+`, and webcpp's code around it: the key pair's making, its signatures and x-only tweak, ECDH in three forms, the secret key's tweaks and negation, and PKCS#8), MemorySanitizer (Linux, clang; the same paths as memcheck's) and dudect (`+ecdh_x+`), nothing found; wasip2, dudect (`+ecdh_x+`), nothing found; not measured yet on wasip3, emscripten (<<crypto-backends-constant-time>>)
|libsodium: native, Valgrind's memcheck (Linux), MemorySanitizer (Linux, clang) and dudect, nothing found; wasip2, dudect, nothing found; not measured yet on wasip3, emscripten (<<crypto-backends-constant-time>>)
|libsodium: native, Valgrind's memcheck (Linux) and MemorySanitizer (Linux, clang), nothing found, and dudect: nothing found with arm64's DIT (data-independent timing) bit set, as the lane runs dudect on macOS and Linux on arm64 (elsewhere its harness sets no DIT) and 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]); without it, dudect times `agree` with an all-zero secret key against random ones at \|t\| 6.7 to 14.5, against the threshold 10, on an Apple M5 Max, from a release build (2026-11-19): about one nanosecond in 15 µs. libsodium does not set DIT: a program on Apple silicon sets it around its secret operations (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]); wasip2, dudect: 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), 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 (<<crypto-backends-constant-time>>)
|libsecp256k1: native, Valgrind's memcheck (Linux; libsecp256k1's own `+ctime_tests.c+`, and webcpp's code around it: the key pair's making, its signatures and x-only tweak, ECDH in three forms, the secret key's tweaks and negation, and PKCS#8), MemorySanitizer (Linux, clang; the same paths as memcheck's) and dudect (judged off the runners GitHub hosts; `+ecdh_x+`), nothing found; wasip2, dudect (judged off the runners GitHub hosts; `+ecdh_x+`), nothing found; not measured yet on wasip3, emscripten (<<crypto-backends-constant-time>>)
|libsodium: native, Valgrind's memcheck (Linux), MemorySanitizer (Linux, clang) and dudect (judged off the runners GitHub hosts), nothing found; wasip2, dudect (judged off the runners GitHub hosts), nothing found; not measured yet on wasip3, emscripten (<<crypto-backends-constant-time>>)
|libsodium: native, Valgrind's memcheck (Linux) and MemorySanitizer (Linux, clang), nothing found, and dudect (judged off the runners GitHub hosts): nothing found with arm64's DIT (data-independent timing) bit set, as the lane runs dudect on macOS and Linux on arm64 (elsewhere its harness sets no DIT) and 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]); without it, dudect times `agree` with an all-zero secret key against random ones at \|t\| 6.7 to 14.5, against the threshold 10, on an Apple M5 Max, from a release build (2026-11-19): about one nanosecond in 15 µs. libsodium does not set DIT: a program on Apple silicon sets it around its secret operations (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]); wasip2, dudect (judged off the runners GitHub hosts): 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), 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 (<<crypto-backends-constant-time>>)

|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]
Expand Down
Loading
Loading