Merge rust-bitcoin/rust-secp256k1#474: Disable re-randomization under more conditions

d206891eaa bump version to 0.23.4 (Andrew Poelstra)
b01337cfb5 context: unconditionally disable auto-rerandomization on wasm (Andrew Poelstra)
748284633b apply `global-context-not-secure` logic to Secp256k1::new (Andrew Poelstra)

Pull request description:

  Fixes #470

ACKs for top commit:
  Kixunil:
    ACK d206891eaa
  tcharding:
    ACK d206891eaa
  sanket1729:
    ACK d206891eaa

Tree-SHA512: 2a7db5b75f55a007aa780b6317804c819c0366e207623220f72a06c2af09087accf1bc834f05899897afcc2035f5e9a5480d8a7ffff83536327c695602ba138d
This commit is contained in:
sanket1729 2022-07-19 00:23:36 -07:00
commit 125211db5b
No known key found for this signature in database
GPG Key ID: 648FFB183E0870A2
3 changed files with 7 additions and 3 deletions

View File

@ -1,3 +1,7 @@
# 0.23.4 - 2022-07-14
* [Disable automatic rerandomization of contexts under WASM](https://github.com/rust-bitcoin/rust-secp256k1/pull/474)
# 0.23.3 - 2022-06-29 # 0.23.3 - 2022-06-29
* [Add must_use for mut self key manipulation methods](https://github.com/rust-bitcoin/rust-secp256k1/pull/465) * [Add must_use for mut self key manipulation methods](https://github.com/rust-bitcoin/rust-secp256k1/pull/465)

View File

@ -1,6 +1,6 @@
[package] [package]
name = "secp256k1" name = "secp256k1"
version = "0.23.3" version = "0.23.4"
authors = [ "Dawid Ciężarkiewicz <dpc@ucore.info>", authors = [ "Dawid Ciężarkiewicz <dpc@ucore.info>",
"Andrew Poelstra <apoelstra@wpsoftware.net>" ] "Andrew Poelstra <apoelstra@wpsoftware.net>" ]
license = "CC0-1.0" license = "CC0-1.0"

View File

@ -47,7 +47,7 @@ pub mod global {
static mut CONTEXT: Option<Secp256k1<All>> = None; static mut CONTEXT: Option<Secp256k1<All>> = None;
ONCE.call_once(|| unsafe { ONCE.call_once(|| unsafe {
let mut ctx = Secp256k1::new(); let mut ctx = Secp256k1::new();
#[cfg(all(feature = "rand-std", not(feature = "global-context-less-secure")))] #[cfg(all(not(target_arch = "wasm32"), feature = "rand-std", not(feature = "global-context-less-secure")))]
{ {
ctx.randomize(&mut rand::thread_rng()); ctx.randomize(&mut rand::thread_rng());
} }
@ -202,7 +202,7 @@ mod alloc_only {
size, size,
}; };
#[cfg(feature = "rand-std")] #[cfg(all(not(target_arch = "wasm32"), feature = "rand-std", not(feature = "global-context-less-secure")))]
{ {
ctx.randomize(&mut rand::thread_rng()); ctx.randomize(&mut rand::thread_rng());
} }