From: Andreas Steffen Date: Wed, 2 Nov 2011 05:41:48 +0000 (+0100) Subject: fixed integrity tests of plugins using libtls or libtnccs X-Git-Tag: 4.6.0~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b597ac4a4cbcd9197b886d743c75d58293264580;p=thirdparty%2Fstrongswan.git fixed integrity tests of plugins using libtls or libtnccs --- diff --git a/src/charon/Makefile.am b/src/charon/Makefile.am index 6481947f15..6918216239 100644 --- a/src/charon/Makefile.am +++ b/src/charon/Makefile.am @@ -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 diff --git a/src/checksum/Makefile.am b/src/checksum/Makefile.am index fc48438c2b..fe6cf79b41 100644 --- a/src/checksum/Makefile.am +++ b/src/checksum/Makefile.am @@ -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 diff --git a/src/checksum/checksum_builder.c b/src/checksum/checksum_builder.c index a4d9aa0846..4bc387da8b 100644 --- a/src/checksum/checksum_builder.c +++ b/src/checksum/checksum_builder.c @@ -23,6 +23,10 @@ #include #include +#ifdef HAS_TNC +#include +#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 */ diff --git a/src/libcharon/plugins/eap_peap/Makefile.am b/src/libcharon/plugins/eap_peap/Makefile.am index 81f2575c73..9f7ec6a4dc 100644 --- a/src/libcharon/plugins/eap_peap/Makefile.am +++ b/src/libcharon/plugins/eap_peap/Makefile.am @@ -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 = \ diff --git a/src/libcharon/plugins/eap_tls/Makefile.am b/src/libcharon/plugins/eap_tls/Makefile.am index 29ddd822b6..fb3de49372 100644 --- a/src/libcharon/plugins/eap_tls/Makefile.am +++ b/src/libcharon/plugins/eap_tls/Makefile.am @@ -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 = \ diff --git a/src/libcharon/plugins/eap_tnc/Makefile.am b/src/libcharon/plugins/eap_tnc/Makefile.am index 0e10f7d9c4..0d5760b25e 100644 --- a/src/libcharon/plugins/eap_tnc/Makefile.am +++ b/src/libcharon/plugins/eap_tnc/Makefile.am @@ -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 = \ diff --git a/src/libcharon/plugins/eap_ttls/Makefile.am b/src/libcharon/plugins/eap_ttls/Makefile.am index 94ce5cc1ea..a06665d4c5 100644 --- a/src/libcharon/plugins/eap_ttls/Makefile.am +++ b/src/libcharon/plugins/eap_ttls/Makefile.am @@ -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 = \ diff --git a/src/libcharon/plugins/tnc_imc/Makefile.am b/src/libcharon/plugins/tnc_imc/Makefile.am index fc19795254..f282978a99 100644 --- a/src/libcharon/plugins/tnc_imc/Makefile.am +++ b/src/libcharon/plugins/tnc_imc/Makefile.am @@ -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 = \ diff --git a/src/libcharon/plugins/tnc_imv/Makefile.am b/src/libcharon/plugins/tnc_imv/Makefile.am index eca3b377b3..0de287d922 100644 --- a/src/libcharon/plugins/tnc_imv/Makefile.am +++ b/src/libcharon/plugins/tnc_imv/Makefile.am @@ -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 = \ diff --git a/src/libcharon/plugins/tnc_tnccs/Makefile.am b/src/libcharon/plugins/tnc_tnccs/Makefile.am index c7fc02f7c4..bf77c4caea 100644 --- a/src/libcharon/plugins/tnc_tnccs/Makefile.am +++ b/src/libcharon/plugins/tnc_tnccs/Makefile.am @@ -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 = \ diff --git a/src/libcharon/plugins/tnc_tnccs/tnc_tnccs_plugin.c b/src/libcharon/plugins/tnc_tnccs/tnc_tnccs_plugin.c index 777c33c51c..a44319ed13 100644 --- a/src/libcharon/plugins/tnc_tnccs/tnc_tnccs_plugin.c +++ b/src/libcharon/plugins/tnc_tnccs/tnc_tnccs_plugin.c @@ -18,6 +18,8 @@ #include +#include + 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 = { diff --git a/src/libcharon/plugins/tnccs_11/Makefile.am b/src/libcharon/plugins/tnccs_11/Makefile.am index c205692d44..b10c4019c2 100644 --- a/src/libcharon/plugins/tnccs_11/Makefile.am +++ b/src/libcharon/plugins/tnccs_11/Makefile.am @@ -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 = \ diff --git a/src/libcharon/plugins/tnccs_20/Makefile.am b/src/libcharon/plugins/tnccs_20/Makefile.am index ec17e64122..f63e2656e8 100644 --- a/src/libcharon/plugins/tnccs_20/Makefile.am +++ b/src/libcharon/plugins/tnccs_20/Makefile.am @@ -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 = \ diff --git a/src/libcharon/plugins/tnccs_dynamic/Makefile.am b/src/libcharon/plugins/tnccs_dynamic/Makefile.am index 57c2baaf0d..d9baee48a6 100644 --- a/src/libcharon/plugins/tnccs_dynamic/Makefile.am +++ b/src/libcharon/plugins/tnccs_dynamic/Makefile.am @@ -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 = \