Skip to content

Commit 7d925f6

Browse files
committed
secp256k1-sys: make signing context pointers atomic
This is in its own commit so that we can argue about it independently of the rest of the PR. I believe this is correct and safe because the docs for `AtomicPtr` say that (a) it is #[repr(C)] and (b) that it has the same in-memory representation as a *mut T.
1 parent a986e8d commit 7d925f6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

secp256k1-sys/src/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ pub mod types;
3939
pub mod recovery;
4040

4141
use core::{slice, ptr};
42+
use core::sync::atomic::AtomicPtr;
4243
use types::*;
4344

4445
/// Flag for context to enable no precomputation
@@ -511,10 +512,10 @@ extern "C" {
511512
pub static secp256k1_context_no_precomp: *const Context;
512513

513514
#[cfg_attr(not(rust_secp_no_symbol_renaming), link_name = "rustsecp256k1_v0_6_1_context_signing_1")]
514-
pub static secp256k1_context_signing_1: *mut Context;
515+
pub static secp256k1_context_signing_1: AtomicPtr<Context>;
515516

516517
#[cfg_attr(not(rust_secp_no_symbol_renaming), link_name = "rustsecp256k1_v0_6_1_context_signing_2")]
517-
pub static secp256k1_context_signing_2: *mut Context;
518+
pub static secp256k1_context_signing_2: AtomicPtr<Context>;
518519

519520
// Contexts
520521
#[cfg_attr(not(rust_secp_no_symbol_renaming), link_name = "rustsecp256k1_v0_6_1_context_preallocated_destroy")]

0 commit comments

Comments
 (0)