Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
cafc77e
[cryptography] secrets wrapper
andresilva Dec 29, 2025
1ccaa2b
[cryptography] mlock/mprotect secret memory
andresilva Dec 29, 2025
a246b08
[cryptography] fix non-unix
andresilva Dec 29, 2025
01fc662
[cryptography] use subtle for constant-time operations
andresilva Dec 29, 2025
4c9941f
[cryptography] use mmap for secrets
andresilva Dec 29, 2025
71bd4ed
[cryptography] use closure-based API for exposing secrets
andresilva Dec 29, 2025
cf161b3
[cryptography] lint
andresilva Dec 29, 2025
4a2958d
[cryptography] allow mlock to fail on tests / benchmarks
andresilva Dec 29, 2025
d89a555
[cryptography] zeroize on construction failure
andresilva Dec 29, 2025
6b38b8d
[cryptography] require soft-mlock for ed25519 benchmarks
andresilva Dec 29, 2025
faab5c9
[cryptography] Secret doesn't require Zeroize
andresilva Dec 29, 2025
b816201
[cryptography] reprotect on panic
andresilva Dec 29, 2025
2bff348
[consensus] require cryptography/soft-mlock for tests
andresilva Dec 29, 2025
a100efe
[cryptography] drop in place before zeroizing
andresilva Dec 29, 2025
fd600b6
[cryptography] lint
andresilva Dec 29, 2025
cdeb2e4
[cryptography] remove share method
andresilva Dec 29, 2025
23b1698
[cryptography] derive partialeq/eq
andresilva Dec 29, 2025
e5f7b6d
[cryptography] specialize Secret for Eq/Ord impls
andresilva Dec 29, 2025
9f7aa17
[cryptography] use libc from workspace
andresilva Dec 29, 2025
4b4a15e
[cryptography] extract AccessGuard out of function
andresilva Dec 29, 2025
9e1bc6c
[cryptography] reduce duplication
andresilva Dec 29, 2025
ddb9a79
[cryptography] add more tests
andresilva Dec 29, 2025
11e68f4
[cryptography] fix sync issues
andresilva Dec 29, 2025
539ce5f
[cryptography] sync correctness
andresilva Dec 29, 2025
40c9231
[cryptography] nits
andresilva Dec 29, 2025
bc28df8
[cryptography] nits
andresilva Dec 29, 2025
490226e
[cryptography] nits
andresilva Dec 29, 2025
0c0d28c
[cryptography] docs
andresilva Dec 29, 2025
49b0a11
[cryptography] lint
andresilva Dec 29, 2025
b8ad207
[cryptography] nits
andresilva Dec 29, 2025
1057a37
[cryptography] ct_cmp_bytes enforce equal slice length
andresilva Dec 30, 2025
e1b2fb2
[cryptography] add Secret::try_new on non-unix
andresilva Dec 30, 2025
f5f007c
[cryptography] don't implement Hash for Secret
andresilva Dec 30, 2025
122fb84
[cryptography] docs
andresilva Dec 30, 2025
f116581
[cryptography] don't attempt to drop and zeroize if mprotect failed
andresilva Dec 30, 2025
b171bb0
[cryptography] nit
andresilva Dec 30, 2025
b561a52
[cryptography] nit imports
andresilva Jan 1, 2026
0f9f3f5
[cryptography] lint
andresilva Jan 1, 2026
ce2f568
Merge branch 'main' into andre/secrets-wrapper
andresilva Jan 3, 2026
086549c
[cryptography/secret] cleanup unsafe block
andresilva Jan 3, 2026
a74cda2
[cryptography/secret] rename soft-mlock to unsafe-mlock
andresilva Jan 3, 2026
c5c813e
[cryptography] Remove Hash from PrivateKey types (#2683)
patrick-ogrady Jan 3, 2026
c19e19e
[cryptography] Secrets Hardening (#2685)
patrick-ogrady Jan 3, 2026
3961108
Merge branch 'main' into andre/secrets-wrapper
patrick-ogrady Jan 3, 2026
b68d78c
Merge branch 'main' into andre/secrets-wrapper
andresilva Jan 5, 2026
b16dd73
[cryptography/secret] remove unix specific implementation
andresilva Jan 5, 2026
f0645c0
[cryptography/secret] use ManuallyDrop instead of MaybeUninit
andresilva Jan 5, 2026
4fc2fe4
[cryptography] add Secret::expose_unwrap
andresilva Jan 5, 2026
c372cb1
[cryptography/handshake] use Secret
andresilva Jan 5, 2026
f3b2eaa
[cryptography] don't implement Ord for Secret
andresilva Jan 5, 2026
3df3c93
[cryptography/secret] docs
andresilva Jan 5, 2026
72e4dcc
[cryptography] lint
andresilva Jan 5, 2026
b62aef9
[cryptography/secret] use raw mut
andresilva Jan 6, 2026
5e9895c
[cryptography/secret] use test_rng
andresilva Jan 6, 2026
c85923b
[cryptography/secret] take ptr before ManuallyDrop::take
andresilva Jan 6, 2026
fb3b30e
[cryptography/secret] zeroize scalar slices
andresilva Jan 6, 2026
3263f2d
[cryptography/secret] const new
andresilva Jan 6, 2026
dac480c
[cryptography/secret] move eq for Secret<Scalar>
andresilva Jan 6, 2026
884714a
[cryptography/secret] mention caller responsibility of wiping tempora…
andresilva Jan 6, 2026
8d7a123
[cryptography/handshake] nit
andresilva Jan 6, 2026
09fca29
[cryptography/secret] zeroize after forget
andresilva Jan 6, 2026
09091f8
[cryptography] use ctutils instead of subtle
andresilva Jan 6, 2026
1da9086
[cryptography] increase test coverage
andresilva Jan 6, 2026
b2bf52e
[cryptography] lint
andresilva Jan 6, 2026
e4de93b
Merge branch 'main' into andre/secrets-wrapper
andresilva Jan 7, 2026
13ab2e9
[cryptography/cipher] use ChaCha20Poly1305::generate_key
andresilva Jan 7, 2026
4eca663
[cryptography/bls12381] avoid stack when creating Scalar from bytes
andresilva Jan 7, 2026
2d44b98
Cleanup from_bytes()
patrick-ogrady Jan 7, 2026
99b8b43
fmt
patrick-ogrady Jan 7, 2026
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
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
matrix:
include:
- package: commonware-cryptography
cargo_flags: ""
cargo_flags: "--features commonware-cryptography/soft-mlock"
file_suffix: ""
benchmark_name: "commonware-cryptography"
- package: commonware-storage
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/slow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
matrix:
include:
- package: commonware-cryptography
cargo_flags: ""
cargo_flags: "--features commonware-cryptography/soft-mlock"
- package: commonware-storage
cargo_flags: ""
- package: commonware-storage
Expand Down
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ serde = "1.0.218"
serde_json = "1.0.122"
serde_yaml = "0.9.34"
sha2 = { version = "0.10.8", default-features = false }
subtle = { version = "2.6.1", default-features = false }
syn = "2.0.0"
sysinfo = "0.37.2"
thiserror = { version = "2.0.12", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ tracing.workspace = true
[dev-dependencies]
commonware-conformance.workspace = true
commonware-consensus = { path = ".", features = ["mocks"] }
commonware-cryptography = { workspace = true, features = ["soft-mlock"] }
commonware-math.workspace = true
commonware-resolver = { workspace = true, features = ["mocks"] }
rstest.workspace = true
Expand Down
9 changes: 9 additions & 0 deletions cryptography/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ rand_chacha.workspace = true
rand_core.workspace = true
rayon = { workspace = true, optional = true }
sha2.workspace = true
subtle.workspace = true
thiserror.workspace = true
x25519-dalek = { workspace = true, features = ["zeroize"] }
zeroize = { workspace = true, features = ["zeroize_derive"] }
Expand All @@ -41,6 +42,9 @@ zeroize = { workspace = true, features = ["zeroize_derive"] }
version = "0.2.15"
features = ["js"]

[target.'cfg(unix)'.dependencies]
libc = "0.2"

[dev-dependencies]
anyhow.workspace = true
commonware-conformance.workspace = true
Expand All @@ -55,6 +59,7 @@ crate-type = ["rlib", "cdylib"]

[features]
default = [ "std" ]
soft-mlock = []
parallel = [ "blake3/rayon", "rayon", "std" ]
mocks = [ "std" ]
arbitrary = [
Expand Down Expand Up @@ -84,6 +89,7 @@ std = [
"rand_core/std",
"rayon",
"sha2/std",
"subtle/std",
"thiserror/std",
"zeroize/std",
]
Expand All @@ -92,16 +98,19 @@ std = [
name = "bls12381"
harness = false
path = "src/bls12381/benches/bench.rs"
required-features = ["soft-mlock"]

[[bench]]
name = "ed25519"
harness = false
path = "src/ed25519/benches/bench.rs"
required-features = ["soft-mlock"]

[[bench]]
name = "secp256r1"
harness = false
path = "src/secp256r1/benches/bench.rs"
required-features = ["soft-mlock"]

[[bench]]
name = "sha256"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,7 @@ fn arbitrary_g2(u: &mut Unstructured) -> Result<G2, arbitrary::Error> {
}

fn arbitrary_share(u: &mut Unstructured) -> Result<Share, arbitrary::Error> {
Ok(Share {
index: u.int_in_range(1..=100)?,
private: arbitrary_scalar(u)?,
})
Ok(Share::new(u.int_in_range(1..=100)?, arbitrary_scalar(u)?))
}

fn arbitrary_poly_scalar(u: &mut Unstructured) -> Result<Poly<Scalar>, arbitrary::Error> {
Expand Down
5 changes: 1 addition & 4 deletions cryptography/fuzz/fuzz_targets/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,7 @@ pub fn arbitrary_scalar(u: &mut Unstructured) -> Result<Scalar, arbitrary::Error

#[allow(unused)]
pub fn arbitrary_share(u: &mut Unstructured) -> Result<Share, arbitrary::Error> {
Ok(Share {
index: u.int_in_range(1..=100)?,
private: arbitrary_scalar(u)?,
})
Ok(Share::new(u.int_in_range(1..=100)?, arbitrary_scalar(u)?))
}

#[allow(unused)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn test_private_key(data: &[u8]) {
if let (Ok(ref_key), Ok(our_key)) = (ref_result, our_result) {
assert_eq!(
ref_key.to_bytes().as_slice(),
our_key.as_ref(),
our_key.encode().as_ref(),
"32-byte input: keys don't match"
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn test_private_key(data: &[u8]) {
if let (Ok(ref_key), Ok(our_key)) = (ref_result, our_result) {
assert_eq!(
ref_key.to_bytes().as_slice(),
our_key.as_ref(),
our_key.encode().as_ref(),
"32-byte input: keys don't match"
);
}
Expand Down
Loading
Loading