server.c: error: implicit declaration of function 'FIPS_mode' [-Werror=implicit-function-declaration]
Summary
BIND 9.18 fails to compile when configure option --enable-fips-mode
is used due to addition of gcc flags
-Werror=implicit-function-declaration
and -Werror=implicit
ref https://gcc.gnu.org/onlinedocs/gcc-11.3.0/gcc/Warning-Options.html
BIND version used
9.18.4 and Main (9.19.0)
Steps to reproduce
configure --enable-fips-mode
What is the current bug behavior?
BIND 9.18 and beyond fail to build.
What is the expected correct behavior?
Build should complete.
Relevant configuration files
Non-applicable.
Relevant logs and/or screenshots
make[5]: Entering directory '/builds/bind-9.18/components/bind/build/amd64/bin/named'
depbase=`echo server.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
/usr/gcc/11/bin/gcc -DHAVE_CONFIG_H -I. \
-I/builds/bind-9.18/components/bind/bind-9.18.4/bin/named \
-I../.. \
-D_FORTIFY_SOURCE=2 \
-include ../../config.h \
-I/builds/bind-9.18/components/bind/bind-9.18.4/bin/named/include \
-I../../include \
-I/builds/bind-9.18/components/bind/bind-9.18.4/include \
-I/builds/bind-9.18/components/bind/bind-9.18.4/lib/isc/include \
-I../../lib/isc/include \
-I/builds/bind-9.18/components/bind/bind-9.18.4/lib/dns/include \
-I../../lib/dns/include \
-I/builds/bind-9.18/components/bind/bind-9.18.4/lib/ns/include \
-I/builds/bind-9.18/components/bind/bind-9.18.4/lib/isccc/include/ \
-I/builds/bind-9.18/components/bind/bind-9.18.4/lib/isccfg/include \
-I/builds/bind-9.18/components/bind/bind-9.18.4/lib/bind9/include \
-I/usr/include/json-c \
-I/usr/include/libxml2 \
-DNAMED_LOCALSTATEDIR=\"/var\" \
-DNAMED_SYSCONFDIR=\"/etc\" \
-m64 -Wall -Wextra -Wwrite-strings -Wpointer-arith \
-Wno-missing-field-initializers -Wformat -Wshadow \
-Werror=implicit-function-declaration -Werror=missing-prototypes \
-Werror=format-security -Werror=parentheses -Werror=implicit \
-Werror=strict-prototypes -Werror=vla -fno-strict-aliasing \
-fno-delete-null-pointer-checks -fdiagnostics-show-option \
-m64 -fPIC -DPIC -O3 \
-ffile-prefix-map=/builds/bind-9.18/components/bind=. \
-D_POSIX_PTHREAD_SEMANTICS -pthread -MT server.o -MD -MP -MF $depbase.Tpo \
-c -o server.o server.c &&\
mv -f $depbase.Tpo $depbase.Po
server.c: In function 'view_loaded':
server.c:9876:31: error: implicit declaration of function 'FIPS_mode' [-Werror=implicit-function-declaration]
9876 | FIPS_mode() ? "enabled" : "disabled");
| ^~~~~~~~~
Possible fixes
Configure gcc flags -Werror=implicit (also-Werror=implicit-function-declaration)
prevent compilation as FIPS_mode() is not declared. This small patch addresses
the issue.
diff -r 59e483e0efed bin/named/server.c
--- a/bin/named/server.c Tue Jun 21 09:28:54 2022 -0700
+++ b/bin/named/server.c Tue Jun 21 09:30:40 2022 -0700
@@ -130,6 +130,11 @@
#include <named/transportconf.h>
#include <named/tsigconf.h>
#include <named/zoneconf.h>
+
+#ifdef HAVE_FIPS_MODE
+#include <openssl/crypto.h>
+#endif
+
#ifdef HAVE_LIBSCF
#include <stdlib.h>