Commit 07b479a62e9a1e6ffde9ba3bae0b174da5e1c078

Steffen Jaeckel 2019-05-18T09:59:27

Merge pull request #263 from fperrad/20190514_lint more linting

diff --git a/bn_mp_exptmod.c b/bn_mp_exptmod.c
index 9bf3d8c..95a1dcb 100644
--- a/bn_mp_exptmod.c
+++ b/bn_mp_exptmod.c
@@ -61,7 +61,7 @@ mp_err mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y)
 
 #ifdef BN_MP_DR_IS_MODULUS_C
    /* is it a DR modulus? */
-   dr = mp_dr_is_modulus(P) == MP_YES;
+   dr = (mp_dr_is_modulus(P) == MP_YES) ? 1 : 0;
 #else
    /* default to no */
    dr = 0;
@@ -70,7 +70,7 @@ mp_err mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y)
 #ifdef BN_MP_REDUCE_IS_2K_C
    /* if not, is it a unrestricted DR modulus? */
    if (dr == 0) {
-      dr = (mp_reduce_is_2k(P) == MP_YES) << 1;
+      dr = (mp_reduce_is_2k(P) == MP_YES) ? 2 : 0;
    }
 #endif
 
diff --git a/bn_mp_reduce_is_2k.c b/bn_mp_reduce_is_2k.c
index fe3aeea..bb70b55 100644
--- a/bn_mp_reduce_is_2k.c
+++ b/bn_mp_reduce_is_2k.c
@@ -29,8 +29,10 @@ mp_bool mp_reduce_is_2k(const mp_int *a)
             iz = 1;
          }
       }
+      return MP_YES;
+   } else {
+      return MP_YES;
    }
-   return MP_YES;
 }
 
 #endif
diff --git a/bn_mp_reduce_is_2k_l.c b/bn_mp_reduce_is_2k_l.c
index b2c7292..36fc59f 100644
--- a/bn_mp_reduce_is_2k_l.c
+++ b/bn_mp_reduce_is_2k_l.c
@@ -20,9 +20,9 @@ mp_bool mp_reduce_is_2k_l(const mp_int *a)
          }
       }
       return (iy >= (a->used/2)) ? MP_YES : MP_NO;
-
+   } else {
+      return MP_NO;
    }
-   return MP_NO;
 }
 
 #endif
diff --git a/bn_mp_sqrtmod_prime.c b/bn_mp_sqrtmod_prime.c
index 86934cd..384453c 100644
--- a/bn_mp_sqrtmod_prime.c
+++ b/bn_mp_sqrtmod_prime.c
@@ -81,7 +81,6 @@ mp_err mp_sqrtmod_prime(const mp_int *n, const mp_int *prime, mp_int *ret)
    /* M = S */
    mp_set_int(&two, 2uL);
 
-   res = MP_VAL;
    while (1) {
       if ((res = mp_copy(&T, &t1)) != MP_OKAY)                    goto cleanup;
       i = 0;
diff --git a/bn_s_mp_rand_jenkins.c b/bn_s_mp_rand_jenkins.c
index a914458..da0771c 100644
--- a/bn_s_mp_rand_jenkins.c
+++ b/bn_s_mp_rand_jenkins.c
@@ -5,7 +5,7 @@
 
 /* Bob Jenkins' http://burtleburtle.net/bob/rand/smallprng.html */
 /* Chosen for speed and a good "mix" */
-typedef struct ranctx {
+typedef struct {
    uint64_t a;
    uint64_t b;
    uint64_t c;