Skip to content

Commit

Permalink
Bump secp256k1 from 0.24.3 to 0.28.0 (paritytech#2357)
Browse files Browse the repository at this point in the history
Bumps [secp256k1](https://github.com/rust-bitcoin/rust-secp256k1) from
0.24.3 to 0.28.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/rust-bitcoin/rust-secp256k1/blob/master/CHANGELOG.md">secp256k1's
changelog</a>.</em></p>
<blockquote>
<h1>0.28.0 - 2023-10-23</h1>
<ul>
<li>Add bindings to the ElligatorSwift implementation <a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/627">#627</a></li>
<li>Depend on recent release of <code>bitcoin_hashes</code> v0.13.0 <a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/621">#621</a></li>
<li>Add a verify function to <code>PublicKey</code> <a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/618">#618</a></li>
<li>Add serialize function for schnorr::Signature <a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/607">#607</a></li>
<li>Bump MSRV to 1.48 <a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/595">#595</a></li>
<li>Remove implementations of <code>PartialEq</code>, <code>Eq</code>,
<code>PartialOrd</code>, <code>Ord</code>, and <code>Hash</code> from
the
<code>impl_array_newtype</code> macro. Users will now need to derive
these traits if they are wanted.</li>
</ul>
<h1>0.27.0 - 2023-03-15</h1>
<ul>
<li><a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/588">Depend
on newly release <code>bitcoin_hashes</code> v0.12</a>.</li>
<li><a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/578">Implement
<code>Debug</code> trait for <code>Scalar</code> type</a>.</li>
<li><a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/582">Implement
<code>insecure-erase</code></a>.</li>
</ul>
<h1>0.26.0 - 2202-12-19</h1>
<ul>
<li>Update libsecp25k1 to v0.2.0</li>
</ul>
<h1>0.25.0 - 2022-12-07</h1>
<ul>
<li><a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/548">Fix
soundness issue with <code>preallocated_gen_new</code></a></li>
<li>Update to <code>secp256k1-sys</code> <a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/549">v0.7.0</a></li>
<li>Use type system to <a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/483">improve
safety</a>.</li>
<li><a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/490">Change
secp256k1-sys symbol names to 0_6_1</a>.</li>
<li><a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/499">Introduce
<code>rustfmt</code></a> to the codebase.</li>
<li><a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/507">Make
all raw pointer methods go through the CPtr trait</a>.</li>
<li><a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/518">Make
comparison functions stable</a>.</li>
<li><a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/512">Remove</a>
public constant <code>ONE_KEY</code> (consider using
<code>FromStr</code> as a replacement).</li>
</ul>
<h1>0.24.1 - 2022-10-25</h1>
<ul>
<li><a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/issues/491">Fix
broken deserialization logic of <code>KeyPair</code></a> that previously
always panicked. After the patch deserialization only panics if neither
the <code>global-context</code> nor the <code>alloc</code> (default)
feature is active.</li>
</ul>
<h1>0.24.0 - 2022-07-20</h1>
<ul>
<li>Upgrade to new release of <a
href="https://github.com/rust-bitcoin/bitcoin_hashes/releases/tag/0.11.0">bitcoin_hashes</a>.</li>
</ul>
<h1>0.23.4 - 2022-07-14</h1>
<ul>
<li><a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/474">Disable
automatic rerandomization of contexts under WASM</a></li>
</ul>
<h1>0.23.3 - 2022-06-29</h1>
<ul>
<li><a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/465">Add
must_use for mut self key manipulation methods</a></li>
<li><a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/pull/466">Fix
fuzzing feature guard</a></li>
</ul>
<h1>0.23.2 - 2022-06-27</h1>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/rust-bitcoin/rust-secp256k1/commit/7de09c8050da12a13ef9ee3850597f69c887952d"><code>7de09c8</code></a>
Merge <a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/issues/256">rust-bitcoin/rust-secp256k1256</a>:
Tracking PR for release: `secp256k1 v0...</li>
<li><a
href="https://github.com/rust-bitcoin/rust-secp256k1/commit/3dc5b165401f249c01a88cec54061301cffd97a0"><code>3dc5b16</code></a>
Bump version to v0.28.0</li>
<li><a
href="https://github.com/rust-bitcoin/rust-secp256k1/commit/3aada83180beec2b9f5ab8e7b9280a5517d3bcde"><code>3aada83</code></a>
Merge <a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/issues/256">rust-bitcoin/rust-secp256k1256</a>:
Add bindings to the ElligatorSwift imp...</li>
<li><a
href="https://github.com/rust-bitcoin/rust-secp256k1/commit/39febcb866ce285d53052a3636602f04483aa710"><code>39febcb</code></a>
Create rust-bidings</li>
<li><a
href="https://github.com/rust-bitcoin/rust-secp256k1/commit/da4f67b274c3061717723a568cfb182e4e2e7cce"><code>da4f67b</code></a>
Merge <a
href="https://redirect.github.com/rust-bitcoin/rust-secp256k1/issues/256">rust-bitcoin/rust-secp256k1256</a>:
Update vendored lib secp256k1 to v0.4.0</li>
<li><a
href="https://github.com/rust-bitcoin/rust-secp256k1/commit/80b2a8d4aa6ffa72041d569eab2278cd8c1ace2a"><code>80b2a8d</code></a>
Update vendored libsecp to v0.4.0</li>
<li><a
href="https://github.com/rust-bitcoin/rust-secp256k1/commit/d2285c929a086276ce6d1670d795c49191e30c65"><code>d2285c9</code></a>
ci: Remove MIPS* from CI</li>
<li><a
href="https://github.com/rust-bitcoin/rust-secp256k1/commit/0d58f50d523b40a78de0b87146208e3ad338c8ba"><code>0d58f50</code></a>
ci: generalize grp in &quot;illegal callback&quot; test</li>
<li><a
href="https://github.com/rust-bitcoin/rust-secp256k1/commit/acf9ac13e9f8df84dd52d2f012cda7211a6af10c"><code>acf9ac1</code></a>
delete <code>test_manual_create_destroy</code> test</li>
<li><a
href="https://github.com/rust-bitcoin/rust-secp256k1/commit/04ce50891bb0d49be5355f5c0d82db70d7dda65a"><code>04ce508</code></a>
lib: fix bad unit test</li>
<li>Additional commits viewable in <a
href="https://github.com/rust-bitcoin/rust-secp256k1/compare/secp256k1-0.24.3...secp256k1-0.28.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=secp256k1&package-manager=cargo&previous-version=0.24.3&new-version=0.28.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
  • Loading branch information
dependabot[bot] and liamaharon authored Nov 18, 2023
1 parent 822faf1 commit 05b319d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion substrate/primitives/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ blake2 = { version = "0.10.4", default-features = false, optional = true }
libsecp256k1 = { version = "0.7", default-features = false, features = ["static-context"], optional = true }
schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated", "u64_backend"], default-features = false }
merlin = { version = "2.0", default-features = false }
secp256k1 = { version = "0.24.0", default-features = false, features = ["recovery", "alloc"], optional = true }
secp256k1 = { version = "0.28.0", default-features = false, features = ["recovery", "alloc"], optional = true }
sp-core-hashing = { path = "hashing", default-features = false, optional = true }
sp-runtime-interface = { path = "../runtime-interface", default-features = false}

Expand Down
13 changes: 4 additions & 9 deletions substrate/primitives/core/src/ecdsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ impl Signature {
pub fn recover_prehashed(&self, message: &[u8; 32]) -> Option<Public> {
let rid = RecoveryId::from_i32(self.0[64] as i32).ok()?;
let sig = RecoverableSignature::from_compact(&self.0[..64], rid).ok()?;
let message = Message::from_slice(message).expect("Message is 32 bytes; qed");
let message = Message::from_digest_slice(message).expect("Message is 32 bytes; qed");

#[cfg(feature = "std")]
let context = SECP256K1;
Expand Down Expand Up @@ -458,7 +458,7 @@ impl Pair {

/// Sign a pre-hashed message
pub fn sign_prehashed(&self, message: &[u8; 32]) -> Signature {
let message = Message::from_slice(message).expect("Message is 32 bytes; qed");
let message = Message::from_digest_slice(message).expect("Message is 32 bytes; qed");

#[cfg(feature = "std")]
let context = SECP256K1;
Expand Down Expand Up @@ -508,12 +508,7 @@ impl Pair {
#[cfg(feature = "full_crypto")]
impl Drop for Pair {
fn drop(&mut self) {
let ptr = self.secret.as_mut_ptr();
for off in 0..self.secret.len() {
unsafe {
core::ptr::write_volatile(ptr.add(off), 0);
}
}
self.secret.non_secure_erase()
}
}

Expand Down Expand Up @@ -760,7 +755,7 @@ mod test {
let msg = [0u8; 32];
let sig1 = pair.sign_prehashed(&msg);
let sig2: Signature = {
let message = Message::from_slice(&msg).unwrap();
let message = Message::from_digest_slice(&msg).unwrap();
SECP256K1.sign_ecdsa_recoverable(&message, &pair.secret).into()
};
assert_eq!(sig1, sig2);
Expand Down
2 changes: 1 addition & 1 deletion substrate/primitives/io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sp-trie = { path = "../trie", default-features = false, optional = true}
sp-externalities = { path = "../externalities", default-features = false}
sp-tracing = { path = "../tracing", default-features = false}
log = { version = "0.4.17", optional = true }
secp256k1 = { version = "0.24.0", features = ["recovery", "global-context"], optional = true }
secp256k1 = { version = "0.28.0", features = ["recovery", "global-context"], optional = true }
tracing = { version = "0.1.29", default-features = false }
tracing-core = { version = "0.1.28", default-features = false}

Expand Down
4 changes: 2 additions & 2 deletions substrate/primitives/io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ pub trait Crypto {
.map_err(|_| EcdsaVerifyError::BadV)?;
let sig = RecoverableSignature::from_compact(&sig[..64], rid)
.map_err(|_| EcdsaVerifyError::BadRS)?;
let msg = Message::from_slice(msg).expect("Message is 32 bytes; qed");
let msg = Message::from_digest_slice(msg).expect("Message is 32 bytes; qed");
let pubkey = SECP256K1
.recover_ecdsa(&msg, &sig)
.map_err(|_| EcdsaVerifyError::BadSignature)?;
Expand Down Expand Up @@ -1185,7 +1185,7 @@ pub trait Crypto {
.map_err(|_| EcdsaVerifyError::BadV)?;
let sig = RecoverableSignature::from_compact(&sig[..64], rid)
.map_err(|_| EcdsaVerifyError::BadRS)?;
let msg = Message::from_slice(msg).expect("Message is 32 bytes; qed");
let msg = Message::from_digest_slice(msg).expect("Message is 32 bytes; qed");
let pubkey = SECP256K1
.recover_ecdsa(&msg, &sig)
.map_err(|_| EcdsaVerifyError::BadSignature)?;
Expand Down

0 comments on commit 05b319d

Please sign in to comment.