Skip to content

Commit d2085b5

Browse files
davxygrishasobol
authored andcommitted
Replace libsecp256k1 with secp256k1 (paritytech#10798)
* Replace libsecp256k1 with secp256k1 * Wipe ecdsa secret key from memory on drop * Some comments for a known issue * Safer core crypto primitives `from_slice` constructor Previous version panics if slice lenght is not the expected one. * Unit test fix * Enable use of global secp256k1 context * Better comments for ecdsa `Pair` drop * Replace `libsecp256k1` with `seco256k1` in `beefy-mmr` Used to convert ecdsa public key to ETH address * Replace `libsecp256k1` with `secp256k1` in FRAME `contracts`benchmarks * Temporary rollback of `beefy-mmr` to libsecp256k1 Check for detected build issues * Cargo fmt * Rollback of FRAME `contracts` benchmarks to `libsecp256k1` * Rollback for unrelated changes * Typo fix * Add comments for deprecated `ecdsa_verify` and `secp256k1_ecdsa_recover`
1 parent 1bd4bf8 commit d2085b5

File tree

10 files changed

+184
-152
lines changed

10 files changed

+184
-152
lines changed

Cargo.lock

Lines changed: 21 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ percent-encoding = { opt-level = 3 }
265265
primitive-types = { opt-level = 3 }
266266
ring = { opt-level = 3 }
267267
rustls = { opt-level = 3 }
268+
secp256k1 = { opt-level = 3 }
268269
sha2 = { opt-level = 3 }
269270
sha3 = { opt-level = 3 }
270271
smallvec = { opt-level = 3 }

client/authority-discovery/src/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fn cryptos_are_compatible() {
105105
let sp_core_signature = sp_core_secret.sign(message); // no error expected...
106106

107107
assert!(sp_core::ed25519::Pair::verify(
108-
&sp_core::ed25519::Signature::from_slice(&libp2p_signature),
108+
&sp_core::ed25519::Signature::from_slice(&libp2p_signature).unwrap(),
109109
message,
110110
&sp_core_public
111111
));

client/executor/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ sc-executor-common = { version = "0.10.0-dev", path = "common" }
3131
sc-executor-wasmi = { version = "0.10.0-dev", path = "wasmi" }
3232
sc-executor-wasmtime = { version = "0.10.0-dev", path = "wasmtime", optional = true }
3333
parking_lot = "0.12.0"
34-
libsecp256k1 = "0.7"
3534
sp-core-hashing-proc-macro = { version = "4.0.0-dev", path = "../../primitives/core/hashing/proc-macro" }
3635
lru = "0.6.6"
3736
tracing = "0.1.29"

primitives/core/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ schnorrkel = { version = "0.9.1", features = [
5454
"u64_backend",
5555
], default-features = false, optional = true }
5656
hex = { version = "0.4", default-features = false, optional = true }
57-
libsecp256k1 = { version = "0.7", default-features = false, features = ["hmac", "static-context"], optional = true }
57+
libsecp256k1 = { version = "0.7", default-features = false, features = ["static-context"], optional = true }
5858
merlin = { version = "2.0", default-features = false, optional = true }
59+
secp256k1 = { version = "0.21.2", default-features = false, features = ["recovery", "global-context"], optional = true }
5960
ss58-registry = { version = "1.11.0", default-features = false }
6061
sp-core-hashing = { version = "4.0.0", path = "./hashing", default-features = false, optional = true }
6162
sp-runtime-interface = { version = "5.0.0", default-features = false, path = "../runtime-interface" }
@@ -106,6 +107,7 @@ std = [
106107
"schnorrkel/std",
107108
"regex",
108109
"num-traits/std",
110+
"secp256k1/std",
109111
"sp-core-hashing/std",
110112
"sp-debug-derive/std",
111113
"sp-externalities",
@@ -129,6 +131,7 @@ full_crypto = [
129131
"schnorrkel",
130132
"hex",
131133
"libsecp256k1",
134+
"secp256k1",
132135
"sp-core-hashing",
133136
"sp-runtime-interface/disable_target_static_assertions",
134137
"merlin",

0 commit comments

Comments
 (0)