no need for that if-else
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
diff --git a/bn_mp_prime_next_prime.c b/bn_mp_prime_next_prime.c
index 81b781b..17abbf8 100644
--- a/bn_mp_prime_next_prime.c
+++ b/bn_mp_prime_next_prime.c
@@ -24,24 +24,18 @@ mp_err mp_prime_next_prime(mp_int *a, int t, int bbs_style)
/* find which prime it is bigger than */
for (x = PRIVATE_MP_PRIME_TAB_SIZE - 2; x >= 0; x--) {
if (mp_cmp_d(a, s_mp_prime_tab[x]) != MP_LT) {
+ /* ok we found a prime smaller or
+ * equal [so the next is larger]
+ */
if (bbs_style == 1) {
- /* ok we found a prime smaller or
- * equal [so the next is larger]
- *
- * however, the prime must be
+ /* ... however, the prime must be
* congruent to 3 mod 4
- */
- if ((s_mp_prime_tab[x + 1] & 3u) != 3u) {
- /* scan upwards for a prime congruent to 3 mod 4 */
- for (y = x + 1; y < PRIVATE_MP_PRIME_TAB_SIZE; y++) {
- if ((s_mp_prime_tab[y] & 3u) == 3u) {
- mp_set(a, s_mp_prime_tab[y]);
- return MP_OKAY;
- }
+ * so do a scan upwards for such a prime */
+ for (y = x + 1; y < PRIVATE_MP_PRIME_TAB_SIZE; y++) {
+ if ((s_mp_prime_tab[y] & 3u) == 3u) {
+ mp_set(a, s_mp_prime_tab[y]);
+ return MP_OKAY;
}
- } else {
- mp_set(a, s_mp_prime_tab[x + 1]);
- return MP_OKAY;
}
} else {
mp_set(a, s_mp_prime_tab[x + 1]);