Skip to content

Commit 1e6eb7d

Browse files
doc: fix FROST API comments and annotations
- Clarify frost_keygen_cache description to specify it holds the group public key and tweak state. - Mark parsing functions with SECP256K1_WARN_UNUSED_RESULT. - Remove outdated parameter from secp256k1_frost_compute_pubshare docs. - Fix typos in comments (my_id instead of myd_id). - Align tweak documentation with frost_pubkey_gen. - Improve formatting of sec_adaptor32 output parameter. No functional or ABI changes.
1 parent 65983c2 commit 1e6eb7d

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

include/secp256k1_frost.h

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ extern "C" {
3636
* comparison, use the corresponding serialization and parsing functions.
3737
*/
3838

39-
/** Opaque data structure that caches information about key tweaking.
39+
/** Opaque data structure that caches information about the FROST group public
40+
* key and tweak state used for signing and verification.
4041
*
4142
* Guaranteed to be 101 bytes in size. It can be safely copied/moved. No
4243
* serialization and parsing functions.
@@ -106,7 +107,7 @@ typedef struct {
106107
* Out: nonce: pointer to a nonce object
107108
* In: in66: pointer to the 66-byte nonce to be parsed
108109
*/
109-
SECP256K1_API int secp256k1_frost_pubnonce_parse(
110+
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_frost_pubnonce_parse(
110111
const secp256k1_context *ctx,
111112
secp256k1_frost_pubnonce *nonce,
112113
const unsigned char *in66
@@ -149,7 +150,7 @@ SECP256K1_API int secp256k1_frost_partial_sig_serialize(
149150
* encoded numbers are out of range, signature verification with it is
150151
* guaranteed to fail for every message and public key.
151152
*/
152-
SECP256K1_API int secp256k1_frost_partial_sig_parse(
153+
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_frost_partial_sig_parse(
153154
const secp256k1_context *ctx,
154155
secp256k1_frost_partial_sig *sig,
155156
const unsigned char *in32
@@ -175,7 +176,7 @@ SECP256K1_API int secp256k1_frost_share_serialize(
175176
* Out: share: pointer to a share object
176177
* In: in32: pointer to the 32-byte share to be parsed
177178
*/
178-
SECP256K1_API int secp256k1_frost_share_parse(
179+
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_frost_share_parse(
179180
const secp256k1_context *ctx,
180181
secp256k1_frost_secshare *share,
181182
const unsigned char *in32
@@ -245,9 +246,8 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_frost_share_verify(
245246
* id: the participant ID of the participant whose partial
246247
* signature will be verified with the pubshare
247248
* vss_commitment: input array of the elements of the VSS commitment
248-
* n_participants: the total number of participants
249249
*/
250-
SECP256K1_API int secp256k1_frost_compute_pubshare(
250+
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_frost_compute_pubshare(
251251
const secp256k1_context *ctx,
252252
secp256k1_pubkey *pubshare,
253253
size_t threshold,
@@ -303,10 +303,9 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_frost_pubkey_get(
303303
* earlier failures).
304304
*
305305
* secp256k1_frost_pubkey_gen(..., keygen_cache, ...)
306-
* secp256k1_frost_pubkey_tweak(..., keygen_cache, xonly_pk)
307306
* secp256k1_frost_pubkey_ec_tweak_add(..., output_pk, keygen_cache, tweak32)
308307
* secp256k1_ec_pubkey_serialize(..., buf, output_pk)
309-
* secp256k1_frost_pubkey_get(..., ec_pk, xonly_pk)
308+
* secp256k1_frost_pubkey_get(..., ec_pk, keygen_cache)
310309
* secp256k1_ec_pubkey_tweak_add(..., ec_pk, tweak32)
311310
* secp256k1_ec_pubkey_serialize(..., buf2, ec_pk)
312311
*
@@ -323,7 +322,7 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_frost_pubkey_get(
323322
* to an invalid value if this function returns 0. If you
324323
* do not need it, this arg can be NULL.
325324
* In/Out: keygen_cache: pointer to a `frost_keygen_cache` struct initialized by
326-
* `frost_pubkey_tweak`
325+
* `frost_pubkey_gen`
327326
* In: tweak32: pointer to a 32-byte tweak. If the tweak is invalid
328327
* according to `secp256k1_ec_seckey_verify`, this function
329328
* returns 0. For uniformly random 32-byte arrays the
@@ -364,7 +363,7 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_frost_pubkey_ec_tweak_a
364363
* to an invalid value if this function returns 0. If you
365364
* do not need it, this arg can be NULL.
366365
* In/Out: keygen_cache: pointer to a `frost_keygen_cache` struct initialized by
367-
* `frost_pubkey_tweak`
366+
* `frost_pubkey_gen`
368367
* In: tweak32: pointer to a 32-byte tweak. If the tweak is invalid
369368
* according to secp256k1_ec_seckey_verify, this function
370369
* returns 0. For uniformly random 32-byte arrays the
@@ -422,7 +421,7 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_frost_pubkey_xonly_twea
422421
* extra_input32: an optional 32-byte array that is input to the nonce
423422
* derivation function (can be NULL)
424423
*/
425-
SECP256K1_API int secp256k1_frost_nonce_gen(
424+
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_frost_nonce_gen(
426425
const secp256k1_context *ctx,
427426
secp256k1_frost_secnonce *secnonce,
428427
secp256k1_frost_pubnonce *pubnonce,
@@ -447,10 +446,10 @@ SECP256K1_API int secp256k1_frost_nonce_gen(
447446
* n_pubnonces: number of elements in the pubnonces array. Must be
448447
* greater than 0.
449448
* msg32: the 32-byte message to sign
450-
* myd_id: the ID of the participant who will use the session for
449+
* my_id: the ID of the participant who will use the session for
451450
* signing
452451
* ids: array of the participant IDs of the signers
453-
keygen_cache: pointer to frost_keygen_cache struct
452+
* keygen_cache: pointer to frost_keygen_cache struct
454453
* adaptor: optional pointer to an adaptor point encoded as a
455454
* public key if this signing session is part of an
456455
* adaptor signature protocol (can be NULL)
@@ -582,7 +581,7 @@ SECP256K1_API int secp256k1_frost_nonce_parity(
582581
* nonce_parity: the output of `frost_nonce_parity` called with the
583582
* session used for producing the pre-signature
584583
*/
585-
SECP256K1_API int secp256k1_frost_verify_adaptor(
584+
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_frost_verify_adaptor(
586585
const secp256k1_context *ctx,
587586
const unsigned char *pre_sig64,
588587
const unsigned char *msg32,
@@ -628,7 +627,7 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_frost_adapt(
628627
* grossly invalid (overflowing) values. 1 otherwise (which does NOT
629628
* mean the signatures or the adaptor are valid!)
630629
* Args: ctx: pointer to a context object
631-
* Out:sec_adaptor32: 32-byte secret adaptor
630+
* Out: sec_adaptor32: 32-byte secret adaptor
632631
* In: sig64: complete, valid 64-byte signature
633632
* pre_sig64: the pre-signature corresponding to sig64, i.e., the
634633
* aggregate of partial signatures without the secret

0 commit comments

Comments
 (0)