Add external-symbols feature to support external libsecp
This feature disables using the bundles sources and will link into existing libsecp256k1 symbols.
This commit is contained in:
parent
55fab77029
commit
bf3fba71cb
|
@ -30,8 +30,10 @@ recovery = ["secp256k1-sys/recovery"]
|
||||||
endomorphism = ["secp256k1-sys/endomorphism"]
|
endomorphism = ["secp256k1-sys/endomorphism"]
|
||||||
lowmemory = ["secp256k1-sys/lowmemory"]
|
lowmemory = ["secp256k1-sys/lowmemory"]
|
||||||
|
|
||||||
# Do not use this feature! HAZMAT. (meant for Bitcoin Core only)
|
# Use this feature to not compile the bundled libsecp256k1 C symbols,
|
||||||
dont_replace_c_symbols = ["secp256k1-sys/dont_replace_c_symbols"]
|
# but use external ones. Use this only if you know what you are doing!
|
||||||
|
external-symbols = ["secp256k1-sys/external-symbols"]
|
||||||
|
|
||||||
# Do not use this feature! HAZMAT. (meant for Fuzzing only. this is *BROKEN CRYPTOGRAPHY*)
|
# Do not use this feature! HAZMAT. (meant for Fuzzing only. this is *BROKEN CRYPTOGRAPHY*)
|
||||||
fuzztarget = ["secp256k1-sys/fuzztarget"]
|
fuzztarget = ["secp256k1-sys/fuzztarget"]
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,9 @@ endomorphism = []
|
||||||
lowmemory = []
|
lowmemory = []
|
||||||
std = []
|
std = []
|
||||||
|
|
||||||
# Do not use this feature! HAZMAT. (meant for Bitcoin Core only)
|
# Use this feature to not compile the bundled libsecp256k1 C symbols,
|
||||||
dont_replace_c_symbols = []
|
# but use external ones. Use this only if you know what you are doing!
|
||||||
|
external-symbols = []
|
||||||
|
|
||||||
# Do not use this feature! HAZMAT. (meant for Fuzzing only. this is *BROKEN CRYPTOGRAPHY*)
|
# Do not use this feature! HAZMAT. (meant for Fuzzing only. this is *BROKEN CRYPTOGRAPHY*)
|
||||||
fuzztarget = []
|
fuzztarget = []
|
||||||
|
|
|
@ -26,6 +26,11 @@ extern crate cc;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
if cfg!(feature = "external-symbols") {
|
||||||
|
println!("cargo:rustc-link-lib=static=secp256k1");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check whether we can use 64-bit compilation
|
// Check whether we can use 64-bit compilation
|
||||||
let use_64bit_compilation = if env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "64" {
|
let use_64bit_compilation = if env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "64" {
|
||||||
let check = cc::Build::new().file("depend/check_uint128_t.c")
|
let check = cc::Build::new().file("depend/check_uint128_t.c")
|
||||||
|
|
|
@ -157,91 +157,91 @@ impl Default for SharedSecret {
|
||||||
#[cfg(not(feature = "fuzztarget"))]
|
#[cfg(not(feature = "fuzztarget"))]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
/// Default ECDH hash function
|
/// Default ECDH hash function
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ecdh_hash_function_default"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ecdh_hash_function_default")]
|
||||||
pub static secp256k1_ecdh_hash_function_default: EcdhHashFn;
|
pub static secp256k1_ecdh_hash_function_default: EcdhHashFn;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_nonce_function_rfc6979"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_nonce_function_rfc6979")]
|
||||||
pub static secp256k1_nonce_function_rfc6979: NonceFn;
|
pub static secp256k1_nonce_function_rfc6979: NonceFn;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_nonce_function_default"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_nonce_function_default")]
|
||||||
pub static secp256k1_nonce_function_default: NonceFn;
|
pub static secp256k1_nonce_function_default: NonceFn;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_context_no_precomp"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_context_no_precomp")]
|
||||||
pub static secp256k1_context_no_precomp: *const Context;
|
pub static secp256k1_context_no_precomp: *const Context;
|
||||||
|
|
||||||
// Contexts
|
// Contexts
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_context_preallocated_size"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_context_preallocated_size")]
|
||||||
pub fn secp256k1_context_preallocated_size(flags: c_uint) -> usize;
|
pub fn secp256k1_context_preallocated_size(flags: c_uint) -> usize;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_context_preallocated_create"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_context_preallocated_create")]
|
||||||
pub fn secp256k1_context_preallocated_create(prealloc: *mut c_void, flags: c_uint) -> *mut Context;
|
pub fn secp256k1_context_preallocated_create(prealloc: *mut c_void, flags: c_uint) -> *mut Context;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_context_preallocated_destroy"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_context_preallocated_destroy")]
|
||||||
pub fn secp256k1_context_preallocated_destroy(cx: *mut Context);
|
pub fn secp256k1_context_preallocated_destroy(cx: *mut Context);
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_context_preallocated_clone_size"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_context_preallocated_clone_size")]
|
||||||
pub fn secp256k1_context_preallocated_clone_size(cx: *const Context) -> usize;
|
pub fn secp256k1_context_preallocated_clone_size(cx: *const Context) -> usize;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_context_preallocated_clone"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_context_preallocated_clone")]
|
||||||
pub fn secp256k1_context_preallocated_clone(cx: *const Context, prealloc: *mut c_void) -> *mut Context;
|
pub fn secp256k1_context_preallocated_clone(cx: *const Context, prealloc: *mut c_void) -> *mut Context;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_context_randomize"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_context_randomize")]
|
||||||
pub fn secp256k1_context_randomize(cx: *mut Context,
|
pub fn secp256k1_context_randomize(cx: *mut Context,
|
||||||
seed32: *const c_uchar)
|
seed32: *const c_uchar)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
// Pubkeys
|
// Pubkeys
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ec_pubkey_parse"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ec_pubkey_parse")]
|
||||||
pub fn secp256k1_ec_pubkey_parse(cx: *const Context, pk: *mut PublicKey,
|
pub fn secp256k1_ec_pubkey_parse(cx: *const Context, pk: *mut PublicKey,
|
||||||
input: *const c_uchar, in_len: usize)
|
input: *const c_uchar, in_len: usize)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ec_pubkey_serialize"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ec_pubkey_serialize")]
|
||||||
pub fn secp256k1_ec_pubkey_serialize(cx: *const Context, output: *mut c_uchar,
|
pub fn secp256k1_ec_pubkey_serialize(cx: *const Context, output: *mut c_uchar,
|
||||||
out_len: *mut usize, pk: *const PublicKey,
|
out_len: *mut usize, pk: *const PublicKey,
|
||||||
compressed: c_uint)
|
compressed: c_uint)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
// Signatures
|
// Signatures
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_parse_der"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_parse_der")]
|
||||||
pub fn secp256k1_ecdsa_signature_parse_der(cx: *const Context, sig: *mut Signature,
|
pub fn secp256k1_ecdsa_signature_parse_der(cx: *const Context, sig: *mut Signature,
|
||||||
input: *const c_uchar, in_len: usize)
|
input: *const c_uchar, in_len: usize)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_parse_compact"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_parse_compact")]
|
||||||
pub fn secp256k1_ecdsa_signature_parse_compact(cx: *const Context, sig: *mut Signature,
|
pub fn secp256k1_ecdsa_signature_parse_compact(cx: *const Context, sig: *mut Signature,
|
||||||
input64: *const c_uchar)
|
input64: *const c_uchar)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_parse_der_lax"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_parse_der_lax")]
|
||||||
pub fn ecdsa_signature_parse_der_lax(cx: *const Context, sig: *mut Signature,
|
pub fn ecdsa_signature_parse_der_lax(cx: *const Context, sig: *mut Signature,
|
||||||
input: *const c_uchar, in_len: usize)
|
input: *const c_uchar, in_len: usize)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_serialize_der"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_serialize_der")]
|
||||||
pub fn secp256k1_ecdsa_signature_serialize_der(cx: *const Context, output: *mut c_uchar,
|
pub fn secp256k1_ecdsa_signature_serialize_der(cx: *const Context, output: *mut c_uchar,
|
||||||
out_len: *mut usize, sig: *const Signature)
|
out_len: *mut usize, sig: *const Signature)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_serialize_compact"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_serialize_compact")]
|
||||||
pub fn secp256k1_ecdsa_signature_serialize_compact(cx: *const Context, output64: *mut c_uchar,
|
pub fn secp256k1_ecdsa_signature_serialize_compact(cx: *const Context, output64: *mut c_uchar,
|
||||||
sig: *const Signature)
|
sig: *const Signature)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_normalize"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_normalize")]
|
||||||
pub fn secp256k1_ecdsa_signature_normalize(cx: *const Context, out_sig: *mut Signature,
|
pub fn secp256k1_ecdsa_signature_normalize(cx: *const Context, out_sig: *mut Signature,
|
||||||
in_sig: *const Signature)
|
in_sig: *const Signature)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
// ECDSA
|
// ECDSA
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ecdsa_verify"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ecdsa_verify")]
|
||||||
pub fn secp256k1_ecdsa_verify(cx: *const Context,
|
pub fn secp256k1_ecdsa_verify(cx: *const Context,
|
||||||
sig: *const Signature,
|
sig: *const Signature,
|
||||||
msg32: *const c_uchar,
|
msg32: *const c_uchar,
|
||||||
pk: *const PublicKey)
|
pk: *const PublicKey)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ecdsa_sign"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ecdsa_sign")]
|
||||||
pub fn secp256k1_ecdsa_sign(cx: *const Context,
|
pub fn secp256k1_ecdsa_sign(cx: *const Context,
|
||||||
sig: *mut Signature,
|
sig: *mut Signature,
|
||||||
msg32: *const c_uchar,
|
msg32: *const c_uchar,
|
||||||
|
@ -251,49 +251,49 @@ extern "C" {
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
// EC
|
// EC
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ec_seckey_verify"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ec_seckey_verify")]
|
||||||
pub fn secp256k1_ec_seckey_verify(cx: *const Context,
|
pub fn secp256k1_ec_seckey_verify(cx: *const Context,
|
||||||
sk: *const c_uchar) -> c_int;
|
sk: *const c_uchar) -> c_int;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ec_pubkey_create"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ec_pubkey_create")]
|
||||||
pub fn secp256k1_ec_pubkey_create(cx: *const Context, pk: *mut PublicKey,
|
pub fn secp256k1_ec_pubkey_create(cx: *const Context, pk: *mut PublicKey,
|
||||||
sk: *const c_uchar) -> c_int;
|
sk: *const c_uchar) -> c_int;
|
||||||
|
|
||||||
//TODO secp256k1_ec_privkey_export
|
//TODO secp256k1_ec_privkey_export
|
||||||
//TODO secp256k1_ec_privkey_import
|
//TODO secp256k1_ec_privkey_import
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ec_privkey_tweak_add"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ec_privkey_tweak_add")]
|
||||||
pub fn secp256k1_ec_privkey_tweak_add(cx: *const Context,
|
pub fn secp256k1_ec_privkey_tweak_add(cx: *const Context,
|
||||||
sk: *mut c_uchar,
|
sk: *mut c_uchar,
|
||||||
tweak: *const c_uchar)
|
tweak: *const c_uchar)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ec_pubkey_tweak_add"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ec_pubkey_tweak_add")]
|
||||||
pub fn secp256k1_ec_pubkey_tweak_add(cx: *const Context,
|
pub fn secp256k1_ec_pubkey_tweak_add(cx: *const Context,
|
||||||
pk: *mut PublicKey,
|
pk: *mut PublicKey,
|
||||||
tweak: *const c_uchar)
|
tweak: *const c_uchar)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ec_privkey_tweak_mul"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ec_privkey_tweak_mul")]
|
||||||
pub fn secp256k1_ec_privkey_tweak_mul(cx: *const Context,
|
pub fn secp256k1_ec_privkey_tweak_mul(cx: *const Context,
|
||||||
sk: *mut c_uchar,
|
sk: *mut c_uchar,
|
||||||
tweak: *const c_uchar)
|
tweak: *const c_uchar)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ec_pubkey_tweak_mul"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ec_pubkey_tweak_mul")]
|
||||||
pub fn secp256k1_ec_pubkey_tweak_mul(cx: *const Context,
|
pub fn secp256k1_ec_pubkey_tweak_mul(cx: *const Context,
|
||||||
pk: *mut PublicKey,
|
pk: *mut PublicKey,
|
||||||
tweak: *const c_uchar)
|
tweak: *const c_uchar)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ec_pubkey_combine"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ec_pubkey_combine")]
|
||||||
pub fn secp256k1_ec_pubkey_combine(cx: *const Context,
|
pub fn secp256k1_ec_pubkey_combine(cx: *const Context,
|
||||||
out: *mut PublicKey,
|
out: *mut PublicKey,
|
||||||
ins: *const *const PublicKey,
|
ins: *const *const PublicKey,
|
||||||
n: c_int)
|
n: c_int)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ecdh"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ecdh")]
|
||||||
pub fn secp256k1_ecdh(
|
pub fn secp256k1_ecdh(
|
||||||
cx: *const Context,
|
cx: *const Context,
|
||||||
output: *mut SharedSecret,
|
output: *mut SharedSecret,
|
||||||
|
@ -305,8 +305,6 @@ extern "C" {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[cfg(all(feature = "std", not(feature = "dont_replace_c_symbols")))]
|
|
||||||
#[no_mangle]
|
|
||||||
/// A reimplementation of the C function `secp256k1_context_create` in rust.
|
/// A reimplementation of the C function `secp256k1_context_create` in rust.
|
||||||
///
|
///
|
||||||
/// This function allocates memory, the pointer should be deallocated using `secp256k1_context_destroy`
|
/// This function allocates memory, the pointer should be deallocated using `secp256k1_context_destroy`
|
||||||
|
@ -315,6 +313,8 @@ extern "C" {
|
||||||
/// This will create a secp256k1 raw context.
|
/// This will create a secp256k1 raw context.
|
||||||
// Returns: a newly created context object.
|
// Returns: a newly created context object.
|
||||||
// In: flags: which parts of the context to initialize.
|
// In: flags: which parts of the context to initialize.
|
||||||
|
#[no_mangle]
|
||||||
|
#[cfg(all(feature = "std", not(feature = "external_symbols")))]
|
||||||
pub unsafe extern "C" fn rustsecp256k1_v0_1_0_context_create(flags: c_uint) -> *mut Context {
|
pub unsafe extern "C" fn rustsecp256k1_v0_1_0_context_create(flags: c_uint) -> *mut Context {
|
||||||
use std::mem;
|
use std::mem;
|
||||||
assert!(mem::align_of::<usize>() >= mem::align_of::<u8>());
|
assert!(mem::align_of::<usize>() >= mem::align_of::<u8>());
|
||||||
|
@ -331,19 +331,19 @@ pub unsafe extern "C" fn rustsecp256k1_v0_1_0_context_create(flags: c_uint) -> *
|
||||||
secp256k1_context_preallocated_create(ptr as *mut c_void, flags)
|
secp256k1_context_preallocated_create(ptr as *mut c_void, flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "std", not(feature = "dont_replace_c_symbols")))]
|
#[cfg(all(feature = "std", not(feature = "external_symbols")))]
|
||||||
pub unsafe fn secp256k1_context_create(flags: c_uint) -> *mut Context {
|
pub unsafe fn secp256k1_context_create(flags: c_uint) -> *mut Context {
|
||||||
rustsecp256k1_v0_1_0_context_create(flags)
|
rustsecp256k1_v0_1_0_context_create(flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "std", not(feature = "dont_replace_c_symbols")))]
|
|
||||||
#[no_mangle]
|
|
||||||
/// A reimplementation of the C function `secp256k1_context_destroy` in rust.
|
/// A reimplementation of the C function `secp256k1_context_destroy` in rust.
|
||||||
///
|
///
|
||||||
/// This function destroys and deallcates the context created by `secp256k1_context_create`.
|
/// This function destroys and deallcates the context created by `secp256k1_context_create`.
|
||||||
///
|
///
|
||||||
/// The pointer shouldn't be used after passing to this function, consider it as passing it to `free()`.
|
/// The pointer shouldn't be used after passing to this function, consider it as passing it to `free()`.
|
||||||
///
|
///
|
||||||
|
#[no_mangle]
|
||||||
|
#[cfg(all(feature = "std", not(feature = "external_symbols")))]
|
||||||
pub unsafe extern "C" fn rustsecp256k1_v0_1_0_context_destroy(ctx: *mut Context) {
|
pub unsafe extern "C" fn rustsecp256k1_v0_1_0_context_destroy(ctx: *mut Context) {
|
||||||
secp256k1_context_preallocated_destroy(ctx);
|
secp256k1_context_preallocated_destroy(ctx);
|
||||||
let ctx: *mut usize = ctx as *mut usize;
|
let ctx: *mut usize = ctx as *mut usize;
|
||||||
|
@ -354,14 +354,12 @@ pub unsafe extern "C" fn rustsecp256k1_v0_1_0_context_destroy(ctx: *mut Context)
|
||||||
let _ = Box::from_raw(slice as *mut [usize]);
|
let _ = Box::from_raw(slice as *mut [usize]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "std", not(feature = "dont_replace_c_symbols")))]
|
#[cfg(all(feature = "std", not(feature = "external_symbols")))]
|
||||||
pub unsafe fn secp256k1_context_destroy(ctx: *mut Context) {
|
pub unsafe fn secp256k1_context_destroy(ctx: *mut Context) {
|
||||||
rustsecp256k1_v0_1_0_context_destroy(ctx)
|
rustsecp256k1_v0_1_0_context_destroy(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[cfg(not(feature = "dont_replace_c_symbols"))]
|
|
||||||
#[no_mangle]
|
|
||||||
/// **This function is an override for the C function, this is the an edited version of the original description:**
|
/// **This function is an override for the C function, this is the an edited version of the original description:**
|
||||||
///
|
///
|
||||||
/// A callback function to be called when an illegal argument is passed to
|
/// A callback function to be called when an illegal argument is passed to
|
||||||
|
@ -380,6 +378,8 @@ pub unsafe fn secp256k1_context_destroy(ctx: *mut Context) {
|
||||||
///
|
///
|
||||||
/// See also secp256k1_default_error_callback_fn.
|
/// See also secp256k1_default_error_callback_fn.
|
||||||
///
|
///
|
||||||
|
#[no_mangle]
|
||||||
|
#[cfg(not(feature = "external_symbols"))]
|
||||||
pub unsafe extern "C" fn rustsecp256k1_v0_1_0_default_illegal_callback_fn(message: *const c_char, _data: *mut c_void) {
|
pub unsafe extern "C" fn rustsecp256k1_v0_1_0_default_illegal_callback_fn(message: *const c_char, _data: *mut c_void) {
|
||||||
use core::str;
|
use core::str;
|
||||||
let msg_slice = slice::from_raw_parts(message as *const u8, strlen(message));
|
let msg_slice = slice::from_raw_parts(message as *const u8, strlen(message));
|
||||||
|
@ -387,8 +387,6 @@ pub unsafe extern "C" fn rustsecp256k1_v0_1_0_default_illegal_callback_fn(messag
|
||||||
panic!("[libsecp256k1] illegal argument. {}", msg);
|
panic!("[libsecp256k1] illegal argument. {}", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "dont_replace_c_symbols"))]
|
|
||||||
#[no_mangle]
|
|
||||||
/// **This function is an override for the C function, this is the an edited version of the original description:**
|
/// **This function is an override for the C function, this is the an edited version of the original description:**
|
||||||
///
|
///
|
||||||
/// A callback function to be called when an internal consistency check
|
/// A callback function to be called when an internal consistency check
|
||||||
|
@ -403,6 +401,8 @@ pub unsafe extern "C" fn rustsecp256k1_v0_1_0_default_illegal_callback_fn(messag
|
||||||
///
|
///
|
||||||
/// See also secp256k1_default_illegal_callback_fn.
|
/// See also secp256k1_default_illegal_callback_fn.
|
||||||
///
|
///
|
||||||
|
#[no_mangle]
|
||||||
|
#[cfg(not(feature = "external_symbols"))]
|
||||||
pub unsafe extern "C" fn rustsecp256k1_v0_1_0_default_error_callback_fn(message: *const c_char, _data: *mut c_void) {
|
pub unsafe extern "C" fn rustsecp256k1_v0_1_0_default_error_callback_fn(message: *const c_char, _data: *mut c_void) {
|
||||||
use core::str;
|
use core::str;
|
||||||
let msg_slice = slice::from_raw_parts(message as *const u8, strlen(message));
|
let msg_slice = slice::from_raw_parts(message as *const u8, strlen(message));
|
||||||
|
|
|
@ -41,21 +41,21 @@ impl Default for RecoverableSignature {
|
||||||
|
|
||||||
#[cfg(not(feature = "fuzztarget"))]
|
#[cfg(not(feature = "fuzztarget"))]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ecdsa_recoverable_signature_parse_compact"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ecdsa_recoverable_signature_parse_compact")]
|
||||||
pub fn secp256k1_ecdsa_recoverable_signature_parse_compact(cx: *const Context, sig: *mut RecoverableSignature,
|
pub fn secp256k1_ecdsa_recoverable_signature_parse_compact(cx: *const Context, sig: *mut RecoverableSignature,
|
||||||
input64: *const c_uchar, recid: c_int)
|
input64: *const c_uchar, recid: c_int)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ecdsa_recoverable_signature_serialize_compact"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ecdsa_recoverable_signature_serialize_compact")]
|
||||||
pub fn secp256k1_ecdsa_recoverable_signature_serialize_compact(cx: *const Context, output64: *mut c_uchar,
|
pub fn secp256k1_ecdsa_recoverable_signature_serialize_compact(cx: *const Context, output64: *mut c_uchar,
|
||||||
recid: *mut c_int, sig: *const RecoverableSignature)
|
recid: *mut c_int, sig: *const RecoverableSignature)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ecdsa_recoverable_signature_convert"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ecdsa_recoverable_signature_convert")]
|
||||||
pub fn secp256k1_ecdsa_recoverable_signature_convert(cx: *const Context, sig: *mut Signature,
|
pub fn secp256k1_ecdsa_recoverable_signature_convert(cx: *const Context, sig: *mut Signature,
|
||||||
input: *const RecoverableSignature)
|
input: *const RecoverableSignature)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ecdsa_sign_recoverable"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ecdsa_sign_recoverable")]
|
||||||
pub fn secp256k1_ecdsa_sign_recoverable(cx: *const Context,
|
pub fn secp256k1_ecdsa_sign_recoverable(cx: *const Context,
|
||||||
sig: *mut RecoverableSignature,
|
sig: *mut RecoverableSignature,
|
||||||
msg32: *const c_uchar,
|
msg32: *const c_uchar,
|
||||||
|
@ -64,7 +64,7 @@ extern "C" {
|
||||||
noncedata: *const c_void)
|
noncedata: *const c_void)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
|
||||||
#[link_name = "rustsecp256k1_v0_1_0_ecdsa_recover"]
|
#[cfg_attr(not(feature = "external-symbols"), link_name = "rustsecp256k1_v0_1_0_ecdsa_recover")]
|
||||||
pub fn secp256k1_ecdsa_recover(cx: *const Context,
|
pub fn secp256k1_ecdsa_recover(cx: *const Context,
|
||||||
pk: *mut PublicKey,
|
pk: *mut PublicKey,
|
||||||
sig: *const RecoverableSignature,
|
sig: *const RecoverableSignature,
|
||||||
|
|
Loading…
Reference in New Issue