Commit 63dc065dc854caac2d7b69ddd6d15f02a5eef996

czurnieden 2018-05-05T03:38:23

Adjusted API compliacnce for MP_8BIT in mp_prime_is_prime

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/bn_mp_prime_is_prime.c b/bn_mp_prime_is_prime.c
index 1cae3e6..d63b2f0 100644
--- a/bn_mp_prime_is_prime.c
+++ b/bn_mp_prime_is_prime.c
@@ -112,7 +112,9 @@ int mp_prime_is_prime(const mp_int *a, int t, int *result)
 
 
 #ifdef MP_8BIT
-   t = 8;
+   if(t >= 0 && t < 8) {
+      t = 8;
+   }
 #else
 // switched off, failed a test, said 2^1119 + 53 (a cert. prime) is not prime
 #ifdef LTM_USE_STRONG_LUCAS_SELFRIDGE_TEST