@@ -384,7 +384,7 @@ impl<C: Signing> Secp256k1<C> {
384
384
msg : & Message ,
385
385
keypair : & KeyPair ,
386
386
nonce_data : * const ffi:: types:: c_void ,
387
- ) -> Result < Signature , Error > {
387
+ ) -> Signature {
388
388
unsafe {
389
389
let mut sig = [ 0u8 ; constants:: SCHNORRSIG_SIGNATURE_SIZE ] ;
390
390
assert_eq ! (
@@ -399,15 +399,15 @@ impl<C: Signing> Secp256k1<C> {
399
399
)
400
400
) ;
401
401
402
- Ok ( Signature ( sig) )
402
+ Signature ( sig)
403
403
}
404
404
}
405
405
406
406
/// Create a schnorr signature internally using the ThreadRng random number
407
407
/// generator to generate the auxiliary random data.
408
408
/// Requires compilation with "rand-std" feature.
409
409
#[ cfg( any( test, feature = "rand-std" ) ) ]
410
- pub fn schnorrsig_sign ( & self , msg : & Message , keypair : & KeyPair ) -> Result < Signature , Error > {
410
+ pub fn schnorrsig_sign ( & self , msg : & Message , keypair : & KeyPair ) -> Signature {
411
411
let mut rng = thread_rng ( ) ;
412
412
self . schnorrsig_sign_with_rng ( msg, keypair, & mut rng)
413
413
}
@@ -417,7 +417,7 @@ impl<C: Signing> Secp256k1<C> {
417
417
& self ,
418
418
msg : & Message ,
419
419
keypair : & KeyPair ,
420
- ) -> Result < Signature , Error > {
420
+ ) -> Signature {
421
421
self . schnorrsig_sign_helper ( msg, keypair, ptr:: null ( ) )
422
422
}
423
423
@@ -427,7 +427,7 @@ impl<C: Signing> Secp256k1<C> {
427
427
msg : & Message ,
428
428
keypair : & KeyPair ,
429
429
aux_rand : & [ u8 ; 32 ] ,
430
- ) -> Result < Signature , Error > {
430
+ ) -> Signature {
431
431
self . schnorrsig_sign_helper (
432
432
msg,
433
433
keypair,
@@ -444,7 +444,7 @@ impl<C: Signing> Secp256k1<C> {
444
444
msg : & Message ,
445
445
keypair : & KeyPair ,
446
446
rng : & mut R ,
447
- ) -> Result < Signature , Error > {
447
+ ) -> Signature {
448
448
let mut aux = [ 0u8 ; 32 ] ;
449
449
rng. fill_bytes ( & mut aux) ;
450
450
self . schnorrsig_sign_helper ( msg, keypair, aux. as_c_ptr ( ) as * const ffi:: types:: c_void )
@@ -533,29 +533,27 @@ mod tests {
533
533
let mut aux_rand = [ 0 ; 32 ] ;
534
534
rng. fill_bytes ( & mut aux_rand) ;
535
535
secp. schnorrsig_sign_with_aux_rand ( msg, seckey, & aux_rand)
536
- . unwrap ( )
537
536
} )
538
537
}
539
538
540
539
#[ test]
541
540
fn test_schnorrsig_sign_with_rng_verify ( ) {
542
541
test_schnorrsig_sign_helper ( |secp, msg, seckey, mut rng| {
543
542
secp. schnorrsig_sign_with_rng ( msg, seckey, & mut rng)
544
- . unwrap ( )
545
543
} )
546
544
}
547
545
548
546
#[ test]
549
547
fn test_schnorrsig_sign_verify ( ) {
550
548
test_schnorrsig_sign_helper ( |secp, msg, seckey, _| {
551
- secp. schnorrsig_sign ( msg, seckey) . unwrap ( )
549
+ secp. schnorrsig_sign ( msg, seckey)
552
550
} )
553
551
}
554
552
555
553
#[ test]
556
554
fn test_schnorrsig_sign_no_aux_rand_verify ( ) {
557
555
test_schnorrsig_sign_helper ( |secp, msg, seckey, _| {
558
- secp. schnorrsig_sign_no_aux_rand ( msg, seckey) . unwrap ( )
556
+ secp. schnorrsig_sign_no_aux_rand ( msg, seckey)
559
557
} )
560
558
}
561
559
@@ -575,8 +573,7 @@ mod tests {
575
573
let expected_sig = Signature :: from_str ( "6470FD1303DDA4FDA717B9837153C24A6EAB377183FC438F939E0ED2B620E9EE5077C4A8B8DCA28963D772A94F5F0DDF598E1C47C137F91933274C7C3EDADCE8" ) . unwrap ( ) ;
576
574
577
575
let sig = secp
578
- . schnorrsig_sign_with_aux_rand ( & msg, & sk, & aux_rand)
579
- . unwrap ( ) ;
576
+ . schnorrsig_sign_with_aux_rand ( & msg, & sk, & aux_rand) ;
580
577
581
578
assert_eq ! ( expected_sig, sig) ;
582
579
}
0 commit comments