Make Secp256k1::verify() static
This avoids the overhead of creating and seeding a Fortuna just to do verification.
This commit is contained in:
parent
d94345f721
commit
204524117c
|
@ -205,7 +205,8 @@ impl Secp256k1 {
|
||||||
|
|
||||||
/// Checks that `sig` is a valid ECDSA signature for `msg` using the public
|
/// Checks that `sig` is a valid ECDSA signature for `msg` using the public
|
||||||
/// key `pubkey`. Returns `Ok(true)` on success.
|
/// key `pubkey`. Returns `Ok(true)` on success.
|
||||||
pub fn verify(&self, msg: &[u8], sig: &[u8], pk: &key::PublicKey) -> Result<()> {
|
pub fn verify(msg: &[u8], sig: &[u8], pk: &key::PublicKey) -> Result<()> {
|
||||||
|
init(); // This is a static function, so we have to init
|
||||||
let res = unsafe {
|
let res = unsafe {
|
||||||
ffi::secp256k1_ecdsa_verify(msg.as_ptr(), msg.len() as c_int,
|
ffi::secp256k1_ecdsa_verify(msg.as_ptr(), msg.len() as c_int,
|
||||||
sig.as_ptr(), sig.len() as c_int,
|
sig.as_ptr(), sig.len() as c_int,
|
||||||
|
|
Loading…
Reference in New Issue