Commit e7f34c6969e1f37c97e7c78a8f05b6e2e898c403

Francois Perrad 2019-05-23T17:50:58

literal suffix

diff --git a/bn_mp_prime_rand.c b/bn_mp_prime_rand.c
index dbf3975..1cfe514 100644
--- a/bn_mp_prime_rand.c
+++ b/bn_mp_prime_rand.c
@@ -45,7 +45,7 @@ mp_err s_mp_prime_random_ex(mp_int *a, int t, int size, int flags, private_mp_pr
    }
 
    /* calc the maskAND value for the MSbyte*/
-   maskAND = ((size&7) == 0) ? 0xFF : (unsigned char)(0xFF >> (8 - (size & 7)));
+   maskAND = ((size&7) == 0) ? 0xFFu : (unsigned char)(0xFFu >> (8 - (size & 7)));
 
    /* calc the maskOR_msb */
    maskOR_msb        = 0;
@@ -55,9 +55,9 @@ mp_err s_mp_prime_random_ex(mp_int *a, int t, int size, int flags, private_mp_pr
    }
 
    /* get the maskOR_lsb */
-   maskOR_lsb         = 1;
+   maskOR_lsb         = 1u;
    if ((flags & MP_PRIME_BBS) != 0) {
-      maskOR_lsb     |= 3;
+      maskOR_lsb     |= 3u;
    }
 
    do {
diff --git a/bn_mp_rand.c b/bn_mp_rand.c
index 1818dd0..7e9052c 100644
--- a/bn_mp_rand.c
+++ b/bn_mp_rand.c
@@ -30,7 +30,7 @@ mp_err mp_rand(mp_int *a, int digits)
    }
 
    /* TODO: We ensure that the highest digit is nonzero. Should this be removed? */
-   while ((a->dp[digits - 1] & MP_MASK) == 0) {
+   while ((a->dp[digits - 1] & MP_MASK) == 0u) {
       if ((err = s_mp_rand_source(a->dp + digits - 1, sizeof(mp_digit))) != MP_OKAY) {
          return err;
       }
diff --git a/bn_s_mp_exptmod.c b/bn_s_mp_exptmod.c
index b1cc0e9..5d5510f 100644
--- a/bn_s_mp_exptmod.c
+++ b/bn_s_mp_exptmod.c
@@ -146,7 +146,7 @@ mp_err s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y
       }
 
       /* grab the next msb from the exponent */
-      y     = (buf >> (mp_digit)(MP_DIGIT_BIT - 1)) & 1;
+      y     = (buf >> (mp_digit)(MP_DIGIT_BIT - 1)) & 1uL;
       buf <<= (mp_digit)1;
 
       /* if the bit is zero and mode == 0 then we ignore it
diff --git a/bn_s_mp_exptmod_fast.c b/bn_s_mp_exptmod_fast.c
index 6b4483c..3045e97 100644
--- a/bn_s_mp_exptmod_fast.c
+++ b/bn_s_mp_exptmod_fast.c
@@ -200,7 +200,7 @@ mp_err s_mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_i
       }
 
       /* grab the next msb from the exponent */
-      y     = (mp_digit)(buf >> (MP_DIGIT_BIT - 1)) & 1;
+      y     = (mp_digit)(buf >> (MP_DIGIT_BIT - 1)) & 1uL;
       buf <<= (mp_digit)1;
 
       /* if the bit is zero and mode == 0 then we ignore it