mbedtls
mbedtls copied to clipboard
Implement low level fixed width modular inversion
Prerequisites: #6017, #6231, #6293
Implement mbedtls_mpi_mod_raw_inv_prime()
. The task is constrained to prime moduli and should use little Fermat to do the job:
https://github.com/hanno-arm/mbedtls/blob/ecp_prototype/library/bignum_core.c#L605-L625
Unlike the prototype, this function does not need to call mod_reduce
as a pre and post condition to all fixed width arithmetic functions is that the elements are represented by the least non-negative residue.
Another difference to the prototype is that this function shouldn't do any allocations. Instead, it should take a single temporary buffer as a parameter and use that for storing temporary values.