@@ -411,9 +411,6 @@ impl KeyAggCache {
411
411
let mut key_agg_cache = MaybeUninit :: < ffi:: MusigKeyAggCache > :: uninit ( ) ;
412
412
let mut agg_pk = MaybeUninit :: < ffi:: XOnlyPublicKey > :: uninit ( ) ;
413
413
414
- // We have no seed here but we want rerandomiziation to happen for `rand` users.
415
- let seed = [ 0_u8 ; 32 ] ;
416
-
417
414
unsafe {
418
415
let pubkeys_ref = core:: slice:: from_raw_parts (
419
416
pubkeys. as_c_ptr ( ) as * const * const ffi:: PublicKey ,
@@ -430,7 +427,7 @@ impl KeyAggCache {
430
427
pubkeys_ref. len ( ) ,
431
428
)
432
429
} ,
433
- Some ( & seed ) ,
430
+ None ,
434
431
) ;
435
432
if ret == 0 {
436
433
// Returns 0 only if the keys are malformed that never happens in safe rust type system.
@@ -507,8 +504,6 @@ impl KeyAggCache {
507
504
/// # }
508
505
/// ```
509
506
pub fn pubkey_ec_tweak_add ( & mut self , tweak : & Scalar ) -> Result < PublicKey , InvalidTweakErr > {
510
- // We have no seed here but we want rerandomiziation to happen for `rand` users.
511
- let seed = [ 0_u8 ; 32 ] ;
512
507
unsafe {
513
508
let mut out = PublicKey :: from ( ffi:: PublicKey :: new ( ) ) ;
514
509
@@ -521,7 +516,7 @@ impl KeyAggCache {
521
516
tweak. as_c_ptr ( ) ,
522
517
)
523
518
} ,
524
- Some ( & seed ) ,
519
+ None ,
525
520
) ;
526
521
if ret == 0 {
527
522
Err ( InvalidTweakErr )
@@ -569,8 +564,6 @@ impl KeyAggCache {
569
564
/// # }
570
565
/// ```
571
566
pub fn pubkey_xonly_tweak_add ( & mut self , tweak : & Scalar ) -> Result < PublicKey , InvalidTweakErr > {
572
- // We have no seed here but we want rerandomiziation to happen for `rand` users.
573
- let seed = [ 0_u8 ; 32 ] ;
574
567
unsafe {
575
568
let mut out = PublicKey :: from ( ffi:: PublicKey :: new ( ) ) ;
576
569
@@ -583,7 +576,7 @@ impl KeyAggCache {
583
576
tweak. as_c_ptr ( ) ,
584
577
)
585
578
} ,
586
- Some ( & seed ) ,
579
+ None ,
587
580
) ;
588
581
if ret == 0 {
589
582
Err ( InvalidTweakErr )
@@ -956,9 +949,6 @@ impl AggregatedNonce {
956
949
957
950
let mut aggnonce = MaybeUninit :: < ffi:: MusigAggNonce > :: uninit ( ) ;
958
951
959
- // We have no seed here but we want rerandomiziation to happen for `rand` users.
960
- let seed = [ 0_u8 ; 32 ] ;
961
-
962
952
unsafe {
963
953
let pubnonces = core:: slice:: from_raw_parts (
964
954
nonces. as_c_ptr ( ) as * const * const ffi:: MusigPubNonce ,
@@ -974,7 +964,7 @@ impl AggregatedNonce {
974
964
pubnonces. len ( ) ,
975
965
)
976
966
} ,
977
- Some ( & seed ) ,
967
+ None ,
978
968
) ;
979
969
if ret == 0 {
980
970
// This can only crash if the individual nonces are invalid which is not possible is rust.
@@ -1124,9 +1114,6 @@ impl Session {
1124
1114
pub fn new ( key_agg_cache : & KeyAggCache , agg_nonce : AggregatedNonce , msg : & [ u8 ; 32 ] ) -> Self {
1125
1115
let mut session = MaybeUninit :: < ffi:: MusigSession > :: uninit ( ) ;
1126
1116
1127
- // We have no seed here but we want rerandomiziation to happen for `rand` users.
1128
- let seed = [ 0_u8 ; 32 ] ;
1129
-
1130
1117
unsafe {
1131
1118
let ret = crate :: with_global_context (
1132
1119
|secp : & Secp256k1 < crate :: AllPreallocated > | {
@@ -1138,7 +1125,7 @@ impl Session {
1138
1125
key_agg_cache. as_ptr ( ) ,
1139
1126
)
1140
1127
} ,
1141
- Some ( & seed ) ,
1128
+ None ,
1142
1129
) ;
1143
1130
if ret == 0 {
1144
1131
// Only fails on cryptographically unreachable codes or if the args are invalid.
@@ -1179,8 +1166,6 @@ impl Session {
1179
1166
keypair : & Keypair ,
1180
1167
key_agg_cache : & KeyAggCache ,
1181
1168
) -> PartialSignature {
1182
- // We have no seed here but we want rerandomiziation to happen for `rand` users.
1183
- let seed = [ 0_u8 ; 32 ] ;
1184
1169
unsafe {
1185
1170
let mut partial_sig = MaybeUninit :: < ffi:: MusigPartialSignature > :: uninit ( ) ;
1186
1171
@@ -1195,7 +1180,7 @@ impl Session {
1195
1180
self . as_ptr ( ) ,
1196
1181
)
1197
1182
} ,
1198
- Some ( & seed ) ,
1183
+ Some ( & keypair . secret_bytes ( ) ) ,
1199
1184
) ;
1200
1185
1201
1186
assert_eq ! ( res, 1 ) ;
@@ -1283,8 +1268,6 @@ impl Session {
1283
1268
pub_nonce : & PublicNonce ,
1284
1269
pub_key : PublicKey ,
1285
1270
) -> bool {
1286
- // We have no seed here but we want rerandomiziation to happen for `rand` users.
1287
- let seed = [ 0_u8 ; 32 ] ;
1288
1271
unsafe {
1289
1272
let ret = crate :: with_global_context (
1290
1273
|secp : & Secp256k1 < crate :: AllPreallocated > | {
@@ -1297,7 +1280,7 @@ impl Session {
1297
1280
self . as_ptr ( ) ,
1298
1281
)
1299
1282
} ,
1300
- Some ( & seed ) ,
1283
+ None ,
1301
1284
) ;
1302
1285
ret == 1
1303
1286
}
0 commit comments