mirror of
https://github.com/jmcorgan/fips.git
synced 2026-10-30 07:37:36 +00:00
Move the root's noise module into fips-core's noise module. handshake.rs, replay.rs and session.rs move unchanged, and the tests move unchanged to core/src/noise/tests/mod.rs. The root's noise/mod.rs moves to core/src/noise/cipher.rs, keeping its module documentation, the protocol names, the error and role types and CipherState; in it the mod lines and the mod tests line go, the re-export block becomes one use of the parent module's sizes, the aead import names super::aead, open, take_cleared and clear_slot become pub, and the test-only key_bytes becomes pub(super), for the tests now beside it. fips-core's noise/mod.rs declares the submodules and re-exports their items, with open behind the test-hooks feature and take_cleared and clear_slot hidden from the docs. The root keeps every path through src/noise.rs, which re-exports the moved items and defines fips::noise::HandshakeState as HandshakeState<OsEntropy>. It also holds a compile-time check that AeadKey is ring's LessSafeKey, so a hosted build cannot silently fall back to the slower RustCrypto backend if the root's fips-core line loses its ring feature; on Windows, where the workers' paths are not built, that line is the only such check. The root re-exports that the files used while they were in the root (identity::secp, testutil::TestEntropy and entropy) go. fips-core gains hkdf and hmac, sha2's zeroize feature and zeroize's derive, which the handshake needs; the root drops hkdf and hmac, which no root code uses now. Cargo.lock gains no package.
73 lines
3.7 KiB
TOML
73 lines
3.7 KiB
TOML
[package]
|
|
name = "fips-core"
|
|
# Versioned with the workspace's root package: this crate is not published on
|
|
# its own, and its version here is never bumped. Release version bumps edit the
|
|
# root Cargo.toml only.
|
|
version = "0.0.0"
|
|
edition = "2024"
|
|
license = "MIT"
|
|
publish = false
|
|
|
|
[dependencies]
|
|
# `alloc` only on secp256k1, bech32 and hex: their `std` features would link
|
|
# `std`, which the bare-metal build (testing/build-core-baremetal.sh) rejects.
|
|
# Without `rand`, `Secp256k1::new()` does not blind the context; the host
|
|
# blinds it through `identity::init_secp`.
|
|
secp256k1 = { version = "0.30", default-features = false, features = ["alloc"] }
|
|
bech32 = { version = "0.12", default-features = false, features = ["alloc"] }
|
|
hex = { version = "0.4", default-features = false, features = ["alloc"] }
|
|
|
|
# The `zeroize` features clear the SHA-256 and HMAC states on drop, which hold
|
|
# handshake secrets in `noise`. `hmac`'s feature only forwards to `digest`'s,
|
|
# which `sha2`'s also turns on; it is listed so the HMAC inside `hkdf` keeps it
|
|
# if `sha2`'s ever stops doing so.
|
|
sha2 = { version = "0.11", default-features = false, features = ["zeroize"] }
|
|
hkdf = { version = "0.13", default-features = false }
|
|
hmac = { version = "0.13", default-features = false, features = ["zeroize"] }
|
|
# `alloc` for the `Zeroizing<Vec<u8>>` guards in the secret key decoding;
|
|
# `zeroize_derive` for the Noise cipher and symmetric states.
|
|
zeroize = { version = "1.9", default-features = false, features = ["alloc", "zeroize_derive"] }
|
|
thiserror = { version = "2.0", default-features = false }
|
|
once_cell = { version = "1.21", default-features = false, features = ["race", "alloc"] }
|
|
# `MmpMode` derives Serialize and Deserialize for the node configuration.
|
|
# Builds without `std` or `alloc`.
|
|
serde = { version = "1.0", default-features = false, features = ["derive"] }
|
|
# `log` for the bloom false-positive estimate: `core` has no float logarithm.
|
|
# Default features (`arch`) as the root crate had them, so the implementation
|
|
# the estimate uses does not change.
|
|
libm = "0.2"
|
|
# The hash map for peer-chosen keys (`utils::hash`): `hashbrown`'s table with a
|
|
# SipHash-1-3 hasher keyed from the host, as `std`'s `HashMap` is built. No
|
|
# default hasher: `foldhash` is not keyed on targets without address-space
|
|
# randomization.
|
|
hashbrown = { version = "0.16", default-features = false }
|
|
siphasher = { version = "1.0", default-features = false }
|
|
# The AEAD backend that builds for every target (`noise::aead`).
|
|
chacha20poly1305 = { version = "0.10", default-features = false }
|
|
# The hosted AEAD backend, behind the `ring` feature: its assembly is faster,
|
|
# but it does not build for bare-metal targets. The AEAD needs neither of its
|
|
# defaults (`alloc`, `dev_urandom_fallback`).
|
|
ring = { version = "0.17", default-features = false, optional = true }
|
|
|
|
[features]
|
|
# Use `ring` for the AEAD instead of RustCrypto (`noise::aead::AeadKey`).
|
|
# Hosted builds turn it on; bare-metal builds must leave it off.
|
|
ring = ["dep:ring"]
|
|
# Test hooks in `proto`: methods and re-exports that only unit tests use to
|
|
# set up or inspect state. This crate's tests see them through `cfg(test)`;
|
|
# the root crate's tests see them because the root enables this feature from
|
|
# its `[dev-dependencies]` only. Never enable it outside tests.
|
|
test-hooks = []
|
|
|
|
[dev-dependencies]
|
|
# Host-only test dependencies; tests may use `std`.
|
|
# Random keys for the test fixtures (`testutil::make_keypair`, the lookup tests).
|
|
rand = "0.10.1"
|
|
# `sign_schnorr` for the protocol tests' signing fixtures, which secp256k1
|
|
# provides only with `rand` and `std`. Tests only: the library stays on
|
|
# `alloc`.
|
|
secp256k1 = { version = "0.30", default-features = false, features = ["rand", "std"] }
|
|
# `MmpMode`'s configuration spelling, checked with the parser the node
|
|
# configuration uses.
|
|
serde_yaml = "0.9"
|