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) {
47
47
return 1 ;
48
48
}
49
49
/* 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. */
52
52
if (!secp256k1_ec_seckey_verify (ctx , seckey1 ) || !secp256k1_ec_seckey_verify (ctx , seckey2 )) {
53
53
printf ("Generated secret key is invalid. This indicates an issue with the random number generator.\n" );
54
54
return 1 ;
Original file line number Diff line number Diff line change @@ -49,13 +49,13 @@ int main(void) {
49
49
assert (return_val );
50
50
51
51
/*** 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. */
55
52
if (!fill_random (seckey , sizeof (seckey ))) {
56
53
printf ("Failed to generate randomness\n" );
57
54
return 1 ;
58
55
}
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. */
59
59
if (!secp256k1_ec_seckey_verify (ctx , seckey )) {
60
60
printf ("Generated secret key is invalid. This indicates an issue with the random number generator.\n" );
61
61
return 1 ;
Original file line number Diff line number Diff line change @@ -47,14 +47,13 @@ int main(void) {
47
47
assert (return_val );
48
48
49
49
/*** 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. */
54
50
if (!fill_random (seckey1 , sizeof (seckey1 )) || !fill_random (seckey2 , sizeof (seckey2 ))) {
55
51
printf ("Failed to generate randomness\n" );
56
52
return 1 ;
57
53
}
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. */
58
57
if (!secp256k1_ec_seckey_verify (ctx , seckey1 ) || !secp256k1_ec_seckey_verify (ctx , seckey2 )) {
59
58
printf ("Generated secret key is invalid. This indicates an issue with the random number generator.\n" );
60
59
return 1 ;
Original file line number Diff line number Diff line change @@ -43,18 +43,17 @@ int main(void) {
43
43
assert (return_val );
44
44
45
45
/*** 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. */
49
46
if (!fill_random (seckey , sizeof (seckey ))) {
50
47
printf ("Failed to generate randomness\n" );
51
48
return 1 ;
52
49
}
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. */
55
54
if (!secp256k1_keypair_create (ctx , & keypair , seckey )) {
56
55
printf ("Generated secret key is invalid. This indicates an issue with the random number generator.\n" );
57
- return 1 ;
56
+ return 1 ;
58
57
}
59
58
60
59
/* 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