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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,6 @@
path = third_party/libs/ed25519-speccheck
url = https://github.com/novifinancial/ed25519-speccheck.git
shallow = true
[submodule "third_party/libs/botan"]
path = third_party/libs/botan
url = https://github.com/randombit/botan.git
5 changes: 5 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ Jamroot is its build configuration, and `libs/<name>` is its repository.
third_party/libs/bips third_party/libs/ed25519-speccheck`, 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
later webcpp::crypto's): nothing installed, with the pinned submodule
initialised (`git submodule update --init third_party/libs/botan`); b2 runs
Botan's own `configure.py` with Python 3 once per target and compiles its
sources; native and Emscripten, with exceptions;
- for native Trystero: CMake and Make (nmake on Windows), and the pinned
`third_party/libs/libdatachannel` checkout with its required nested sources.
Initialize it, and the libsecp256k1 every room links, with `git submodule
Expand Down
47 changes: 38 additions & 9 deletions CODING-GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,9 @@ exactly its authors' and the program carries only what it calls.
their instruction sets alone, each flagged for its own set; XKCP is built
from the one file of Keccak-p[1600] and the five high-level files
webcpp::hash's adapter calls, not from every file of its package;
libsodium is built without its `.S` files.
libsodium is built without its `.S` files. Two libraries are not built
file by file from webcpp's list at all: OpenSSL (rule 7) and Botan (rule
13), whose sources upstream selects.
3. Every file is compiled with `-ffunction-sections -fdata-sections` (`/Gy
/Gw` on MSVC); upstream's warnings are not webcpp's (`<warnings>off`); each
define the library cannot work out for itself on a target sits beside the
Expand Down Expand Up @@ -391,6 +393,7 @@ exactly its authors' and the program carries only what it calls.
WASIp3 single and cooperative profiles must agree with the consumer's
threading choice. Keep explicit host entropy seeding and fail-closed tests.
Other libraries with external dependencies still use `webcpp.external`.
Botan's configuration is upstream's too, its compilation b2's (rule 13).
8. The webcpp library's `config.hpp` chooses the default backend from the
target and the `HAS` defines, and refuses impossible combinations with
`#error`. The backend is named after the C library (`backends::bearssl`),
Expand All @@ -407,6 +410,18 @@ exactly its authors' and the program carries only what it calls.
the submodule's.
12. Moving a pin is a change of its own: the submodule, the canary's commit,
the tests on every target and the size table.
13. Botan is configured by upstream and compiled by b2, as
`tools/webcpp-botan.jam` does: Botan's own `configure.py` chooses the
modules (`tools/botan/modules.txt`, one list for every webcpp library, each
module with who needs it) and writes `build.h` and the list of sources for
each target into the build directory, `bin/third_party/botan/config-<hash>`,
never into the checkout; b2 compiles each listed source as an object of its
own with the program's properties. This is rule 2's kind of exception, as
OpenSSL's rule 7 is: the selection is upstream's, the compilation b2's.
Never the amalgamation, never a patch, never a module that seeds a
generator from the system (`system_rng`, `auto_rng`), which the helper
refuses. A library adds its own canary and define to the target; the
provisioning carries none.

## 6. Exceptions and RTTI

Expand Down Expand Up @@ -961,6 +976,8 @@ update --init third_party/libs/<name>`; a build that needs none never looks.
| `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 |
| `blake3` | BLAKE3 1.8.7 at `f3149ec`; `third_party/Jamfile` compiles `c/blake3.c`, `blake3_dispatch.c` and `blake3_portable.c` on every target, the intrinsics files on their instruction sets alone (an exception to chapter 5 rule 2), with webcpp::hash's canary; `WEBCPP_HASH_HAS_BLAKE3=1` | CC0-1.0, Apache-2.0, or Apache-2.0 with LLVM exception |
| `blake3_vectors` | BLAKE3's official vectors, `test_vectors/test_vectors.json` of the submodule `third_party/libs/blake3` at `f3149ec`, test data: hash's tests read it at run time under the directory its define `WEBCPP_TEST_BLAKE3_VECTORS` gives, on every target (wasmtime is given it, `webcpp.data`), and run again when it changes | CC0-1.0, Apache-2.0, or Apache-2.0 with LLVM exception |
| `botan` | Botan 3.14.1 at `01af88c`, the submodule `third_party/libs/botan`; configured by upstream's `configure.py` per target (`--minimized-build`, the modules of `tools/botan/modules.txt`) into `bin/third_party/botan/config-<hash>`, the library sources its `configure.py` lists compiled by b2 one object each (chapter 5, rule 13), natively and on Emscripten, with exceptions; `botan_test`, Botan's own test program; webcpp::hash's canary (`src/canary_botan.cpp`, compiled with Botan's own properties and build.h, and `WEBCPP_HASH_HAS_BOTAN` in the usage requirements, when `libs/hash` is checked out); no canary of the provisioning's own | BSD-2-Clause |
| `botan_vectors` | Botan's own test data, `src/tests/data` of the submodule `third_party/libs/botan` at `01af88c`, test data: hash's tests read `hash/whirlpool.vec`, `hash/skein.vec`, `passhash/bcrypt.vec`, `bcrypt_pbkdf.vec` and `kdf/sp800_108_ctr.vec` at run time under the directory its define `WEBCPP_TEST_BOTAN_VECTORS` gives, natively and on Emscripten (`webcpp.data`), and run again when they change | BSD-2-Clause |
| `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 |
Expand Down Expand Up @@ -9309,7 +9326,7 @@ summary.
`organization/openspec/changes/site-increments-4-5/specs/site/spec.md`
(proposals).

### hash (hashing and key derivation over Boost.Hash2 and C backends; wrapper; accepted 2026-11-14, increments 1, 2, 3, 4, 5 and 7 built, not merged)
### hash (hashing and key derivation over Boost.Hash2 and C backends; wrapper; accepted 2026-11-14, increments 1 to 7 built, not merged)

webcpp::hash is one entry point for hashing and key derivation in a C++20
program on every target webcpp has, a wrapper (`"port-of": null`). Increment 1
Expand Down Expand Up @@ -9338,10 +9355,18 @@ Argon2id with every parameter of RFC 9106; and the key derivations of
standards (`kdf_standards.hpp`), SP 800-108's KBKDF, SP 800-56C's one-step KDF
and ANSI X9.63's KDF, which have no default backend; increment 5 gives them
BearSSL's MD5, SHA-1, SHA-2, TLS 1.0's MD5-SHA1, SHAKE and HMAC, each reached
only by naming `backends::bearssl`. The C libraries are built by
only by naming `backends::bearssl`; increment 6 gives them Botan 3.14.1's
surface, each reached only by naming `backends::botan` (natively and on
Emscripten, in a program built with exceptions): its digests, Streebog,
Whirlpool and Skein-512 among them, its MACs, HKDF, PBKDF2, Argon2, scrypt and
the key derivations of standards, and bcrypt and bcrypt_pbkdf
(`bcrypt.hpp`), with their heavy forms `async_bcrypt`, `async_bcrypt_pbkdf`
and `async_bcrypt_verify`. The C libraries are built by
`third_party/Jamfile` (`xkcp`, `blake3`, `sodium`, `bearssl`, each with a
canary), their own suites by the `c-suites` lane (`test/c_suites`), the
examples are in `example/` and the documentation in `doc/`. Every function
canary), Botan by `tools/webcpp-botan.jam` as `/third_party//botan` (hash's
canary in `src/canary_botan.cpp`; designs D43 to D45), their own suites, and
Botan's, by the `c-suites` lane (`test/c_suites`), the examples are in
`example/` and the documentation in `doc/`. Every function
reports failure as a `boost::system::result`, takes its data as `std::span` and
allocates nothing in webcpp's own code; increment 7 adds an asynchronous family
in `async.hpp` over webcpp::asio (any completion token, Cobalt's `use_op`
Expand Down Expand Up @@ -9389,10 +9414,14 @@ and G4); the proposal, with the specification, the design and the plan, is in
derivations of standards, each reached only by naming `backends::openssl`;
the fifth, built, is BearSSL's MD5, SHA-1, SHA-2, TLS 1.0's MD5-SHA1 and SHAKE
through `digest_of` and `hasher`, and its HMAC through `mac`, each reached
only by naming `backends::bearssl`; the seventh, built, adds the browser
backend over WebCrypto through a parallel asynchronous family, whose cells
`doc/capabilities.json` marks asynchronous only; the sixth widens Botan's
surface. Across the built increments every tag that two backends or more
only by naming `backends::bearssl`; the sixth, built, is Botan's surface
through the families, the key derivations and bcrypt, each reached only by
naming `backends::botan`, which the stream provisions itself (design D43),
whose column is read at 3.14.1 (design D44) and which needs exceptions,
natively and on Emscripten, its lanes MSVC's included (design D45); the
seventh, built, adds the browser backend over WebCrypto through a parallel
asynchronous family, whose cells `doc/capabilities.json` marks asynchronous
only. Across the built increments every tag that two backends or more
have is checked to give the same bytes on each pair of them, on random cases.
Source: `libraries/hash/openspec/changes/genesis/reference/spec.md` section
1.5 (proposals).
Expand Down
1 change: 1 addition & 0 deletions Jamroot
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import tools/webcpp-lint-headers ;
import tools/webcpp-openssl ;
import tools/webcpp-libdatachannel ;
import tools/webcpp-ca-certificates ;
import tools/webcpp-botan ;

# A shell with CPATH (Homebrew sets it) puts its headers before the
# configured Boost, and the compiler would use them without a word.
Expand Down
6 changes: 6 additions & 0 deletions doc/releases/0.1.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,12 @@ family alone, and a tag outside its namespace's chapter.
template argument: each sentence reads the Backend's position from the header declaring the template.
* Fixed an interrupted OpenSSL or libdatachannel build leaving a configuration later builds took as
complete: its build record is published last, and one without it is built again.
* Added /third_party//botan, Botan 3.14.1 configured by upstream and compiled by b2, natively and on
Emscripten.
* Added /third_party//botan_vectors, Botan's own test data at its pin, which webcpp::hash's tests read
at run time.
* Changed tools/hash/doc_tables.py to mark backends::botan "with exceptions only" in every table, and
to refuse a function's default outside hash2, xkcp, blake3 and sodium.

[#webcpp-0-1-0-compilers-tested]
== Compilers tested
Expand Down
2 changes: 1 addition & 1 deletion libs/hash
Submodule hash updated 159 files
69 changes: 69 additions & 0 deletions third_party/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,25 @@ webcpp-openssl.declare $(WEBCPP_ROOT)
tools/openssl/msvc.conf tools/openssl/pin.json ;
explicit openssl ;

# Botan 3.14.1 (BSD-2-Clause), randombit/botan at 01af88c: upstream's
# configure.py chooses the modules (tools/botan/modules.txt, webcpp::hash's and
# webcpp::crypto's) and writes build.h and the list of sources for each target
# into bin/third_party/botan/config-<hash>; b2 compiles each listed source as
# an object of its own, with the consumer's properties, never the amalgamation
# and never a patch (CODING-GUIDELINES.md chapter 5, rule 13). Natively and on
# Emscripten, with exceptions. A library adds its own canary and define
# through webcpp-botan.declare's requirements and usage requirements here,
# as webcpp::hash's do (botan-hash-canary and botan-hash-usage, after the C
# libraries of webcpp::hash below; webcpp::crypto's join at its increment 7);
# the provisioning carries none.
import webcpp-botan ;
webcpp-botan.declare $(WEBCPP_ROOT)
: tools/botan/configure.py tools/botan/source.py tools/botan/pin.json
tools/botan/modules.txt tools/webcpp-botan.jam
: <conditional>@botan-hash-canary
: <conditional>@botan-hash-usage ;
explicit botan botan_test ;

# libdatachannel and its pinned nested dependencies use upstream CMake, with
# the exact OpenSSL archives above. Each archive reaches the program once. Its
# configurations are named as OpenSSL's are, by the bytes of the inputs below,
Expand Down Expand Up @@ -437,6 +456,27 @@ rule bearssl-hash-usage ( properties * )
}
}

# Botan, /third_party//botan above, carries webcpp::hash's canary as BearSSL
# does: src/canary_botan.cpp, a source of the library, compiled with Botan's
# own properties and its configured build.h, which the library gains only when
# libs/hash holds it, so that a checkout without libs/hash builds Botan as
# before; WEBCPP_HASH_HAS_BOTAN then joins the usage requirements.
rule botan-hash-canary ( properties * )
{
if [ path.exists [ path.native $(HASH)/src/canary_botan.cpp ] ]
{
return <source>$(HASH)/src/canary_botan.cpp <include>$(HASH)/include ;
}
}

rule botan-hash-usage ( properties * )
{
if [ path.exists [ path.native $(HASH)/src/canary_botan.cpp ] ]
{
return <define>WEBCPP_HASH_HAS_BOTAN=1 ;
}
}

# XKCP (CC0; brg_endian.h under Brian Gladman's terms), the Keccak team's code
# package at d20c8fc (2026-11-10; XKCP has no release tags): its Keccak-p[1600]
# in the plain-64bits implementation with all rounds unrolled ("generic64"),
Expand Down Expand Up @@ -936,6 +976,35 @@ alias openssl_evp_data : : <conditional>@openssl-evp-data-checked-out : :
<dependency>libs/openssl/test/recipes/30-test_evp_data/evpmd_sha.txt ;
explicit openssl_evp_data ;

# Botan's own test data (BSD-2-Clause), src/tests/data of the submodule
# third_party/libs/botan at the pin, read at run time from the directory
# WEBCPP_TEST_BOTAN_VECTORS gives, on every target it is built for, never
# copied: webcpp::hash reads hash/whirlpool.vec, hash/skein.vec,
# passhash/bcrypt.vec, bcrypt_pbkdf.vec and kdf/sp800_108_ctr.vec, and its
# c-suites lane runs Botan's own test program over the directory. Quoted as
# wycheproof's define is.
path-constant BOTAN_VECTORS : libs/botan/src/tests/data ;

rule botan-vectors-checked-out ( properties * )
{
if ! [ path.exists [ path.native $(BOTAN_VECTORS)/hash/whirlpool.vec ] ]
{
errors.user-error "third_party/libs/botan is not checked out. Check it out with"
"`git submodule update --init third_party/libs/botan`." ;
}
}

.botan-vectors = [ regex.replace $(BOTAN_VECTORS) "\\\\" "/" ] ;
alias botan_vectors : : <conditional>@botan-vectors-checked-out : :
<define>"\"WEBCPP_TEST_BOTAN_VECTORS=\\\"$(.botan-vectors)\\\"\""
[ webcpp.data $(BOTAN_VECTORS) ]
<dependency>libs/botan/src/tests/data/hash/whirlpool.vec
<dependency>libs/botan/src/tests/data/hash/skein.vec
<dependency>libs/botan/src/tests/data/passhash/bcrypt.vec
<dependency>libs/botan/src/tests/data/bcrypt_pbkdf.vec
<dependency>libs/botan/src/tests/data/kdf/sp800_108_ctr.vec ;
explicit botan_vectors ;

# BLAKE2's reference code package (CC0-1.0) at ed1974e, shallow, as test data
# that nothing compiles: webcpp::hash reads testvectors/blake2b-kat.txt (the
# keyed BLAKE2b cases) and testvectors/blake2-kat.json (the unkeyed ones) at
Expand Down
1 change: 1 addition & 0 deletions third_party/libs/botan
Submodule botan added at 01af88
Loading
Loading