@@ -658,6 +658,147 @@ extern "C" {
658
658
hashfp : EllswiftEcdhHashFn ,
659
659
data : * mut c_void )
660
660
-> c_int ;
661
+
662
+ #[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_10_0_musig_pubnonce_parse" ) ]
663
+ pub fn secp256k1_musig_pubnonce_parse (
664
+ cx : * const Context ,
665
+ nonce : * mut MusigPubNonce ,
666
+ in66 : * const c_uchar ,
667
+ ) -> c_int ;
668
+
669
+ #[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_10_0_musig_pubnonce_serialize" ) ]
670
+ pub fn secp256k1_musig_pubnonce_serialize (
671
+ cx : * const Context ,
672
+ out66 : * mut c_uchar ,
673
+ nonce : * const MusigPubNonce ,
674
+ ) -> c_int ;
675
+
676
+ #[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_10_0_musig_aggnonce_parse" ) ]
677
+ pub fn secp256k1_musig_aggnonce_parse (
678
+ cx : * const Context ,
679
+ nonce : * mut MusigAggNonce ,
680
+ in66 : * const c_uchar ,
681
+ ) -> c_int ;
682
+
683
+ #[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_10_0_musig_aggnonce_serialize" ) ]
684
+ pub fn secp256k1_musig_aggnonce_serialize (
685
+ cx : * const Context ,
686
+ out66 : * mut c_uchar ,
687
+ nonce : * const MusigAggNonce ,
688
+ ) -> c_int ;
689
+
690
+ #[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_10_0_musig_partial_sig_parse" ) ]
691
+ pub fn secp256k1_musig_partial_sig_parse (
692
+ cx : * const Context ,
693
+ sig : * mut MusigPartialSignature ,
694
+ in32 : * const c_uchar ,
695
+ ) -> c_int ;
696
+
697
+ #[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_10_0_musig_partial_sig_serialize" ) ]
698
+ pub fn secp256k1_musig_partial_sig_serialize (
699
+ cx : * const Context ,
700
+ out32 : * mut c_uchar ,
701
+ sig : * const MusigPartialSignature ,
702
+ ) -> c_int ;
703
+
704
+ #[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_10_0_musig_pubkey_agg" ) ]
705
+ pub fn secp256k1_musig_pubkey_agg (
706
+ cx : * const Context ,
707
+ agg_pk : * mut XOnlyPublicKey ,
708
+ keyagg_cache : * mut MusigKeyAggCache ,
709
+ pubkeys : * const * const PublicKey ,
710
+ n_pubkeys : size_t ,
711
+ ) -> c_int ;
712
+
713
+ #[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_10_0_musig_pubkey_get" ) ]
714
+ pub fn secp256k1_musig_pubkey_get (
715
+ cx : * const Context ,
716
+ agg_pk : * mut PublicKey ,
717
+ keyagg_cache : * const MusigKeyAggCache ,
718
+ ) -> c_int ;
719
+
720
+ #[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_10_0_musig_pubkey_ec_tweak_add" ) ]
721
+ pub fn secp256k1_musig_pubkey_ec_tweak_add (
722
+ cx : * const Context ,
723
+ output_pubkey : * mut PublicKey ,
724
+ keyagg_cache : * mut MusigKeyAggCache ,
725
+ tweak32 : * const c_uchar ,
726
+ ) -> c_int ;
727
+
728
+ #[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_10_0_musig_pubkey_xonly_tweak_add" ) ]
729
+ pub fn secp256k1_musig_pubkey_xonly_tweak_add (
730
+ cx : * const Context ,
731
+ output_pubkey : * mut PublicKey ,
732
+ keyagg_cache : * mut MusigKeyAggCache ,
733
+ tweak32 : * const c_uchar ,
734
+ ) -> c_int ;
735
+
736
+ #[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_10_0_musig_nonce_gen" ) ]
737
+ pub fn secp256k1_musig_nonce_gen (
738
+ cx : * const Context ,
739
+ secnonce : * mut MusigSecNonce ,
740
+ pubnonce : * mut MusigPubNonce ,
741
+ session_secrand32 : * const c_uchar ,
742
+ seckey : * const c_uchar ,
743
+ pubkey : * const PublicKey ,
744
+ msg32 : * const c_uchar ,
745
+ keyagg_cache : * const MusigKeyAggCache ,
746
+ extra_input32 : * const c_uchar ,
747
+ ) -> c_int ;
748
+
749
+ #[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_10_0_musig_nonce_agg" ) ]
750
+ pub fn secp256k1_musig_nonce_agg (
751
+ cx : * const Context ,
752
+ aggnonce : * mut MusigAggNonce ,
753
+ pubnonces : * const * const MusigPubNonce ,
754
+ n_pubnonces : size_t ,
755
+ ) -> c_int ;
756
+
757
+
758
+ #[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_10_0_musig_nonce_process" ) ]
759
+ pub fn secp256k1_musig_nonce_process (
760
+ cx : * const Context ,
761
+ session : * mut MusigSession ,
762
+ aggnonce : * const MusigAggNonce ,
763
+ msg32 : * const c_uchar ,
764
+ keyagg_cache : * const MusigKeyAggCache ,
765
+ ) -> c_int ;
766
+
767
+ #[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_10_0_musig_partial_sign" ) ]
768
+ pub fn secp256k1_musig_partial_sign (
769
+ cx : * const Context ,
770
+ partial_sig : * mut MusigPartialSignature ,
771
+ secnonce : * mut MusigSecNonce ,
772
+ keypair : * const Keypair ,
773
+ keyagg_cache : * const MusigKeyAggCache ,
774
+ session : * const MusigSession ,
775
+ ) -> c_int ;
776
+
777
+ #[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_10_0_musig_partial_sig_verify" ) ]
778
+ pub fn secp256k1_musig_partial_sig_verify (
779
+ cx : * const Context ,
780
+ partial_sig : * const MusigPartialSignature ,
781
+ pubnonce : * const MusigPubNonce ,
782
+ pubkey : * const PublicKey ,
783
+ keyagg_cache : * const MusigKeyAggCache ,
784
+ session : * const MusigSession ,
785
+ ) -> c_int ;
786
+
787
+ #[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_10_0_musig_partial_sig_agg" ) ]
788
+ pub fn secp256k1_musig_partial_sig_agg (
789
+ cx : * const Context ,
790
+ sig64 : * mut c_uchar ,
791
+ session : * const MusigSession ,
792
+ partial_sigs : * const * const MusigPartialSignature ,
793
+ n_sigs : size_t ,
794
+ ) -> c_int ;
795
+
796
+ #[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_10_0_ec_pubkey_sort" ) ]
797
+ pub fn secp256k1_ec_pubkey_sort (
798
+ ctx : * const Context ,
799
+ pubkeys : * const * const PublicKey ,
800
+ n_pubkeys : size_t
801
+ ) -> c_int ;
661
802
}
662
803
663
804
#[ cfg( not( secp256k1_fuzz) ) ]
@@ -1084,6 +1225,137 @@ impl <T: CPtr> CPtr for Option<T> {
1084
1225
}
1085
1226
}
1086
1227
1228
+ pub const MUSIG_KEYAGG_LEN : usize = 197 ;
1229
+ pub const MUSIG_SECNONCE_LEN : usize = 132 ;
1230
+ pub const MUSIG_PUBNONCE_LEN : usize = 132 ;
1231
+ pub const MUSIG_AGGNONCE_LEN : usize = 132 ;
1232
+ pub const MUSIG_AGGNONCE_SERIALIZED_LEN : usize = 66 ;
1233
+ pub const MUSIG_PUBNONCE_SERIALIZED_LEN : usize = 66 ;
1234
+ pub const MUSIG_SESSION_LEN : usize = 133 ;
1235
+ pub const MUSIG_PART_SIG_LEN : usize = 36 ;
1236
+
1237
+ #[ repr( C ) ]
1238
+ #[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
1239
+ pub struct MusigKeyAggCache ( [ c_uchar ; MUSIG_KEYAGG_LEN ] ) ;
1240
+ impl_array_newtype ! ( MusigKeyAggCache , c_uchar, MUSIG_KEYAGG_LEN ) ;
1241
+ impl_raw_debug ! ( MusigKeyAggCache ) ;
1242
+
1243
+ impl MusigKeyAggCache {
1244
+ pub fn new ( ) -> Self {
1245
+ MusigKeyAggCache ( [ 0 ; MUSIG_KEYAGG_LEN ] )
1246
+ }
1247
+ }
1248
+
1249
+ impl Default for MusigKeyAggCache {
1250
+ fn default ( ) -> Self {
1251
+ Self :: new ( )
1252
+ }
1253
+ }
1254
+
1255
+ #[ repr( C ) ]
1256
+ #[ derive( Copy , Clone , PartialEq , Eq ) ]
1257
+ pub struct MusigSecNonce ( pub ( crate ) [ c_uchar ; MUSIG_SECNONCE_LEN ] ) ;
1258
+ impl_array_newtype ! ( MusigSecNonce , c_uchar, MUSIG_SECNONCE_LEN ) ;
1259
+ impl_raw_debug ! ( MusigSecNonce ) ;
1260
+
1261
+ impl MusigSecNonce {
1262
+ pub fn new ( ) -> Self {
1263
+ MusigSecNonce ( [ 0 ; MUSIG_SECNONCE_LEN ] )
1264
+ }
1265
+
1266
+ /// Don't use this. Refer to the documentation of wrapper APIs in the crate.
1267
+ //
1268
+ // No need for strong warning here, the user cannot use the ffi types directly in any of the APIs
1269
+ pub fn dangerous_from_bytes ( bytes : [ c_uchar ; MUSIG_SECNONCE_LEN ] ) -> Self {
1270
+ MusigSecNonce ( bytes)
1271
+ }
1272
+
1273
+ /// Don't use this. Refer to the documentation of wrapper APIs in the crate.
1274
+ //
1275
+ // No need for strong warning here, the user cannot use the ffi types directly in any of the high level APIs
1276
+ pub fn dangerous_into_bytes ( self ) -> [ c_uchar ; MUSIG_SECNONCE_LEN ] {
1277
+ self . 0
1278
+ }
1279
+ }
1280
+
1281
+ impl Default for MusigSecNonce {
1282
+ fn default ( ) -> Self {
1283
+ Self :: new ( )
1284
+ }
1285
+ }
1286
+
1287
+ #[ repr( C ) ]
1288
+ #[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
1289
+ pub struct MusigPubNonce ( [ c_uchar ; MUSIG_PUBNONCE_LEN ] ) ;
1290
+ impl_array_newtype ! ( MusigPubNonce , c_uchar, MUSIG_PUBNONCE_LEN ) ;
1291
+ impl_raw_debug ! ( MusigPubNonce ) ;
1292
+
1293
+ impl MusigPubNonce {
1294
+ pub fn new ( ) -> Self {
1295
+ MusigPubNonce ( [ 0 ; MUSIG_PUBNONCE_LEN ] )
1296
+ }
1297
+ }
1298
+
1299
+ impl Default for MusigPubNonce {
1300
+ fn default ( ) -> Self {
1301
+ Self :: new ( )
1302
+ }
1303
+ }
1304
+
1305
+ #[ repr( C ) ]
1306
+ #[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
1307
+ pub struct MusigAggNonce ( [ c_uchar ; MUSIG_AGGNONCE_LEN ] ) ;
1308
+ impl_array_newtype ! ( MusigAggNonce , c_uchar, MUSIG_AGGNONCE_LEN ) ;
1309
+ impl_raw_debug ! ( MusigAggNonce ) ;
1310
+
1311
+ impl MusigAggNonce {
1312
+ pub fn new ( ) -> Self {
1313
+ MusigAggNonce ( [ 0 ; MUSIG_AGGNONCE_LEN ] )
1314
+ }
1315
+ }
1316
+
1317
+ impl Default for MusigAggNonce {
1318
+ fn default ( ) -> Self {
1319
+ Self :: new ( )
1320
+ }
1321
+ }
1322
+
1323
+ #[ repr( C ) ]
1324
+ #[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
1325
+ pub struct MusigSession ( [ c_uchar ; MUSIG_SESSION_LEN ] ) ;
1326
+ impl_array_newtype ! ( MusigSession , c_uchar, MUSIG_SESSION_LEN ) ;
1327
+ impl_raw_debug ! ( MusigSession ) ;
1328
+
1329
+ impl MusigSession {
1330
+ pub fn new ( ) -> Self {
1331
+ MusigSession ( [ 0 ; MUSIG_SESSION_LEN ] )
1332
+ }
1333
+ }
1334
+
1335
+ impl Default for MusigSession {
1336
+ fn default ( ) -> Self {
1337
+ Self :: new ( )
1338
+ }
1339
+ }
1340
+
1341
+ #[ repr( C ) ]
1342
+ #[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
1343
+ pub struct MusigPartialSignature ( [ c_uchar ; MUSIG_PART_SIG_LEN ] ) ;
1344
+ impl_array_newtype ! ( MusigPartialSignature , c_uchar, MUSIG_PART_SIG_LEN ) ;
1345
+ impl_raw_debug ! ( MusigPartialSignature ) ;
1346
+
1347
+ impl MusigPartialSignature {
1348
+ pub fn new ( ) -> Self {
1349
+ MusigPartialSignature ( [ 0 ; MUSIG_PART_SIG_LEN ] )
1350
+ }
1351
+ }
1352
+
1353
+ impl Default for MusigPartialSignature {
1354
+ fn default ( ) -> Self {
1355
+ Self :: new ( )
1356
+ }
1357
+ }
1358
+
1087
1359
#[ cfg( secp256k1_fuzz) ]
1088
1360
mod fuzz_dummy {
1089
1361
use super :: * ;
0 commit comments