OcCryptoLib: Drop pool memory usage optimisation in BigNumMod

Currently BigNumMod does not allocate memory for A words with leading
zeroes. For us words are 8 bytes. When doing RSA computations with
proper keys 8 zero bytes are nearly impossible and 16 zero bytes are
completely impossible. Avoiding this optimisation does not change
library behaviour for nearly all inputs but provides simpler guarantees
about memory usage and simplifies testing.
This commit is contained in:
vit9696 2022-03-06 15:14:58 +03:00
parent 823e98fe68
commit 0f22e66dfb

View File

@ -602,7 +602,7 @@ BigNumMod (
"An overflow verification must be added"
);
Memory = AllocatePool (2 * SigWordsModTmp * OC_BN_WORD_SIZE);
Memory = AllocatePool (2 * NumWordsA * OC_BN_WORD_SIZE);
if (Memory == NULL) {
return FALSE;
}