@@ -672,6 +672,147 @@ extern "C" {
672672                                  hashfp :  EllswiftEcdhHashFn , 
673673                                  data :  * mut  c_void ) 
674674                                  -> c_int ; 
675+ 
676+     #[ cfg_attr( not( rust_secp_no_symbol_renaming) ,  link_name = "rustsecp256k1_v0_11_musig_pubnonce_parse" ) ]  
677+     pub  fn  secp256k1_musig_pubnonce_parse ( 
678+         cx :  * const  Context , 
679+         nonce :  * mut  MusigPubNonce , 
680+         in66 :  * const  c_uchar , 
681+     )  -> c_int ; 
682+ 
683+     #[ cfg_attr( not( rust_secp_no_symbol_renaming) ,  link_name = "rustsecp256k1_v0_11_musig_pubnonce_serialize" ) ]  
684+     pub  fn  secp256k1_musig_pubnonce_serialize ( 
685+         cx :  * const  Context , 
686+         out66 :  * mut  c_uchar , 
687+         nonce :  * const  MusigPubNonce , 
688+     )  -> c_int ; 
689+ 
690+     #[ cfg_attr( not( rust_secp_no_symbol_renaming) ,  link_name = "rustsecp256k1_v0_11_musig_aggnonce_parse" ) ]  
691+     pub  fn  secp256k1_musig_aggnonce_parse ( 
692+         cx :  * const  Context , 
693+         nonce :  * mut  MusigAggNonce , 
694+         in66 :  * const  c_uchar , 
695+     )  -> c_int ; 
696+ 
697+     #[ cfg_attr( not( rust_secp_no_symbol_renaming) ,  link_name = "rustsecp256k1_v0_11_musig_aggnonce_serialize" ) ]  
698+     pub  fn  secp256k1_musig_aggnonce_serialize ( 
699+         cx :  * const  Context , 
700+         out66 :  * mut  c_uchar , 
701+         nonce :  * const  MusigAggNonce , 
702+     )  -> c_int ; 
703+ 
704+     #[ cfg_attr( not( rust_secp_no_symbol_renaming) ,  link_name = "rustsecp256k1_v0_11_musig_partial_sig_parse" ) ]  
705+     pub  fn  secp256k1_musig_partial_sig_parse ( 
706+         cx :  * const  Context , 
707+         sig :  * mut  MusigPartialSignature , 
708+         in32 :  * const  c_uchar , 
709+     )  -> c_int ; 
710+ 
711+     #[ cfg_attr( not( rust_secp_no_symbol_renaming) ,  link_name = "rustsecp256k1_v0_11_musig_partial_sig_serialize" ) ]  
712+     pub  fn  secp256k1_musig_partial_sig_serialize ( 
713+         cx :  * const  Context , 
714+         out32 :  * mut  c_uchar , 
715+         sig :  * const  MusigPartialSignature , 
716+     )  -> c_int ; 
717+ 
718+     #[ cfg_attr( not( rust_secp_no_symbol_renaming) ,  link_name = "rustsecp256k1_v0_11_musig_pubkey_agg" ) ]  
719+     pub  fn  secp256k1_musig_pubkey_agg ( 
720+         cx :  * const  Context , 
721+         agg_pk :  * mut  XOnlyPublicKey , 
722+         keyagg_cache :  * mut  MusigKeyAggCache , 
723+         pubkeys :  * const  * const  PublicKey , 
724+         n_pubkeys :  size_t , 
725+     )  -> c_int ; 
726+ 
727+     #[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_11_musig_pubkey_get" ) ]  
728+     pub  fn  secp256k1_musig_pubkey_get ( 
729+         cx :  * const  Context , 
730+         agg_pk :  * mut  PublicKey , 
731+         keyagg_cache :  * const  MusigKeyAggCache , 
732+     )  -> c_int ; 
733+ 
734+     #[ cfg_attr( not( rust_secp_no_symbol_renaming) ,  link_name = "rustsecp256k1_v0_11_musig_pubkey_ec_tweak_add" ) ]  
735+     pub  fn  secp256k1_musig_pubkey_ec_tweak_add ( 
736+         cx :  * const  Context , 
737+         output_pubkey :  * mut  PublicKey , 
738+         keyagg_cache :  * mut  MusigKeyAggCache , 
739+         tweak32 :  * const  c_uchar , 
740+     )  -> c_int ; 
741+ 
742+     #[ cfg_attr( not( rust_secp_no_symbol_renaming) ,  link_name = "rustsecp256k1_v0_11_musig_pubkey_xonly_tweak_add" ) ]  
743+     pub  fn  secp256k1_musig_pubkey_xonly_tweak_add ( 
744+         cx :  * const  Context , 
745+         output_pubkey :  * mut  PublicKey , 
746+         keyagg_cache :  * mut  MusigKeyAggCache , 
747+         tweak32 :  * const  c_uchar , 
748+     )  -> c_int ; 
749+ 
750+     #[ cfg_attr( not( rust_secp_no_symbol_renaming) ,  link_name = "rustsecp256k1_v0_11_musig_nonce_gen" ) ]  
751+     pub  fn  secp256k1_musig_nonce_gen ( 
752+         cx :  * const  Context , 
753+         secnonce :  * mut  MusigSecNonce , 
754+         pubnonce :  * mut  MusigPubNonce , 
755+         session_secrand32 :  * const  c_uchar , 
756+         seckey :  * const  c_uchar , 
757+         pubkey :  * const  PublicKey , 
758+         msg32 :  * const  c_uchar , 
759+         keyagg_cache :  * const  MusigKeyAggCache , 
760+         extra_input32 :  * const  c_uchar , 
761+     )  -> c_int ; 
762+ 
763+     #[ cfg_attr( not( rust_secp_no_symbol_renaming) ,  link_name = "rustsecp256k1_v0_11_musig_nonce_agg" ) ]  
764+     pub  fn  secp256k1_musig_nonce_agg ( 
765+         cx :  * const  Context , 
766+         aggnonce :  * mut  MusigAggNonce , 
767+         pubnonces :  * const  * const  MusigPubNonce , 
768+         n_pubnonces :  size_t , 
769+     )  -> c_int ; 
770+ 
771+ 
772+     #[ cfg_attr( not( rust_secp_no_symbol_renaming) ,  link_name = "rustsecp256k1_v0_11_musig_nonce_process" ) ]  
773+     pub  fn  secp256k1_musig_nonce_process ( 
774+         cx :  * const  Context , 
775+         session :  * mut  MusigSession , 
776+         aggnonce :  * const  MusigAggNonce , 
777+         msg32 :  * const  c_uchar , 
778+         keyagg_cache :  * const  MusigKeyAggCache , 
779+     )  -> c_int ; 
780+ 
781+     #[ cfg_attr( not( rust_secp_no_symbol_renaming) ,  link_name = "rustsecp256k1_v0_11_musig_partial_sign" ) ]  
782+     pub  fn  secp256k1_musig_partial_sign ( 
783+         cx :  * const  Context , 
784+         partial_sig :  * mut  MusigPartialSignature , 
785+         secnonce :  * mut  MusigSecNonce , 
786+         keypair :  * const  Keypair , 
787+         keyagg_cache :  * const  MusigKeyAggCache , 
788+         session :  * const  MusigSession , 
789+     )  -> c_int ; 
790+ 
791+     #[ cfg_attr( not( rust_secp_no_symbol_renaming) ,  link_name = "rustsecp256k1_v0_11_musig_partial_sig_verify" ) ]  
792+     pub  fn  secp256k1_musig_partial_sig_verify ( 
793+         cx :  * const  Context , 
794+         partial_sig :  * const  MusigPartialSignature , 
795+         pubnonce :  * const  MusigPubNonce , 
796+         pubkey :  * const  PublicKey , 
797+         keyagg_cache :  * const  MusigKeyAggCache , 
798+         session :  * const  MusigSession , 
799+     )  -> c_int ; 
800+ 
801+     #[ cfg_attr( not( rust_secp_no_symbol_renaming) ,  link_name = "rustsecp256k1_v0_11_musig_partial_sig_agg" ) ]  
802+     pub  fn  secp256k1_musig_partial_sig_agg ( 
803+         cx :  * const  Context , 
804+         sig64 :  * mut  c_uchar , 
805+         session :  * const  MusigSession , 
806+         partial_sigs :  * const  * const  MusigPartialSignature , 
807+         n_sigs :  size_t , 
808+     )  -> c_int ; 
809+ 
810+     #[ cfg_attr( not( rust_secp_no_symbol_renaming) ,  link_name = "rustsecp256k1_v0_11_ec_pubkey_sort" ) ]  
811+     pub  fn  secp256k1_ec_pubkey_sort ( 
812+         ctx :  * const  Context , 
813+         pubkeys :  * const  * const  PublicKey , 
814+         n_pubkeys :  size_t 
815+     )  -> c_int ; 
675816} 
676817
677818#[ cfg( not( secp256k1_fuzz) ) ]  
@@ -1098,6 +1239,133 @@ impl <T: CPtr> CPtr for Option<T> {
10981239    } 
10991240} 
11001241
1242+ pub  const  MUSIG_KEYAGG_LEN :  usize  = 197 ; 
1243+ pub  const  MUSIG_SECNONCE_LEN :  usize  = 132 ; 
1244+ pub  const  MUSIG_PUBNONCE_LEN :  usize  = 132 ; 
1245+ pub  const  MUSIG_AGGNONCE_LEN :  usize  = 132 ; 
1246+ pub  const  MUSIG_AGGNONCE_SERIALIZED_LEN :  usize  = 66 ; 
1247+ pub  const  MUSIG_PUBNONCE_SERIALIZED_LEN :  usize  = 66 ; 
1248+ pub  const  MUSIG_SESSION_LEN :  usize  = 133 ; 
1249+ pub  const  MUSIG_PART_SIG_LEN :  usize  = 36 ; 
1250+ 
1251+ #[ repr( C ) ]  
1252+ #[ derive( Copy ,  Clone ,  PartialEq ,  Eq ,  PartialOrd ,  Ord ,  Hash ) ]  
1253+ pub  struct  MusigKeyAggCache ( [ c_uchar ;  MUSIG_KEYAGG_LEN ] ) ; 
1254+ impl_array_newtype ! ( MusigKeyAggCache ,  c_uchar,  MUSIG_KEYAGG_LEN ) ; 
1255+ impl_raw_debug ! ( MusigKeyAggCache ) ; 
1256+ 
1257+ impl  MusigKeyAggCache  { 
1258+     pub  fn  new ( )  -> Self  { 
1259+         MusigKeyAggCache ( [ 0 ;  MUSIG_KEYAGG_LEN ] ) 
1260+     } 
1261+ } 
1262+ 
1263+ impl  Default  for  MusigKeyAggCache  { 
1264+     fn  default ( )  -> Self  { 
1265+         Self :: new ( ) 
1266+     } 
1267+ } 
1268+ 
1269+ #[ repr( C ) ]  
1270+ #[ derive( Copy ,  Clone ,  PartialEq ,  Eq ) ]  
1271+ pub  struct  MusigSecNonce ( pub ( crate )  [ c_uchar ;  MUSIG_SECNONCE_LEN ] ) ; 
1272+ impl_array_newtype ! ( MusigSecNonce ,  c_uchar,  MUSIG_SECNONCE_LEN ) ; 
1273+ impl_raw_debug ! ( MusigSecNonce ) ; 
1274+ 
1275+ impl  MusigSecNonce  { 
1276+     pub  fn  new ( )  -> Self  { 
1277+         MusigSecNonce ( [ 0 ;  MUSIG_SECNONCE_LEN ] ) 
1278+     } 
1279+ 
1280+     // No need for strong warning here, the user cannot use the ffi types directly in any of the APIs 
1281+     pub  fn  dangerous_from_bytes ( bytes :  [ c_uchar ;  MUSIG_SECNONCE_LEN ] )  -> Self  { 
1282+         MusigSecNonce ( bytes) 
1283+     } 
1284+ 
1285+     // No need for strong warning here, the user cannot use the ffi types directly in any of the high level APIs 
1286+     pub  fn  dangerous_into_bytes ( self )  -> [ c_uchar ;  MUSIG_SECNONCE_LEN ]  { 
1287+         self . 0 
1288+     } 
1289+ } 
1290+ 
1291+ impl  Default  for  MusigSecNonce  { 
1292+     fn  default ( )  -> Self  { 
1293+         Self :: new ( ) 
1294+     } 
1295+ } 
1296+ 
1297+ #[ repr( C ) ]  
1298+ #[ derive( Copy ,  Clone ,  PartialEq ,  Eq ,  PartialOrd ,  Ord ,  Hash ) ]  
1299+ pub  struct  MusigPubNonce ( [ c_uchar ;  MUSIG_PUBNONCE_LEN ] ) ; 
1300+ impl_array_newtype ! ( MusigPubNonce ,  c_uchar,  MUSIG_PUBNONCE_LEN ) ; 
1301+ impl_raw_debug ! ( MusigPubNonce ) ; 
1302+ 
1303+ impl  MusigPubNonce  { 
1304+     pub  fn  new ( )  -> Self  { 
1305+         MusigPubNonce ( [ 0 ;  MUSIG_PUBNONCE_LEN ] ) 
1306+     } 
1307+ } 
1308+ 
1309+ impl  Default  for  MusigPubNonce  { 
1310+     fn  default ( )  -> Self  { 
1311+         Self :: new ( ) 
1312+     } 
1313+ } 
1314+ 
1315+ #[ repr( C ) ]  
1316+ #[ derive( Copy ,  Clone ,  PartialEq ,  Eq ,  PartialOrd ,  Ord ,  Hash ) ]  
1317+ pub  struct  MusigAggNonce ( [ c_uchar ;  MUSIG_AGGNONCE_LEN ] ) ; 
1318+ impl_array_newtype ! ( MusigAggNonce ,  c_uchar,  MUSIG_AGGNONCE_LEN ) ; 
1319+ impl_raw_debug ! ( MusigAggNonce ) ; 
1320+ 
1321+ impl  MusigAggNonce  { 
1322+     pub  fn  new ( )  -> Self  { 
1323+         MusigAggNonce ( [ 0 ;  MUSIG_AGGNONCE_LEN ] ) 
1324+     } 
1325+ } 
1326+ 
1327+ impl  Default  for  MusigAggNonce  { 
1328+     fn  default ( )  -> Self  { 
1329+         Self :: new ( ) 
1330+     } 
1331+ } 
1332+ 
1333+ #[ repr( C ) ]  
1334+ #[ derive( Copy ,  Clone ,  PartialEq ,  Eq ,  PartialOrd ,  Ord ,  Hash ) ]  
1335+ pub  struct  MusigSession ( [ c_uchar ;  MUSIG_SESSION_LEN ] ) ; 
1336+ impl_array_newtype ! ( MusigSession ,  c_uchar,  MUSIG_SESSION_LEN ) ; 
1337+ impl_raw_debug ! ( MusigSession ) ; 
1338+ 
1339+ impl  MusigSession  { 
1340+     pub  fn  new ( )  -> Self  { 
1341+         MusigSession ( [ 0 ;  MUSIG_SESSION_LEN ] ) 
1342+     } 
1343+ } 
1344+ 
1345+ impl  Default  for  MusigSession  { 
1346+     fn  default ( )  -> Self  { 
1347+         Self :: new ( ) 
1348+     } 
1349+ } 
1350+ 
1351+ #[ repr( C ) ]  
1352+ #[ derive( Copy ,  Clone ,  PartialEq ,  Eq ,  PartialOrd ,  Ord ,  Hash ) ]  
1353+ pub  struct  MusigPartialSignature ( [ c_uchar ;  MUSIG_PART_SIG_LEN ] ) ; 
1354+ impl_array_newtype ! ( MusigPartialSignature ,  c_uchar,  MUSIG_PART_SIG_LEN ) ; 
1355+ impl_raw_debug ! ( MusigPartialSignature ) ; 
1356+ 
1357+ impl  MusigPartialSignature  { 
1358+     pub  fn  new ( )  -> Self  { 
1359+         MusigPartialSignature ( [ 0 ;  MUSIG_PART_SIG_LEN ] ) 
1360+     } 
1361+ } 
1362+ 
1363+ impl  Default  for  MusigPartialSignature  { 
1364+     fn  default ( )  -> Self  { 
1365+         Self :: new ( ) 
1366+     } 
1367+ } 
1368+ 
11011369#[ cfg( secp256k1_fuzz) ]  
11021370mod  fuzz_dummy { 
11031371    use  super :: * ; 
0 commit comments