diff --git a/bn_mp_kronecker.c b/bn_mp_kronecker.c index c44d10e..f3a423a 100644 --- a/bn_mp_kronecker.c +++ b/bn_mp_kronecker.c @@ -37,7 +37,7 @@ int mp_kronecker(const mp_int *a, const mp_int *p, int *c) static const int table[8] = {0, 1, 0, -1, 0, -1, 0, 1}; if (mp_iszero(p) != MP_NO) { - if (a->used == 1 && a->dp[0] == 1u) { + if ((a->used == 1) && (a->dp[0] == 1u)) { *c = 1; return e; } else { diff --git a/bn_mp_prime_frobenius_underwood.c b/bn_mp_prime_frobenius_underwood.c index 0a10342..6a2a51d 100644 --- a/bn_mp_prime_frobenius_underwood.c +++ b/bn_mp_prime_frobenius_underwood.c @@ -48,7 +48,8 @@ int mp_prime_frobenius_underwood(const mp_int *N, int *result) for (a = 0; a < LTM_FROBENIUS_UNDERWOOD_A; a++) { /* TODO: That's ugly! No, really, it is! */ - if (a==2||a==4||a==7||a==8||a==10||a==14||a==18||a==23||a==26||a==28) { + if ((a==2) || (a==4) || (a==7) || (a==8) || (a==10) || + (a==14) || (a==18) || (a==23) || (a==26) || (a==28)) { continue; } /* (32764^2 - 4) < 2^31, no bigint for >MP_8BIT needed) */ @@ -83,7 +84,7 @@ int mp_prime_frobenius_underwood(const mp_int *N, int *result) goto LBL_FU_ERR; } /* Composite if N and (a+4)*(2*a+5) are not coprime */ - if ((e = mp_set_long(&T1z, (unsigned long)((a+4)*(2*a+5)))) != MP_OKAY) { + if ((e = mp_set_long(&T1z, (unsigned long)((a+4)*((2*a)+5)))) != MP_OKAY) { goto LBL_FU_ERR; } @@ -91,7 +92,7 @@ int mp_prime_frobenius_underwood(const mp_int *N, int *result) goto LBL_FU_ERR; } - if (!(T1z.used == 1 && T1z.dp[0] == 1u)) { + if (!((T1z.used == 1) && (T1z.dp[0] == 1u))) { goto LBL_FU_ERR; } @@ -174,7 +175,7 @@ int mp_prime_frobenius_underwood(const mp_int *N, int *result) } } - if ((e = mp_set_long(&T1z, (unsigned long)(2 * a + 5))) != MP_OKAY) { + if ((e = mp_set_long(&T1z, (unsigned long)((2 * a) + 5))) != MP_OKAY) { goto LBL_FU_ERR; } if ((e = mp_mod(&T1z,N,&T1z)) != MP_OKAY) { diff --git a/bn_mp_prime_is_prime.c b/bn_mp_prime_is_prime.c index 5bde2c8..99f8d04 100644 --- a/bn_mp_prime_is_prime.c +++ b/bn_mp_prime_is_prime.c @@ -41,7 +41,7 @@ int mp_prime_is_prime(const mp_int *a, int t, int *result) /* Some shortcuts */ /* N > 3 */ if (a->used == 1) { - if (a->dp[0] == 0u || a->dp[0] == 1u) { + if ((a->dp[0] == 0u) || (a->dp[0] == 1u)) { *result = 0; return MP_OKAY; } diff --git a/bn_mp_prime_strong_lucas_selfridge.c b/bn_mp_prime_strong_lucas_selfridge.c index 878a6bf..579baff 100644 --- a/bn_mp_prime_strong_lucas_selfridge.c +++ b/bn_mp_prime_strong_lucas_selfridge.c @@ -133,7 +133,7 @@ int mp_prime_strong_lucas_selfridge(const mp_int *a, int *result) } D += 2; - if (D > INT_MAX - 2) { + if (D > (INT_MAX - 2)) { e = MP_VAL; goto LBL_LS_ERR; }