From: Nikos Mavrogiannopoulos Date: Fri, 8 Nov 2013 15:48:32 +0000 (+0100) Subject: Self checks are conditionally included in the library. X-Git-Tag: gnutls_3_3_0pre0~520^2~92 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9715e8597da2bc4e7fb6e42f62039a7024a5418b;p=thirdparty%2Fgnutls.git Self checks are conditionally included in the library. --- diff --git a/configure.ac b/configure.ac index c584725a57..8387847ed6 100644 --- a/configure.ac +++ b/configure.ac @@ -122,6 +122,14 @@ AM_CONDITIONAL(ASM_X86, test x"$hw_accel" = x"x86" || test x"$hw_accel" = x"x86- AM_CONDITIONAL(HAVE_GCC_GNU89_INLINE_OPTION, test "$gnu89_inline" = "yes"]) AM_CONDITIONAL(HAVE_GCC, test "$GCC" = "yes") +AC_ARG_ENABLE(self-checks, + AS_HELP_STRING([--enable-self-checks], [enable self checking functionality]), + enable_self_checks=$enableval, enable_self_checks=no) +AM_CONDITIONAL(ENABLE_SELF_CHECKS, test "$enable_self_checks" = "yes") +if [ test "$enable_self_checks" = "yes" ];then + AC_DEFINE([ENABLE_SELF_CHECKS], 1, [Self checks are included in the library]) +fi + dnl Try the hooks.m4 LIBGNUTLS_HOOKS LIBGNUTLS_EXTRA_HOOKS @@ -720,6 +728,7 @@ if features are disabled) Heartbeat support: $ac_enable_heartbeat RSA-EXPORT compat: $ac_enable_rsa_export Unicode support: $ac_have_unicode + Self checks: $enable_self_checks ]) AC_MSG_NOTICE([Optional applications: diff --git a/lib/Makefile.am b/lib/Makefile.am index 004ed4f70b..2f5d5e5fea 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -78,8 +78,11 @@ COBJECTS = gnutls_range.c gnutls_record.c \ gnutls_rsa_export.c gnutls_helper.c gnutls_supplemental.c \ random.c crypto-api.c gnutls_privkey.c gnutls_pcert.c \ gnutls_pubkey.c locks.c gnutls_dtls.c system_override.c \ - crypto-backend.c verify-tofu.c pin.c tpm.c \ - crypto-selftests.c crypto-selftests-pk.c + crypto-backend.c verify-tofu.c pin.c tpm.c + +if ENABLE_SELF_CHECKS +COBJECTS += crypto-selftests.c crypto-selftests-pk.c +endif if ENABLE_PKCS11 COBJECTS += pkcs11.c pkcs11_privkey.c pkcs11_write.c pkcs11_secret.c \ diff --git a/tests/slow/Makefile.am b/tests/slow/Makefile.am index 265588434b..0e4b382a67 100644 --- a/tests/slow/Makefile.am +++ b/tests/slow/Makefile.am @@ -24,7 +24,13 @@ AM_CPPFLAGS = -I$(top_srcdir)/lib/includes \ AM_LDFLAGS = -no-install LDADD = ../libutils.la \ - ../../lib/libgnutls.la $(LTLIBGCRYPT) $(LIBSOCKET) + $(top_builddir)/lib/libgnutls.la $(LTLIBGCRYPT) $(LIBSOCKET) + +if !ENABLE_SELF_CHECKS +cipher_test_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/lib/ -I$(top_builddir)/gl/ +else +cipher_test_CPPFLAGS = $(AM_CPPFLAGS) +endif ctests = gendh keygen cipher-test diff --git a/tests/slow/cipher-test.c b/tests/slow/cipher-test.c index f88e29e563..3c85a793ae 100644 --- a/tests/slow/cipher-test.c +++ b/tests/slow/cipher-test.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -17,6 +18,10 @@ tls_log_func (int level, const char *str) fprintf(stderr, "<%d>| %s", level, str); } +#ifndef ENABLE_SELF_CHECKS +# include "../../lib/crypto-selftests.c" +# include "../../lib/crypto-selftests-pk.c" +#endif int main(int argc, char **argv) {