]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Self checks are conditionally included in the library.
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Fri, 8 Nov 2013 15:48:32 +0000 (16:48 +0100)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Wed, 27 Nov 2013 10:41:05 +0000 (11:41 +0100)
configure.ac
lib/Makefile.am
tests/slow/Makefile.am
tests/slow/cipher-test.c

index c584725a574d6631f262335e3e4da866ba054f62..8387847ed6668a8e67d0c1287c1e71b96b9eddad 100644 (file)
@@ -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:
index 004ed4f70b5f8f295571946d499830fdb275f86f..2f5d5e5fea2dde835f96b8ace0e77019e76f2f19 100644 (file)
@@ -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 \
index 265588434b169490f3d88a108200c888f284d983..0e4b382a679f3647ed82c5b1f0abedb21d8e6ded 100644 (file)
@@ -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
 
index f88e29e5638f0caa66aaaf023ca542496fff5800..3c85a793ae23212259155d171f27ac7cfd19fc13 100644 (file)
@@ -1,3 +1,4 @@
+#include <config.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
@@ -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)
 {