@@ -226,7 +226,7 @@ SECP256K1_API secp256k1_context* secp256k1_context_create(
226
226
* memory allocation entirely, see the functions in secp256k1_preallocated.h.
227
227
*
228
228
* Returns: a newly created context object.
229
- * Args: ctx: an existing context to copy (cannot be NULL)
229
+ * Args: ctx: an existing context to copy
230
230
*/
231
231
SECP256K1_API secp256k1_context * secp256k1_context_clone (
232
232
const secp256k1_context * ctx
@@ -247,7 +247,7 @@ SECP256K1_API secp256k1_context* secp256k1_context_clone(
247
247
*/
248
248
SECP256K1_API void secp256k1_context_destroy (
249
249
secp256k1_context * ctx
250
- );
250
+ ) SECP256K1_ARG_NONNULL ( 1 ) ;
251
251
252
252
/** Set a callback function to be called when an illegal argument is passed to
253
253
* an API call. It will only trigger for violations that are mentioned
@@ -278,11 +278,11 @@ SECP256K1_API void secp256k1_context_destroy(
278
278
* fails. In this case, the corresponding default handler will be called with
279
279
* the data pointer argument set to NULL.
280
280
*
281
- * Args: ctx: an existing context object (cannot be NULL)
281
+ * Args: ctx: an existing context object.
282
282
* In: fun: a pointer to a function to call when an illegal argument is
283
283
* passed to the API, taking a message and an opaque pointer.
284
284
* (NULL restores the default handler.)
285
- * data: the opaque pointer to pass to fun above.
285
+ * data: the opaque pointer to pass to fun above, must be NULL for the default handler .
286
286
*
287
287
* See also secp256k1_context_set_error_callback.
288
288
*/
@@ -302,12 +302,12 @@ SECP256K1_API void secp256k1_context_set_illegal_callback(
302
302
* for that). After this callback returns, anything may happen, including
303
303
* crashing.
304
304
*
305
- * Args: ctx: an existing context object (cannot be NULL)
305
+ * Args: ctx: an existing context object.
306
306
* In: fun: a pointer to a function to call when an internal error occurs,
307
307
* taking a message and an opaque pointer (NULL restores the
308
308
* default handler, see secp256k1_context_set_illegal_callback
309
309
* for details).
310
- * data: the opaque pointer to pass to fun above.
310
+ * data: the opaque pointer to pass to fun above, must be NULL for the default handler .
311
311
*
312
312
* See also secp256k1_context_set_illegal_callback.
313
313
*/
@@ -320,7 +320,7 @@ SECP256K1_API void secp256k1_context_set_error_callback(
320
320
/** Create a secp256k1 scratch space object.
321
321
*
322
322
* Returns: a newly created scratch space.
323
- * Args: ctx: an existing context object (cannot be NULL)
323
+ * Args: ctx: an existing context object.
324
324
* In: size: amount of memory to be available as scratch space. Some extra
325
325
* (<100 bytes) will be allocated for extra accounting.
326
326
*/
@@ -480,16 +480,16 @@ SECP256K1_API int secp256k1_ecdsa_signature_serialize_compact(
480
480
* Returns: 1: correct signature
481
481
* 0: incorrect or unparseable signature
482
482
* Args: ctx: a secp256k1 context object, initialized for verification.
483
- * In: sig: the signature being verified (cannot be NULL)
484
- * msghash32: the 32-byte message hash being verified (cannot be NULL) .
483
+ * In: sig: the signature being verified.
484
+ * msghash32: the 32-byte message hash being verified.
485
485
* The verifier must make sure to apply a cryptographic
486
486
* hash function to the message by itself and not accept an
487
487
* msghash32 value directly. Otherwise, it would be easy to
488
488
* create a "valid" signature without knowledge of the
489
489
* secret key. See also
490
490
* https://bitcoin.stackexchange.com/a/81116/35586 for more
491
491
* background on this topic.
492
- * pubkey: pointer to an initialized public key to verify with (cannot be NULL)
492
+ * pubkey: pointer to an initialized public key to verify with.
493
493
*
494
494
* To avoid accepting malleable signatures, only ECDSA signatures in lower-S
495
495
* form are accepted.
@@ -515,8 +515,7 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdsa_verify(
515
515
* or copy if the input was already normalized. (can be NULL if
516
516
* you're only interested in whether the input was already
517
517
* normalized).
518
- * In: sigin: a pointer to a signature to check/normalize (cannot be NULL,
519
- * can be identical to sigout)
518
+ * In: sigin: a pointer to a signature to check/normalize (can be identical to sigout)
520
519
*
521
520
* With ECDSA a third-party can forge a second distinct signature of the same
522
521
* message, given a single initial signature, but without knowing the key. This
@@ -568,12 +567,16 @@ SECP256K1_API extern const secp256k1_nonce_function secp256k1_nonce_function_def
568
567
*
569
568
* Returns: 1: signature created
570
569
* 0: the nonce generation function failed, or the secret key was invalid.
571
- * Args: ctx: pointer to a context object, initialized for signing (cannot be NULL)
572
- * Out: sig: pointer to an array where the signature will be placed (cannot be NULL)
573
- * In: msghash32: the 32-byte message hash being signed (cannot be NULL)
574
- * seckey: pointer to a 32-byte secret key (cannot be NULL)
575
- * noncefp: pointer to a nonce generation function. If NULL, secp256k1_nonce_function_default is used
576
- * ndata: pointer to arbitrary data used by the nonce generation function (can be NULL)
570
+ * Args: ctx: pointer to a context object, initialized for signing.
571
+ * Out: sig: pointer to an array where the signature will be placed.
572
+ * In: msghash32: the 32-byte message hash being signed.
573
+ * seckey: pointer to a 32-byte secret key.
574
+ * noncefp: pointer to a nonce generation function. If NULL,
575
+ * secp256k1_nonce_function_default is used.
576
+ * ndata: pointer to arbitrary data used by the nonce generation function
577
+ * (can be NULL). If it is non-NULL and
578
+ * secp256k1_nonce_function_default is used, then ndata must be a
579
+ * pointer to 32-bytes of additional data.
577
580
*
578
581
* The created signature is always in lower-S form. See
579
582
* secp256k1_ecdsa_signature_normalize for more details.
@@ -596,8 +599,8 @@ SECP256K1_API int secp256k1_ecdsa_sign(
596
599
*
597
600
* Returns: 1: secret key is valid
598
601
* 0: secret key is invalid
599
- * Args: ctx: pointer to a context object (cannot be NULL)
600
- * In: seckey: pointer to a 32-byte secret key (cannot be NULL)
602
+ * Args: ctx: pointer to a context object.
603
+ * In: seckey: pointer to a 32-byte secret key.
601
604
*/
602
605
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_verify (
603
606
const secp256k1_context * ctx ,
@@ -606,11 +609,11 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_verify(
606
609
607
610
/** Compute the public key for a secret key.
608
611
*
609
- * Returns: 1: secret was valid, public key stores
610
- * 0: secret was invalid, try again
611
- * Args: ctx: pointer to a context object, initialized for signing (cannot be NULL)
612
- * Out: pubkey: pointer to the created public key (cannot be NULL)
613
- * In: seckey: pointer to a 32-byte secret key (cannot be NULL)
612
+ * Returns: 1: secret was valid, public key stores.
613
+ * 0: secret was invalid, try again.
614
+ * Args: ctx: pointer to a context object, initialized for signing.
615
+ * Out: pubkey: pointer to the created public key.
616
+ * In: seckey: pointer to a 32-byte secret key.
614
617
*/
615
618
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_create (
616
619
const secp256k1_context * ctx ,
@@ -626,8 +629,7 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_create(
626
629
* In/Out: seckey: pointer to the 32-byte secret key to be negated. If the
627
630
* secret key is invalid according to
628
631
* secp256k1_ec_seckey_verify, this function returns 0 and
629
- * seckey will be set to some unspecified value. (cannot be
630
- * NULL)
632
+ * seckey will be set to some unspecified value.
631
633
*/
632
634
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_negate (
633
635
const secp256k1_context * ctx ,
@@ -645,7 +647,7 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_negate(
645
647
*
646
648
* Returns: 1 always
647
649
* Args: ctx: pointer to a context object
648
- * In/Out: pubkey: pointer to the public key to be negated (cannot be NULL)
650
+ * In/Out: pubkey: pointer to the public key to be negated.
649
651
*/
650
652
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_negate (
651
653
const secp256k1_context * ctx ,
@@ -657,15 +659,15 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_negate(
657
659
* Returns: 0 if the arguments are invalid or the resulting secret key would be
658
660
* invalid (only when the tweak is the negation of the secret key). 1
659
661
* otherwise.
660
- * Args: ctx: pointer to a context object (cannot be NULL) .
662
+ * Args: ctx: pointer to a context object.
661
663
* In/Out: seckey: pointer to a 32-byte secret key. If the secret key is
662
664
* invalid according to secp256k1_ec_seckey_verify, this
663
665
* function returns 0. seckey will be set to some unspecified
664
- * value if this function returns 0. (cannot be NULL)
666
+ * value if this function returns 0.
665
667
* In: tweak32: pointer to a 32-byte tweak. If the tweak is invalid according to
666
668
* secp256k1_ec_seckey_verify, this function returns 0. For
667
669
* uniformly random 32-byte arrays the chance of being invalid
668
- * is negligible (around 1 in 2^128) (cannot be NULL) .
670
+ * is negligible (around 1 in 2^128).
669
671
*/
670
672
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_tweak_add (
671
673
const secp256k1_context * ctx ,
@@ -686,14 +688,13 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_add(
686
688
* Returns: 0 if the arguments are invalid or the resulting public key would be
687
689
* invalid (only when the tweak is the negation of the corresponding
688
690
* secret key). 1 otherwise.
689
- * Args: ctx: pointer to a context object initialized for validation
690
- * (cannot be NULL).
691
+ * Args: ctx: pointer to a context object initialized for validation.
691
692
* In/Out: pubkey: pointer to a public key object. pubkey will be set to an
692
- * invalid value if this function returns 0 (cannot be NULL) .
693
+ * invalid value if this function returns 0.
693
694
* In: tweak32: pointer to a 32-byte tweak. If the tweak is invalid according to
694
695
* secp256k1_ec_seckey_verify, this function returns 0. For
695
696
* uniformly random 32-byte arrays the chance of being invalid
696
- * is negligible (around 1 in 2^128) (cannot be NULL) .
697
+ * is negligible (around 1 in 2^128).
697
698
*/
698
699
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_add (
699
700
const secp256k1_context * ctx ,
@@ -704,15 +705,15 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_add(
704
705
/** Tweak a secret key by multiplying it by a tweak.
705
706
*
706
707
* Returns: 0 if the arguments are invalid. 1 otherwise.
707
- * Args: ctx: pointer to a context object (cannot be NULL) .
708
+ * Args: ctx: pointer to a context object.
708
709
* In/Out: seckey: pointer to a 32-byte secret key. If the secret key is
709
710
* invalid according to secp256k1_ec_seckey_verify, this
710
711
* function returns 0. seckey will be set to some unspecified
711
- * value if this function returns 0. (cannot be NULL)
712
+ * value if this function returns 0.
712
713
* In: tweak32: pointer to a 32-byte tweak. If the tweak is invalid according to
713
714
* secp256k1_ec_seckey_verify, this function returns 0. For
714
715
* uniformly random 32-byte arrays the chance of being invalid
715
- * is negligible (around 1 in 2^128) (cannot be NULL) .
716
+ * is negligible (around 1 in 2^128).
716
717
*/
717
718
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_tweak_mul (
718
719
const secp256k1_context * ctx ,
@@ -731,14 +732,13 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_mul(
731
732
/** Tweak a public key by multiplying it by a tweak value.
732
733
*
733
734
* Returns: 0 if the arguments are invalid. 1 otherwise.
734
- * Args: ctx: pointer to a context object initialized for validation
735
- * (cannot be NULL).
735
+ * Args: ctx: pointer to a context object initialized for validation.
736
736
* In/Out: pubkey: pointer to a public key object. pubkey will be set to an
737
- * invalid value if this function returns 0 (cannot be NULL) .
737
+ * invalid value if this function returns 0.
738
738
* In: tweak32: pointer to a 32-byte tweak. If the tweak is invalid according to
739
739
* secp256k1_ec_seckey_verify, this function returns 0. For
740
740
* uniformly random 32-byte arrays the chance of being invalid
741
- * is negligible (around 1 in 2^128) (cannot be NULL) .
741
+ * is negligible (around 1 in 2^128).
742
742
*/
743
743
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_mul (
744
744
const secp256k1_context * ctx ,
@@ -749,7 +749,7 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_mul(
749
749
/** Updates the context randomization to protect against side-channel leakage.
750
750
* Returns: 1: randomization successfully updated or nothing to randomize
751
751
* 0: error
752
- * Args: ctx: pointer to a context object (cannot be NULL)
752
+ * Args: ctx: pointer to a context object.
753
753
* In: seed32: pointer to a 32-byte random seed (NULL resets to initial state)
754
754
*
755
755
* While secp256k1 code is written to be constant-time no matter what secret
@@ -780,18 +780,17 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_context_randomize(
780
780
*
781
781
* Returns: 1: the sum of the public keys is valid.
782
782
* 0: the sum of the public keys is not valid.
783
- * Args: ctx: pointer to a context object
784
- * Out: out: pointer to a public key object for placing the resulting public key
785
- * (cannot be NULL)
786
- * In: ins: pointer to array of pointers to public keys (cannot be NULL)
787
- * n: the number of public keys to add together (must be at least 1)
783
+ * Args: ctx: pointer to a context object.
784
+ * Out: out: pointer to a public key object for placing the resulting public key.
785
+ * In: ins: pointer to array of pointers to public keys.
786
+ * n: the number of public keys to add together (must be at least 1).
788
787
*/
789
788
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_combine (
790
789
const secp256k1_context * ctx ,
791
790
secp256k1_pubkey * out ,
792
791
const secp256k1_pubkey * const * ins ,
793
792
size_t n
794
- ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 );
793
+ ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL ( 2 ) SECP256K1_ARG_NONNULL (3 );
795
794
796
795
/** Compute a tagged hash as defined in BIP-340.
797
796
*
0 commit comments