From 1803417e039b38c0fe44b8d81d105b8cde9bd761 Mon Sep 17 00:00:00 2001 From: czurnieden Date: Wed, 12 Jun 2019 01:58:03 +0200 Subject: [PATCH] removed obsolete code --- bn_mp_prime_is_prime.c | 1 - bn_mp_prime_strong_lucas_selfridge.c | 24 +++++------------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/bn_mp_prime_is_prime.c b/bn_mp_prime_is_prime.c index f497822..0c5131e 100644 --- a/bn_mp_prime_is_prime.c +++ b/bn_mp_prime_is_prime.c @@ -145,7 +145,6 @@ mp_err mp_prime_is_prime(const mp_int *a, int t, mp_bool *result) TODO: can be made a bit finer grained but comparing is not free. */ if (t < 0) { - t = -t; /* Sorenson, Jonathan; Webster, Jonathan (2015). "Strong Pseudoprimes to Twelve Prime Bases". diff --git a/bn_mp_prime_strong_lucas_selfridge.c b/bn_mp_prime_strong_lucas_selfridge.c index 34b073c..58e59d9 100644 --- a/bn_mp_prime_strong_lucas_selfridge.c +++ b/bn_mp_prime_strong_lucas_selfridge.c @@ -177,26 +177,12 @@ mp_err mp_prime_strong_lucas_selfridge(const mp_int *a, mp_bool *result) mp_set(&U2mz, 1uL); /* U_1 */ mp_set(&V2mz, (mp_digit)P); /* V_1 */ - if (Q < 0) { - Q = -Q; - mp_set_u32(&Qmz, (uint32_t)Q); - if ((err = mp_mul_2(&Qmz, &Q2mz)) != MP_OKAY) { - goto LBL_LS_ERR; - } - /* Initializes calculation of Q^d */ - mp_set_u32(&Qkdz, (uint32_t)Q); - Qmz.sign = MP_NEG; - Q2mz.sign = MP_NEG; - Qkdz.sign = MP_NEG; - Q = -Q; - } else { - mp_set_u32(&Qmz, (uint32_t)Q); - if ((err = mp_mul_2(&Qmz, &Q2mz)) != MP_OKAY) { - goto LBL_LS_ERR; - } - /* Initializes calculation of Q^d */ - mp_set_u32(&Qkdz, (uint32_t)Q); + mp_set_i32(&Qmz, Q); + if ((err = mp_mul_2(&Qmz, &Q2mz)) != MP_OKAY) { + goto LBL_LS_ERR; } + /* Initializes calculation of Q^d */ + mp_set_i32(&Qkdz, Q); Nbits = mp_count_bits(&Dz);