Skip to content

Commit 7b2fc1c

Browse files
committed
Merge #213: Removed gotos, which are hard to trace and maintain.
11690d3 Removed gotos, which are hard to trace and maintain. (Iang)
2 parents 122a1ec + 11690d3 commit 7b2fc1c

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/secp256k1.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ int secp256k1_ecdsa_verify(const unsigned char *msg32, const unsigned char *sig,
3737
secp256k1_ge_t q;
3838
secp256k1_ecdsa_sig_t s;
3939
secp256k1_scalar_t m;
40-
int ret = -3;
4140
DEBUG_CHECK(secp256k1_ecmult_consts != NULL);
4241
DEBUG_CHECK(msg32 != NULL);
4342
DEBUG_CHECK(sig != NULL);
@@ -46,20 +45,16 @@ int secp256k1_ecdsa_verify(const unsigned char *msg32, const unsigned char *sig,
4645
secp256k1_scalar_set_b32(&m, msg32, NULL);
4746

4847
if (!secp256k1_eckey_pubkey_parse(&q, pubkey, pubkeylen)) {
49-
ret = -1;
50-
goto end;
48+
return -1;
5149
}
5250
if (!secp256k1_ecdsa_sig_parse(&s, sig, siglen)) {
53-
ret = -2;
54-
goto end;
51+
return -2;
5552
}
5653
if (!secp256k1_ecdsa_sig_verify(&s, &q, &m)) {
57-
ret = 0;
58-
goto end;
54+
return 0;
5955
}
60-
ret = 1;
61-
end:
62-
return ret;
56+
/* success is 1, all other values are fail */
57+
return 1;
6358
}
6459

6560
static int nonce_function_rfc6979(unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, unsigned int counter, const void *data) {

0 commit comments

Comments
 (0)