When decoding a DSA private key, and constructing the public key
ensure that P is non-zero, and thus can be used as modulus.
Issue found using oss-fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=393
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
goto error;
}
+ if (_gnutls_mpi_cmp_ui(pkey->params.params[0], 0) == 0) {
+ gnutls_assert();
+ ret = GNUTLS_E_ILLEGAL_PARAMETER;
+ goto error;
+ }
+
/* the public key can be generated as g^x mod p */
ret = _gnutls_mpi_init(&pkey->params.params[3]);
if (ret < 0) {