Merge pull request #263 from fperrad/20190514_lint more linting
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
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;