@@ -14,7 +14,7 @@ extern "C" {
14
14
* 2. Array lengths always immediately the follow the argument whose length
15
15
* they describe, even if this violates rule 1.
16
16
* 3. Within the OUT/OUTIN/IN groups, pointers to data that is typically generated
17
- * later go first. This means: signatures, public nonces, private nonces,
17
+ * later go first. This means: signatures, public nonces, secret nonces,
18
18
* messages, public keys, secret keys, tweaks.
19
19
* 4. Arguments that are not data pointers go last, from more complex to less
20
20
* complex: function pointers, algorithm names, messages, void pointers,
@@ -531,7 +531,7 @@ SECP256K1_API extern const secp256k1_nonce_function secp256k1_nonce_function_def
531
531
/** Create an ECDSA signature.
532
532
*
533
533
* Returns: 1: signature created
534
- * 0: the nonce generation function failed, or the private key was invalid.
534
+ * 0: the nonce generation function failed, or the secret key was invalid.
535
535
* Args: ctx: pointer to a context object, initialized for signing (cannot be NULL)
536
536
* Out: sig: pointer to an array where the signature will be placed (cannot be NULL)
537
537
* In: msg32: the 32-byte message hash being signed (cannot be NULL)
@@ -574,23 +574,23 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_verify(
574
574
* 0: secret was invalid, try again
575
575
* Args: ctx: pointer to a context object, initialized for signing (cannot be NULL)
576
576
* Out: pubkey: pointer to the created public key (cannot be NULL)
577
- * In: seckey: pointer to a 32-byte private key (cannot be NULL)
577
+ * In: seckey: pointer to a 32-byte secret key (cannot be NULL)
578
578
*/
579
579
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_create (
580
580
const secp256k1_context * ctx ,
581
581
secp256k1_pubkey * pubkey ,
582
582
const unsigned char * seckey
583
583
) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 );
584
584
585
- /** Negates a private key in place.
585
+ /** Negates a secret key in place.
586
586
*
587
- * Returns: 0 if the given private key is invalid according to
587
+ * Returns: 0 if the given secret key is invalid according to
588
588
* secp256k1_ec_seckey_verify. 1 otherwise
589
589
* Args: ctx: pointer to a context object
590
- * In/Out: seckey: pointer to the 32-byte private key to be negated. The private
590
+ * In/Out: seckey: pointer to the 32-byte secret key to be negated. The secret
591
591
* key should be valid according to secp256k1_ec_seckey_verify.
592
- * Value becomes unspecified if this function returns 0.
593
- * (cannot be NULL)
592
+ * If this function returns 0, seckey will be some
593
+ * unspecified value. (cannot be NULL)
594
594
*/
595
595
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_negate (
596
596
const secp256k1_context * ctx ,
@@ -608,16 +608,18 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_negate(
608
608
secp256k1_pubkey * pubkey
609
609
) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 );
610
610
611
- /** Tweak a private key by adding tweak to it.
612
- * Returns: 0 if the tweak was out of range (chance of around 1 in 2^128 for
613
- * uniformly random 32-byte arrays, or if the given private key is
614
- * invalid according to secp256k1_ec_seckey_verify, or if the resulting
615
- * private key would be invalid (only when the tweak is the complement
616
- * of the private key). 1 otherwise.
611
+ /** Tweak a secret key by adding tweak to it.
612
+ * Returns: 0 if the resulting secret key would be invalid (only when the tweak
613
+ * is the negation of the secret key). 1 otherwise.
617
614
* Args: ctx: pointer to a context object (cannot be NULL).
618
- * In/Out: seckey: pointer to a 32-byte private key. Value becomes unspecified if this
619
- * function returns 0. (cannot be NULL)
620
- * In: tweak: pointer to a 32-byte tweak.
615
+ * In/Out: seckey: pointer to a 32-byte secret key. The secret key should be
616
+ * valid according to secp256k1_ec_seckey_verify. If this
617
+ * function returns 0, seckey will be some unspecified
618
+ * value. (cannot be NULL)
619
+ * In: tweak: pointer to a 32-byte tweak. Must be in the same range as secret
620
+ * keys (see secp256k1_ec_seckey_verify). For uniformly random
621
+ * 32-byte arrays the chance of being out of range is
622
+ * negligible (around 1 in 2^128). (cannot be NULL)
621
623
*/
622
624
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_add (
623
625
const secp256k1_context * ctx ,
@@ -626,30 +628,32 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_add(
626
628
) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 );
627
629
628
630
/** Tweak a public key by adding tweak times the generator to it.
629
- * Returns: 0 if the tweak was out of range (chance of around 1 in 2^128 for
630
- * uniformly random 32-byte arrays, or if the given private key is
631
- * invalid according to secp256k1_ec_seckey_verify, or if the resulting
632
- * public key would be invalid (only when the tweak is the complement
633
- * of the corresponding private key). 1 otherwise.
631
+ * Returns: 0 if the resulting public key would be invalid (only when the tweak
632
+ * is the negation of the corresponding secret key). 1 otherwise.
634
633
* Args: ctx: pointer to a context object initialized for validation
635
634
* (cannot be NULL).
636
- * In/Out: pubkey: pointer to a public key object. Value becomes unspecified if this
637
- * function returns 0. (cannot be NULL).
638
- * In: tweak: pointer to a 32-byte tweak.
635
+ * In/Out: pubkey: pointer to a public key object. If this function returns 0,
636
+ * pubkey will be invalid. (cannot be NULL).
637
+ * In: tweak: pointer to a 32-byte tweak. Must be in the same range as secret
638
+ * keys (see secp256k1_ec_seckey_verify). For uniformly random
639
+ * 32-byte arrays the chance of being out of range is
640
+ * negligible (around 1 in 2^128). (cannot be NULL)
639
641
*/
640
642
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_add (
641
643
const secp256k1_context * ctx ,
642
644
secp256k1_pubkey * pubkey ,
643
645
const unsigned char * tweak
644
646
) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 );
645
647
646
- /** Tweak a private key by multiplying it by a tweak.
647
- * Returns: 0 if the tweak was out of range (chance of around 1 in 2^128 for
648
- * uniformly random 32-byte arrays, or equal to zero. 1 otherwise.
648
+ /** Tweak a secret key by multiplying it by a tweak.
649
+ * Returns: 0 if the arguments are invalid.. 1 otherwise.
649
650
* Args: ctx: pointer to a context object (cannot be NULL).
650
- * In/Out: seckey: pointer to a 32-byte private key. Value becomes unspecified if this
651
- * function returns 0. (cannot be NULL).
652
- * In: tweak: pointer to a 32-byte tweak.
651
+ * In/Out: seckey: pointer to a 32-byte secret key. If this function returns 0,
652
+ * seckey will be some unspecified value. (cannot be NULL).
653
+ * In: tweak: pointer to a 32-byte tweak. Must be in the same range as secret
654
+ * keys (see secp256k1_ec_seckey_verify). For uniformly random
655
+ * 32-byte arrays the chance of being out of range is
656
+ * negligible (around 1 in 2^128). (cannot be NULL)
653
657
*/
654
658
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_mul (
655
659
const secp256k1_context * ctx ,
@@ -658,13 +662,15 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_mul(
658
662
) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 );
659
663
660
664
/** Tweak a public key by multiplying it by a tweak value.
661
- * Returns: 0 if the tweak was out of range (chance of around 1 in 2^128 for
662
- * uniformly random 32-byte arrays, or equal to zero. 1 otherwise.
665
+ * Returns: 0 if the arguments are invalid. 1 otherwise.
663
666
* Args: ctx: pointer to a context object initialized for validation
664
- * (cannot be NULL).
665
- * In/Out: pubkey: pointer to a public key object. Value becomes unspecified if this
666
- * function returns 0. (cannot be NULL).
667
- * In: tweak: pointer to a 32-byte tweak.
667
+ * (cannot be NULL).
668
+ * In/Out: pubkey: pointer to a public key object. If this function returns 0,
669
+ * pubkey will be invalid. (cannot be NULL).
670
+ * In: tweak: pointer to a 32-byte tweak. Must be in the same range as secret
671
+ * keys (see secp256k1_ec_seckey_verify). For uniformly random
672
+ * 32-byte arrays the chance of being out of range is
673
+ * negligible (around 1 in 2^128). (cannot be NULL)
668
674
*/
669
675
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_mul (
670
676
const secp256k1_context * ctx ,
0 commit comments