Browse Source

FIPS 186.4 compliant usage of ltm `mp_prime_is_prime()`

Steffen Jaeckel 6 years ago
parent
commit
1bfde18513
1 changed files with 1 additions and 3 deletions
  1. 1 3
      src/math/ltm_desc.c

+ 1 - 3
src/math/ltm_desc.c

@@ -412,9 +412,7 @@ static int isprime(void *a, int b, int *c)
    int err;
    LTC_ARGCHK(a != NULL);
    LTC_ARGCHK(c != NULL);
-   if (b == 0) {
-       b = LTC_MILLER_RABIN_REPS;
-   } /* if */
+   b = mp_prime_rabin_miller_trials(mp_count_bits(a));
    err = mpi_to_ltc_error(mp_prime_is_prime(a, b, c));
    *c = (*c == MP_YES) ? LTC_MP_YES : LTC_MP_NO;
    return err;