diff --git a/.gitmodules b/.gitmodules index e88abe77..b8dcfa6c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -102,3 +102,7 @@ [submodule "libs/codecs"] path = libs/codecs url = ../codecs.git +[submodule "third_party/libs/hpke"] + path = third_party/libs/hpke + url = https://github.com/cfrg/draft-irtf-cfrg-hpke.git + shallow = true diff --git a/AGENTS.md b/AGENTS.md index 9f27c23e..3f7cc47e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -76,7 +76,7 @@ for web developers and for AI developers (`CODING-GUIDELINES.md` chapter 16). | asio | Boost.Asio with browser event-loop suspension, WASIp2/P3 networking and optional source-built TLS | native, emscripten, wasip2, wasip3 | a submodule at `libs/asio`; see its feature matrix for variants | | beast | HTTP and WebSocket applications using native/WASIp3 sockets, browser WebSocket/fetch, WASI host HTTP or supplied streams | native, emscripten, wasip2, wasip3, by backend | a submodule at `libs/beast`; all 53 upstream applications remain in its compatibility matrix | | cobalt | Boost.Cobalt coroutine applications with shipped Wasm adaptations and optional corrected SSL | native, emscripten, wasip2, wasip3, by capability | a submodule at `libs/cobalt`; see its feature and application matrices for variants | -| codecs | one contract for converting bytes and values to text and back, and any data through streams; seven formats (hex, base32, base58, base64, bech32, percent, RFC 7468's armor); header-only, percent over Boost.URL; webcpp's own | native, wasip2, wasip3, emscripten; its own lanes `constant-time` and `fuzz` | a submodule at `libs/codecs`; depends on config and secure, percent also on Boost.URL | +| codecs | one contract for converting bytes and values to text and back, and any data through streams; eight formats (hex, base32, z-base-32, base58, base64, bech32, percent, RFC 7468's armor); header-only, percent over Boost.URL; webcpp's own | native, wasip2, wasip3, emscripten; its own lanes `constant-time` and `fuzz` | a submodule at `libs/codecs`; depends on config and secure, percent also on Boost.URL | | config | webcpp's configuration, which every library includes first: the target, exceptions and webcpp's version, as Boost.Config is Boost's; webcpp's own | native, wasip2, wasip3, emscripten | a submodule at `libs/config` | | crypto | AES-GCM, the AES block cipher, random_device and secp256k1 over C libraries built from source (BearSSL, OpenSSL, libsecp256k1, ctaes), webcpp's own | native, wasip2, wasip3, emscripten (OpenSSL not on emscripten); its own lane `c-suites` | a submodule at `libs/crypto`; depends on hash and secure | | hash | hashing and key derivation: Boost.Hash2's algorithms by alias, Keccak-256, BLAKE3, HKDF, PBKDF2, Argon2 and scrypt over C backends (XKCP, BLAKE3, libsodium, BearSSL, OpenSSL, Botan) and a browser backend; a wrapper | native, wasip2, wasip3, emscripten (by backend); its own lane `c-suites` | a submodule at `libs/hash`; depends on config and secure | @@ -114,7 +114,7 @@ webcpp/ a submodule under third_party/libs/, pinned at a commit and keeping its own licence (openssl, libdatachannel, bearssl, secp256k1, bitcoin for ctaes, xkcp, libsodium, blake3, and the test data wycheproof, bips, - JSON-Schema-Test-Suite and nativejson-benchmark), and the Jamfile that + hpke, JSON-Schema-Test-Suite and nativejson-benchmark), and the Jamfile that declares it as /webcpp/third_party// and /third_party// (guidelines chapter 10) doc/ the index page (index.adoc, Jamfile) @@ -271,7 +271,7 @@ Jamroot is its build configuration, and `libs/` is its repository. - for crypto: nothing installed, with the pinned submodules initialised: `git submodule update --init third_party/libs/bearssl third_party/libs/secp256k1 third_party/libs/bitcoin third_party/libs/wycheproof - third_party/libs/bips third_party/libs/ed25519-speccheck`, and + third_party/libs/bips third_party/libs/ed25519-speccheck third_party/libs/hpke`, and `third_party/libs/openssl` for its OpenSSL backend (below); b2 builds every backend from its sources; - for Botan (`/third_party//botan`, webcpp::hash's `backends::botan` and @@ -1673,7 +1673,9 @@ jobs: every library's tests hold it, and trystero's guarantee 6 rests on it. The image is `tools/ci/container/Dockerfile`'s: Ubuntu 24.04, the runner's release, pinned by the digest of its image index, with `g++-14`, - `clang-18`, Python, Git, Make, Perl and CMake, every package, + `clang-18`, `libclang-rt-18-dev` (Clang 18's `sanitizer/` headers, which + secure's `declassify_compile_msan` includes), Python, Git, Make, Perl and + CMake, every package, `ca-certificates` included, from Ubuntu's snapshot of the archive at the date its `ARG SNAPSHOT` names (`Snapshot: yes` on the sources, `apt-get --snapshot`), so that one Dockerfile is one set of packages. The snapshot diff --git a/CODING-GUIDELINES.md b/CODING-GUIDELINES.md index 9d81dbb0..8face9ef 100644 --- a/CODING-GUIDELINES.md +++ b/CODING-GUIDELINES.md @@ -348,11 +348,14 @@ exactly its authors' and the program carries only what it calls. fix upstream. Until upstream applies it, the pin may point at our fork's branch carrying exactly that submitted patch and nothing else, and it returns to upstream once the patch is applied. BearSSL is pinned so: - `ae63032` of `webcpporg/bearssl`'s branch - `upstream/ecdsa-bits2int-constant-time`, upstream's `7bea48e` and the ECDSA - nonce fix submitted upstream (owner decision of 2026-12-02, which - superseded the exception of 2026-11-21 that let a mirror's `webcpp` branch - carry a fix of webcpp's own). + `f8a2f3d` of `webcpporg/bearssl`'s branch `webcpp-pin`, upstream's + `7bea48e` and two fixes submitted upstream, each on a branch of its own on + top of `7bea48e`: the ECDSA nonce fix (`ae63032`, branch + `upstream/ecdsa-bits2int-constant-time`; owner decision of 2026-12-02, + which superseded the exception of 2026-11-21 that let a mirror's `webcpp` + branch carry a fix of webcpp's own) and P-256's scalar check (`ec57f88`, + branch `upstream/ec-p256-check-scalar-constant-time`; owner decision of + 2026-12-04, an explicit exception to this rule like the first). 2. `third_party/Jamfile` builds it from its own sources, file by file, as a static library, in the library's own C dialect, on every target and with every file: a file that does not apply to a target still compiles, to the @@ -984,7 +987,7 @@ update --init third_party/libs/`; a build that needs none never looks. | Target | What it is | Licence | | --- | --- | --- | -| `bearssl` | BearSSL at `ae63032` of webcpp's fork `webcpporg/bearssl`, branch `upstream/ecdsa-bits2int-constant-time`: upstream's `7bea48e` and exactly the ECDSA nonce fix submitted upstream, until upstream applies it (chapter 5 rule 1); a static library built file by file by `third_party/Jamfile` with webcpp::crypto's and webcpp::hash's canaries (hash's when `libs/hash` is checked out), on every target; `WEBCPP_CRYPTO_HAS_BEARSSL=1`, and `WEBCPP_HASH_HAS_BEARSSL=1` with hash's canary | MIT | +| `bearssl` | BearSSL at `f8a2f3d` of webcpp's fork `webcpporg/bearssl`, branch `webcpp-pin`: upstream's `7bea48e` and exactly the two fixes submitted upstream, the ECDSA nonce's (`ae63032`) and P-256's scalar check's (`ec57f88`), until upstream applies them (chapter 5 rule 1); a static library built file by file by `third_party/Jamfile` with webcpp::crypto's and webcpp::hash's canaries (hash's when `libs/hash` is checked out), on every target; `WEBCPP_CRYPTO_HAS_BEARSSL=1`, and `WEBCPP_HASH_HAS_BEARSSL=1` with hash's canary | MIT | | `bips` | `bitcoin/bips` at `927b6de9`, shallow, test data: crypto's tests read BIP340's `bip-0340/test-vectors.csv` and BIP341's `bip-0341/wallet-test-vectors.json` at run time under the directory its define `WEBCPP_TEST_BIPS` gives, on every target (wasmtime is given it, `webcpp.data`), and run again when it changes | BSD-2-Clause, as BIP340's header states | | `bitcoin_base58_vectors` | Bitcoin Core's base58 vectors, `src/test/data/base58_encode_decode.json` and `src/test/data/key_io_valid.json` of the submodule `third_party/libs/bitcoin` (Bitcoin Core v31.1 at `9be056a`, shallow), test data that nothing compiles: codecs' tests (the first file) and hash's Base58Check test (the second) read them at run time under the directory its define `WEBCPP_TEST_BITCOIN_BASE58_VECTORS` gives, on every target (wasmtime is given it, `webcpp.data`), and run again when either changes | MIT | | `blake2_vectors` | BLAKE2's reference code package `BLAKE2/BLAKE2` at `ed1974e` (2023-02-12), the submodule `third_party/libs/blake2`, shallow, test data that nothing compiles: hash's tests read `testvectors/blake2b-kat.txt` and `testvectors/blake2-kat.json` at run time under the directory its define `WEBCPP_TEST_BLAKE2_VECTORS` gives, on every target (wasmtime is given it, `webcpp.data`), and run again when one of them changes | CC0-1.0 | @@ -995,6 +998,7 @@ update --init third_party/libs/`; a build that needs none never looks. | `ca_certificates` | Dated Mozilla/curl CA data snapshot under `third_party/ca_certificates`, verified against its manifest and embedded by a build-generated header; updated explicitly by `tools/ca_certificates/update.py` | MPL-2.0 | | `ctaes` | `src/crypto/ctaes` of `bitcoin/bitcoin` v31.1 at `9be056a` (commit `9be056a8a72b624dae9623b2f7bded92c2a21c91`), the submodule `third_party/libs/bitcoin`, shallow; `third_party/Jamfile` compiles its `ctaes.c` alone, with webcpp::crypto's canary, on every target (`WEBCPP_CRYPTO_HAS_CTAES=1`); the tree's `src/secp256k1/` subtree is never on an include path and no glob over `third_party/libs` reaches it | MIT | | `ed25519-speccheck` | `novifinancial/ed25519-speccheck` at `65519336` (2021-02-26), shallow, test data: crypto's tests read the twelve Ed25519 edge cases of "Taming the many EdDSAs", its `cases.json`, at run time under the directory its define `WEBCPP_TEST_ED25519_SPECCHECK` gives, on every target (wasmtime is given it, `webcpp.data`), and run again when it changes | Apache-2.0 | +| `hpke` | `cfrg/draft-irtf-cfrg-hpke` at `5f503c5` (2021-05-24), shallow, test data: crypto's tests read RFC 9180's test vectors, its `test-vectors.json` (Appendix A's source, 128 entries), at run time under the directory its define `WEBCPP_TEST_HPKE` gives, on every target (wasmtime is given it, `webcpp.data`), and run again when it changes | IETF Trust Legal Provisions (BCP 78; code components under the Simplified BSD License) | | `json-schema-test-suite` | the JSON Schema Test Suite at `5b0ee16` (2026-09-21), test data: a test that names it reads the suite at run time from the directory its define `WEBCPP_TEST_JSON_SCHEMA_TEST_SUITE` gives, on every target (wasmtime is given it, `webcpp.data`), and runs again when a file of the suite changes | MIT | | `libdatachannel` | libdatachannel 0.24.6 at `6b1e2e620f1e37f0eafeee702eaea0043cb305fd`, with pinned libjuice, libsrtp, plog and usrsctp sources; static native archives built by upstream CMake through B2 against the same source-built OpenSSL, from a staged copy the patches of `tools/libdatachannel/patches` correct | MPL-2.0 and the nested dependencies' own licences | | `nativejson-benchmark` | Milo Yip's nativejson-benchmark at `478d572` (2022-10-28), test data: document's benchmarks (`libs/document/bench`) read its `data/canada.json`, `data/citm_catalog.json` and `data/twitter.json` at run time under the directory its define `WEBCPP_TEST_NATIVEJSON_BENCHMARK` gives, on every target (wasmtime is given it, `webcpp.data`), and run again when one of them changes; its own submodules are never checked out | MIT | @@ -7359,18 +7363,25 @@ since that change); what is decided and not built is in chapter 17. 2026-11-21 to 2026-12-02 webcpp's BearSSL carried a fix of its own on the mirror's `webcpp` branch and the checkers found nothing; the owner decision of 2026-12-02 (chapter 5 rule 1) replaced it with the same fix submitted - upstream: BearSSL is pinned at `ae63032` of `webcpporg/bearssl`'s branch + upstream: BearSSL was pinned at `ae63032` of `webcpporg/bearssl`'s branch `upstream/ecdsa-bits2int-constant-time`, upstream's `7bea48e` and that one - patch, until upstream applies it, and the checkers find nothing under it - (2026-12-02). The planted + patch, and the checkers found nothing under it on arm64 (2026-12-02). On + the x86-64 runner memcheck then found Clang turning P-256's scalar check + (`check_scalar` of `ec_p256_m62.c`, which `agree` reaches) into a jump on + the secret scalar, a select of the C made a branch by the code generator; + the owner decision of 2026-12-04 added the fix submitted upstream for it: + BearSSL is pinned at `f8a2f3d` of the fork's branch `webcpp-pin`, upstream's + `7bea48e` and the two patches, until upstream applies them, and memcheck + finds nothing under it on x86-64 either (2026-12-04). The planted programs failed and dudect passed there too: dudect judged P-256's signing with its low-S step (|t| 1.70 on Linux, 1.63 natively on an Apple M5 Max, release, one run each; provisional, measured again in the final quiet pass). Source: `libs/crypto/test/constant_time/Jamfile`, `test/sizes/Jamfile`, `bench/throughput.cpp`, `doc/backends.adoc` (libs/crypto); - BearSSL's `src/ec/ecdsa_i31_bits.c` at `7bea48e` (upstream) and at - `ae63032` (`webcpporg/bearssl`, the patch submitted upstream); the + BearSSL's `src/ec/ecdsa_i31_bits.c` and `src/ec/ec_p256_m62.c` at + `7bea48e` (upstream) and at `f8a2f3d` (`webcpporg/bearssl`, the patches + submitted upstream, `ae63032` and `ec57f88`); the superseded fix's commits, `32381d6` and `205c5ff` of the mirror's `webcpp` branch, are history. @@ -10062,14 +10073,14 @@ delivery. ### codecs (bytes and values to text and back, and the conversion contract; own; accepted 2026-11-26, merged) webcpp::codecs is webcpp's one contract for converting bytes and typed values to -text and back, and any data through one-shot and stream transformers, with seven +text and back, and any data through one-shot and stream transformers, with eight formats over it, webcpp's own (`"port-of": null`, categories String and Cryptography). It is implemented in `webcpporg/codecs`, the submodule `libs/codecs`, built on the branch `codecs/genesis` of its repository and of the superproject and merged on 2026-11-30, after the owner's CI ran once, at the end. Its headers are ``, the core, which registers no format and includes none, and -``, +``, each format reachable only through its own header, with `detail/core/` and `detail/formats/` behind them; its targets are `/webcpp/codecs//codecs`, header-only, depending on Boost's headers, config and secure, and @@ -10123,7 +10134,10 @@ The owner's decisions: `encode` and `decode` taking any `CharSet`; only this header depends on Boost.URL), and, by decision 13, RFC 7468's armor. base58 becomes a template by decisions 25 and 26 and bech32 by decision 27; `formats::base58`, - `formats::bech32` and `formats::bech32m` stay. + `formats::bech32` and `formats::bech32m` stay. z-base-32 (`formats::zbase32`, + pkarr's keys) joins them by the change `zbase32` (scope approved by the owner on + 2026-12-01): base32's one implementation over its alphabet, lower case alone, no + padding, canonical, always constant time and streaming natively. Source: design.md owner decision 5 and D13 (proposals); `include/webcpp/codecs/*.hpp` (libs/codecs). - **Owner decisions 6 and 11: constant time.** hex, base32, base64 and bech32 (and diff --git a/doc/releases/0.1.0.adoc b/doc/releases/0.1.0.adoc index 762670ad..1feea683 100644 --- a/doc/releases/0.1.0.adoc +++ b/doc/releases/0.1.0.adoc @@ -21,8 +21,8 @@ applications for native, browser and WASI targets, with explicit source distribu and optional corrected SSL integration, from R. * link:{library-pages}codecs/{library-page}[codecs]: one contract for converting bytes and typed values to text and back, and any data through streams, for -{cpp}20, with hex, base32, base58, base64, bech32, percent-encoding and RFC 7468's -armor over it, from R. +{cpp}20, with hex, base32, z-base-32, base58, base64, bech32, percent-encoding +and RFC 7468's armor over it, from R. * link:{library-pages}config/{library-page}[config]: webcpp's configuration, which every library includes first: the target, exceptions and the version, from R. @@ -182,6 +182,8 @@ target through `/webcpp/third_party//wycheproof`. `/third_party//secp256k1`, its tables chosen by `webcpp-secp256k1-tables`. * Added bitcoin/bips to `third_party/`, whose BIP340 vectors a test reads on every target through `/third_party//bips`. +* Added RFC 9180's test vectors (cfrg/draft-irtf-cfrg-hpke) to `third_party/`, +which crypto's HPKE tests read on every target through `/third_party//hpke`. * Changed `/third_party//bips` to also serve BIP341's `bip-0341/wallet-test-vectors.json`, whose cases run again when it changes. * Changed the lint to never read third-party code under `third_party/libs/`. diff --git a/libs/codecs b/libs/codecs index 8535c31c..85061b2b 160000 --- a/libs/codecs +++ b/libs/codecs @@ -1 +1 @@ -Subproject commit 8535c31c9dc5456b5166b2a3738e1c7d752379d0 +Subproject commit 85061b2b21c4fed25c60fbe4d0f80923ed2e1f2a diff --git a/libs/crypto b/libs/crypto index b19a26ed..36d1279d 160000 --- a/libs/crypto +++ b/libs/crypto @@ -1 +1 @@ -Subproject commit b19a26ed957cdd0ba06954f33abf1ee5202aab14 +Subproject commit 36d1279d9048ff667183ec2e45c6e1961a34dd6a diff --git a/libs/hash b/libs/hash index dc0068a5..d7ea49cc 160000 --- a/libs/hash +++ b/libs/hash @@ -1 +1 @@ -Subproject commit dc0068a5663a93fa2c243326a4b80d9ea9bdff80 +Subproject commit d7ea49cc5e131b46e8d12f1daa411c14e5fda6ec diff --git a/libs/secure b/libs/secure index 44b15570..a88fc50f 160000 --- a/libs/secure +++ b/libs/secure @@ -1 +1 @@ -Subproject commit 44b15570ef99b0584d5237ff481dbfb1d29299b8 +Subproject commit a88fc50ff08a65943ceca860374955366634103d diff --git a/third_party/Jamfile b/third_party/Jamfile index 887f3291..bae6da10 100644 --- a/third_party/Jamfile +++ b/third_party/Jamfile @@ -153,6 +153,32 @@ alias bips : : @bips-checked-out : : $(.bips-files) ; explicit bips ; +# cfrg/draft-irtf-cfrg-hpke, shallow: test data, never compiled, an IETF +# Contribution under the IETF Trust's Legal Provisions (BCP 78; code +# components under the Simplified BSD License). A test that names hpke reads +# RFC 9180's test vectors, test-vectors.json (Appendix A's source), from the +# directory WEBCPP_TEST_HPKE names, with forward slashes, the directory given +# to wasmtime on WASI (webcpp.data), and runs again when it changes. +path-constant HPKE : libs/hpke ; +.hpke = [ regex.replace $(HPKE) "\\\\" "/" ] ; +.hpke-files = [ glob libs/hpke/test-vectors.json ] ; + +rule hpke-checked-out ( properties * ) +{ + if ! [ path.exists [ path.native $(HPKE)/test-vectors.json ] ] + { + errors.user-error "third_party/libs/hpke is not checked out: it holds no" + "test-vectors.json. Check it out with `git submodule update --init" + "third_party/libs/hpke`." ; + } +} + +alias hpke : : @hpke-checked-out : : + "\"WEBCPP_TEST_HPKE=\\\"$(.hpke)\\\"\"" + [ webcpp.data $(HPKE) ] + $(.hpke-files) ; +explicit hpke ; + # novifinancial/ed25519-speccheck (Apache-2.0), shallow: test data, never # compiled. A test that names ed25519-speccheck reads the twelve Ed25519 edge # cases of "Taming the many EdDSAs", cases.json, from the directory @@ -278,17 +304,19 @@ rule crypto-checked-out ( properties * ) .c-library = $(.c-sections) @crypto-checked-out $(CRYPTO)/include ; -# BearSSL (MIT) at ae63032 of webcpp's fork webcpporg/bearssl, branch -# upstream/ecdsa-bits2int-constant-time: upstream's 7bea48e and exactly the -# ECDSA nonce fix submitted upstream, until upstream applies it -# (CODING-GUIDELINES chapter 5, rule 1). Every .c of src/, the POWER8 ones too, -# which off POWER compile to the stubs other files call. One source of entropy, -# getentropy, with RDRAND and /dev/urandom off (libs/crypto's random_device -# reads the same source): wasi-libc and Emscripten declare getentropy only -# under _DEFAULT_SOURCE, and macOS only in , which -# src/rand/sysrng.c does not include. On Windows BearSSL's only seeder is -# CryptGenRandom, not the system's BCryptGenRandom, so every seeder is off -# there and BearSSL has none. +# BearSSL (MIT) at f8a2f3d of webcpp's fork webcpporg/bearssl, branch +# webcpp-pin: upstream's 7bea48e and exactly the two fixes submitted upstream, +# each on a branch of its own, until upstream applies them: the ECDSA nonce's +# (ae63032, upstream/ecdsa-bits2int-constant-time) and P-256's scalar check's +# (ec57f88, upstream/ec-p256-check-scalar-constant-time) (CODING-GUIDELINES +# chapter 5, rule 1, and the owner's exception for them). Every .c of src/, +# the POWER8 ones too, which off POWER compile to the stubs other files call. +# One source of entropy, getentropy, with RDRAND and /dev/urandom off +# (libs/crypto's random_device reads the same source): wasi-libc and +# Emscripten declare getentropy only under _DEFAULT_SOURCE, and macOS only in +# , which src/rand/sysrng.c does not include. On Windows +# BearSSL's only seeder is CryptGenRandom, not the system's BCryptGenRandom, so +# every seeder is off there and BearSSL has none. path-constant BEARSSL : libs/bearssl ; rule bearssl-checked-out ( properties * ) diff --git a/third_party/libs/bearssl b/third_party/libs/bearssl index ae63032d..f8a2f3d9 160000 --- a/third_party/libs/bearssl +++ b/third_party/libs/bearssl @@ -1 +1 @@ -Subproject commit ae63032d9f30bf53674db5445875adf71b8626b7 +Subproject commit f8a2f3d96fc6e3ce8c7b626fec4fc506fef2b0ce diff --git a/third_party/libs/hpke b/third_party/libs/hpke new file mode 160000 index 00000000..5f503c56 --- /dev/null +++ b/third_party/libs/hpke @@ -0,0 +1 @@ +Subproject commit 5f503c564da00b0687b3de75f1dfbdfc4079ad31 diff --git a/tools/ci/container/Dockerfile b/tools/ci/container/Dockerfile index d216f54b..88ba31c7 100644 --- a/tools/ci/container/Dockerfile +++ b/tools/ci/container/Dockerfile @@ -7,10 +7,12 @@ # The image of the container lanes (tools/ci/matrix.py), GCC 14 and Clang 18 on libstdc++: Ubuntu # 24.04, the release of their runner, pinned by the digest of its image index (docker-library's # repo-info, repos/ubuntu/remote/24.04.md), with the two compilers and Python, which runs -# the examples. Git checks maintainer imports; Make and Perl build pinned OpenSSL, and CMake -# builds pinned libdatachannel against that exact provider. b2, Boost's headers and the libraries the CI's actions build -# are the runner's, mounted at their own paths; the lane runs in it with no network but the -# loopback, which the packages are installed before. +# the examples. libclang-rt-18-dev gives Clang 18 its sanitizer/ headers, which a test that compiles +# a header with MemorySanitizer's marks includes (secure's declassify_compile_msan, which reads +# sanitizer/msan_interface.h). Git checks maintainer imports; Make and Perl build pinned OpenSSL, +# and CMake builds pinned libdatachannel against that exact provider. b2, Boost's headers and the +# libraries the CI's actions build are the runner's, mounted at their own paths; the lane runs in it +# with no network but the loopback, which the packages are installed before. # # Every package comes from Ubuntu's snapshot of the archive at SNAPSHOT, so that one Dockerfile is # one set of packages: apt reads the archive as it was then (Snapshot: yes on the sources, and @@ -46,5 +48,5 @@ RUN sed -i 's/^Signed-By: .*/&\nSnapshot: yes/' /etc/apt/sources.list.d/ubuntu.s --snapshot "${SNAPSHOT}" \ && DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retries=5 install --yes \ --no-install-recommends --snapshot "${SNAPSHOT}" \ - g++-14 clang-18 python3 git make perl cmake pkg-config \ + g++-14 clang-18 libclang-rt-18-dev python3 git make perl cmake pkg-config \ && rm -rf /var/lib/apt/lists/* diff --git a/tools/ci/environments.json b/tools/ci/environments.json index 82341539..170aedef 100644 --- a/tools/ci/environments.json +++ b/tools/ci/environments.json @@ -5,15 +5,15 @@ "archives": [ "9d96e42f303046fb0b221aa9071eabccc40b9683e0b7af2b02a929d15476ca6a" ], - "image": "ghcr.io/webcpporg/ci-environment@sha256:1b5e0f6d7876e95c0a38fbcc2f2d027feca6d4538db1fe0a1874b0c38fb78877", + "image": "ghcr.io/webcpporg/ci-environment@sha256:fdbf030d9a13bfefc81a6aee3e01f02214b16a2d337e652716724cccfdc49495", "recipe": "1caf5163552b9ba131f4687f9321cf90a157ce02e411d8d3284faf3a63547bbf", - "source": "c711c0f1d8faca1650606272a717a8aabf20c838" + "source": "38487b0b1439345bb6011a64c6932c1b1ef17809" }, "native-linux-x64": { "archives": [], - "image": "ghcr.io/webcpporg/ci-environment@sha256:f1eaaabce5acda76e57d40170b8be4c8b940688041af942620421551fc30c30f", - "recipe": "34fb00b6fe5aebb73082f45019a5ed6a13a2e8fec9f4900d6a278d1a00c236ac", - "source": "c711c0f1d8faca1650606272a717a8aabf20c838" + "image": "ghcr.io/webcpporg/ci-environment@sha256:3a02e2fd0e6413ca1803cea4a8ac17b57a3aa70f864e54ef478fe5683983a59a", + "recipe": "cc585d94e5000196ed897e54c1c9bf9071b9d5ec5433849670e41325f026e831", + "source": "38487b0b1439345bb6011a64c6932c1b1ef17809" }, "wasi-sdk-linux-x64": { "archives": [ @@ -21,34 +21,34 @@ "b761e3a0721dbae9c09a0059e5fdb2bf917d1b4a8a7b430fb3b5aafb0984b2c4", "eee3e634dcf71aa22b1333391623cf5c9965a637dc428a27b1a858c026c587f1" ], - "image": "ghcr.io/webcpporg/ci-environment@sha256:23c70b9ffea7b84c5cc392fa50b58e529ef8bed19986d8920bab670e2157a697", + "image": "ghcr.io/webcpporg/ci-environment@sha256:e4d549895068496fd87297872ece80a9a9f8e944403f79c3d70b7391eb229e08", "recipe": "a00ab454b3a141598498dae1ea1be18d688ec8b9d546373bc632dce768759cfd", - "source": "c711c0f1d8faca1650606272a717a8aabf20c838" + "source": "38487b0b1439345bb6011a64c6932c1b1ef17809" }, "wasi-wit-linux-x64": { "archives": [ "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487", "f1d5749fdf69bb9400562eba50f8f25f5cd800ef4b74300038b6f99ae7409674" ], - "image": "ghcr.io/webcpporg/ci-environment@sha256:36d2ef9037418f0a239614092ee7cd8d142d5fa440cb7127915e984253fc995a", + "image": "ghcr.io/webcpporg/ci-environment@sha256:95cf09c6173ddd086e4a779af5ab32065fe260d7aa72409abd36fe3f2a99a6e5", "recipe": "a154f6fe1adb7268d5c4f0c6a5e244166d3925fd74d3d125691709067a84209a", - "source": "c711c0f1d8faca1650606272a717a8aabf20c838" + "source": "38487b0b1439345bb6011a64c6932c1b1ef17809" }, "wasmtime-linux-x64": { "archives": [ "685466455dd42a14774a86c36c8f2e45cbb9bd6d92a850139315df60a75498a5" ], - "image": "ghcr.io/webcpporg/ci-environment@sha256:1dbca1cea71fba2bc988ac15ac2dceafec003cd755c5b3a33e7222138e8b2205", + "image": "ghcr.io/webcpporg/ci-environment@sha256:72785fc0437fbeb36444acafed9e1c782da2fa205c6967a5f688683fcc5d816d", "recipe": "3e46afc7303c53c2161bcc97ff2714fd6a0426aa61dac6cb85f4f56b33bb0101", - "source": "c711c0f1d8faca1650606272a717a8aabf20c838" + "source": "38487b0b1439345bb6011a64c6932c1b1ef17809" }, "wit-bindgen-linux-x64": { "archives": [ "3e81cc6523729f7532b4aa7968648a04abf0c711b7d1677150e9121f4e6458fe" ], - "image": "ghcr.io/webcpporg/ci-environment@sha256:63bb9536dc7102892616a0b6123e6b60546cc161081d2a5df9237bede6d7090c", + "image": "ghcr.io/webcpporg/ci-environment@sha256:88dcd994a01ec12378121ed15821e4ddf8610e85901bb6ff6ab87d36ec2331fd", "recipe": "436fd39c29f16fc56d136cad6ca2f829f984cf536a0abc83f53d8cf23049ad93", - "source": "c711c0f1d8faca1650606272a717a8aabf20c838" + "source": "38487b0b1439345bb6011a64c6932c1b1ef17809" } }, "schema": 1 diff --git a/tools/ci/matrix_test.py b/tools/ci/matrix_test.py index 062329f5..6b5bb510 100755 --- a/tools/ci/matrix_test.py +++ b/tools/ci/matrix_test.py @@ -1523,7 +1523,8 @@ def container_lane_runs_b2_with_no_network(root): assert all('--snapshot "${SNAPSHOT}"' in call for call in calls), calls assert re.search(r'install[^&]*--snapshot "\$\{SNAPSHOT\}" ca-certificates', code), code pin_test_image(root) - for package in ('g++-14', 'clang-18', 'python3', 'git', 'make', 'perl', 'cmake', 'pkg-config'): + for package in ('g++-14', 'clang-18', 'libclang-rt-18-dev', 'python3', 'git', 'make', 'perl', + 'cmake', 'pkg-config'): assert re.search(r'install\b[^&]*\s' + re.escape(package) + r'(?=\s|$)', code), ( package, code) entry = host_lane(root) diff --git a/tools/test/fixtures/crypto_jamfiles/canary_missing/canary_missing.outcome b/tools/test/fixtures/crypto_jamfiles/canary_missing/canary_missing.outcome index 80b6e69c..11b1194a 100644 --- a/tools/test/fixtures/crypto_jamfiles/canary_missing/canary_missing.outcome +++ b/tools/test/fixtures/crypto_jamfiles/canary_missing/canary_missing.outcome @@ -10,18 +10,18 @@ build: fails # tag::messages[] [native-darwin] contains: Undefined symbols for architecture -contains: _webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link +contains: _webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link [native-linux] -contains: webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link -contains: undefined reference to `webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link' +contains: webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link +contains: undefined reference to `webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link' [wasip2] contains: wasm-ld: error: -contains: undefined symbol: webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link +contains: undefined symbol: webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link [wasip3] contains: wasm-ld: error: -contains: undefined symbol: webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link +contains: undefined symbol: webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link [emscripten] contains: wasm-ld: error: -contains: undefined symbol: webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link +contains: undefined symbol: webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link contains: em++: error: # end::messages[] diff --git a/tools/test/fixtures/crypto_jamfiles/canary_other_configuration/canary_other_configuration.outcome b/tools/test/fixtures/crypto_jamfiles/canary_other_configuration/canary_other_configuration.outcome index 6cac727a..acd2e4c1 100644 --- a/tools/test/fixtures/crypto_jamfiles/canary_other_configuration/canary_other_configuration.outcome +++ b/tools/test/fixtures/crypto_jamfiles/canary_other_configuration/canary_other_configuration.outcome @@ -10,18 +10,18 @@ build: fails # tag::messages[] [native-darwin] contains: Undefined symbols for architecture -contains: _webcpp_crypto_bearssl_ae63032_sysrng__add_third_party_bearssl_to_your_link +contains: _webcpp_crypto_bearssl_f8a2f3d_sysrng__add_third_party_bearssl_to_your_link [native-linux] -contains: webcpp_crypto_bearssl_ae63032_sysrng__add_third_party_bearssl_to_your_link -contains: undefined reference to `webcpp_crypto_bearssl_ae63032_sysrng__add_third_party_bearssl_to_your_link' +contains: webcpp_crypto_bearssl_f8a2f3d_sysrng__add_third_party_bearssl_to_your_link +contains: undefined reference to `webcpp_crypto_bearssl_f8a2f3d_sysrng__add_third_party_bearssl_to_your_link' [wasip2] contains: wasm-ld: error: -contains: undefined symbol: webcpp_crypto_bearssl_ae63032_sysrng__add_third_party_bearssl_to_your_link +contains: undefined symbol: webcpp_crypto_bearssl_f8a2f3d_sysrng__add_third_party_bearssl_to_your_link [wasip3] contains: wasm-ld: error: -contains: undefined symbol: webcpp_crypto_bearssl_ae63032_sysrng__add_third_party_bearssl_to_your_link +contains: undefined symbol: webcpp_crypto_bearssl_f8a2f3d_sysrng__add_third_party_bearssl_to_your_link [emscripten] contains: wasm-ld: error: -contains: undefined symbol: webcpp_crypto_bearssl_ae63032_sysrng__add_third_party_bearssl_to_your_link +contains: undefined symbol: webcpp_crypto_bearssl_f8a2f3d_sysrng__add_third_party_bearssl_to_your_link contains: em++: error: # end::messages[] diff --git a/tools/test/fixtures/crypto_jamfiles/canary_without/canary_without.outcome b/tools/test/fixtures/crypto_jamfiles/canary_without/canary_without.outcome index d33df052..8a83bf06 100644 --- a/tools/test/fixtures/crypto_jamfiles/canary_without/canary_without.outcome +++ b/tools/test/fixtures/crypto_jamfiles/canary_without/canary_without.outcome @@ -10,31 +10,31 @@ build: fails # tag::messages[] [native-darwin] contains: Undefined symbols for architecture -contains: _webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link +contains: _webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link [native-linux] -contains: webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link -contains: undefined reference to `webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link' +contains: webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link +contains: undefined reference to `webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link' [wasip2] contains: wasm-ld: error: -contains: undefined symbol: webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link +contains: undefined symbol: webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link [wasip3] contains: wasm-ld: error: -contains: undefined symbol: webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link +contains: undefined symbol: webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link [emscripten] contains: wasm-ld: error: -contains: undefined symbol: webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link +contains: undefined symbol: webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link contains: em++: error: # end::messages[] # The canary is the only link error (spec section 4.3): no line names an undefined symbol or # reference that is not it. Each linker's own words for one. [native-darwin] -not-contains: ", referenced from: unless webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link +not-contains: ", referenced from: unless webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link [native-linux] -not-contains: undefined reference unless webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link +not-contains: undefined reference unless webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link [wasip2] -not-contains: undefined symbol unless webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link +not-contains: undefined symbol unless webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link [wasip3] -not-contains: undefined symbol unless webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link +not-contains: undefined symbol unless webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link [emscripten] -not-contains: undefined symbol unless webcpp_crypto_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link +not-contains: undefined symbol unless webcpp_crypto_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link diff --git a/tools/test/fixtures/hash_jamfiles/canary_bearssl_missing/canary_bearssl_missing.outcome b/tools/test/fixtures/hash_jamfiles/canary_bearssl_missing/canary_bearssl_missing.outcome index 591a0f40..061f8083 100644 --- a/tools/test/fixtures/hash_jamfiles/canary_bearssl_missing/canary_bearssl_missing.outcome +++ b/tools/test/fixtures/hash_jamfiles/canary_bearssl_missing/canary_bearssl_missing.outcome @@ -9,17 +9,17 @@ targets: native wasip2 wasip3 emscripten build: fails [native-darwin] contains: Undefined symbols for architecture -contains: _webcpp_hash_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link +contains: _webcpp_hash_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link [native-linux] -contains: webcpp_hash_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link -contains: undefined reference to `webcpp_hash_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link' +contains: webcpp_hash_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link +contains: undefined reference to `webcpp_hash_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link' [wasip2] contains: wasm-ld: error: -contains: undefined symbol: webcpp_hash_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link +contains: undefined symbol: webcpp_hash_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link [wasip3] contains: wasm-ld: error: -contains: undefined symbol: webcpp_hash_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link +contains: undefined symbol: webcpp_hash_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link [emscripten] contains: wasm-ld: error: -contains: undefined symbol: webcpp_hash_bearssl_ae63032_getentropy__add_third_party_bearssl_to_your_link +contains: undefined symbol: webcpp_hash_bearssl_f8a2f3d_getentropy__add_third_party_bearssl_to_your_link contains: em++: error: diff --git a/tools/test/third_party_test.py b/tools/test/third_party_test.py index 5d189ee6..2a9c9984 100755 --- a/tools/test/third_party_test.py +++ b/tools/test/third_party_test.py @@ -52,10 +52,11 @@ BEARSSL = 'third_party/libs/bearssl' -# The commit BearSSL is pinned at: ae63032 of the fork webcpporg/bearssl, branch -# upstream/ecdsa-bits2int-constant-time, upstream's 7bea48e and exactly the ECDSA nonce fix -# submitted upstream (CODING-GUIDELINES chapter 5 rule 1); back to upstream once it is applied. -BEARSSL_COMMIT = 'ae63032d9f30bf53674db5445875adf71b8626b7' +# The commit BearSSL is pinned at: f8a2f3d of the fork webcpporg/bearssl, branch webcpp-pin, +# upstream's 7bea48e and exactly the two fixes submitted upstream, the ECDSA nonce's (ae63032) and +# P-256's scalar check's (ec57f88) (CODING-GUIDELINES chapter 5 rule 1); back to upstream once +# they are applied. +BEARSSL_COMMIT = 'f8a2f3d96fc6e3ce8c7b626fec4fc506fef2b0ce' BITCOIN = 'third_party/libs/bitcoin' @@ -109,6 +110,12 @@ ED25519_SPECCHECK = 'third_party/libs/ed25519-speccheck' +HPKE = 'third_party/libs/hpke' + +# The commit cfrg/draft-irtf-cfrg-hpke is pinned at: RFC 9180's test vectors, its +# test-vectors.json (libs/crypto/test/support/hpke_vectors.hpp). +HPKE_COMMIT = '5f503c564da00b0687b3de75f1dfbdfc4079ad31' + # The commit novifinancial/ed25519-speccheck is pinned at: the twelve Ed25519 edge cases of # "Taming the many EdDSAs", its cases.json (libs/crypto/test/ed25519_speccheck_test.cpp). ED25519_SPECCHECK_COMMIT = '65519336fda78a3d016e947df6d82848aca0c9da' @@ -363,6 +370,12 @@ def test_ed25519_speccheck_is_pinned(_: Path) -> None: assert listed.stdout.split()[:2] == ['160000', ED25519_SPECCHECK_COMMIT], listed.stdout +def test_hpke_is_pinned(_: Path) -> None: + listed = subprocess.run(['git', '-C', str(harness.ROOT), 'ls-files', '-s', HPKE], + capture_output=True, text=True, check=True) + assert listed.stdout.split()[:2] == ['160000', HPKE_COMMIT], listed.stdout + + def test_bips_target_files(_: Path) -> None: jamfile = (harness.ROOT / 'third_party' / 'Jamfile').read_text() found = re.search(r'^\.bips-files = \[ glob ([^\]]*)\] ;', jamfile, re.MULTILINE) @@ -510,6 +523,19 @@ def test_ed25519_speccheck_not_checked_out_is_refused(root: Path) -> None: harness.expect(harness.run_b2(root, 'libs/demo/test//pass'), True) +def test_hpke_not_checked_out_is_refused(root: Path) -> None: + harness.third_party_of_its_own(root, 'hpke', checked_out=False) + harness.add_library(root, 'hpke_reader', ( + 'import webcpp ;\n\nwebcpp.run reads_vectors : reads_vectors.cpp\n' + ' : /webcpp/third_party//hpke ;\n'), + {'reads_vectors.cpp': 'int main() { return 0; }\n'}) + result = harness.run_b2(root, 'libs/hpke_reader/test') + harness.expect(result, False, 'third_party/libs/hpke is not checked out', + 'git submodule update --init third_party/libs/hpke') + # A build that needs no vectors never looks for them. + harness.expect(harness.run_b2(root, 'libs/demo/test//pass'), True) + + def test_ctaes_not_checked_out_is_refused(root: Path) -> None: harness.copy_integration_libraries(root, 'config', 'crypto') harness.third_party_of_its_own(root, 'bitcoin', checked_out=False) @@ -1186,8 +1212,10 @@ def test_botan_test_program_runs(root: Path) -> None: test_a_changed_suite_file_runs_the_test_again, test_a_suite_not_checked_out_is_refused, test_ed25519_speccheck_not_checked_out_is_refused, + test_hpke_not_checked_out_is_refused, test_bips_is_pinned, test_ed25519_speccheck_is_pinned, + test_hpke_is_pinned, test_bips_target_files, test_bip352_vectors_match_libsecp256k1, test_bearssl_is_pinned,