summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorClemens Lang <cllang@redhat.com>2022-06-21 19:00:42 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2022-07-01 15:57:18 +0900
commit96fafffeeba5899d3d1b4d68ce99faed23cef641 (patch)
treec74e4531617fc70c3281b2d0af4eab4218ebfc0c /tests
parent58c92098d053aae7c78cc42bdd7c80c13efc89bb (diff)
downloadlibgcrypt-96fafffeeba5899d3d1b4d68ce99faed23cef641.tar.gz
kdf: Skip tests if hash algo is not available
* tests/t-kdf.c (check_openpgp, check_pbkdf2): Test digest availability. -- Skip tests that would fail if libgcrypt is compiled with an --enable-digests option that does not include the required digest algorithms for the test vectors. GnuPG-bug-id: 6048 Signed-off-by: Clemens Lang <cllang@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/t-kdf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/t-kdf.c b/tests/t-kdf.c
index 508e4bbe..454b7c48 100644
--- a/tests/t-kdf.c
+++ b/tests/t-kdf.c
@@ -862,6 +862,8 @@ check_openpgp (void)
/* MD5 isn't supported in fips mode */
if (in_fips_mode && tv[tvidx].hashalgo == GCRY_MD_MD5)
continue;
+ if (gcry_md_test_algo (tv[tvidx].hashalgo) != 0)
+ continue;
if (verbose)
fprintf (stderr, "checking S2K test vector %d\n", tvidx);
assert (tv[tvidx].dklen <= sizeof outbuf);
@@ -1097,6 +1099,8 @@ check_pbkdf2 (void)
{
if (tv[tvidx].disabled)
continue;
+ if (gcry_md_test_algo (tv[tvidx].hashalgo) != 0)
+ continue;
if (verbose)
fprintf (stderr, "checking PBKDF2 test vector %d algo %d\n", tvidx,
tv[tvidx].hashalgo);