From 2ecaa3c4c6790116f9a7b78ad043f305b269614f Mon Sep 17 00:00:00 2001 From: Guido Vranken Date: Thu, 1 Apr 2021 00:57:06 +0200 Subject: [PATCH] Use unsigned integers in mp_is_bit_set ZD 12012 --- wolfcrypt/src/integer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wolfcrypt/src/integer.c b/wolfcrypt/src/integer.c index 1751bd85b..5dd9e15fc 100644 --- a/wolfcrypt/src/integer.c +++ b/wolfcrypt/src/integer.c @@ -1446,10 +1446,10 @@ int mp_set (mp_int * a, mp_digit b) /* check if a bit is set */ int mp_is_bit_set (mp_int *a, mp_digit b) { - int i = (int)(b / DIGIT_BIT); /* word index */ - int s = b % DIGIT_BIT; /* bit index */ + mp_digit i = b / DIGIT_BIT; /* word index */ + mp_digit s = b % DIGIT_BIT; /* bit index */ - if (a->used <= i) { + if ((mp_digit)a->used <= i) { /* no words avaialable at that bit count */ return 0; }