Merge rust-bitcoin/rust-bitcoin#7204: key-expression: Get secp256k1 from the crypto dep
What changed, and why it matters
This change is a routine internal cleanup: the key_expression crate stops depending directly on the secp256k1 cryptography library and instead uses a re-export provided by another internal crate called crypto. No user-facing behavior, types, or error messages change. It is not a security fix and does not introduce any obvious vulnerability.
No security action required. Treat as normal dependency-refactoring maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit removes the direct secp256k1 dependency from key_expression/Cargo.toml and updates feature forwarding so that std/alloc/serde/arbitrary features route through the crypto crate, which already re-exports secp256k1. Source files now import secp256k1 via crypto::secp256k1 instead of the top-level crate, and the public re-export in lib.rs becomes pub use crypto::secp256k1. Lock files are updated to reflect one fewer dependency edge. The PR description explicitly states there are no behavior, public type, or error variant changes.
Changed components
key_expression/Cargo.tomlkey_expression/src/bip32.rskey_expression/src/lib.rsCargo lock filesInspect captured patch +7 / −10
### Cargo-minimal.lock
@@ -233,7 +233,6 @@ dependencies = [
"bitcoin-network-kind",
"bitcoin_hashes 1.2.0",
"hex-conservative 1.1.0",
- "secp256k1 0.33.0",
"serde",
"serde_json",
]
### Cargo-recent.lock
@@ -226,7 +226,6 @@ dependencies = [
"bitcoin-network-kind",
"bitcoin_hashes 1.2.0",
"hex-conservative 1.1.0",
- "secp256k1 0.33.0",
"serde",
"serde_json",
]
### benches/Cargo.lock
@@ -163,7 +163,6 @@ dependencies = [
"bitcoin-network-kind",
"bitcoin_hashes",
"hex-conservative",
- "secp256k1",
"serde",
]
### bitcoin/embedded/Cargo.lock
@@ -113,7 +113,6 @@ dependencies = [
"bitcoin-network-kind",
"bitcoin_hashes",
"hex-conservative",
- "secp256k1",
"serde",
]
### key_expression/Cargo.toml
@@ -15,10 +15,10 @@ exclude = ["tests", "contrib"]
[features]
default = ["std"]
-std = ["alloc", "base58/std", "crypto/std", "hashes/std", "hex/std", "internals/std", "network/std", "secp256k1/std", "serde?/std"]
-alloc = ["base58/alloc", "crypto/alloc", "hashes/alloc", "hex/alloc", "internals/alloc", "network/alloc", "secp256k1/alloc", "serde?/alloc"]
-serde = ["dep:serde", "hashes/serde", "internals/serde", "secp256k1/serde"]
-arbitrary = ["crypto/arbitrary", "dep:arbitrary", "hashes/arbitrary", "secp256k1/arbitrary", "network/arbitrary"]
+std = ["alloc", "base58/std", "crypto/std", "hashes/std", "hex/std", "internals/std", "network/std", "serde?/std"]
+alloc = ["base58/alloc", "crypto/alloc", "hashes/alloc", "hex/alloc", "internals/alloc", "network/alloc", "serde?/alloc"]
+serde = ["dep:serde", "hashes/serde", "internals/serde", "crypto/serde", "network/serde"]
+arbitrary = ["crypto/arbitrary", "dep:arbitrary", "hashes/arbitrary", "network/arbitrary"]
[dependencies]
base58 = { package = "base58ck", path = "../base58", version = "0.5.0", default-features = false }
@@ -27,7 +27,6 @@ hashes = { package = "bitcoin_hashes", path = "../hashes", version = "1.1.0", de
hex = { package = "hex-conservative", version = "1.1.0", default-features = false, features = ["alloc"] }
internals = { package = "bitcoin-internals", path = "../internals", version = "0.8.2" }
network = { package = "bitcoin-network-kind", path = "../network", version = "1.0.0", default-features = false }
-secp256k1 = { version = "0.33.0", default-features = false }
arbitrary = { version = "1.4.1", optional = true }
serde = { version = "1.0.195", default-features = false, features = ["derive"], optional = true }
### key_expression/src/bip32.rs
@@ -17,6 +17,7 @@ use core::{fmt, slice};
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
use crypto::key::{FullPublicKey, Keypair, PrivateKey, XOnlyPublicKey};
+use crypto::secp256k1;
use hashes::{hash160, hash_newtype, sha256, sha512, Hash, HashEngine, Hmac, HmacEngine};
use internals::array::ArrayExt;
use network::NetworkKind;
@@ -1376,6 +1377,7 @@ pub mod error {
use core::convert::Infallible;
use core::fmt;
+ use crypto::secp256k1;
use internals::write_err;
use super::{ChildNumber, Fingerprint};
### key_expression/src/lib.rs
@@ -22,7 +22,7 @@ extern crate hashes;
extern crate hex;
-pub extern crate secp256k1;
+pub use crypto::secp256k1;
#[cfg(feature = "serde")]
extern crate serde;Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.