File tree Expand file tree Collapse file tree 4 files changed +13
-15
lines changed
Expand file tree Collapse file tree 4 files changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -47,8 +47,8 @@ int main(void) {
4747 return 1 ;
4848 }
4949 /* If the secret key is zero or out of range (greater than secp256k1's
50- * order), we fail. Note that the probability of this occurring
51- * is negligible with a properly functioning random number generator. */
50+ * order), we fail. Note that the probability of this occurring is negligible
51+ * with a properly functioning random number generator. */
5252 if (!secp256k1_ec_seckey_verify (ctx , seckey1 ) || !secp256k1_ec_seckey_verify (ctx , seckey2 )) {
5353 printf ("Generated secret key is invalid. This indicates an issue with the random number generator.\n" );
5454 return 1 ;
Original file line number Diff line number Diff line change @@ -49,13 +49,13 @@ int main(void) {
4949 assert (return_val );
5050
5151 /*** Key Generation ***/
52- /* If the secret key is zero or out of range (greater than secp256k1's
53- * order), we return 1. Note that the probability of this occurring
54- * is negligible with a properly functioning random number generator. */
5552 if (!fill_random (seckey , sizeof (seckey ))) {
5653 printf ("Failed to generate randomness\n" );
5754 return 1 ;
5855 }
56+ /* If the secret key is zero or out of range (greater than secp256k1's
57+ * order), we fail. Note that the probability of this occurring is negligible
58+ * with a properly functioning random number generator. */
5959 if (!secp256k1_ec_seckey_verify (ctx , seckey )) {
6060 printf ("Generated secret key is invalid. This indicates an issue with the random number generator.\n" );
6161 return 1 ;
Original file line number Diff line number Diff line change @@ -47,14 +47,13 @@ int main(void) {
4747 assert (return_val );
4848
4949 /*** Generate secret keys ***/
50-
51- /* If the secret key is zero or out of range (greater than secp256k1's
52- * order), we return 1. Note that the probability of this occurring
53- * is negligible with a properly functioning random number generator. */
5450 if (!fill_random (seckey1 , sizeof (seckey1 )) || !fill_random (seckey2 , sizeof (seckey2 ))) {
5551 printf ("Failed to generate randomness\n" );
5652 return 1 ;
5753 }
54+ /* If the secret key is zero or out of range (greater than secp256k1's
55+ * order), we fail. Note that the probability of this occurring is negligible
56+ * with a properly functioning random number generator. */
5857 if (!secp256k1_ec_seckey_verify (ctx , seckey1 ) || !secp256k1_ec_seckey_verify (ctx , seckey2 )) {
5958 printf ("Generated secret key is invalid. This indicates an issue with the random number generator.\n" );
6059 return 1 ;
Original file line number Diff line number Diff line change @@ -43,18 +43,17 @@ int main(void) {
4343 assert (return_val );
4444
4545 /*** Key Generation ***/
46- /* If the secret key is zero or out of range (greater than secp256k1's
47- * order), we return 1. Note that the probability of this occurring
48- * is negligible with a properly functioning random number generator. */
4946 if (!fill_random (seckey , sizeof (seckey ))) {
5047 printf ("Failed to generate randomness\n" );
5148 return 1 ;
5249 }
53- /* Try to create a keypair with a valid context, it should only fail if
54- * the secret key is zero or out of range. */
50+ /* Try to create a keypair with a valid context. This only fails if the
51+ * secret key is zero or out of range (greater than secp256k1's order). Note
52+ * that the probability of this occurring is negligible with a properly
53+ * functioning random number generator. */
5554 if (!secp256k1_keypair_create (ctx , & keypair , seckey )) {
5655 printf ("Generated secret key is invalid. This indicates an issue with the random number generator.\n" );
57- return 1 ;
56+ return 1 ;
5857 }
5958
6059 /* Extract the X-only public key from the keypair. We pass NULL for
You can’t perform that action at this time.
0 commit comments