From 11690d3bb92c4de08215a42b9c407d9306f69292 Mon Sep 17 00:00:00 2001 From: Iang Date: Sat, 8 Nov 2014 18:19:10 +0000 Subject: [PATCH] Removed gotos, which are hard to trace and maintain. --- src/secp256k1.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/secp256k1.c b/src/secp256k1.c index 22c1febb3e2..1b07b8a7173 100644 --- a/src/secp256k1.c +++ b/src/secp256k1.c @@ -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); @@ -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) {