@@ -17,8 +17,8 @@ use {Message, Signing, Verification, KeyPair, XOnlyPublicKey};
17
17
use SECP256K1 ;
18
18
19
19
/// Represents a Schnorr signature.
20
- pub struct Signature ( [ u8 ; constants:: SCHNORRSIG_SIGNATURE_SIZE ] ) ;
21
- impl_array_newtype ! ( Signature , u8 , constants:: SCHNORRSIG_SIGNATURE_SIZE ) ;
20
+ pub struct Signature ( [ u8 ; constants:: SCHNORR_SIGNATURE_SIZE ] ) ;
21
+ impl_array_newtype ! ( Signature , u8 , constants:: SCHNORR_SIGNATURE_SIZE ) ;
22
22
impl_pretty_debug ! ( Signature ) ;
23
23
24
24
#[ cfg( feature = "serde" ) ]
@@ -68,10 +68,10 @@ impl fmt::Display for Signature {
68
68
impl str:: FromStr for Signature {
69
69
type Err = Error ;
70
70
fn from_str ( s : & str ) -> Result < Signature , Error > {
71
- let mut res = [ 0u8 ; constants:: SCHNORRSIG_SIGNATURE_SIZE ] ;
71
+ let mut res = [ 0u8 ; constants:: SCHNORR_SIGNATURE_SIZE ] ;
72
72
match from_hex ( s, & mut res) {
73
- Ok ( constants:: SCHNORRSIG_SIGNATURE_SIZE ) => {
74
- Signature :: from_slice ( & res[ 0 ..constants:: SCHNORRSIG_SIGNATURE_SIZE ] )
73
+ Ok ( constants:: SCHNORR_SIGNATURE_SIZE ) => {
74
+ Signature :: from_slice ( & res[ 0 ..constants:: SCHNORR_SIGNATURE_SIZE ] )
75
75
}
76
76
_ => Err ( Error :: InvalidSignature ) ,
77
77
}
@@ -83,8 +83,8 @@ impl Signature {
83
83
#[ inline]
84
84
pub fn from_slice ( data : & [ u8 ] ) -> Result < Signature , Error > {
85
85
match data. len ( ) {
86
- constants:: SCHNORRSIG_SIGNATURE_SIZE => {
87
- let mut ret = [ 0u8 ; constants:: SCHNORRSIG_SIGNATURE_SIZE ] ;
86
+ constants:: SCHNORR_SIGNATURE_SIZE => {
87
+ let mut ret = [ 0u8 ; constants:: SCHNORR_SIGNATURE_SIZE ] ;
88
88
ret[ ..] . copy_from_slice ( data) ;
89
89
Ok ( Signature ( ret) )
90
90
}
@@ -102,14 +102,14 @@ impl Signature {
102
102
}
103
103
104
104
impl < C : Signing > Secp256k1 < C > {
105
- fn schnorrsig_sign_helper (
105
+ fn sign_schnorr_helper (
106
106
& self ,
107
107
msg : & Message ,
108
108
keypair : & KeyPair ,
109
109
nonce_data : * const ffi:: types:: c_void ,
110
110
) -> Signature {
111
111
unsafe {
112
- let mut sig = [ 0u8 ; constants:: SCHNORRSIG_SIGNATURE_SIZE ] ;
112
+ let mut sig = [ 0u8 ; constants:: SCHNORR_SIGNATURE_SIZE ] ;
113
113
assert_eq ! (
114
114
1 ,
115
115
ffi:: secp256k1_schnorrsig_sign(
@@ -160,7 +160,7 @@ impl<C: Signing> Secp256k1<C> {
160
160
msg : & Message ,
161
161
keypair : & KeyPair ,
162
162
) -> Signature {
163
- self . schnorrsig_sign_helper ( msg, keypair, ptr:: null ( ) )
163
+ self . sign_schnorr_helper ( msg, keypair, ptr:: null ( ) )
164
164
}
165
165
166
166
/// Create a Schnorr signature using the given auxiliary random data.
@@ -181,7 +181,7 @@ impl<C: Signing> Secp256k1<C> {
181
181
keypair : & KeyPair ,
182
182
aux_rand : & [ u8 ; 32 ] ,
183
183
) -> Signature {
184
- self . schnorrsig_sign_helper (
184
+ self . sign_schnorr_helper (
185
185
msg,
186
186
keypair,
187
187
aux_rand. as_c_ptr ( ) as * const ffi:: types:: c_void ,
@@ -214,7 +214,7 @@ impl<C: Signing> Secp256k1<C> {
214
214
) -> Signature {
215
215
let mut aux = [ 0u8 ; 32 ] ;
216
216
rng. fill_bytes ( & mut aux) ;
217
- self . schnorrsig_sign_helper ( msg, keypair, aux. as_c_ptr ( ) as * const ffi:: types:: c_void )
217
+ self . sign_schnorr_helper ( msg, keypair, aux. as_c_ptr ( ) as * const ffi:: types:: c_void )
218
218
}
219
219
}
220
220
@@ -304,8 +304,8 @@ mod tests {
304
304
305
305
#[ test]
306
306
#[ cfg( all( feature = "std" , feature = "rand-std" ) ) ]
307
- fn test_schnorrsig_sign_with_aux_rand_verify ( ) {
308
- test_schnorrsig_sign_helper ( |secp, msg, seckey, rng| {
307
+ fn schnorr_sign_with_aux_rand_verify ( ) {
308
+ sign_helper ( |secp, msg, seckey, rng| {
309
309
let mut aux_rand = [ 0u8 ; 32 ] ;
310
310
rng. fill_bytes ( & mut aux_rand) ;
311
311
secp. sign_schnorr_with_aux_rand ( msg, seckey, & aux_rand)
@@ -314,30 +314,30 @@ mod tests {
314
314
315
315
#[ test]
316
316
#[ cfg( all( feature = "std" , feature = "rand-std" ) ) ]
317
- fn test_schnorrsig_sign_with_rng_verify ( ) {
318
- test_schnorrsig_sign_helper ( |secp, msg, seckey, mut rng| {
317
+ fn schnor_sign_with_rng_verify ( ) {
318
+ sign_helper ( |secp, msg, seckey, mut rng| {
319
319
secp. sign_schnorr_with_rng ( msg, seckey, & mut rng)
320
320
} )
321
321
}
322
322
323
323
#[ test]
324
324
#[ cfg( all( feature = "std" , feature = "rand-std" ) ) ]
325
- fn test_schnorrsig_sign_verify ( ) {
326
- test_schnorrsig_sign_helper ( |secp, msg, seckey, _| {
325
+ fn schnorr_sign_verify ( ) {
326
+ sign_helper ( |secp, msg, seckey, _| {
327
327
secp. sign_schnorr ( msg, seckey)
328
328
} )
329
329
}
330
330
331
331
#[ test]
332
332
#[ cfg( all( feature = "std" , feature = "rand-std" ) ) ]
333
- fn test_schnorrsig_sign_no_aux_rand_verify ( ) {
334
- test_schnorrsig_sign_helper ( |secp, msg, seckey, _| {
333
+ fn schnorr_sign_no_aux_rand_verify ( ) {
334
+ sign_helper ( |secp, msg, seckey, _| {
335
335
secp. sign_schnorr_no_aux_rand ( msg, seckey)
336
336
} )
337
337
}
338
338
339
339
#[ cfg( all( feature = "std" , feature = "rand-std" ) ) ]
340
- fn test_schnorrsig_sign_helper (
340
+ fn sign_helper (
341
341
sign : fn ( & Secp256k1 < All > , & Message , & KeyPair , & mut ThreadRng ) -> Signature ,
342
342
) {
343
343
let secp = Secp256k1 :: new ( ) ;
@@ -361,7 +361,7 @@ mod tests {
361
361
#[ test]
362
362
#[ cfg( any( feature = "alloc" , feature = "std" ) ) ]
363
363
#[ cfg( not( fuzzing) ) ] // fixed sig vectors can't work with fuzz-sigs
364
- fn test_schnorrsig_sign ( ) {
364
+ fn schnorr_sign ( ) {
365
365
let secp = Secp256k1 :: new ( ) ;
366
366
367
367
let hex_msg = hex_32 ! ( "E48441762FB75010B2AA31A512B62B4148AA3FB08EB0765D76B252559064A614" ) ;
@@ -384,7 +384,7 @@ mod tests {
384
384
#[ test]
385
385
#[ cfg( not( fuzzing) ) ] // fixed sig vectors can't work with fuzz-sigs
386
386
#[ cfg( any( feature = "alloc" , feature = "std" ) ) ]
387
- fn test_schnorrsig_verify ( ) {
387
+ fn schnorr_verify ( ) {
388
388
let secp = Secp256k1 :: new ( ) ;
389
389
390
390
let hex_msg = hex_32 ! ( "E48441762FB75010B2AA31A512B62B4148AA3FB08EB0765D76B252559064A614" ) ;
@@ -439,24 +439,24 @@ mod tests {
439
439
fn test_pubkey_from_bad_slice ( ) {
440
440
// Bad sizes
441
441
assert_eq ! (
442
- XOnlyPublicKey :: from_slice( & [ 0 ; constants:: SCHNORRSIG_PUBLIC_KEY_SIZE - 1 ] ) ,
442
+ XOnlyPublicKey :: from_slice( & [ 0 ; constants:: SCHNORR_PUBLIC_KEY_SIZE - 1 ] ) ,
443
443
Err ( InvalidPublicKey )
444
444
) ;
445
445
assert_eq ! (
446
- XOnlyPublicKey :: from_slice( & [ 0 ; constants:: SCHNORRSIG_PUBLIC_KEY_SIZE + 1 ] ) ,
446
+ XOnlyPublicKey :: from_slice( & [ 0 ; constants:: SCHNORR_PUBLIC_KEY_SIZE + 1 ] ) ,
447
447
Err ( InvalidPublicKey )
448
448
) ;
449
449
450
450
// Bad parse
451
451
assert_eq ! (
452
- XOnlyPublicKey :: from_slice( & [ 0xff ; constants:: SCHNORRSIG_PUBLIC_KEY_SIZE ] ) ,
452
+ XOnlyPublicKey :: from_slice( & [ 0xff ; constants:: SCHNORR_PUBLIC_KEY_SIZE ] ) ,
453
453
Err ( InvalidPublicKey )
454
454
) ;
455
455
// In fuzzing mode restrictions on public key validity are much more
456
456
// relaxed, thus the invalid check below is expected to fail.
457
457
#[ cfg( not( fuzzing) ) ]
458
458
assert_eq ! (
459
- XOnlyPublicKey :: from_slice( & [ 0x55 ; constants:: SCHNORRSIG_PUBLIC_KEY_SIZE ] ) ,
459
+ XOnlyPublicKey :: from_slice( & [ 0x55 ; constants:: SCHNORR_PUBLIC_KEY_SIZE ] ) ,
460
460
Err ( InvalidPublicKey )
461
461
) ;
462
462
assert_eq ! ( XOnlyPublicKey :: from_slice( & [ ] ) , Err ( InvalidPublicKey ) ) ;
@@ -567,7 +567,7 @@ mod tests {
567
567
let aux = [ 3u8 ; 32 ] ;
568
568
let sig = s
569
569
. sign_schnorr_with_aux_rand ( & msg, & keypair, & aux) ;
570
- static SIG_BYTES : [ u8 ; constants:: SCHNORRSIG_SIGNATURE_SIZE ] = [
570
+ static SIG_BYTES : [ u8 ; constants:: SCHNORR_SIGNATURE_SIZE ] = [
571
571
0x14 , 0xd0 , 0xbf , 0x1a , 0x89 , 0x53 , 0x50 , 0x6f , 0xb4 , 0x60 , 0xf5 , 0x8b , 0xe1 , 0x41 ,
572
572
0xaf , 0x76 , 0x7f , 0xd1 , 0x12 , 0x53 , 0x5f , 0xb3 , 0x92 , 0x2e , 0xf2 , 0x17 , 0x30 , 0x8e ,
573
573
0x2c , 0x26 , 0x70 , 0x6f , 0x1e , 0xeb , 0x43 , 0x2b , 0x3d , 0xba , 0x9a , 0x01 , 0x08 , 0x2f ,
0 commit comments