File tree Expand file tree Collapse file tree 3 files changed +18
-24
lines changed Expand file tree Collapse file tree 3 files changed +18
-24
lines changed Original file line number Diff line number Diff line change @@ -46,14 +46,12 @@ int main(void) {
46
46
/* If the secret key is zero or out of range (bigger than secp256k1's
47
47
* order), we try to sample a new key. Note that the probability of this
48
48
* happening is negligible. */
49
- while (1 ) {
50
- if (!fill_random (seckey1 , sizeof (seckey1 )) || !fill_random (seckey2 , sizeof (seckey2 ))) {
51
- printf ("Failed to generate randomness\n" );
52
- return 1 ;
53
- }
54
- if (secp256k1_ec_seckey_verify (ctx , seckey1 ) && secp256k1_ec_seckey_verify (ctx , seckey2 )) {
55
- break ;
56
- }
49
+ if (!fill_random (seckey1 , sizeof (seckey1 )) || !fill_random (seckey2 , sizeof (seckey2 ))) {
50
+ printf ("Failed to generate randomness\n" );
51
+ return 1 ;
52
+ }
53
+ if (secp256k1_ec_seckey_verify (ctx , seckey1 ) && secp256k1_ec_seckey_verify (ctx , seckey2 )) {
54
+ break ;
57
55
}
58
56
59
57
/* Public key creation using a valid context with a verified secret key should never fail */
Original file line number Diff line number Diff line change @@ -53,14 +53,12 @@ int main(void) {
53
53
/* If the secret key is zero or out of range (bigger than secp256k1's
54
54
* order), we try to sample a new key. Note that the probability of this
55
55
* happening is negligible. */
56
- while (1 ) {
57
- if (!fill_random (seckey , sizeof (seckey ))) {
58
- printf ("Failed to generate randomness\n" );
59
- return 1 ;
60
- }
61
- if (secp256k1_ec_seckey_verify (ctx , seckey )) {
62
- break ;
63
- }
56
+ if (!fill_random (seckey , sizeof (seckey ))) {
57
+ printf ("Failed to generate randomness\n" );
58
+ return 1 ;
59
+ }
60
+ if (secp256k1_ec_seckey_verify (ctx , seckey )) {
61
+ break ;
64
62
}
65
63
66
64
/* Public key creation using a valid context with a verified secret key should never fail */
Original file line number Diff line number Diff line change @@ -51,14 +51,12 @@ int main(void) {
51
51
/* If the secret key is zero or out of range (bigger than secp256k1's
52
52
* order), we try to sample a new key. Note that the probability of this
53
53
* happening is negligible. */
54
- while (1 ) {
55
- if (!fill_random (seckey1 , sizeof (seckey1 )) || !fill_random (seckey2 , sizeof (seckey2 ))) {
56
- printf ("Failed to generate randomness\n" );
57
- return 1 ;
58
- }
59
- if (secp256k1_ec_seckey_verify (ctx , seckey1 ) && secp256k1_ec_seckey_verify (ctx , seckey2 )) {
60
- break ;
61
- }
54
+ if (!fill_random (seckey1 , sizeof (seckey1 )) || !fill_random (seckey2 , sizeof (seckey2 ))) {
55
+ printf ("Failed to generate randomness\n" );
56
+ return 1 ;
57
+ }
58
+ if (secp256k1_ec_seckey_verify (ctx , seckey1 ) && secp256k1_ec_seckey_verify (ctx , seckey2 )) {
59
+ break ;
62
60
}
63
61
64
62
/* Generate ElligatorSwift public keys. This should never fail with valid context and
You can’t perform that action at this time.
0 commit comments