@@ -585,8 +585,8 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_create(
585
585
* Args: ctx: pointer to a context object
586
586
* In/Out: seckey: pointer to the 32-byte secret key to be negated. The secret
587
587
* key should be valid according to secp256k1_ec_seckey_verify.
588
- * Value becomes undefined if this function returns 0.
589
- * (cannot be NULL)
588
+ * If this function returns 0, seckey will be some
589
+ * unspecified value. (cannot be NULL)
590
590
*/
591
591
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_negate (
592
592
const secp256k1_context * ctx ,
@@ -605,15 +605,17 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_negate(
605
605
) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 );
606
606
607
607
/** Tweak a secret key by adding tweak to it.
608
- * Returns: 0 if the tweak was out of range (chance of around 1 in 2^128 for
609
- * uniformly random 32-byte arrays, or if the given secret key is
610
- * invalid according to secp256k1_ec_seckey_verify, or if the resulting
611
- * secret key would be invalid (only when the tweak is the complement
612
- * of the secret key). 1 otherwise.
608
+ * Returns: 0 if the resulting secret key would be invalid (only when the tweak
609
+ * is the negation of the secret key). 1 otherwise.
613
610
* Args: ctx: pointer to a context object (cannot be NULL).
614
- * In/Out: seckey: pointer to a 32-byte secret key. Value becomes undefined if this
615
- * function returns 0. (cannot be NULL)
616
- * In: tweak: pointer to a 32-byte tweak.
611
+ * In/Out: seckey: pointer to a 32-byte secret key. The secret key should be
612
+ * valid according to secp256k1_ec_seckey_verify. If this
613
+ * function returns 0, seckey will be some unspecified
614
+ * value. (cannot be NULL)
615
+ * In: tweak: pointer to a 32-byte tweak. Must be in the same range as secret
616
+ * keys (see secp256k1_ec_seckey_verify). For uniformly random
617
+ * 32-byte arrays the chance of being out of range is
618
+ * negligible (around 1 in 2^128). (cannot be NULL)
617
619
*/
618
620
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_add (
619
621
const secp256k1_context * ctx ,
@@ -622,16 +624,16 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_add(
622
624
) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 );
623
625
624
626
/** Tweak a public key by adding tweak times the generator to it.
625
- * Returns: 0 if the tweak was out of range (chance of around 1 in 2^128 for
626
- * uniformly random 32-byte arrays, or if the given secret key is
627
- * invalid according to secp256k1_ec_seckey_verify, or if the resulting
628
- * public key would be invalid (only when the tweak is the complement
629
- * of the corresponding secret key). 1 otherwise.
627
+ * Returns: 0 if the resulting public key would be invalid (only when the tweak
628
+ * is the negation of the corresponding secret key). 1 otherwise.
630
629
* Args: ctx: pointer to a context object initialized for validation
631
630
* (cannot be NULL).
632
- * In/Out: pubkey: pointer to a public key object. Value becomes undefined if this
633
- * function returns 0. (cannot be NULL).
634
- * In: tweak: pointer to a 32-byte tweak.
631
+ * In/Out: pubkey: pointer to a public key object. If this function returns 0,
632
+ * pubkey will be invalid. (cannot be NULL).
633
+ * In: tweak: pointer to a 32-byte tweak. Must be in the same range as secret
634
+ * keys (see secp256k1_ec_seckey_verify). For uniformly random
635
+ * 32-byte arrays the chance of being out of range is
636
+ * negligible (around 1 in 2^128). (cannot be NULL)
635
637
*/
636
638
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_add (
637
639
const secp256k1_context * ctx ,
@@ -640,12 +642,14 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_add(
640
642
) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 );
641
643
642
644
/** Tweak a secret key by multiplying it by a tweak.
643
- * Returns: 0 if the tweak was out of range (chance of around 1 in 2^128 for
644
- * uniformly random 32-byte arrays, or equal to zero. 1 otherwise.
645
+ * Returns: 0 if the arguments are invalid.. 1 otherwise.
645
646
* Args: ctx: pointer to a context object (cannot be NULL).
646
- * In/Out: seckey: pointer to a 32-byte secret key. Value becomes undefined if this
647
- * function returns 0. (cannot be NULL).
648
- * In: tweak: pointer to a 32-byte tweak.
647
+ * In/Out: seckey: pointer to a 32-byte secret key. If this function returns 0,
648
+ * seckey will be some unspecified value. (cannot be NULL).
649
+ * In: tweak: pointer to a 32-byte tweak. Must be in the same range as secret
650
+ * keys (see secp256k1_ec_seckey_verify). For uniformly random
651
+ * 32-byte arrays the chance of being out of range is
652
+ * negligible (around 1 in 2^128). (cannot be NULL)
649
653
*/
650
654
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_mul (
651
655
const secp256k1_context * ctx ,
@@ -654,13 +658,15 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_mul(
654
658
) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 );
655
659
656
660
/** Tweak a public key by multiplying it by a tweak value.
657
- * Returns: 0 if the tweak was out of range (chance of around 1 in 2^128 for
658
- * uniformly random 32-byte arrays, or equal to zero. 1 otherwise.
661
+ * Returns: 0 if the arguments are invalid. 1 otherwise.
659
662
* Args: ctx: pointer to a context object initialized for validation
660
- * (cannot be NULL).
661
- * In/Out: pubkey: pointer to a public key object. Value becomes undefined if this
662
- * function returns 0. (cannot be NULL).
663
- * In: tweak: pointer to a 32-byte tweak.
663
+ * (cannot be NULL).
664
+ * In/Out: pubkey: pointer to a public key object. If this function returns 0,
665
+ * pubkey will be invalid. (cannot be NULL).
666
+ * In: tweak: pointer to a 32-byte tweak. Must be in the same range as secret
667
+ * keys (see secp256k1_ec_seckey_verify). For uniformly random
668
+ * 32-byte arrays the chance of being out of range is
669
+ * negligible (around 1 in 2^128). (cannot be NULL)
664
670
*/
665
671
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_mul (
666
672
const secp256k1_context * ctx ,
0 commit comments