You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we only allow inline assembly for single long-multiply-accumulate steps within scalar*bignum long multiplications (MULADDC_CORE). There are at least two ways this should be made more flexible to allow for higher performance bignum implementations:
(Simple) Allow the optimization of multiple consecutive occurrences of MULADDC_CORE, as discussed in Improve inline assembly for Cortex-M + DSP #5360. Ultimately, allow replacing the entire mpi_mul_hlp() routine.
(More complex) Allow a larger step/window size during Montgomery multiplication: Instead of iterating through inputs in steps of mbedtls_mpi_uint, allow iteration in steps of mbedtls_mpi_uint[N]. This will allow to significantly reduce the number of memory operations used multiplications, esp. on the A-profile where we have 31 GPRs of which the current MULADDC_CORE uses only very few.
Suggested enhancement
Currently, we only allow inline assembly for single long-multiply-accumulate steps within scalar*bignum long multiplications (
MULADDC_CORE
). There are at least two ways this should be made more flexible to allow for higher performance bignum implementations:MULADDC_CORE
, as discussed in Improve inline assembly for Cortex-M + DSP #5360. Ultimately, allow replacing the entirempi_mul_hlp()
routine.mbedtls_mpi_uint
, allow iteration in steps ofmbedtls_mpi_uint[N]
. This will allow to significantly reduce the number of memory operations used multiplications, esp. on the A-profile where we have 31 GPRs of which the currentMULADDC_CORE
uses only very few.At first I wondered whether the second point should be implemented by changing the typedef's for
mbedtls_mpi_uint
, but that's an API break sincembedtls_mpi_uint
is part ofmbedtls_mpi_mul_int()
. It seems better to directly modify the granularity of the two loops aroundmpi_mul_hlp()
we have in the code: Firstly,mbedtls_mpi_mul_mpi()
(https://github.com/ARMmbed/mbedtls/blob/development/library/bignum.c#L1487-1488), and secondly,mpi_montmul()
(https://github.com/ARMmbed/mbedtls/blob/development/library/bignum.c#L1911-L1935).The text was updated successfully, but these errors were encountered: