| 1 |
AC_DEFUN([ACX_OPENSSL_FIPS],[ |
| 2 |
AC_MSG_CHECKING(for OpenSSL FIPS capable library) |
| 3 |
|
| 4 |
tmp_CPPFLAGS=$CPPFLAGS |
| 5 |
tmp_LIBS=$LIBS |
| 6 |
|
| 7 |
CPPFLAGS="$CPPFLAGS $CRYPTO_INCLUDES" |
| 8 |
LIBS="$CRYPTO_LIBS $LIBS" |
| 9 |
|
| 10 |
# check whether we can build an application which can |
| 11 |
# "reference the OpenSSL FIPS object module" |
| 12 |
|
| 13 |
AC_LANG_PUSH([C]) |
| 14 |
AC_CACHE_VAL([acx_cv_lib_openssl_fips],[ |
| 15 |
acx_cv_lib_openssl_fips=no |
| 16 |
AC_RUN_IFELSE([ |
| 17 |
AC_LANG_SOURCE([[ |
| 18 |
#include <openssl/crypto.h> |
| 19 |
int main() |
| 20 |
{ |
| 21 |
return !FIPS_mode_set(1); |
| 22 |
} |
| 23 |
]]) |
| 24 |
],[ |
| 25 |
AC_MSG_RESULT([Found working FIPS_mode_set()]) |
| 26 |
acx_cv_lib_openssl_fips=yes |
| 27 |
],[ |
| 28 |
AC_MSG_RESULT([FIPS_mode_set(1) failed]) |
| 29 |
AC_MSG_ERROR([OpenSSL library is not FIPS capable]) |
| 30 |
],[ |
| 31 |
AC_MSG_WARN([Cannot test, assuming FIPS]) |
| 32 |
acx_cv_lib_openssl_fips=yes |
| 33 |
]) |
| 34 |
]) |
| 35 |
AC_LANG_POP([C]) |
| 36 |
|
| 37 |
# build missing fips_premain_dso tool |
| 38 |
|
| 39 |
if test "x${FIPSLD_CC}" != "x"; then |
| 40 |
THERE="`echo $CC | sed -e 's|[[^/]]*$||'`".. |
| 41 |
if test "x${FIPSLIBDIR}" != "x"; then |
| 42 |
PREMAIN_C="${FIPSLIBDIR}/fips_premain.c" |
| 43 |
elif test -f "${THERE}/fips/fips_premain.c"; then |
| 44 |
PREMAIN_C="${THERE}/fips/fips_premain.c" |
| 45 |
elif test -f "${THERE}/lib/fips_premain.c"; then |
| 46 |
PREMAIN_C="${THERE}/lib/fips_premain.c" |
| 47 |
else |
| 48 |
AC_MSG_WARN([can't find fips_premain.c]) |
| 49 |
fi |
| 50 |
|
| 51 |
$FIPSLD_CC $CPPFLAGS -DFINGERPRINT_PREMAIN_DSO_LOAD \ |
| 52 |
-o src/lib/fips_premain_dso $PREMAIN_C $LIBS |
| 53 |
fi |
| 54 |
|
| 55 |
CPPFLAGS=$tmp_CPPFLAGS |
| 56 |
LIBS=$tmp_LIBS |
| 57 |
]) |