Add FIPS-detecting option to feature-test helper

The '--have-fips' option of feature-test detects FIPS mode.
This commit is contained in:
Michal Nowak
2020-10-20 12:12:00 +02:00
committed by Mark Andrews
parent c51a39e97a
commit fe8b41286f
2 changed files with 15 additions and 0 deletions

View 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)

View 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);