SP math: fix one word Montgomery Reduction for non-asm

Set the word size for x86.
This commit is contained in:
Sean Parkinson
2021-01-28 09:54:58 +10:00
parent a1e083b5b1
commit 0ccb0d5fce
2 changed files with 3 additions and 1 deletions

View File

@@ -11986,7 +11986,7 @@ static int _sp_mont_red(sp_int* a, sp_int* m, sp_int_digit mp)
a->dp[1] = (sp_int_digit)w;
w >>= SP_WORD_SIZE;
a->dp[2] = (sp_int_digit)w;
a->used = 2;
a->used = 3;
/* mp is SP_WORD_SIZE */
bits = SP_WORD_SIZE;
}

View File

@@ -167,6 +167,8 @@ extern "C" {
#define SP_WORD_SIZE 16
#undef WOLFSSL_SP_ASM
#endif
#elif defined(WOLFSSL_SP_X86)
#define SP_WORD_SIZE 32
#elif defined(WOLFSSL_SP_ARM64_ASM) || defined(WOLFSSL_SP_ARM64)
#define SP_WORD_SIZE 64
#elif defined(WOLFSSL_SP_ARM32_ASM) || defined(WOLFSSL_SP_ARM32)