8
8
extern "C" {
9
9
#endif
10
10
11
+ /** This module implements incremental (Half-)Aggregation of Schnorr
12
+ * signatures as specificed by the Bitcoin Improvement Proposal draft
13
+ * "Half-Aggregation of BIP 340 signatures"
14
+ * (https://github.com/BlockstreamResearch/cross-input-aggregation/blob/master/half-aggregation.mediawiki).
15
+ */
16
+
17
+ /** (Half-)Aggregate a sequence of Schnorr signatures.
18
+ *
19
+ * Returns 1 on success, 0 on failure.
20
+ * Args: ctx: a secp256k1 context object.
21
+ * Out: aggsig: pointer to an array of aggsig_len many bytes to
22
+ * store the serialized aggregate signature. The size
23
+ * is expected to be 32*(n+1) bytes.
24
+ * In/Out: aggsig_len: size of the aggsig array that is passed in bytes;
25
+ * will be overwritten to be the exact size of aggsig.
26
+ * In: pubkeys: Array of n many x-only public keys.
27
+ * Can only be NULL if n is 0.
28
+ * msgs32: Array of n many 32-byte messages.
29
+ * Can only be NULL if n is 0.
30
+ * sigs64: Array of n many 64-byte signatures.
31
+ * Can only be NULL if n is 0.
32
+ * n: number of signatures to be aggregated.
33
+ */
34
+ SECP256K1_API int secp256k1_schnorrsig_aggregate (
35
+ const secp256k1_context * ctx ,
36
+ unsigned char * aggsig ,
37
+ size_t * aggsig_len ,
38
+ const secp256k1_xonly_pubkey * pubkeys ,
39
+ const unsigned char * msgs32 ,
40
+ const unsigned char * sigs64 ,
41
+ size_t n
42
+ ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 );
11
43
12
44
/** Incrementally (Half-)Aggregate a sequence of Schnorr
13
45
* signatures to an existing half-aggregate signature.
@@ -22,7 +54,7 @@ extern "C" {
22
54
* aggsig_len: size of aggsig array in bytes.
23
55
* Should be large enough to hold the new
24
56
* serialized aggregate signature, i.e.,
25
- * should satisfy aggsig_size >= 32*(n_before+n_new+1).
57
+ * should satisfy aggsig_len >= 32*(n_before+n_new+1).
26
58
* It will be overwritten to be the exact size of the
27
59
* resulting aggsig.
28
60
* In: all_pubkeys: Array of (n_before + n_new) many x-only public keys,
@@ -51,32 +83,6 @@ SECP256K1_API int secp256k1_schnorrsig_inc_aggregate(
51
83
size_t n_new
52
84
) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 );
53
85
54
- /** (Half-)Aggregate a sequence of Schnorr signatures.
55
- *
56
- * Returns 1 on success, 0 on failure.
57
- * Args: ctx: a secp256k1 context object.
58
- * Out: aggsig: pointer to an array of aggsig_len many bytes to
59
- * store the serialized aggregate signature.
60
- * In/Out: aggsig_len: size of the aggsig array that is passed in bytes;
61
- * will be overwritten to be the exact size of aggsig.
62
- * In: pubkeys: Array of n many x-only public keys.
63
- * Can only be NULL if n is 0.
64
- * msgs32: Array of n many 32-byte messages.
65
- * Can only be NULL if n is 0.
66
- * sigs64: Array of n many 64-byte signatures.
67
- * Can only be NULL if n is 0.
68
- * n: number of signatures to be aggregated.
69
- */
70
- SECP256K1_API int secp256k1_schnorrsig_aggregate (
71
- const secp256k1_context * ctx ,
72
- unsigned char * aggsig ,
73
- size_t * aggsig_len ,
74
- const secp256k1_xonly_pubkey * pubkeys ,
75
- const unsigned char * msgs32 ,
76
- const unsigned char * sigs64 ,
77
- size_t n
78
- ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 );
79
-
80
86
/** Verify a (Half-)aggregate Schnorr signature.
81
87
*
82
88
* Returns: 1: correct signature.
@@ -85,11 +91,11 @@ SECP256K1_API int secp256k1_schnorrsig_aggregate(
85
91
* In: pubkeys: Array of n many x-only public keys. Can only be NULL if n is 0.
86
92
* msgs32: Array of n many 32-byte messages. Can only be NULL if n is 0.
87
93
* n: number of signatures to that have been aggregated.
88
- * aggsig: Pointer to an array of aggsig_size many bytes
94
+ * aggsig: Pointer to an array of aggsig_len many bytes
89
95
* containing the serialized aggregate
90
96
* signature to be verified.
91
97
* aggsig_len: Size of the aggregate signature in bytes.
92
- * Should be aggsig_len = 32*(n+1)
98
+ * Must be aggsig_len = 32*(n+1)
93
99
*/
94
100
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_schnorrsig_aggverify (
95
101
const secp256k1_context * ctx ,
0 commit comments