diff --git a/crates/ccc-crypto-wolfssl/src/lib.rs b/crates/ccc-crypto-wolfssl/src/lib.rs index bdc592e..89a9fea 100644 --- a/crates/ccc-crypto-wolfssl/src/lib.rs +++ b/crates/ccc-crypto-wolfssl/src/lib.rs @@ -9,6 +9,43 @@ //! Call [`init()`] once at application start (from the bridge crate's //! `ccc_init()` function). That registers a [`WolfSslProvider`] into the //! global [`ProviderRegistry`][ccc_crypto_core::registry::ProviderRegistry]. +//! +//! ## FIPS 140-3 builds +//! +//! Release builds link the commercial wolfCrypt FIPS 140-3 module (R3-7, +//! D-26). Build with `--features fips` and point the build at the unpacked +//! bundle: +//! +//! ```text +//! export WOLFSSL_FIPS_SOURCE_DIR=/path/to/wolfssl-x.y.z-commercial-fips-v5 +//! export WOLFSSL_FIPS_VERSION=v5 # or v6; default v5 +//! export WOLFSSL_FIPS_CORE_HASH=<64 hex> # after the first run, see below +//! cargo build --release --features fips +//! ``` +//! +//! - The build fails if `WOLFSSL_FIPS_SOURCE_DIR` is unset or is not a FIPS +//! bundle (no `wolfcrypt/src/fips.c`). It never falls back to the +//! open-source tree, and `WOLFSSL_INSTALL_DIR` and `stub_ffi` are refused. +//! - wolfSSL's CMake has no FIPS support, so the bundle is built with its own +//! `configure`: `--enable-fips= --enable-cryptonly --enable-static +//! --disable-shared --enable-aesgcm --enable-sha384 --enable-sha512 +//! --enable-sha3 --enable-hkdf --enable-pwdbased --enable-keygen` for the +//! approved services, plus `--enable-chacha --enable-poly1305 +//! --enable-xchacha --enable-curve25519 --enable-curve448 --enable-blake2`, +//! which are non-approved services of the module. Cross builds pass +//! `--host=...` through `WOLFSSL_FIPS_CONFIGURE_ARGS`. Windows uses the +//! bundle's `IDE/WIN10` project instead. +//! - In-core integrity hash: the module hashes its own code in the final, +//! linked binary, so the hash changes with every relink of a static +//! library. Build once, read [`fips::fips_core_hash()`] from the failing +//! binary, set `WOLFSSL_FIPS_CORE_HASH` (it becomes +//! `-DWOLFCRYPT_FIPS_CORE_HASH_VALUE`) and rebuild. To keep the hash +//! stable across application changes, the final link (the bridge cdylib) +//! should place the FIPS objects with a linker script, as wolfSSL's +//! static-linking guide describes. +//! - [`CryptoProvider::fips_mode()`][ccc_crypto_core::CryptoProvider::fips_mode] +//! is `true` only for a `fips` build whose power-on self-test passed +//! (`wolfCrypt_GetStatus_fips() == 0`); every other build reports `false`. pub mod aead; pub mod capabilities;