Merge pull request #3806 from elms/autoconf/oot_fips_check

configure: fix for FIPS out-of-tree builds
This commit is contained in:
Daniel Pouzzner
2021-02-24 14:38:26 -06:00
committed by GitHub

View File

@ -181,43 +181,45 @@ AC_ARG_ENABLE([fips],
[ENABLED_FIPS="no"]) [ENABLED_FIPS="no"])
AS_CASE([$ENABLED_FIPS], AS_CASE([$ENABLED_FIPS],
["ready"],[ [ready],[
ENABLED_FIPS="yes" ENABLED_FIPS="yes"
FIPS_VERSION="v2" FIPS_VERSION="v2"
FIPS_READY="yes" FIPS_READY="yes"
], ],
["v2"],[ [no],[
# FIPS v2 FIPS_VERSION="none"
ENABLED_FIPS="yes" ENABLED_FIPS="no"
FIPS_VERSION="v2"
], ],
["rand"],[ [rand|v1|v2],[
# FIPS Rand FIPS_VERSION="$ENABLED_FIPS"
ENABLED_FIPS="yes" ENABLED_FIPS="yes"
FIPS_VERSION="rand"
], ],
["no"],[FIPS_VERSION="none"], [yes],
[ [
# FIPS v1 # FIPS v1
ENABLED_FIPS="yes" ENABLED_FIPS="yes"
FIPS_VERSION="v1" FIPS_VERSION="v1"
],
[
AC_MSG_ERROR([Invalid value for --enable-fips \"$ENABLED_FIPS\" (allowed: ready, rand, v1, v2)])
]) ])
case "$FIPS_VERSION" in AS_CASE([$FIPS_VERSION],
none) if test -s wolfcrypt/src/fips.c || test -s ctaocrypt/src/fips.c; then [none],
AC_MSG_ERROR([FIPS source tree is incompatible with non-FIPS build (requires --enable-fips)]) [
fi AS_IF([ test -s $srcdir/wolfcrypt/src/fips.c -o -s $srcdir/ctaocrypt/src/fips.c ],
;; [AC_MSG_ERROR([FIPS source tree is incompatible with non-FIPS build (requires --enable-fips)])])
v1) if ! test -s ctaocrypt/src/fips.c; then ],
AC_MSG_ERROR([non-FIPS-v1 source tree is incompatible with --enable-fips=$enableval]) [v1],
fi [
;; AS_IF([ ! test -s $srcdir/ctaocrypt/src/fips.c],
*) if ! test -s wolfcrypt/src/fips.c; then [AC_MSG_ERROR([non-FIPS-v1 source tree is incompatible with --enable-fips=$enableval])])
AC_MSG_ERROR([non-FIPS source tree is incompatible with --enable-fips=$enableval]) ],
fi [
;; AS_IF([ ! test -s $srcdir/wolfcrypt/src/fips.c],
esac [AC_MSG_ERROR([non-FIPS source tree is incompatible with --enable-fips=$enableval])])
]
)
# Linux Kernel Module # Linux Kernel Module
AC_ARG_ENABLE([linuxkm], AC_ARG_ENABLE([linuxkm],