]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
pkcs12: do not go try calculating pbkdf2 with 0 iterations
authorDmitry Baryshkov <dbaryshkov@gmail.com>
Tue, 28 Jan 2020 10:05:14 +0000 (13:05 +0300)
committerDmitry Baryshkov <dbaryshkov@gmail.com>
Tue, 28 Jan 2020 10:06:58 +0000 (13:06 +0300)
Nettle will abort on a call to pbkdf2 if iterations is 0. Add check to
GnuTLS PKCS12 GOST code to check that iter is not 0.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
fuzz/gnutls_pkcs12_key_parser_fuzzer.repro/dcbb6c7d385ddf87823849890768b022dc9e1eff [new file with mode: 0644]
lib/x509/pkcs12.c

diff --git a/fuzz/gnutls_pkcs12_key_parser_fuzzer.repro/dcbb6c7d385ddf87823849890768b022dc9e1eff b/fuzz/gnutls_pkcs12_key_parser_fuzzer.repro/dcbb6c7d385ddf87823849890768b022dc9e1eff
new file mode 100644 (file)
index 0000000..ebc03d3
Binary files /dev/null and b/fuzz/gnutls_pkcs12_key_parser_fuzzer.repro/dcbb6c7d385ddf87823849890768b022dc9e1eff differ
index 8c3310d066b08350c697f1a55dea9cffb3badf62..6324fb25a360f23b45a71c4effda0f6018711d4e 100644 (file)
@@ -867,6 +867,9 @@ _gnutls_pkcs12_gost_string_to_key(gnutls_mac_algorithm_t algo,
        size_t temp_len = sizeof(temp);
        unsigned int pass_len = 0;
 
+       if (iter == 0)
+               return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
+
        if (pass)
                pass_len = strlen(pass);