diff options
Diffstat (limited to 'plugins/MirOTR/Libgcrypt/mpi/mpi-inv.c')
-rw-r--r-- | plugins/MirOTR/Libgcrypt/mpi/mpi-inv.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/MirOTR/Libgcrypt/mpi/mpi-inv.c b/plugins/MirOTR/Libgcrypt/mpi/mpi-inv.c index 5d269466e0..ee6813b1ed 100644 --- a/plugins/MirOTR/Libgcrypt/mpi/mpi-inv.c +++ b/plugins/MirOTR/Libgcrypt/mpi/mpi-inv.c @@ -29,7 +29,7 @@ * 1 = (a*x) mod n */ int -gcry_mpi_invm( gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t n ) +_gcry_mpi_invm (gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t n) { #if 0 gcry_mpi_t u, v, u1, u2, u3, v1, v2, v3, q, t1, t2, t3; @@ -165,6 +165,11 @@ gcry_mpi_invm( gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t n ) int sign; int odd ; + if (!mpi_cmp_ui (a, 0)) + return 0; /* Inverse does not exists. */ + if (!mpi_cmp_ui (n, 1)) + return 0; /* Inverse does not exists. */ + u = mpi_copy(a); v = mpi_copy(n); |