Skip to content

Commit 51cda5b

Browse files
committed
use correct amount of MR trials in tests
1 parent 1cbfbe0 commit 51cda5b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

demo/test.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ static int test_mp_prime_is_prime(void)
890890
mp_read_radix(&a,
891891
"91xLNF3roobhzgTzoFIG6P13ZqhOVYSN60Fa7Cj2jVR1g0k89zdahO9/kAiRprpfO1VAp1aBHucLFV/qLKLFb+zonV7R2Vxp1K13ClwUXStpV0oxTNQVjwybmFb5NBEHImZ6V7P6+udRJuH8VbMEnS0H8/pSqQrg82OoQQ2fPpAk6G1hkjqoCv5s/Yr",
892892
64);
893-
mp_prime_is_prime(&a, 8, &cnt);
893+
mp_prime_is_prime(&a, mp_prime_rabin_miller_trials(mp_count_bits(&a)), &cnt);
894894
if (cnt == MP_YES) {
895895
printf("Arnault's pseudoprime is not prime but mp_prime_is_prime says it is.\n");
896896
goto LBL_ERR;
@@ -900,7 +900,7 @@ static int test_mp_prime_is_prime(void)
900900
mp_set(&a, 1uL);
901901
mp_mul_2d(&a,1119,&a);
902902
mp_add_d(&a, 53uL, &a);
903-
err = mp_prime_is_prime(&a, 8, &cnt);
903+
err = mp_prime_is_prime(&a, mp_prime_rabin_miller_trials(mp_count_bits(&a)), &cnt);
904904
/* small problem */
905905
if (err != MP_OKAY) {
906906
printf("\nfailed with error: %s\n", mp_error_to_string(err));
@@ -930,7 +930,7 @@ static int test_mp_prime_is_prime(void)
930930
/* let's see if it's really a safe prime */
931931
mp_sub_d(&a, 1uL, &b);
932932
mp_div_2(&b, &b);
933-
err = mp_prime_is_prime(&b, 8, &cnt);
933+
err = mp_prime_is_prime(&b, mp_prime_rabin_miller_trials(mp_count_bits(&b)), &cnt);
934934
/* small problem */
935935
if (err != MP_OKAY) {
936936
printf("\nfailed with error: %s\n", mp_error_to_string(err));

0 commit comments

Comments
 (0)