Searched hist:"98 efc118f400621401ff981d176e0aedd720fbd3" (Results 1 – 1 of 1) sorted by relevance
| /optee_os/lib/libutee/ |
| H A D | tee_api_arith_mpi.c | 98efc118f400621401ff981d176e0aedd720fbd3 Thu Jan 17 15:48:30 UTC 2019 Jerome Forissier <jerome.forissier@linaro.org> mbedtls: TEE_BigIntMul(): use temporary
mbedtls_mpi_mul_mpi() checks the allocated size of the output number before starting to multiply the numbers. It makes a conservative guess by requiring the result to be at least as large as the sum of the sizes of the input numbers. For instance, if A fits in one "limb" and B fits in two, then the result is expected to have nblimbs = 3 at least. This is sometimes too restrictive. Consider A = 1 (can be represented with nblimbs == 1 32-bit words) and B = 0x0FFFFFFFFFFFFFFF (fits in a bignum with nblimbs == 2 32-bit words). A * B is equal to B and fits in 2 limbs, but the current code requires 3. This patch fixes the problem by allocating a big enough temporary result.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
|