@@ -64,22 +64,38 @@ SECP256K1_API extern const secp256k1_nonce_function_hardened secp256k1_nonce_fun
64
64
* signature. Instead, you can manually use secp256k1_schnorrsig_verify and
65
65
* abort if it fails.
66
66
*
67
- * Otherwise BIP-340 compliant if the noncefp argument is NULL or
68
- * secp256k1_nonce_function_bip340 and the ndata argument is 32-byte auxiliary
69
- * randomness.
70
- *
71
67
* Returns 1 on success, 0 on failure.
72
68
* Args: ctx: pointer to a context object, initialized for signing (cannot be NULL)
73
69
* Out: sig64: pointer to a 64-byte array to store the serialized signature (cannot be NULL)
74
70
* In: msg32: the 32-byte message being signed (cannot be NULL)
75
71
* keypair: pointer to an initialized keypair (cannot be NULL)
76
- * noncefp: pointer to a nonce generation function. If NULL, secp256k1_nonce_function_bip340 is used
77
- * ndata: pointer to arbitrary data used by the nonce generation
78
- * function (can be NULL). If it is non-NULL and
79
- * secp256k1_nonce_function_bip340 is used, then ndata must be a
80
- * pointer to 32-byte auxiliary randomness as per BIP-340.
72
+ * aux_rand32: 32 bytes of fresh randomness. While recommended to provide
73
+ * this, it is only supplemental to security and can be NULL. See
74
+ * BIP-340 for a full explanation of this argument and for
75
+ * guidance if randomness is expensive.
81
76
*/
82
77
SECP256K1_API int secp256k1_schnorrsig_sign (
78
+ const secp256k1_context * ctx ,
79
+ unsigned char * sig64 ,
80
+ const unsigned char * msg32 ,
81
+ const secp256k1_keypair * keypair ,
82
+ unsigned char * aux_rand32
83
+ ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 ) SECP256K1_ARG_NONNULL (4 );
84
+
85
+ /** Create a Schnorr signature with a more flexible API.
86
+ *
87
+ * Same arguments as secp256k1_schnorrsig_sign except that it misses aux_rand32
88
+ * and instead allows allows providing a different nonce derivation function
89
+ * with its own data argument.
90
+ *
91
+ * In: noncefp: pointer to a nonce generation function. If NULL,
92
+ * secp256k1_nonce_function_bip340 is used
93
+ * ndata: pointer to arbitrary data used by the nonce generation function
94
+ * (can be NULL). If it is non-NULL and
95
+ * secp256k1_nonce_function_bip340 is used, then ndata must be a
96
+ * pointer to 32-byte auxiliary randomness as per BIP-340.
97
+ */
98
+ SECP256K1_API int secp256k1_schnorrsig_sign_custom (
83
99
const secp256k1_context * ctx ,
84
100
unsigned char * sig64 ,
85
101
const unsigned char * msg32 ,
@@ -88,6 +104,7 @@ SECP256K1_API int secp256k1_schnorrsig_sign(
88
104
void * ndata
89
105
) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 ) SECP256K1_ARG_NONNULL (4 );
90
106
107
+
91
108
/** Verify a Schnorr signature.
92
109
*
93
110
* Returns: 1: correct signature
0 commit comments