Skip to content

Commit

Permalink
DRAFT
Browse files Browse the repository at this point in the history
  • Loading branch information
DanGould committed Aug 10, 2024
1 parent d367ea4 commit 50ae4f7
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 2,005 deletions.
24 changes: 1 addition & 23 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@ keywords = ["cryptography", "crypto", "key-exchange", "encryption", "aead", "sec
categories = ["cryptography", "no-std"]

[features]
# "p256" enables the use of ECDH-NIST-P256 as a KEM
# "p384" enables the use of ECDH-NIST-P384 as a KEM
# "x25519" enables the use of the X25519 as a KEM
default = ["alloc", "p256", "x25519"]
x25519 = ["dep:x25519-dalek"]
p384 = ["dep:p384"]
p256 = ["dep:p256"]
p521 = ["dep:p521"]
k256 = ["dep:k256"]
default = ["alloc", "secp"]
secp = ["bitcoin", "secp256k1/global-context", "secp256k1/rand-std"]
# Include allocating methods like open() and seal()
alloc = []
Expand All @@ -32,20 +24,14 @@ aead = "0.5"
aes-gcm = "0.10"
bitcoin = { version = "0.32.0", optional = true }
secp256k1 = { version = "0.29", optional = true }
# bitcoin = { git = "https://github.com/rust-bitcoin/rust-bitcoin", commit = "0d1cab68eee59f79c3ec76cf393438471b68fe69", optional = true }
chacha20poly1305 = "0.10"
generic-array = { version = "0.14", default-features = false }
digest = "0.10"
hkdf = "0.12"
hmac = "0.12"
rand_core = { version = "0.6", default-features = false }
k256 = { version = "0.13", default-features = false, features = ["arithmetic", "ecdh"], optional = true}
p256 = { version = "0.13", default-features = false, features = ["arithmetic", "ecdh"], optional = true}
p384 = { version = "0.13", default-features = false, features = ["arithmetic", "ecdh"], optional = true}
p521 = { version = "0.13", default-features = false, features = ["arithmetic", "ecdh"], optional = true}
sha2 = { version = "0.10", default-features = false }
subtle = { version = "2.6", default-features = false }
x25519-dalek = { version = "2", default-features = false, features = ["static_secrets"], optional = true }
zeroize = { version = "1", default-features = false, features = ["zeroize_derive"] }

[dev-dependencies]
Expand All @@ -56,14 +42,6 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
rand = { version = "0.8", default-features = false, features = ["getrandom", "std_rng"] }

[[example]]
name = "client_server"
required-features = ["x25519"]

[[example]]
name = "agility"
required-features = ["p256", "p384", "p521", "x25519"]

# Tell docs.rs to build docs with `--all-features` and `--cfg docsrs` (for nightly docs features)
[package.metadata.docs.rs]
all-features = true
Expand Down
23 changes: 5 additions & 18 deletions benches/benches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,25 +210,12 @@ where
pub fn benches() {
let mut c = Criterion::default().configure_from_args();

// NIST ciphersuite at the 128-bit security level is AES-GCM-128, HKDF-SHA256, and ECDH-P256
#[cfg(feature = "p256")]
bench_ciphersuite::<hpke::aead::AesGcm128, hpke::kdf::HkdfSha256, hpke::kem::DhP256HkdfSha256>(
"NIST[seclevel=128]",
&mut c,
);

// Non-NIST ciphersuite at the 128-bit security level is ChaCha20Poly1305, HKDF-SHA256, and X25519
#[cfg(feature = "x25519")]
bench_ciphersuite::<
hpke::aead::ChaCha20Poly1305,
hpke::kdf::HkdfSha256,
hpke::kem::X25519HkdfSha256,
>("Non-NIST[seclevel=128]", &mut c);

#[cfg(feature = "secp")]
bench_ciphersuite::<hpke::aead::AesGcm128, hpke::kdf::HkdfSha256, hpke::kem::SecpK256HkdfSha256>(
"secp", &mut c,
);
bench_ciphersuite::<
bitcoin_hpke::aead::AesGcm128,
bitcoin_hpke::kdf::HkdfSha256,
bitcoin_hpke::kem::SecpK256HkdfSha256,
>("secp", &mut c);
}

criterion_main!(benches);
Loading

0 comments on commit 50ae4f7

Please sign in to comment.