diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-01-02 13:44:46 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-01-02 16:07:20 +0100 |
commit | 10028bd326e47f731a5887586dae4d097e5a6f8e (patch) | |
tree | f31c769702a4a093da5746876e6e35f7c69b668d | |
parent | 3d65e159a05e44d5aadcfbb52d75892f2687d944 (diff) | |
download | gnutls-10028bd326e47f731a5887586dae4d097e5a6f8e.tar.gz |
wrap_nettle_mpi_modm: bail on a modulus that is zero
Relates #156
-rw-r--r-- | lib/nettle/mpi.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/nettle/mpi.c b/lib/nettle/mpi.c index 61fddfb7e0..c8dccf6e64 100644 --- a/lib/nettle/mpi.c +++ b/lib/nettle/mpi.c @@ -233,6 +233,9 @@ static void wrap_nettle_mpi_clear(bigint_t a) static int wrap_nettle_mpi_modm(bigint_t r, const bigint_t a, const bigint_t b) { + if (mpz_cmp_ui(TOMPZ(b), 0) == 0) + return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST); + mpz_mod(TOMPZ(r), TOMPZ(a), TOMPZ(b)); return 0; |