@@ -658,6 +658,147 @@ extern "C" {
658658 hashfp : EllswiftEcdhHashFn ,
659659 data : * mut c_void )
660660 -> 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 ;
661802}
662803
663804#[ cfg( not( secp256k1_fuzz) ) ]
@@ -1084,6 +1225,102 @@ impl <T: CPtr> CPtr for Option<T> {
10841225 }
10851226}
10861227
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 ) ]
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+
1250+ #[ repr( C ) ]
1251+ #[ derive( Copy , Clone , PartialEq , Eq ) ]
1252+ pub struct MusigSecNonce ( pub ( crate ) [ c_uchar ; MUSIG_SECNONCE_LEN ] ) ;
1253+ impl_array_newtype ! ( MusigSecNonce , c_uchar, MUSIG_SECNONCE_LEN ) ;
1254+ impl_raw_debug ! ( MusigSecNonce ) ;
1255+
1256+ impl MusigSecNonce {
1257+ pub fn new ( ) -> Self {
1258+ MusigSecNonce ( [ 0 ; MUSIG_SECNONCE_LEN ] )
1259+ }
1260+
1261+ /// Don't use this. Refer to the documentation of wrapper APIs in the crate.
1262+ //
1263+ // No need for strong warning here, the user cannot use the ffi types directly in any of the APIs
1264+ pub fn dangerous_from_bytes ( bytes : [ c_uchar ; MUSIG_SECNONCE_LEN ] ) -> Self {
1265+ MusigSecNonce ( bytes)
1266+ }
1267+
1268+ /// Don't use this. Refer to the documentation of wrapper APIs in the crate.
1269+ //
1270+ // No need for strong warning here, the user cannot use the ffi types directly in any of the high level APIs
1271+ pub fn dangerous_into_bytes ( self ) -> [ c_uchar ; MUSIG_SECNONCE_LEN ] {
1272+ self . 0
1273+ }
1274+ }
1275+
1276+ #[ repr( C ) ]
1277+ #[ derive( Copy , Clone , PartialEq , Eq ) ]
1278+ pub struct MusigPubNonce ( [ c_uchar ; MUSIG_PUBNONCE_LEN ] ) ;
1279+ impl_array_newtype ! ( MusigPubNonce , c_uchar, MUSIG_PUBNONCE_LEN ) ;
1280+ impl_raw_debug ! ( MusigPubNonce ) ;
1281+
1282+ impl MusigPubNonce {
1283+ pub fn new ( ) -> Self {
1284+ MusigPubNonce ( [ 0 ; MUSIG_PUBNONCE_LEN ] )
1285+ }
1286+ }
1287+
1288+ #[ repr( C ) ]
1289+ #[ derive( Copy , Clone , PartialEq , Eq ) ]
1290+ pub struct MusigAggNonce ( [ c_uchar ; MUSIG_AGGNONCE_LEN ] ) ;
1291+ impl_array_newtype ! ( MusigAggNonce , c_uchar, MUSIG_AGGNONCE_LEN ) ;
1292+ impl_raw_debug ! ( MusigAggNonce ) ;
1293+
1294+ impl MusigAggNonce {
1295+ pub fn new ( ) -> Self {
1296+ MusigAggNonce ( [ 0 ; MUSIG_AGGNONCE_LEN ] )
1297+ }
1298+ }
1299+
1300+ #[ repr( C ) ]
1301+ #[ derive( Copy , Clone , PartialEq , Eq ) ]
1302+ pub struct MusigSession ( [ c_uchar ; MUSIG_SESSION_LEN ] ) ;
1303+ impl_array_newtype ! ( MusigSession , c_uchar, MUSIG_SESSION_LEN ) ;
1304+ impl_raw_debug ! ( MusigSession ) ;
1305+
1306+ impl MusigSession {
1307+ pub fn new ( ) -> Self {
1308+ MusigSession ( [ 0 ; MUSIG_SESSION_LEN ] )
1309+ }
1310+ }
1311+
1312+ #[ repr( C ) ]
1313+ #[ derive( Copy , Clone , PartialEq , Eq ) ]
1314+ pub struct MusigPartialSignature ( [ c_uchar ; MUSIG_PART_SIG_LEN ] ) ;
1315+ impl_array_newtype ! ( MusigPartialSignature , c_uchar, MUSIG_PART_SIG_LEN ) ;
1316+ impl_raw_debug ! ( MusigPartialSignature ) ;
1317+
1318+ impl MusigPartialSignature {
1319+ pub fn new ( ) -> Self {
1320+ MusigPartialSignature ( [ 0 ; MUSIG_PART_SIG_LEN ] )
1321+ }
1322+ }
1323+
10871324#[ cfg( secp256k1_fuzz) ]
10881325mod fuzz_dummy {
10891326 use super :: * ;
0 commit comments