wolfssl: document the FIPS 140-3 build

Explains the bundle variables, configure options and the in-core
hash workflow for release builds.

Refs: R3-7
This commit is contained in:
JohnE 2026-11-16 03:56:08 -05:00
parent d92de9e60b
commit 9b11fb0c43
1 changed files with 37 additions and 0 deletions

View File

@ -9,6 +9,43 @@
//! Call [`init()`] once at application start (from the bridge crate's //! Call [`init()`] once at application start (from the bridge crate's
//! `ccc_init()` function). That registers a [`WolfSslProvider`] into the //! `ccc_init()` function). That registers a [`WolfSslProvider`] into the
//! global [`ProviderRegistry`][ccc_crypto_core::registry::ProviderRegistry]. //! 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=<v5|v6> --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 aead;
pub mod capabilities; pub mod capabilities;