From 20a95cb2d816bc641d95d2d9b5be46d574de47d5 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 20 Jan 2015 14:39:26 +0100 Subject: [PATCH] handle point at infinity --- secp256k1/src/impl/ecdsa.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/secp256k1/src/impl/ecdsa.h b/secp256k1/src/impl/ecdsa.h index b001e26..dd26cfd 100644 --- a/secp256k1/src/impl/ecdsa.h +++ b/secp256k1/src/impl/ecdsa.h @@ -149,6 +149,8 @@ int static secp256k1_ecdsa_sig_recover(const secp256k1_ecdsa_sig_t *sig, secp256 secp256k1_num_mod_mul(&u2, &rn, &sig->s, &c->order); secp256k1_gej_t qj; secp256k1_ecmult(&qj, &xj, &u2, &u1); + if (secp256k1_gej_is_infinity(&qj)) + return 0; secp256k1_ge_set_gej(pubkey, &qj); secp256k1_num_free(&rn); secp256k1_num_free(&u1);