diff --git a/wolfcrypt/src/sp_int.c b/wolfcrypt/src/sp_int.c index 30d3d01a8..c20085c87 100644 --- a/wolfcrypt/src/sp_int.c +++ b/wolfcrypt/src/sp_int.c @@ -11991,7 +11991,8 @@ static int _sp_mont_red(sp_int* a, sp_int* m, sp_int_digit mp) bits = SP_WORD_SIZE; } else { - sp_int_digit mask = (1UL << (bits & (SP_WORD_SIZE - 1))) - 1; + sp_int_digit mask = (sp_int_digit) + ((1UL << (bits & (SP_WORD_SIZE - 1))) - 1); sp_int_word o = 0; w = 0; for (i = 0; i < m->used; i++) {