summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2023-03-06 17:26:17 +0100
committerNIIBE Yutaka <gniibe@fsij.org>2023-03-14 11:58:45 +0900
commitfae63f517906ba8f46d255f1b5770665f2197ad9 (patch)
tree9d1cb4b33f41cc56252569f740aa8d123842c0f8
parente0a5a9eb8301991c28fae8632add8dacce81aeb4 (diff)
downloadlibgcrypt-fae63f517906ba8f46d255f1b5770665f2197ad9.tar.gz
tests: Improve test coverage for FIPS service indicators.
* tests/basic.c (check_digests): Check the FIPS indicators. (check_mac): Ditto. -- Signed-off-by: Jakub Jelen <jjelen@redhat.com>
-rw-r--r--tests/basic.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/basic.c b/tests/basic.c
index 095bdc97..5d5ceac9 100644
--- a/tests/basic.c
+++ b/tests/basic.c
@@ -15370,6 +15370,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);
@@ -16948,6 +16954,7 @@ check_mac (void)
#endif /* USE_GOST28147 */
{ 0 },
};
+ gcry_error_t err;
int i;
if (verbose)
@@ -16961,6 +16968,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);