From fe8b41286fe27a19570d4a068ef07fdf3cf3aa5b Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Tue, 20 Oct 2020 12:12:00 +0200 Subject: [PATCH] Add FIPS-detecting option to feature-test helper The '--have-fips' option of feature-test detects FIPS mode. --- bin/tests/system/Makefile.am | 5 +++++ bin/tests/system/feature-test.c | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/bin/tests/system/Makefile.am b/bin/tests/system/Makefile.am index c4ba3a0266..3998b0d6f7 100644 --- a/bin/tests/system/Makefile.am +++ b/bin/tests/system/Makefile.am @@ -36,6 +36,11 @@ feature_test_CPPFLAGS = \ $(AM_CPPFLAGS) \ $(LIBDNS_CFLAGS) +feature_test_LDADD = \ + $(LDADD) \ + $(LIBDNS_LIBS) \ + $(OPENSSL_LIBS) + makejournal_CPPFLAGS = \ $(AM_CPPFLAGS) \ $(LIBDNS_CFLAGS) diff --git a/bin/tests/system/feature-test.c b/bin/tests/system/feature-test.c index eb09f59f33..82a7269f36 100644 --- a/bin/tests/system/feature-test.c +++ b/bin/tests/system/feature-test.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -33,6 +34,7 @@ usage(void) { fprintf(stderr, "\t--enable-querytrace\n"); fprintf(stderr, "\t--gethostname\n"); fprintf(stderr, "\t--gssapi\n"); + fprintf(stderr, "\t--have-fips-mode\n"); fprintf(stderr, "\t--have-geoip2\n"); fprintf(stderr, "\t--have-json-c\n"); fprintf(stderr, "\t--have-libxml2\n"); @@ -107,6 +109,14 @@ main(int argc, char **argv) { #endif /* HAVE_GSSAPI */ } + if (strcmp(argv[1], "--have-fips-mode") == 0) { +#if defined(ENABLE_FIPS_MODE) + return (0); +#else + return (isc_fips_mode() ? 0 : 1); +#endif + } + if (strcmp(argv[1], "--have-geoip2") == 0) { #ifdef HAVE_GEOIP2 return (0);