Merge pull request #241 from fperrad/20190508_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
diff --git a/bn_mp_rand.c b/bn_mp_rand.c
index 5a3a1d3..c0fc2cd 100644
--- a/bn_mp_rand.c
+++ b/bn_mp_rand.c
@@ -161,11 +161,11 @@ static int s_mp_rand_source_platform(void *p, size_t n)
#endif
}
-int (*s_rand_source)(void *, size_t) = s_mp_rand_source_platform;
+int (*s_rand_source)(void *out, size_t size) = s_mp_rand_source_platform;
-void mp_rand_source(int (*get)(void *out, size_t size))
+void mp_rand_source(int (*source)(void *out, size_t size))
{
- s_rand_source = get == NULL ? s_mp_rand_source_platform : get;
+ s_rand_source = (source == NULL) ? s_mp_rand_source_platform : source;
}
/* makes a pseudo-random int of a given size */
diff --git a/bn_mp_reduce_is_2k.c b/bn_mp_reduce_is_2k.c
index aea0840..ba8958f 100644
--- a/bn_mp_reduce_is_2k.c
+++ b/bn_mp_reduce_is_2k.c
@@ -24,7 +24,7 @@ int mp_reduce_is_2k(const mp_int *a)
return MP_NO;
}
iz <<= 1;
- if (iz > (mp_digit)MP_MASK) {
+ if (iz > MP_MASK) {
++iw;
iz = 1;
}
diff --git a/tommath.h b/tommath.h
index b5119fe..2954839 100644
--- a/tommath.h
+++ b/tommath.h
@@ -306,7 +306,7 @@ int mp_rand(mp_int *a, int digits);
/* makes a pseudo-random small int of a given size */
MP_DEPRECATED(mp_rand) int mp_rand_digit(mp_digit *r);
/* use custom random data source instead of source provided the platform */
-void mp_rand_source(int source(void *, size_t));
+void mp_rand_source(int source(void *out, size_t size));
#ifdef MP_PRNG_ENABLE_LTM_RNG
# warning MP_PRNG_ENABLE_LTM_RNG has been deprecated, use mp_rand_source instead.
diff --git a/tommath_private.h b/tommath_private.h
index fc836f2..053b3be 100644
--- a/tommath_private.h
+++ b/tommath_private.h
@@ -70,7 +70,7 @@ extern void MP_FREE(void *mem, size_t size);
#define MP_MAXFAST (int)(1u << (MP_SIZEOF_BITS(mp_word) - (2u * (size_t)MP_DIGIT_BIT)))
/* random number source */
-extern int (*s_rand_source)(void *, size_t);
+extern int (*s_rand_source)(void *out, size_t size);
/* lowlevel functions, do not call! */
int s_mp_add(const mp_int *a, const mp_int *b, mp_int *c);