gcry_mpi_invm succeeds if the inverse does not exist

NIIBE Yutaka gniibe at fsij.org
Tue Apr 14 08:32:06 CEST 2020


Hello,

Thank you for your report with a test case.  It helps a lot.

Guido Vranken wrote:
> This is not in accordance with the documentation:
>
> Function: int gcry_mpi_invm (gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t m)
> Set x to the multiplicative inverse of a \bmod m. Return true if the
> inverse exists.

Indeed.  It seems that API was changed to return the result
(success/failure) in libgcrypt 1.3.2 in 2007.  Before that, the API was
void (no return value).  Since the initial change, it never returns
correct value.

I'll fix for 1.9.
-- 



More information about the Gcrypt-devel mailing list