From f0041cd7613a4f9700631dfe05e1b05627371fa8 Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Mon, 7 Jul 2025 18:43:29 +1000 Subject: [PATCH] SP int: fix 8 bit words and sp_clamp_ct Need to cast to sp_size_t as it may be bigger than the word type sp_int_digit. --- wolfcrypt/src/sp_int.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/sp_int.c b/wolfcrypt/src/sp_int.c index e03d2ea39..1203a0683 100644 --- a/wolfcrypt/src/sp_int.c +++ b/wolfcrypt/src/sp_int.c @@ -8025,8 +8025,8 @@ static void sp_clamp_ct(sp_int* a) (sp_int_digit)((sp_int_sdigit)(negVal & minusOne) >> (SP_WORD_SIZE - 1)); #else - sp_int_digit zeroMask = - (sp_int_digit)((((sp_int_sword)a->dp[i]) - 1) >> SP_WORD_SIZE); + sp_size_t zeroMask = + (sp_size_t)((((sp_int_sword)a->dp[i]) - 1) >> SP_WORD_SIZE); #endif mask &= (sp_size_t)zeroMask; used = (sp_size_t)(used + mask);