mbedtls
mbedtls copied to clipboard
Document and test the input ranges for which mbedtls_mpi_core_montmul() produces canonical results
It is common (especially in PQC, less so in ECC) to accumulate non-canonical results (>= N, the modulus), reducing when the value nears the word boundary (the number of limbs in N).
This task is to document which of the inputs to mbedtls_mpi_core_montmul() must be canonical (< N), and which do not need to be, in order for the result to be correct, and in order for the output to be in canonical form.
Unit tests should be added, including corner cases.