Commit 5d8f04a944cf8fa1b7c550cc1a86a108e8fccc25

Steffen Jaeckel 2019-05-11T19:26:36

Merge pull request #241 from fperrad/20190508_lint more linting

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);