summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2021-11-19 21:46:56 +0100
committerNiels Möller <nisse@lysator.liu.se>2021-11-19 21:46:56 +0100
commitdd5662399b985f6f0b127840b2173c73c2855e15 (patch)
treea0529a303153c6af2c5e0d4bc45b529bda765930 /testsuite
parent07d5e755028f0ea11fde67948b3eb038d85c637b (diff)
downloadnettle-dd5662399b985f6f0b127840b2173c73c2855e15.tar.gz
Delete function mpz_limbs_cmp.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/ecdsa-sign-test.c5
-rw-r--r--testsuite/gostdsa-sign-test.c5
-rw-r--r--testsuite/testutils.c6
3 files changed, 8 insertions, 8 deletions
diff --git a/testsuite/ecdsa-sign-test.c b/testsuite/ecdsa-sign-test.c
index 08a10a1d..ba031fbf 100644
--- a/testsuite/ecdsa-sign-test.c
+++ b/testsuite/ecdsa-sign-test.c
@@ -12,6 +12,7 @@ test_ecdsa (const struct ecc_curve *ecc,
const char *r, const char *s)
{
struct dsa_signature ref;
+ mpz_t t;
mpz_t z;
mpz_t k;
mp_limb_t *rp = xalloc_limbs (ecc->p.size);
@@ -30,8 +31,8 @@ test_ecdsa (const struct ecc_curve *ecc,
mpz_set_str (ref.r, r, 16);
mpz_set_str (ref.s, s, 16);
- if (mpz_limbs_cmp (ref.r, rp, ecc->p.size) != 0
- || mpz_limbs_cmp (ref.s, sp, ecc->p.size) != 0)
+ if (mpz_cmp (ref.r, mpz_roinit_n (t, rp, ecc->p.size)) != 0
+ || mpz_cmp (ref.s, mpz_roinit_n (t, sp, ecc->p.size)) != 0)
{
fprintf (stderr, "_ecdsa_sign failed, bit_size = %u\n", ecc->p.bit_size);
fprintf (stderr, "r = ");
diff --git a/testsuite/gostdsa-sign-test.c b/testsuite/gostdsa-sign-test.c
index 0e2e0420..dc1154b4 100644
--- a/testsuite/gostdsa-sign-test.c
+++ b/testsuite/gostdsa-sign-test.c
@@ -13,6 +13,7 @@ test_gostdsa (const struct ecc_curve *ecc,
const char *r, const char *s)
{
struct dsa_signature ref;
+ mpz_t t;
mpz_t z;
mpz_t k;
mp_limb_t *rp = xalloc_limbs (ecc->p.size);
@@ -31,8 +32,8 @@ test_gostdsa (const struct ecc_curve *ecc,
mpz_set_str (ref.r, r, 16);
mpz_set_str (ref.s, s, 16);
- if (mpz_limbs_cmp (ref.r, rp, ecc->p.size) != 0
- || mpz_limbs_cmp (ref.s, sp, ecc->p.size) != 0)
+ if (mpz_cmp (ref.r, mpz_roinit_n (t, rp, ecc->p.size)) != 0
+ || mpz_cmp (ref.s, mpz_roinit_n (t, sp, ecc->p.size)) != 0)
{
fprintf (stderr, "_gostdsa_sign failed, bit_size = %u\n", ecc->p.bit_size);
fprintf (stderr, "r = ");
diff --git a/testsuite/testutils.c b/testsuite/testutils.c
index ef67c53e..9bb250b4 100644
--- a/testsuite/testutils.c
+++ b/testsuite/testutils.c
@@ -1748,14 +1748,12 @@ const struct ecc_curve * const ecc_curves[] = {
static int
test_mpn (const char *ref, const mp_limb_t *xp, mp_size_t n)
{
- mpz_t r;
+ mpz_t r, x;
int res;
mpz_init_set_str (r, ref, 16);
- while (n > 0 && xp[n-1] == 0)
- n--;
- res = (mpz_limbs_cmp (r, xp, n) == 0);
+ res = (mpz_cmp (r, mpz_roinit_n (x, xp, n)) == 0);
mpz_clear (r);
return res;
}