Make Secp256k1::verify() static

This avoids the overhead of creating and seeding a Fortuna just to do verification.
This commit is contained in:
Andrew Poelstra 2014-08-31 22:33:19 -05:00
parent d94345f721
commit 204524117c
1 changed files with 2 additions and 1 deletions

View File

@ -205,7 +205,8 @@ impl Secp256k1 {
/// Checks that `sig` is a valid ECDSA signature for `msg` using the public
/// 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 {
ffi::secp256k1_ecdsa_verify(msg.as_ptr(), msg.len() as c_int,
sig.as_ptr(), sig.len() as c_int,