fixed integrity tests of plugins using libtls or libtnccs
authorAndreas Steffen <andreas.steffen@strongswan.org>
Wed, 2 Nov 2011 05:41:48 +0000 (06:41 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Wed, 2 Nov 2011 05:42:08 +0000 (06:42 +0100)
14 files changed:
src/charon/Makefile.am
src/checksum/Makefile.am
src/checksum/checksum_builder.c
src/libcharon/plugins/eap_peap/Makefile.am
src/libcharon/plugins/eap_tls/Makefile.am
src/libcharon/plugins/eap_tnc/Makefile.am
src/libcharon/plugins/eap_ttls/Makefile.am
src/libcharon/plugins/tnc_imc/Makefile.am
src/libcharon/plugins/tnc_imv/Makefile.am
src/libcharon/plugins/tnc_tnccs/Makefile.am
src/libcharon/plugins/tnc_tnccs/tnc_tnccs_plugin.c
src/libcharon/plugins/tnccs_11/Makefile.am
src/libcharon/plugins/tnccs_20/Makefile.am
src/libcharon/plugins/tnccs_dynamic/Makefile.am

index 6481947..6918216 100644 (file)
@@ -18,5 +18,9 @@ charon_LDADD = \
        $(top_builddir)/src/libcharon/libcharon.la \
        -lm $(PTHREADLIB) $(DLLIB)
 
+if USE_LIBTNCCS
+  charon_LDADD += $(top_builddir)/src/libtnccs/libtnccs.la
+endif
+
 EXTRA_DIST = Android.mk
 
index fc48438..fe6cf79 100644 (file)
@@ -30,6 +30,13 @@ if !MONOLITHIC
 endif
 endif
 
+if USE_LIBTNCCS
+  libs += $(top_builddir)/src/libtnccs/.libs/libtnccs.so
+  checksum_builder_LDADD += $(top_builddir)/src/libtnccs/libtnccs.la
+  INCLUDES += -I$(top_srcdir)/src/libtncif -I$(top_srcdir)/src/libtnccs
+  AM_CFLAGS += -DHAS_TNC
+endif
+
 if USE_CHARON
   libs += $(top_builddir)/src/libcharon/.libs/libcharon.so
   libs += $(top_builddir)/src/charon/.libs/charon
index a4d9aa0..4bc387d 100644 (file)
 #include <daemon.h>
 #include <utils/enumerator.h>
 
+#ifdef HAS_TNC
+#include <tnc/tnc.h>
+#endif
+
 /* we need to fake the pluto symbol to dlopen() the xauth plugin */
 void *pluto;
 
@@ -133,6 +137,11 @@ int main(int argc, char* argv[])
        hydra = NULL;
        charon = NULL;
 
+#ifdef HAS_TNC
+       /* forces link against libtnccs */
+       tnc = NULL;
+#endif
+
        /* avoid confusing leak reports in build process */
        setenv("LEAK_DETECTIVE_DISABLE", "1", 0);
        /* don't use a strongswan.conf, forces integrity check to disabled */
index 81f2575..9f7ec6a 100644 (file)
@@ -8,7 +8,6 @@ if MONOLITHIC
 noinst_LTLIBRARIES = libstrongswan-eap-peap.la
 else
 plugin_LTLIBRARIES = libstrongswan-eap-peap.la
-libstrongswan_eap_peap_la_LIBADD = $(top_builddir)/src/libtls/libtls.la
 endif
 
 libstrongswan_eap_peap_la_SOURCES = \
index 29ddd82..fb3de49 100644 (file)
@@ -8,7 +8,6 @@ if MONOLITHIC
 noinst_LTLIBRARIES = libstrongswan-eap-tls.la
 else
 plugin_LTLIBRARIES = libstrongswan-eap-tls.la
-libstrongswan_eap_tls_la_LIBADD = $(top_builddir)/src/libtls/libtls.la
 endif
 
 libstrongswan_eap_tls_la_SOURCES = \
index 0e10f7d..0d5760b 100644 (file)
@@ -13,9 +13,6 @@ if MONOLITHIC
 noinst_LTLIBRARIES = libstrongswan-eap-tnc.la
 else
 plugin_LTLIBRARIES = libstrongswan-eap-tnc.la
-libstrongswan_eap_tnc_la_LIBADD = \
-       $(top_builddir)/src/libtls/libtls.la \
-       $(top_builddir)/src/libtnccs/libtnccs.la
 endif
 
 libstrongswan_eap_tnc_la_SOURCES = \
index 94ce5cc..a06665d 100644 (file)
@@ -8,7 +8,6 @@ if MONOLITHIC
 noinst_LTLIBRARIES = libstrongswan-eap-ttls.la
 else
 plugin_LTLIBRARIES = libstrongswan-eap-ttls.la
-libstrongswan_eap_ttls_la_LIBADD = $(top_builddir)/src/libtls/libtls.la
 endif
 
 libstrongswan_eap_ttls_la_SOURCES = \
index fc19795..f282978 100644 (file)
@@ -11,8 +11,7 @@ noinst_LTLIBRARIES = libstrongswan-tnc-imc.la
 else
 plugin_LTLIBRARIES = libstrongswan-tnc-imc.la
 libstrongswan_tnc_imc_la_LIBADD = \
-       $(top_builddir)/src/libtncif/libtncif.la \
-       $(top_builddir)/src/libtnccs/libtnccs.la
+       $(top_builddir)/src/libtncif/libtncif.la
 endif
 
 libstrongswan_tnc_imc_la_SOURCES = \
index eca3b37..0de287d 100644 (file)
@@ -13,8 +13,7 @@ noinst_LTLIBRARIES = libstrongswan-tnc-imv.la
 else
 plugin_LTLIBRARIES = libstrongswan-tnc-imv.la
 libstrongswan_tnc_imv_la_LIBADD = \
-       $(top_builddir)/src/libtncif/libtncif.la \
-       $(top_builddir)/src/libtnccs/libtnccs.la
+       $(top_builddir)/src/libtncif/libtncif.la
 endif
 
 libstrongswan_tnc_imv_la_SOURCES = \
index c7fc02f..bf77c4c 100644 (file)
@@ -11,8 +11,7 @@ noinst_LTLIBRARIES = libstrongswan-tnc-tnccs.la
 else
 plugin_LTLIBRARIES = libstrongswan-tnc-tnccs.la
 libstrongswan_tnc_tnccs_la_LIBADD = \
-       $(top_builddir)/src/libtncif/libtncif.la \
-       $(top_builddir)/src/libtnccs/libtnccs.la
+       $(top_builddir)/src/libtncif/libtncif.la
 endif
 
 libstrongswan_tnc_tnccs_la_SOURCES = \
index 777c33c..a44319e 100644 (file)
@@ -18,6 +18,8 @@
 
 #include <tnc/tnc.h>
 
+#include <debug.h>
+
 typedef struct private_tnc_tnccs_plugin_t private_tnc_tnccs_plugin_t;
 
 /**
@@ -64,6 +66,21 @@ plugin_t *tnc_tnccs_plugin_create(void)
 {
        private_tnc_tnccs_plugin_t *this;
 
+       if (lib->integrity)
+       {
+               if (lib->integrity->check(lib->integrity, "libtnccs", libtnccs_init))
+               {
+                       DBG1(DBG_LIB,
+                                "lib    'libtnccs': passed file and segment integrity tests");
+               }
+               else
+               {
+                       DBG1(DBG_LIB,
+                                "lib    'libtnccs': failed integrity tests");
+                       return NULL;
+               }
+       }
+
        INIT(this,
                .public = {
                        .plugin = {
index c205692..b10c401 100644 (file)
@@ -15,8 +15,7 @@ noinst_LTLIBRARIES = libstrongswan-tnccs-11.la
 else
 plugin_LTLIBRARIES = libstrongswan-tnccs-11.la
 libstrongswan_tnccs_11_la_LIBADD += \
-       $(top_builddir)/src/libtncif/libtncif.la \
-       $(top_builddir)/src/libtnccs/libtnccs.la
+       $(top_builddir)/src/libtncif/libtncif.la
 endif
 
 libstrongswan_tnccs_11_la_SOURCES = \
index ec17e64..f63e265 100644 (file)
@@ -12,8 +12,7 @@ noinst_LTLIBRARIES = libstrongswan-tnccs-20.la
 else
 plugin_LTLIBRARIES = libstrongswan-tnccs-20.la
 libstrongswan_tnccs_20_la_LIBADD = \
-       $(top_builddir)/src/libtncif/libtncif.la \
-       $(top_builddir)/src/libtnccs/libtnccs.la
+       $(top_builddir)/src/libtncif/libtncif.la
 endif
 
 libstrongswan_tnccs_20_la_SOURCES = \
index 57c2baa..d9baee4 100644 (file)
@@ -12,8 +12,7 @@ noinst_LTLIBRARIES = libstrongswan-tnccs-dynamic.la
 else
 plugin_LTLIBRARIES = libstrongswan-tnccs-dynamic.la
 libstrongswan_tnccs_dynamic_la_LIBADD = \
-       $(top_builddir)/src/libtncif/libtncif.la \
-       $(top_builddir)/src/libtnccs/libtnccs.la
+       $(top_builddir)/src/libtncif/libtncif.la
 endif
 
 libstrongswan_tnccs_dynamic_la_SOURCES = \