]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add FIPS-detecting option to feature-test helper
authorMichal Nowak <mnowak@isc.org>
Tue, 20 Oct 2020 10:12:00 +0000 (12:12 +0200)
committerMark Andrews <marka@isc.org>
Mon, 3 Apr 2023 02:06:04 +0000 (12:06 +1000)
The '--have-fips' option of feature-test detects FIPS mode.

bin/tests/system/Makefile.am
bin/tests/system/feature-test.c

index c4ba3a0266b3c22513c5f9b8d9701a2d735ebe9d..3998b0d6f7e401fa7ebefc298562b7842bc5625d 100644 (file)
@@ -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)
index eb09f59f3348c4bc423514d147d51be166932468..82a7269f361e811520d2369099a6fb2a9e53d58c 100644 (file)
@@ -17,6 +17,7 @@
 #include <string.h>
 #include <unistd.h>
 
+#include <isc/fips.h>
 #include <isc/md.h>
 #include <isc/net.h>
 #include <isc/util.h>
@@ -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);