Make Montgomery reduction available to applications #2537
Labels
component-crypto
Crypto primitives and low-level interfaces
enhancement
help-wanted
This issue is not being actively worked on, but PRs welcome.
historical-reviewing
Currently reviewing (for legacy PR/issues)
Enhancement\Feature Request
Suggested enhancement
Mbedtls already implements Montgomery reduction, but this functionality is not available to applications. I would propose making the functions
mpi_montred
,mpi_montmul
andmpi_montg_init
available as public APIs (presumably renamed the match library naming conventions).Justification - why does the library need this feature?
Applications doing mathematical operations with a single modulus can be greatly sped up (and get better side channel resistance) by using Montgomery multiplication/reduction instead of performing a multiply followed by standard division.
As an example, we have implemented support for decompressing compressed EC points in our application using the Mbedtls API. We would have just contributed a patch to the library, but it seems this feature has already been proposed and rejected in #861.
Other applications that Mbedtls is unlikely to implement directly but that perform many modular multiplications include format preserving encryption, BIP32 key derivation, elliptic curve signature schemes like GOST/ECGDSA/SM2, ... all of which could be aided by making Montgomery operations available. And again the functionality already exists in the library, it just is not available to applications. So there is no cost to code size from this change.
If if would be accepted we would provide a patch.
The text was updated successfully, but these errors were encountered: