diff options
author | Jakub Jelen <jjelen@redhat.com> | 2023-03-06 17:26:17 +0100 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2023-03-14 13:53:58 +0900 |
commit | 22cb410dd4456a84b5bde8be6a907afdc38a792b (patch) | |
tree | 274d3e60a3a5050c4decff562e350a71610b4c32 | |
parent | 251f1749900e355ee6b027ee6a5c070eba16c85f (diff) | |
download | libgcrypt-22cb410dd4456a84b5bde8be6a907afdc38a792b.tar.gz |
tests: Improve test coverage for FIPS service indicators.
* tests/basic.c (check_digests): Check the FIPS indicators.
(check_mac): Ditto.
--
Cherry-pick master commit of:
fae63f517906ba8f46d255f1b5770665f2197ad9
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
-rw-r--r-- | tests/basic.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/basic.c b/tests/basic.c index 94a07320..febb6a61 100644 --- a/tests/basic.c +++ b/tests/basic.c @@ -13645,6 +13645,12 @@ check_digests (void) { if (in_fips_mode) { + err = gcry_control(GCRYCTL_FIPS_SERVICE_INDICATOR_MD, algos[i].md); + if (err == GPG_ERR_NO_ERROR) + { + fail ("algo %d, gcry_md_test_algo failed while it should" + " have worked in FIPS mode\n", algos[i].md); + } if (verbose) fprintf (stderr, " algorithm %d not available in fips mode\n", algos[i].md); @@ -15223,6 +15229,7 @@ check_mac (void) #endif /* USE_GOST28147 */ { 0 }, }; + gcry_error_t err; int i; if (verbose) @@ -15236,6 +15243,12 @@ check_mac (void) { if (in_fips_mode) { + err = gcry_control(GCRYCTL_FIPS_SERVICE_INDICATOR_MAC, algos[i].algo); + if (err == GPG_ERR_NO_ERROR) + { + fail ("algo %d, gcry_mac_test_algo failed while it should" + " have worked in FIPS mode\n", algos[i].algo); + } if (verbose) fprintf (stderr, " algorithm %d not available in fips mode\n", algos[i].algo); |