Fix in SP math for casting signed -1 to unsigned.
This commit is contained in:
parent
7fd51cf9d9
commit
b8bdeec940
@ -950,7 +950,7 @@ static int sp_div(sp_int* a, sp_int* d, sp_int* r, sp_int* rem)
|
||||
}
|
||||
for (i = sa->used - 1; i >= d->used; i--) {
|
||||
if (sa->dp[i] == dt) {
|
||||
t = (sp_digit)-1;
|
||||
t = SP_MASK; /* f's */
|
||||
}
|
||||
else {
|
||||
t = sp_div_word(sa->dp[i], sa->dp[i-1], dt);
|
||||
|
@ -85,8 +85,6 @@ This library provides single precision (SP) integer math functions.
|
||||
#endif
|
||||
typedef uint128_t sp_int_word;
|
||||
typedef int128_t sp_int_sword;
|
||||
#else
|
||||
#error Word size not defined
|
||||
#endif
|
||||
#else
|
||||
#if SP_WORD_SIZE == 32
|
||||
@ -106,12 +104,16 @@ This library provides single precision (SP) integer math functions.
|
||||
#endif
|
||||
typedef uint128_t sp_int_word;
|
||||
typedef int128_t sp_int_sword;
|
||||
#else
|
||||
#error Word size not defined
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define SP_MASK (sp_digit)(-1)
|
||||
#if SP_WORD_SIZE == 32
|
||||
#define SP_MASK ((sp_digit)0xffffffff)
|
||||
#elif SP_WORD_SIZE == 64
|
||||
#define SP_MASK ((sp_digit)0xffffffffffffffff)
|
||||
#else
|
||||
#error Word size not defined
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(WOLFSSL_HAVE_SP_ECC) && defined(WOLFSSL_SP_NONBLOCK)
|
||||
|
Loading…
x
Reference in New Issue
Block a user