Commit 84fc6abeb5809597af978bfb0134b2bdc2fcf7fd

Steffen Jaeckel 2019-09-07T10:42:17

Merge pull request #344 from czurnieden/correct_ilogb Bugfix: removed check against MP_MASK

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/bn_mp_ilogb.c b/bn_mp_ilogb.c
index 3d23d38..3185ca6 100644
--- a/bn_mp_ilogb.c
+++ b/bn_mp_ilogb.c
@@ -140,11 +140,7 @@ mp_err mp_ilogb(const mp_int *a, uint32_t base, mp_int *c)
 
    while ((high - low) > 1u) {
       mid = (high + low) >> 1;
-      /* Difference can be larger then the type behind mp_digit can hold */
-      if ((mid - low) > (unsigned int)(MP_MASK)) {
-         err = MP_VAL;
-         goto LBL_ERR;
-      }
+
       if ((err = mp_expt_u32(&bi_base, (uint32_t)(mid - low), &t)) != MP_OKAY) {
          goto LBL_ERR;
       }