From b0be6aba910392e06aa85a87d2240a1aadb2fff5 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sat, 13 Jul 2013 01:31:41 +0200 Subject: [PATCH] Invert buggy logic in secp256k1_ecdsa_seckey_verify --- src/secp256k1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/secp256k1.c b/src/secp256k1.c index 9fd7e7f..1908780 100644 --- a/src/secp256k1.c +++ b/src/secp256k1.c @@ -115,8 +115,8 @@ int secp256k1_ecdsa_seckey_verify(const unsigned char *seckey) { secp256k1_num_t sec; secp256k1_num_init(&sec); secp256k1_num_set_bin(&sec, seckey, 32); - int ret = secp256k1_num_is_zero(&sec) || - (secp256k1_num_cmp(&sec, &secp256k1_ge_consts->order) >= 0); + int ret = !secp256k1_num_is_zero(&sec) && + (secp256k1_num_cmp(&sec, &secp256k1_ge_consts->order) < 0); secp256k1_num_free(&sec); return ret; }