Skip to content

Commit

Permalink
Merge bitcoin#213: Removed gotos, which are hard to trace and maintain.
Browse files Browse the repository at this point in the history
11690d3 Removed gotos, which are hard to trace and maintain. (Iang)
  • Loading branch information
sipa committed Feb 13, 2015
2 parents 122a1ec + 11690d3 commit 7b2fc1c
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/secp256k1.c
Expand Up @@ -37,7 +37,6 @@ int secp256k1_ecdsa_verify(const unsigned char *msg32, const unsigned char *sig,
secp256k1_ge_t q;
secp256k1_ecdsa_sig_t s;
secp256k1_scalar_t m;
int ret = -3;
DEBUG_CHECK(secp256k1_ecmult_consts != NULL);
DEBUG_CHECK(msg32 != NULL);
DEBUG_CHECK(sig != NULL);
Expand All @@ -46,20 +45,16 @@ int secp256k1_ecdsa_verify(const unsigned char *msg32, const unsigned char *sig,
secp256k1_scalar_set_b32(&m, msg32, NULL);

if (!secp256k1_eckey_pubkey_parse(&q, pubkey, pubkeylen)) {
ret = -1;
goto end;
return -1;
}
if (!secp256k1_ecdsa_sig_parse(&s, sig, siglen)) {
ret = -2;
goto end;
return -2;
}
if (!secp256k1_ecdsa_sig_verify(&s, &q, &m)) {
ret = 0;
goto end;
return 0;
}
ret = 1;
end:
return ret;
/* success is 1, all other values are fail */
return 1;
}

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

0 comments on commit 7b2fc1c

Please sign in to comment.