From 615bdd0c5644367b8de78dbde490fb678041203f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se> Date: Wed, 17 Sep 2014 21:37:19 +0200 Subject: [PATCH] Move mpn_zero_p to testutils.c. --- ChangeLog | 4 ++++ testsuite/ecc-modinv-test.c | 11 ----------- testsuite/testutils.c | 13 +++++++++++++ testsuite/testutils.h | 5 +++++ 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3b469555..ea613b72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2014-09-17 Niels Möller <nisse@lysator.liu.se> + * testsuite/ecc-modinv-test.c (mpn_zero_p): Moved function, to... + * testsuite/testutils.c (mpn_zero_p): New location. Also make + non-static. + * testsuite/testutils.c (ecc_curves): Include curve25519 in list. (test_ecc_mul_a): Include reference points for curve25519 (with Edwards coordinates). Allow n == 1, and compare to the generator. diff --git a/testsuite/ecc-modinv-test.c b/testsuite/ecc-modinv-test.c index ee4267dc..7324880a 100644 --- a/testsuite/ecc-modinv-test.c +++ b/testsuite/ecc-modinv-test.c @@ -37,17 +37,6 @@ ref_modinv (mp_limb_t *rp, const mp_limb_t *ap, const mp_limb_t *mp, mp_size_t m #define MAX_ECC_SIZE (1 + 521 / GMP_NUMB_BITS) #define COUNT 500 -static int -mpn_zero_p (mp_srcptr ap, mp_size_t n) -{ - while (--n >= 0) - { - if (ap[n] != 0) - return 0; - } - return 1; -} - void test_main (void) { diff --git a/testsuite/testutils.c b/testsuite/testutils.c index 095af95a..71d64f01 100644 --- a/testsuite/testutils.c +++ b/testsuite/testutils.c @@ -686,6 +686,19 @@ mpz_combit (mpz_t x, unsigned long int bit) } #endif +#ifndef mpn_zero_p +int +mpn_zero_p (mp_srcptr ap, mp_size_t n) +{ + while (--n >= 0) + { + if (ap[n] != 0) + return 0; + } + return 1; +} +#endif + mp_limb_t * xalloc_limbs (mp_size_t n) { diff --git a/testsuite/testutils.h b/testsuite/testutils.h index b7a7d039..7f2135b8 100644 --- a/testsuite/testutils.h +++ b/testsuite/testutils.h @@ -157,6 +157,11 @@ test_armor(const struct nettle_armor *armor, const uint8_t *ascii); #if WITH_HOGWEED +#ifndef mpn_zero_p +int +mpn_zero_p (mp_srcptr ap, mp_size_t n); +#endif + mp_limb_t * xalloc_limbs (mp_size_t n); -- GitLab