@@ -13,9 +13,7 @@ use core::{fmt, ptr, str};
1313pub use self :: recovery:: { RecoverableSignature , RecoveryId } ;
1414pub use self :: serialized_signature:: SerializedSignature ;
1515use crate :: ffi:: CPtr ;
16- use crate :: {
17- ecdsa, ffi, from_hex, Error , Message , PublicKey , Secp256k1 , SecretKey ,
18- } ;
16+ use crate :: { ecdsa, ffi, from_hex, Error , Message , PublicKey , Secp256k1 , SecretKey } ;
1917
2018/// An ECDSA signature
2119#[ derive( Copy , Clone , PartialOrd , Ord , PartialEq , Eq , Hash ) ]
@@ -253,19 +251,21 @@ fn sign_ecdsa_with_noncedata_pointer(
253251 // We can assume the return value because it's not possible to construct
254252 // an invalid signature from a valid `Message` and `SecretKey`
255253 let res = crate :: with_global_context (
256- |secp : & Secp256k1 < crate :: AllPreallocated > | ffi:: secp256k1_ecdsa_sign (
257- secp. ctx . as_ptr ( ) ,
258- & mut ret,
259- msg. as_c_ptr ( ) ,
260- sk. as_c_ptr ( ) ,
261- ffi:: secp256k1_nonce_function_rfc6979,
262- noncedata_ptr
263- ) ,
254+ |secp : & Secp256k1 < crate :: AllPreallocated > | {
255+ ffi:: secp256k1_ecdsa_sign (
256+ secp. ctx . as_ptr ( ) ,
257+ & mut ret,
258+ msg. as_c_ptr ( ) ,
259+ sk. as_c_ptr ( ) ,
260+ ffi:: secp256k1_nonce_function_rfc6979,
261+ noncedata_ptr,
262+ )
263+ } ,
264264 Some ( & sk. to_secret_bytes ( ) ) ,
265265 ) ;
266266
267267 assert_eq ! ( res, 1 ) ;
268-
268+
269269 Signature :: from ( ret)
270270 }
271271}
@@ -304,14 +304,16 @@ fn sign_grind_with_check(
304304 // We can assume the return value because it's not possible to construct
305305 // an invalid signature from a valid `Message` and `SecretKey`
306306 let res = crate :: with_global_context (
307- |secp : & Secp256k1 < crate :: AllPreallocated > | ffi:: secp256k1_ecdsa_sign (
308- secp. ctx . as_ptr ( ) ,
309- & mut ret,
310- msg. as_c_ptr ( ) ,
311- sk. as_c_ptr ( ) ,
312- ffi:: secp256k1_nonce_function_rfc6979,
313- entropy_p
314- ) ,
307+ |secp : & Secp256k1 < crate :: AllPreallocated > | {
308+ ffi:: secp256k1_ecdsa_sign (
309+ secp. ctx . as_ptr ( ) ,
310+ & mut ret,
311+ msg. as_c_ptr ( ) ,
312+ sk. as_c_ptr ( ) ,
313+ ffi:: secp256k1_nonce_function_rfc6979,
314+ entropy_p,
315+ )
316+ } ,
315317 Some ( & sk. to_secret_bytes ( ) ) ,
316318 ) ;
317319 assert_eq ! ( res, 1 ) ;
@@ -337,11 +339,7 @@ fn sign_grind_with_check(
337339/// of signing operation performed by this function is exponential in the
338340/// number of bytes grinded.
339341/// Requires a signing capable context.
340- pub fn sign_grind_r (
341- msg : impl Into < Message > ,
342- sk : & SecretKey ,
343- bytes_to_grind : usize ,
344- ) -> Signature {
342+ pub fn sign_grind_r ( msg : impl Into < Message > , sk : & SecretKey , bytes_to_grind : usize ) -> Signature {
345343 let len_check = |s : & ffi:: Signature | der_length_check ( s, 71 - bytes_to_grind) ;
346344 sign_grind_with_check ( msg, sk, len_check)
347345}
@@ -377,21 +375,19 @@ pub fn sign_low_r(msg: impl Into<Message>, sk: &SecretKey) -> Signature {
377375/// # }
378376/// ```
379377#[ inline]
380- pub fn verify (
381- sig : & Signature ,
382- msg : impl Into < Message > ,
383- pk : & PublicKey ,
384- ) -> Result < ( ) , Error > {
378+ pub fn verify ( sig : & Signature , msg : impl Into < Message > , pk : & PublicKey ) -> Result < ( ) , Error > {
385379 let msg = msg. into ( ) ;
386380 unsafe {
387381 let res = crate :: with_global_context (
388- |secp : & Secp256k1 < crate :: AllPreallocated > | ffi:: secp256k1_ecdsa_verify (
389- secp. ctx . as_ptr ( ) ,
390- sig. as_c_ptr ( ) ,
391- msg. as_c_ptr ( ) ,
392- pk. as_c_ptr ( ) ,
393- ) ,
394- None , // FIXME: What goes here?
382+ |secp : & Secp256k1 < crate :: AllPreallocated > | {
383+ ffi:: secp256k1_ecdsa_verify (
384+ secp. ctx . as_ptr ( ) ,
385+ sig. as_c_ptr ( ) ,
386+ msg. as_c_ptr ( ) ,
387+ pk. as_c_ptr ( ) ,
388+ )
389+ } ,
390+ None , // FIXME: What goes here?
395391 ) ;
396392 if res == 0 {
397393 Err ( Error :: IncorrectSignature )
0 commit comments