From 8a99323312fbce6824b93eba4a6d04f6941c9eae Mon Sep 17 00:00:00 2001 From: Tim Ruffing Date: Sun, 13 Sep 2020 11:27:15 +0200 Subject: [PATCH] tests: Initialize random group elements fully Summary: Also fix add a missing comment. This is a backport of secp56k1 [[https://github.com/bitcoin-core/secp256k1/pull/814 | [[https://github.com/bitcoin-core/secp256k1/pull/814 | PR814]]]] Test Plan: ninja check-secp256k1 Reviewers: #bitcoin_abc, jasonbcox Reviewed By: #bitcoin_abc, jasonbcox Differential Revision: https://reviews.bitcoinabc.org/D7613 --- src/group.h | 1 + src/tests.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/group.h b/src/group.h index 6185be05..32236fb2 100644 --- a/src/group.h +++ b/src/group.h @@ -59,6 +59,7 @@ static int secp256k1_ge_is_infinity(const secp256k1_ge *a); /** Check whether a group element is valid (i.e., on the curve). */ static int secp256k1_ge_is_valid_var(const secp256k1_ge *a); +/** Set r equal to the inverse of a (i.e., mirrored around the X axis) */ static void secp256k1_ge_neg(secp256k1_ge *r, const secp256k1_ge *a); /** Set a group element equal to another which is given in jacobian coordinates */ diff --git a/src/tests.c b/src/tests.c index 29a35a2a..e1b0c7da 100644 --- a/src/tests.c +++ b/src/tests.c @@ -86,6 +86,7 @@ void random_group_element_test(secp256k1_ge *ge) { break; } } while(1); + ge->infinity = 0; } void random_group_element_jacobian_test(secp256k1_gej *gej, const secp256k1_ge *ge) {