Commit c6e9e99efb53ada3a1ec304d8af308305ff943d7

Steffen Jaeckel 2019-09-04T07:42:05

Merge pull request #335 from fperrad/20190902_lint some linting

diff --git a/bn_mp_div_d.c b/bn_mp_div_d.c
index a1f1212..33bee91 100644
--- a/bn_mp_div_d.c
+++ b/bn_mp_div_d.c
@@ -44,7 +44,7 @@ mp_err mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d)
    }
 
    /* three? */
-   if (MP_HAS(MP_DIV_3) && b == 3u) {
+   if (MP_HAS(MP_DIV_3) && (b == 3u)) {
       return mp_div_3(a, c, d);
    }
 
diff --git a/bn_mp_exptmod.c b/bn_mp_exptmod.c
index bc4b643..5f811eb 100644
--- a/bn_mp_exptmod.c
+++ b/bn_mp_exptmod.c
@@ -49,15 +49,15 @@ LBL_ERR:
 
    /* modified diminished radix reduction */
    if (MP_HAS(MP_REDUCE_IS_2K_L) && MP_HAS(MP_REDUCE_2K_L) && MP_HAS(S_MP_EXPTMOD) &&
-       mp_reduce_is_2k_l(P) == MP_YES) {
+       (mp_reduce_is_2k_l(P) == MP_YES)) {
       return s_mp_exptmod(G, X, P, Y, 1);
    }
 
    /* is it a DR modulus? default to no */
-   dr = MP_HAS(MP_DR_IS_MODULUS) && mp_dr_is_modulus(P) == MP_YES ? 1 : 0;
+   dr = (MP_HAS(MP_DR_IS_MODULUS) && (mp_dr_is_modulus(P) == MP_YES)) ? 1 : 0;
 
    /* if not, is it a unrestricted DR modulus? */
-   if (MP_HAS(MP_REDUCE_IS_2K) && dr == 0) {
+   if (MP_HAS(MP_REDUCE_IS_2K) && (dr == 0)) {
       dr = (mp_reduce_is_2k(P) == MP_YES) ? 2 : 0;
    }
 
diff --git a/bn_mp_mul.c b/bn_mp_mul.c
index a09a68b..561913a 100644
--- a/bn_mp_mul.c
+++ b/bn_mp_mul.c
@@ -21,7 +21,7 @@ mp_err mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
         * was actually slower on the author's machine, but YMMV.
         */
        (min_len >= MP_KARATSUBA_MUL_CUTOFF) &&
-       (max_len / 2 >= MP_KARATSUBA_MUL_CUTOFF) &&
+       ((max_len / 2) >= MP_KARATSUBA_MUL_CUTOFF) &&
        /* Not much effect was observed below a ratio of 1:2, but again: YMMV. */
        (max_len >= (2 * min_len))) {
       err = s_mp_balance_mul(a,b,c);
diff --git a/bn_mp_sqr.c b/bn_mp_sqr.c
index d99cacc..e0d0a73 100644
--- a/bn_mp_sqr.c
+++ b/bn_mp_sqr.c
@@ -8,10 +8,10 @@ mp_err mp_sqr(const mp_int *a, mp_int *b)
 {
    mp_err err;
    if (MP_HAS(S_MP_TOOM_SQR) && /* use Toom-Cook? */
-       a->used >= MP_TOOM_SQR_CUTOFF) {
+       (a->used >= MP_TOOM_SQR_CUTOFF)) {
       err = s_mp_toom_sqr(a, b);
    } else if (MP_HAS(S_MP_KARATSUBA_SQR) &&  /* Karatsuba? */
-              a->used >= MP_KARATSUBA_SQR_CUTOFF) {
+              (a->used >= MP_KARATSUBA_SQR_CUTOFF)) {
       err = s_mp_karatsuba_sqr(a, b);
    } else if (MP_HAS(S_MP_SQR_FAST) && /* can we use the fast comba multiplier? */
               (((a->used * 2) + 1) < MP_WARRAY) &&