summaryrefslogtreecommitdiff
path: root/src/conftest
diff options
context:
space:
mode:
Diffstat (limited to 'src/conftest')
-rw-r--r--src/conftest/Makefile.am26
-rw-r--r--src/conftest/Makefile.in954
-rw-r--r--src/conftest/README315
-rw-r--r--src/conftest/actions.c339
-rw-r--r--src/conftest/actions.h42
-rw-r--r--src/conftest/config.c343
-rw-r--r--src/conftest/config.h56
-rw-r--r--src/conftest/conftest.c550
-rw-r--r--src/conftest/conftest.h74
-rw-r--r--src/conftest/hooks/add_notify.c140
-rw-r--r--src/conftest/hooks/add_payload.c151
-rw-r--r--src/conftest/hooks/custom_proposal.c188
-rw-r--r--src/conftest/hooks/force_cookie.c117
-rw-r--r--src/conftest/hooks/hook.h45
-rw-r--r--src/conftest/hooks/ignore_message.c89
-rw-r--r--src/conftest/hooks/ike_auth_fill.c145
-rw-r--r--src/conftest/hooks/log_id.c89
-rw-r--r--src/conftest/hooks/log_ke.c81
-rw-r--r--src/conftest/hooks/log_proposals.c98
-rw-r--r--src/conftest/hooks/log_ts.c86
-rw-r--r--src/conftest/hooks/pretend_auth.c386
-rw-r--r--src/conftest/hooks/rebuild_auth.c243
-rw-r--r--src/conftest/hooks/reset_seq.c158
-rw-r--r--src/conftest/hooks/set_critical.c123
-rw-r--r--src/conftest/hooks/set_ike_initiator.c87
-rw-r--r--src/conftest/hooks/set_ike_request.c84
-rw-r--r--src/conftest/hooks/set_ike_spi.c104
-rw-r--r--src/conftest/hooks/set_ike_version.c111
-rw-r--r--src/conftest/hooks/set_length.c133
-rw-r--r--src/conftest/hooks/set_proposal_number.c163
-rw-r--r--src/conftest/hooks/set_reserved.c245
-rw-r--r--src/conftest/hooks/unencrypted_notify.c153
-rw-r--r--src/conftest/hooks/unsort_message.c133
33 files changed, 6051 insertions, 0 deletions
diff --git a/src/conftest/Makefile.am b/src/conftest/Makefile.am
new file mode 100644
index 000000000..7eab0df27
--- /dev/null
+++ b/src/conftest/Makefile.am
@@ -0,0 +1,26 @@
+ipsec_PROGRAMS = conftest
+
+AM_CFLAGS = -rdynamic
+
+conftest_SOURCES = conftest.c conftest.h config.c config.h actions.c actions.h \
+ hooks/hook.h hooks/ike_auth_fill.c hooks/unsort_message.c \
+ hooks/add_notify.c hooks/unencrypted_notify.c hooks/ignore_message.c \
+ hooks/add_payload.c hooks/set_critical.c hooks/force_cookie.c \
+ hooks/set_ike_version.c hooks/pretend_auth.c hooks/set_length.c \
+ hooks/log_proposals.c hooks/set_proposal_number.c hooks/log_ke.c \
+ hooks/log_id.c hooks/custom_proposal.c hooks/set_ike_spi.c \
+ hooks/set_ike_request.c hooks/set_reserved.c hooks/set_ike_initiator.c \
+ hooks/log_ts.c hooks/rebuild_auth.c hooks/reset_seq.c
+
+INCLUDES = \
+ -I$(top_srcdir)/src/libstrongswan \
+ -I$(top_srcdir)/src/libhydra \
+ -I$(top_srcdir)/src/libcharon
+
+conftest_LDADD = \
+ $(top_builddir)/src/libstrongswan/libstrongswan.la \
+ $(top_builddir)/src/libhydra/libhydra.la \
+ $(top_builddir)/src/libcharon/libcharon.la \
+ -lm $(PTHREADLIB) $(DLLIB)
+
+EXTRA_DIST = README
diff --git a/src/conftest/Makefile.in b/src/conftest/Makefile.in
new file mode 100644
index 000000000..1c07710e0
--- /dev/null
+++ b/src/conftest/Makefile.in
@@ -0,0 +1,954 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+ipsec_PROGRAMS = conftest$(EXEEXT)
+subdir = src/conftest
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/config/libtool.m4 \
+ $(top_srcdir)/m4/config/ltoptions.m4 \
+ $(top_srcdir)/m4/config/ltsugar.m4 \
+ $(top_srcdir)/m4/config/ltversion.m4 \
+ $(top_srcdir)/m4/config/lt~obsolete.m4 \
+ $(top_srcdir)/m4/macros/with.m4 \
+ $(top_srcdir)/m4/macros/enable-disable.m4 \
+ $(top_srcdir)/m4/macros/add-plugin.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(ipsecdir)"
+PROGRAMS = $(ipsec_PROGRAMS)
+am_conftest_OBJECTS = conftest.$(OBJEXT) config.$(OBJEXT) \
+ actions.$(OBJEXT) ike_auth_fill.$(OBJEXT) \
+ unsort_message.$(OBJEXT) add_notify.$(OBJEXT) \
+ unencrypted_notify.$(OBJEXT) ignore_message.$(OBJEXT) \
+ add_payload.$(OBJEXT) set_critical.$(OBJEXT) \
+ force_cookie.$(OBJEXT) set_ike_version.$(OBJEXT) \
+ pretend_auth.$(OBJEXT) set_length.$(OBJEXT) \
+ log_proposals.$(OBJEXT) set_proposal_number.$(OBJEXT) \
+ log_ke.$(OBJEXT) log_id.$(OBJEXT) custom_proposal.$(OBJEXT) \
+ set_ike_spi.$(OBJEXT) set_ike_request.$(OBJEXT) \
+ set_reserved.$(OBJEXT) set_ike_initiator.$(OBJEXT) \
+ log_ts.$(OBJEXT) rebuild_auth.$(OBJEXT) reset_seq.$(OBJEXT)
+conftest_OBJECTS = $(am_conftest_OBJECTS)
+am__DEPENDENCIES_1 =
+conftest_DEPENDENCIES = \
+ $(top_builddir)/src/libstrongswan/libstrongswan.la \
+ $(top_builddir)/src/libhydra/libhydra.la \
+ $(top_builddir)/src/libcharon/libcharon.la \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(conftest_SOURCES)
+DIST_SOURCES = $(conftest_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BTLIB = @BTLIB@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLIB = @DLLIB@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GPERF = @GPERF@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MYSQLCFLAG = @MYSQLCFLAG@
+MYSQLCONFIG = @MYSQLCONFIG@
+MYSQLLIB = @MYSQLLIB@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PTHREADLIB = @PTHREADLIB@
+RANLIB = @RANLIB@
+RTLIB = @RTLIB@
+RUBY = @RUBY@
+RUBYINCLUDE = @RUBYINCLUDE@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOCKLIB = @SOCKLIB@
+STRIP = @STRIP@
+VERSION = @VERSION@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+c_plugins = @c_plugins@
+datadir = @datadir@
+datarootdir = @datarootdir@
+dbusservicedir = @dbusservicedir@
+default_pkcs11 = @default_pkcs11@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gtk_CFLAGS = @gtk_CFLAGS@
+gtk_LIBS = @gtk_LIBS@
+h_plugins = @h_plugins@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+ipsecdir = @ipsecdir@
+ipsecgroup = @ipsecgroup@
+ipsecuser = @ipsecuser@
+libcharon_plugins = @libcharon_plugins@
+libdir = @libdir@
+libexecdir = @libexecdir@
+linux_headers = @linux_headers@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+maemo_CFLAGS = @maemo_CFLAGS@
+maemo_LIBS = @maemo_LIBS@
+manager_plugins = @manager_plugins@
+mandir = @mandir@
+medsrv_plugins = @medsrv_plugins@
+mkdir_p = @mkdir_p@
+nm_CFLAGS = @nm_CFLAGS@
+nm_LIBS = @nm_LIBS@
+nm_ca_dir = @nm_ca_dir@
+oldincludedir = @oldincludedir@
+openac_plugins = @openac_plugins@
+p_plugins = @p_plugins@
+pdfdir = @pdfdir@
+piddir = @piddir@
+pki_plugins = @pki_plugins@
+plugindir = @plugindir@
+pluto_plugins = @pluto_plugins@
+pool_plugins = @pool_plugins@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+random_device = @random_device@
+resolv_conf = @resolv_conf@
+routing_table = @routing_table@
+routing_table_prio = @routing_table_prio@
+s_plugins = @s_plugins@
+sbindir = @sbindir@
+scepclient_plugins = @scepclient_plugins@
+scripts_plugins = @scripts_plugins@
+sharedstatedir = @sharedstatedir@
+soup_CFLAGS = @soup_CFLAGS@
+soup_LIBS = @soup_LIBS@
+srcdir = @srcdir@
+strongswan_conf = @strongswan_conf@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+urandom_device = @urandom_device@
+xml_CFLAGS = @xml_CFLAGS@
+xml_LIBS = @xml_LIBS@
+AM_CFLAGS = -rdynamic
+conftest_SOURCES = conftest.c conftest.h config.c config.h actions.c actions.h \
+ hooks/hook.h hooks/ike_auth_fill.c hooks/unsort_message.c \
+ hooks/add_notify.c hooks/unencrypted_notify.c hooks/ignore_message.c \
+ hooks/add_payload.c hooks/set_critical.c hooks/force_cookie.c \
+ hooks/set_ike_version.c hooks/pretend_auth.c hooks/set_length.c \
+ hooks/log_proposals.c hooks/set_proposal_number.c hooks/log_ke.c \
+ hooks/log_id.c hooks/custom_proposal.c hooks/set_ike_spi.c \
+ hooks/set_ike_request.c hooks/set_reserved.c hooks/set_ike_initiator.c \
+ hooks/log_ts.c hooks/rebuild_auth.c hooks/reset_seq.c
+
+INCLUDES = \
+ -I$(top_srcdir)/src/libstrongswan \
+ -I$(top_srcdir)/src/libhydra \
+ -I$(top_srcdir)/src/libcharon
+
+conftest_LDADD = \
+ $(top_builddir)/src/libstrongswan/libstrongswan.la \
+ $(top_builddir)/src/libhydra/libhydra.la \
+ $(top_builddir)/src/libcharon/libcharon.la \
+ -lm $(PTHREADLIB) $(DLLIB)
+
+EXTRA_DIST = README
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/conftest/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/conftest/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-ipsecPROGRAMS: $(ipsec_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(ipsecdir)" || $(MKDIR_P) "$(DESTDIR)$(ipsecdir)"
+ @list='$(ipsec_PROGRAMS)'; test -n "$(ipsecdir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(ipsecdir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(ipsecdir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-ipsecPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(ipsec_PROGRAMS)'; test -n "$(ipsecdir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(ipsecdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(ipsecdir)" && rm -f $$files
+
+clean-ipsecPROGRAMS:
+ @list='$(ipsec_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+conftest$(EXEEXT): $(conftest_OBJECTS) $(conftest_DEPENDENCIES)
+ @rm -f conftest$(EXEEXT)
+ $(LINK) $(conftest_OBJECTS) $(conftest_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/actions.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add_notify.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add_payload.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/config.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conftest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/custom_proposal.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/force_cookie.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ignore_message.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ike_auth_fill.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log_id.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log_ke.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log_proposals.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log_ts.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pretend_auth.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rebuild_auth.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reset_seq.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_critical.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_ike_initiator.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_ike_request.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_ike_spi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_ike_version.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_length.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_proposal_number.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_reserved.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unencrypted_notify.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unsort_message.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+ike_auth_fill.o: hooks/ike_auth_fill.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ike_auth_fill.o -MD -MP -MF $(DEPDIR)/ike_auth_fill.Tpo -c -o ike_auth_fill.o `test -f 'hooks/ike_auth_fill.c' || echo '$(srcdir)/'`hooks/ike_auth_fill.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ike_auth_fill.Tpo $(DEPDIR)/ike_auth_fill.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/ike_auth_fill.c' object='ike_auth_fill.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ike_auth_fill.o `test -f 'hooks/ike_auth_fill.c' || echo '$(srcdir)/'`hooks/ike_auth_fill.c
+
+ike_auth_fill.obj: hooks/ike_auth_fill.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ike_auth_fill.obj -MD -MP -MF $(DEPDIR)/ike_auth_fill.Tpo -c -o ike_auth_fill.obj `if test -f 'hooks/ike_auth_fill.c'; then $(CYGPATH_W) 'hooks/ike_auth_fill.c'; else $(CYGPATH_W) '$(srcdir)/hooks/ike_auth_fill.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ike_auth_fill.Tpo $(DEPDIR)/ike_auth_fill.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/ike_auth_fill.c' object='ike_auth_fill.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ike_auth_fill.obj `if test -f 'hooks/ike_auth_fill.c'; then $(CYGPATH_W) 'hooks/ike_auth_fill.c'; else $(CYGPATH_W) '$(srcdir)/hooks/ike_auth_fill.c'; fi`
+
+unsort_message.o: hooks/unsort_message.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT unsort_message.o -MD -MP -MF $(DEPDIR)/unsort_message.Tpo -c -o unsort_message.o `test -f 'hooks/unsort_message.c' || echo '$(srcdir)/'`hooks/unsort_message.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/unsort_message.Tpo $(DEPDIR)/unsort_message.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/unsort_message.c' object='unsort_message.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o unsort_message.o `test -f 'hooks/unsort_message.c' || echo '$(srcdir)/'`hooks/unsort_message.c
+
+unsort_message.obj: hooks/unsort_message.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT unsort_message.obj -MD -MP -MF $(DEPDIR)/unsort_message.Tpo -c -o unsort_message.obj `if test -f 'hooks/unsort_message.c'; then $(CYGPATH_W) 'hooks/unsort_message.c'; else $(CYGPATH_W) '$(srcdir)/hooks/unsort_message.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/unsort_message.Tpo $(DEPDIR)/unsort_message.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/unsort_message.c' object='unsort_message.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o unsort_message.obj `if test -f 'hooks/unsort_message.c'; then $(CYGPATH_W) 'hooks/unsort_message.c'; else $(CYGPATH_W) '$(srcdir)/hooks/unsort_message.c'; fi`
+
+add_notify.o: hooks/add_notify.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT add_notify.o -MD -MP -MF $(DEPDIR)/add_notify.Tpo -c -o add_notify.o `test -f 'hooks/add_notify.c' || echo '$(srcdir)/'`hooks/add_notify.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/add_notify.Tpo $(DEPDIR)/add_notify.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/add_notify.c' object='add_notify.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o add_notify.o `test -f 'hooks/add_notify.c' || echo '$(srcdir)/'`hooks/add_notify.c
+
+add_notify.obj: hooks/add_notify.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT add_notify.obj -MD -MP -MF $(DEPDIR)/add_notify.Tpo -c -o add_notify.obj `if test -f 'hooks/add_notify.c'; then $(CYGPATH_W) 'hooks/add_notify.c'; else $(CYGPATH_W) '$(srcdir)/hooks/add_notify.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/add_notify.Tpo $(DEPDIR)/add_notify.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/add_notify.c' object='add_notify.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o add_notify.obj `if test -f 'hooks/add_notify.c'; then $(CYGPATH_W) 'hooks/add_notify.c'; else $(CYGPATH_W) '$(srcdir)/hooks/add_notify.c'; fi`
+
+unencrypted_notify.o: hooks/unencrypted_notify.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT unencrypted_notify.o -MD -MP -MF $(DEPDIR)/unencrypted_notify.Tpo -c -o unencrypted_notify.o `test -f 'hooks/unencrypted_notify.c' || echo '$(srcdir)/'`hooks/unencrypted_notify.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/unencrypted_notify.Tpo $(DEPDIR)/unencrypted_notify.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/unencrypted_notify.c' object='unencrypted_notify.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o unencrypted_notify.o `test -f 'hooks/unencrypted_notify.c' || echo '$(srcdir)/'`hooks/unencrypted_notify.c
+
+unencrypted_notify.obj: hooks/unencrypted_notify.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT unencrypted_notify.obj -MD -MP -MF $(DEPDIR)/unencrypted_notify.Tpo -c -o unencrypted_notify.obj `if test -f 'hooks/unencrypted_notify.c'; then $(CYGPATH_W) 'hooks/unencrypted_notify.c'; else $(CYGPATH_W) '$(srcdir)/hooks/unencrypted_notify.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/unencrypted_notify.Tpo $(DEPDIR)/unencrypted_notify.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/unencrypted_notify.c' object='unencrypted_notify.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o unencrypted_notify.obj `if test -f 'hooks/unencrypted_notify.c'; then $(CYGPATH_W) 'hooks/unencrypted_notify.c'; else $(CYGPATH_W) '$(srcdir)/hooks/unencrypted_notify.c'; fi`
+
+ignore_message.o: hooks/ignore_message.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ignore_message.o -MD -MP -MF $(DEPDIR)/ignore_message.Tpo -c -o ignore_message.o `test -f 'hooks/ignore_message.c' || echo '$(srcdir)/'`hooks/ignore_message.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ignore_message.Tpo $(DEPDIR)/ignore_message.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/ignore_message.c' object='ignore_message.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ignore_message.o `test -f 'hooks/ignore_message.c' || echo '$(srcdir)/'`hooks/ignore_message.c
+
+ignore_message.obj: hooks/ignore_message.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ignore_message.obj -MD -MP -MF $(DEPDIR)/ignore_message.Tpo -c -o ignore_message.obj `if test -f 'hooks/ignore_message.c'; then $(CYGPATH_W) 'hooks/ignore_message.c'; else $(CYGPATH_W) '$(srcdir)/hooks/ignore_message.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ignore_message.Tpo $(DEPDIR)/ignore_message.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/ignore_message.c' object='ignore_message.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ignore_message.obj `if test -f 'hooks/ignore_message.c'; then $(CYGPATH_W) 'hooks/ignore_message.c'; else $(CYGPATH_W) '$(srcdir)/hooks/ignore_message.c'; fi`
+
+add_payload.o: hooks/add_payload.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT add_payload.o -MD -MP -MF $(DEPDIR)/add_payload.Tpo -c -o add_payload.o `test -f 'hooks/add_payload.c' || echo '$(srcdir)/'`hooks/add_payload.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/add_payload.Tpo $(DEPDIR)/add_payload.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/add_payload.c' object='add_payload.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o add_payload.o `test -f 'hooks/add_payload.c' || echo '$(srcdir)/'`hooks/add_payload.c
+
+add_payload.obj: hooks/add_payload.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT add_payload.obj -MD -MP -MF $(DEPDIR)/add_payload.Tpo -c -o add_payload.obj `if test -f 'hooks/add_payload.c'; then $(CYGPATH_W) 'hooks/add_payload.c'; else $(CYGPATH_W) '$(srcdir)/hooks/add_payload.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/add_payload.Tpo $(DEPDIR)/add_payload.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/add_payload.c' object='add_payload.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o add_payload.obj `if test -f 'hooks/add_payload.c'; then $(CYGPATH_W) 'hooks/add_payload.c'; else $(CYGPATH_W) '$(srcdir)/hooks/add_payload.c'; fi`
+
+set_critical.o: hooks/set_critical.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT set_critical.o -MD -MP -MF $(DEPDIR)/set_critical.Tpo -c -o set_critical.o `test -f 'hooks/set_critical.c' || echo '$(srcdir)/'`hooks/set_critical.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/set_critical.Tpo $(DEPDIR)/set_critical.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/set_critical.c' object='set_critical.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_critical.o `test -f 'hooks/set_critical.c' || echo '$(srcdir)/'`hooks/set_critical.c
+
+set_critical.obj: hooks/set_critical.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT set_critical.obj -MD -MP -MF $(DEPDIR)/set_critical.Tpo -c -o set_critical.obj `if test -f 'hooks/set_critical.c'; then $(CYGPATH_W) 'hooks/set_critical.c'; else $(CYGPATH_W) '$(srcdir)/hooks/set_critical.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/set_critical.Tpo $(DEPDIR)/set_critical.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/set_critical.c' object='set_critical.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_critical.obj `if test -f 'hooks/set_critical.c'; then $(CYGPATH_W) 'hooks/set_critical.c'; else $(CYGPATH_W) '$(srcdir)/hooks/set_critical.c'; fi`
+
+force_cookie.o: hooks/force_cookie.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT force_cookie.o -MD -MP -MF $(DEPDIR)/force_cookie.Tpo -c -o force_cookie.o `test -f 'hooks/force_cookie.c' || echo '$(srcdir)/'`hooks/force_cookie.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/force_cookie.Tpo $(DEPDIR)/force_cookie.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/force_cookie.c' object='force_cookie.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o force_cookie.o `test -f 'hooks/force_cookie.c' || echo '$(srcdir)/'`hooks/force_cookie.c
+
+force_cookie.obj: hooks/force_cookie.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT force_cookie.obj -MD -MP -MF $(DEPDIR)/force_cookie.Tpo -c -o force_cookie.obj `if test -f 'hooks/force_cookie.c'; then $(CYGPATH_W) 'hooks/force_cookie.c'; else $(CYGPATH_W) '$(srcdir)/hooks/force_cookie.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/force_cookie.Tpo $(DEPDIR)/force_cookie.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/force_cookie.c' object='force_cookie.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o force_cookie.obj `if test -f 'hooks/force_cookie.c'; then $(CYGPATH_W) 'hooks/force_cookie.c'; else $(CYGPATH_W) '$(srcdir)/hooks/force_cookie.c'; fi`
+
+set_ike_version.o: hooks/set_ike_version.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT set_ike_version.o -MD -MP -MF $(DEPDIR)/set_ike_version.Tpo -c -o set_ike_version.o `test -f 'hooks/set_ike_version.c' || echo '$(srcdir)/'`hooks/set_ike_version.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/set_ike_version.Tpo $(DEPDIR)/set_ike_version.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/set_ike_version.c' object='set_ike_version.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_ike_version.o `test -f 'hooks/set_ike_version.c' || echo '$(srcdir)/'`hooks/set_ike_version.c
+
+set_ike_version.obj: hooks/set_ike_version.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT set_ike_version.obj -MD -MP -MF $(DEPDIR)/set_ike_version.Tpo -c -o set_ike_version.obj `if test -f 'hooks/set_ike_version.c'; then $(CYGPATH_W) 'hooks/set_ike_version.c'; else $(CYGPATH_W) '$(srcdir)/hooks/set_ike_version.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/set_ike_version.Tpo $(DEPDIR)/set_ike_version.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/set_ike_version.c' object='set_ike_version.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_ike_version.obj `if test -f 'hooks/set_ike_version.c'; then $(CYGPATH_W) 'hooks/set_ike_version.c'; else $(CYGPATH_W) '$(srcdir)/hooks/set_ike_version.c'; fi`
+
+pretend_auth.o: hooks/pretend_auth.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pretend_auth.o -MD -MP -MF $(DEPDIR)/pretend_auth.Tpo -c -o pretend_auth.o `test -f 'hooks/pretend_auth.c' || echo '$(srcdir)/'`hooks/pretend_auth.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pretend_auth.Tpo $(DEPDIR)/pretend_auth.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/pretend_auth.c' object='pretend_auth.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pretend_auth.o `test -f 'hooks/pretend_auth.c' || echo '$(srcdir)/'`hooks/pretend_auth.c
+
+pretend_auth.obj: hooks/pretend_auth.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pretend_auth.obj -MD -MP -MF $(DEPDIR)/pretend_auth.Tpo -c -o pretend_auth.obj `if test -f 'hooks/pretend_auth.c'; then $(CYGPATH_W) 'hooks/pretend_auth.c'; else $(CYGPATH_W) '$(srcdir)/hooks/pretend_auth.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pretend_auth.Tpo $(DEPDIR)/pretend_auth.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/pretend_auth.c' object='pretend_auth.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pretend_auth.obj `if test -f 'hooks/pretend_auth.c'; then $(CYGPATH_W) 'hooks/pretend_auth.c'; else $(CYGPATH_W) '$(srcdir)/hooks/pretend_auth.c'; fi`
+
+set_length.o: hooks/set_length.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT set_length.o -MD -MP -MF $(DEPDIR)/set_length.Tpo -c -o set_length.o `test -f 'hooks/set_length.c' || echo '$(srcdir)/'`hooks/set_length.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/set_length.Tpo $(DEPDIR)/set_length.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/set_length.c' object='set_length.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_length.o `test -f 'hooks/set_length.c' || echo '$(srcdir)/'`hooks/set_length.c
+
+set_length.obj: hooks/set_length.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT set_length.obj -MD -MP -MF $(DEPDIR)/set_length.Tpo -c -o set_length.obj `if test -f 'hooks/set_length.c'; then $(CYGPATH_W) 'hooks/set_length.c'; else $(CYGPATH_W) '$(srcdir)/hooks/set_length.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/set_length.Tpo $(DEPDIR)/set_length.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/set_length.c' object='set_length.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_length.obj `if test -f 'hooks/set_length.c'; then $(CYGPATH_W) 'hooks/set_length.c'; else $(CYGPATH_W) '$(srcdir)/hooks/set_length.c'; fi`
+
+log_proposals.o: hooks/log_proposals.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT log_proposals.o -MD -MP -MF $(DEPDIR)/log_proposals.Tpo -c -o log_proposals.o `test -f 'hooks/log_proposals.c' || echo '$(srcdir)/'`hooks/log_proposals.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/log_proposals.Tpo $(DEPDIR)/log_proposals.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/log_proposals.c' object='log_proposals.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o log_proposals.o `test -f 'hooks/log_proposals.c' || echo '$(srcdir)/'`hooks/log_proposals.c
+
+log_proposals.obj: hooks/log_proposals.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT log_proposals.obj -MD -MP -MF $(DEPDIR)/log_proposals.Tpo -c -o log_proposals.obj `if test -f 'hooks/log_proposals.c'; then $(CYGPATH_W) 'hooks/log_proposals.c'; else $(CYGPATH_W) '$(srcdir)/hooks/log_proposals.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/log_proposals.Tpo $(DEPDIR)/log_proposals.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/log_proposals.c' object='log_proposals.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o log_proposals.obj `if test -f 'hooks/log_proposals.c'; then $(CYGPATH_W) 'hooks/log_proposals.c'; else $(CYGPATH_W) '$(srcdir)/hooks/log_proposals.c'; fi`
+
+set_proposal_number.o: hooks/set_proposal_number.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT set_proposal_number.o -MD -MP -MF $(DEPDIR)/set_proposal_number.Tpo -c -o set_proposal_number.o `test -f 'hooks/set_proposal_number.c' || echo '$(srcdir)/'`hooks/set_proposal_number.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/set_proposal_number.Tpo $(DEPDIR)/set_proposal_number.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/set_proposal_number.c' object='set_proposal_number.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_proposal_number.o `test -f 'hooks/set_proposal_number.c' || echo '$(srcdir)/'`hooks/set_proposal_number.c
+
+set_proposal_number.obj: hooks/set_proposal_number.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT set_proposal_number.obj -MD -MP -MF $(DEPDIR)/set_proposal_number.Tpo -c -o set_proposal_number.obj `if test -f 'hooks/set_proposal_number.c'; then $(CYGPATH_W) 'hooks/set_proposal_number.c'; else $(CYGPATH_W) '$(srcdir)/hooks/set_proposal_number.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/set_proposal_number.Tpo $(DEPDIR)/set_proposal_number.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/set_proposal_number.c' object='set_proposal_number.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_proposal_number.obj `if test -f 'hooks/set_proposal_number.c'; then $(CYGPATH_W) 'hooks/set_proposal_number.c'; else $(CYGPATH_W) '$(srcdir)/hooks/set_proposal_number.c'; fi`
+
+log_ke.o: hooks/log_ke.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT log_ke.o -MD -MP -MF $(DEPDIR)/log_ke.Tpo -c -o log_ke.o `test -f 'hooks/log_ke.c' || echo '$(srcdir)/'`hooks/log_ke.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/log_ke.Tpo $(DEPDIR)/log_ke.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/log_ke.c' object='log_ke.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o log_ke.o `test -f 'hooks/log_ke.c' || echo '$(srcdir)/'`hooks/log_ke.c
+
+log_ke.obj: hooks/log_ke.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT log_ke.obj -MD -MP -MF $(DEPDIR)/log_ke.Tpo -c -o log_ke.obj `if test -f 'hooks/log_ke.c'; then $(CYGPATH_W) 'hooks/log_ke.c'; else $(CYGPATH_W) '$(srcdir)/hooks/log_ke.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/log_ke.Tpo $(DEPDIR)/log_ke.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/log_ke.c' object='log_ke.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o log_ke.obj `if test -f 'hooks/log_ke.c'; then $(CYGPATH_W) 'hooks/log_ke.c'; else $(CYGPATH_W) '$(srcdir)/hooks/log_ke.c'; fi`
+
+log_id.o: hooks/log_id.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT log_id.o -MD -MP -MF $(DEPDIR)/log_id.Tpo -c -o log_id.o `test -f 'hooks/log_id.c' || echo '$(srcdir)/'`hooks/log_id.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/log_id.Tpo $(DEPDIR)/log_id.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/log_id.c' object='log_id.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o log_id.o `test -f 'hooks/log_id.c' || echo '$(srcdir)/'`hooks/log_id.c
+
+log_id.obj: hooks/log_id.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT log_id.obj -MD -MP -MF $(DEPDIR)/log_id.Tpo -c -o log_id.obj `if test -f 'hooks/log_id.c'; then $(CYGPATH_W) 'hooks/log_id.c'; else $(CYGPATH_W) '$(srcdir)/hooks/log_id.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/log_id.Tpo $(DEPDIR)/log_id.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/log_id.c' object='log_id.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o log_id.obj `if test -f 'hooks/log_id.c'; then $(CYGPATH_W) 'hooks/log_id.c'; else $(CYGPATH_W) '$(srcdir)/hooks/log_id.c'; fi`
+
+custom_proposal.o: hooks/custom_proposal.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT custom_proposal.o -MD -MP -MF $(DEPDIR)/custom_proposal.Tpo -c -o custom_proposal.o `test -f 'hooks/custom_proposal.c' || echo '$(srcdir)/'`hooks/custom_proposal.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/custom_proposal.Tpo $(DEPDIR)/custom_proposal.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/custom_proposal.c' object='custom_proposal.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o custom_proposal.o `test -f 'hooks/custom_proposal.c' || echo '$(srcdir)/'`hooks/custom_proposal.c
+
+custom_proposal.obj: hooks/custom_proposal.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT custom_proposal.obj -MD -MP -MF $(DEPDIR)/custom_proposal.Tpo -c -o custom_proposal.obj `if test -f 'hooks/custom_proposal.c'; then $(CYGPATH_W) 'hooks/custom_proposal.c'; else $(CYGPATH_W) '$(srcdir)/hooks/custom_proposal.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/custom_proposal.Tpo $(DEPDIR)/custom_proposal.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/custom_proposal.c' object='custom_proposal.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o custom_proposal.obj `if test -f 'hooks/custom_proposal.c'; then $(CYGPATH_W) 'hooks/custom_proposal.c'; else $(CYGPATH_W) '$(srcdir)/hooks/custom_proposal.c'; fi`
+
+set_ike_spi.o: hooks/set_ike_spi.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT set_ike_spi.o -MD -MP -MF $(DEPDIR)/set_ike_spi.Tpo -c -o set_ike_spi.o `test -f 'hooks/set_ike_spi.c' || echo '$(srcdir)/'`hooks/set_ike_spi.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/set_ike_spi.Tpo $(DEPDIR)/set_ike_spi.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/set_ike_spi.c' object='set_ike_spi.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_ike_spi.o `test -f 'hooks/set_ike_spi.c' || echo '$(srcdir)/'`hooks/set_ike_spi.c
+
+set_ike_spi.obj: hooks/set_ike_spi.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT set_ike_spi.obj -MD -MP -MF $(DEPDIR)/set_ike_spi.Tpo -c -o set_ike_spi.obj `if test -f 'hooks/set_ike_spi.c'; then $(CYGPATH_W) 'hooks/set_ike_spi.c'; else $(CYGPATH_W) '$(srcdir)/hooks/set_ike_spi.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/set_ike_spi.Tpo $(DEPDIR)/set_ike_spi.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/set_ike_spi.c' object='set_ike_spi.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_ike_spi.obj `if test -f 'hooks/set_ike_spi.c'; then $(CYGPATH_W) 'hooks/set_ike_spi.c'; else $(CYGPATH_W) '$(srcdir)/hooks/set_ike_spi.c'; fi`
+
+set_ike_request.o: hooks/set_ike_request.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT set_ike_request.o -MD -MP -MF $(DEPDIR)/set_ike_request.Tpo -c -o set_ike_request.o `test -f 'hooks/set_ike_request.c' || echo '$(srcdir)/'`hooks/set_ike_request.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/set_ike_request.Tpo $(DEPDIR)/set_ike_request.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/set_ike_request.c' object='set_ike_request.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_ike_request.o `test -f 'hooks/set_ike_request.c' || echo '$(srcdir)/'`hooks/set_ike_request.c
+
+set_ike_request.obj: hooks/set_ike_request.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT set_ike_request.obj -MD -MP -MF $(DEPDIR)/set_ike_request.Tpo -c -o set_ike_request.obj `if test -f 'hooks/set_ike_request.c'; then $(CYGPATH_W) 'hooks/set_ike_request.c'; else $(CYGPATH_W) '$(srcdir)/hooks/set_ike_request.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/set_ike_request.Tpo $(DEPDIR)/set_ike_request.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/set_ike_request.c' object='set_ike_request.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_ike_request.obj `if test -f 'hooks/set_ike_request.c'; then $(CYGPATH_W) 'hooks/set_ike_request.c'; else $(CYGPATH_W) '$(srcdir)/hooks/set_ike_request.c'; fi`
+
+set_reserved.o: hooks/set_reserved.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT set_reserved.o -MD -MP -MF $(DEPDIR)/set_reserved.Tpo -c -o set_reserved.o `test -f 'hooks/set_reserved.c' || echo '$(srcdir)/'`hooks/set_reserved.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/set_reserved.Tpo $(DEPDIR)/set_reserved.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/set_reserved.c' object='set_reserved.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_reserved.o `test -f 'hooks/set_reserved.c' || echo '$(srcdir)/'`hooks/set_reserved.c
+
+set_reserved.obj: hooks/set_reserved.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT set_reserved.obj -MD -MP -MF $(DEPDIR)/set_reserved.Tpo -c -o set_reserved.obj `if test -f 'hooks/set_reserved.c'; then $(CYGPATH_W) 'hooks/set_reserved.c'; else $(CYGPATH_W) '$(srcdir)/hooks/set_reserved.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/set_reserved.Tpo $(DEPDIR)/set_reserved.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/set_reserved.c' object='set_reserved.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_reserved.obj `if test -f 'hooks/set_reserved.c'; then $(CYGPATH_W) 'hooks/set_reserved.c'; else $(CYGPATH_W) '$(srcdir)/hooks/set_reserved.c'; fi`
+
+set_ike_initiator.o: hooks/set_ike_initiator.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT set_ike_initiator.o -MD -MP -MF $(DEPDIR)/set_ike_initiator.Tpo -c -o set_ike_initiator.o `test -f 'hooks/set_ike_initiator.c' || echo '$(srcdir)/'`hooks/set_ike_initiator.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/set_ike_initiator.Tpo $(DEPDIR)/set_ike_initiator.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/set_ike_initiator.c' object='set_ike_initiator.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_ike_initiator.o `test -f 'hooks/set_ike_initiator.c' || echo '$(srcdir)/'`hooks/set_ike_initiator.c
+
+set_ike_initiator.obj: hooks/set_ike_initiator.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT set_ike_initiator.obj -MD -MP -MF $(DEPDIR)/set_ike_initiator.Tpo -c -o set_ike_initiator.obj `if test -f 'hooks/set_ike_initiator.c'; then $(CYGPATH_W) 'hooks/set_ike_initiator.c'; else $(CYGPATH_W) '$(srcdir)/hooks/set_ike_initiator.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/set_ike_initiator.Tpo $(DEPDIR)/set_ike_initiator.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/set_ike_initiator.c' object='set_ike_initiator.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_ike_initiator.obj `if test -f 'hooks/set_ike_initiator.c'; then $(CYGPATH_W) 'hooks/set_ike_initiator.c'; else $(CYGPATH_W) '$(srcdir)/hooks/set_ike_initiator.c'; fi`
+
+log_ts.o: hooks/log_ts.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT log_ts.o -MD -MP -MF $(DEPDIR)/log_ts.Tpo -c -o log_ts.o `test -f 'hooks/log_ts.c' || echo '$(srcdir)/'`hooks/log_ts.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/log_ts.Tpo $(DEPDIR)/log_ts.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/log_ts.c' object='log_ts.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o log_ts.o `test -f 'hooks/log_ts.c' || echo '$(srcdir)/'`hooks/log_ts.c
+
+log_ts.obj: hooks/log_ts.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT log_ts.obj -MD -MP -MF $(DEPDIR)/log_ts.Tpo -c -o log_ts.obj `if test -f 'hooks/log_ts.c'; then $(CYGPATH_W) 'hooks/log_ts.c'; else $(CYGPATH_W) '$(srcdir)/hooks/log_ts.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/log_ts.Tpo $(DEPDIR)/log_ts.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/log_ts.c' object='log_ts.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o log_ts.obj `if test -f 'hooks/log_ts.c'; then $(CYGPATH_W) 'hooks/log_ts.c'; else $(CYGPATH_W) '$(srcdir)/hooks/log_ts.c'; fi`
+
+rebuild_auth.o: hooks/rebuild_auth.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rebuild_auth.o -MD -MP -MF $(DEPDIR)/rebuild_auth.Tpo -c -o rebuild_auth.o `test -f 'hooks/rebuild_auth.c' || echo '$(srcdir)/'`hooks/rebuild_auth.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/rebuild_auth.Tpo $(DEPDIR)/rebuild_auth.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/rebuild_auth.c' object='rebuild_auth.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rebuild_auth.o `test -f 'hooks/rebuild_auth.c' || echo '$(srcdir)/'`hooks/rebuild_auth.c
+
+rebuild_auth.obj: hooks/rebuild_auth.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rebuild_auth.obj -MD -MP -MF $(DEPDIR)/rebuild_auth.Tpo -c -o rebuild_auth.obj `if test -f 'hooks/rebuild_auth.c'; then $(CYGPATH_W) 'hooks/rebuild_auth.c'; else $(CYGPATH_W) '$(srcdir)/hooks/rebuild_auth.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/rebuild_auth.Tpo $(DEPDIR)/rebuild_auth.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/rebuild_auth.c' object='rebuild_auth.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rebuild_auth.obj `if test -f 'hooks/rebuild_auth.c'; then $(CYGPATH_W) 'hooks/rebuild_auth.c'; else $(CYGPATH_W) '$(srcdir)/hooks/rebuild_auth.c'; fi`
+
+reset_seq.o: hooks/reset_seq.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT reset_seq.o -MD -MP -MF $(DEPDIR)/reset_seq.Tpo -c -o reset_seq.o `test -f 'hooks/reset_seq.c' || echo '$(srcdir)/'`hooks/reset_seq.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/reset_seq.Tpo $(DEPDIR)/reset_seq.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/reset_seq.c' object='reset_seq.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o reset_seq.o `test -f 'hooks/reset_seq.c' || echo '$(srcdir)/'`hooks/reset_seq.c
+
+reset_seq.obj: hooks/reset_seq.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT reset_seq.obj -MD -MP -MF $(DEPDIR)/reset_seq.Tpo -c -o reset_seq.obj `if test -f 'hooks/reset_seq.c'; then $(CYGPATH_W) 'hooks/reset_seq.c'; else $(CYGPATH_W) '$(srcdir)/hooks/reset_seq.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/reset_seq.Tpo $(DEPDIR)/reset_seq.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hooks/reset_seq.c' object='reset_seq.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o reset_seq.obj `if test -f 'hooks/reset_seq.c'; then $(CYGPATH_W) 'hooks/reset_seq.c'; else $(CYGPATH_W) '$(srcdir)/hooks/reset_seq.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(ipsecdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-ipsecPROGRAMS clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-ipsecPROGRAMS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-ipsecPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-ipsecPROGRAMS clean-libtool ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am \
+ install-ipsecPROGRAMS install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-ipsecPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/conftest/README b/src/conftest/README
new file mode 100644
index 000000000..e2156921f
--- /dev/null
+++ b/src/conftest/README
@@ -0,0 +1,315 @@
+
+
+ conftest - an IKEv2 conformance testing framework
+ =================================================
+
+
+1. Introduction
+---------------
+
+conftest is a conformance testing framework for IKEv2 and related protocols,
+based on the strongSwan IKEv2 daemon charon. It uses a specialized configuration
+and control front-end, but links against the mainstream strongSwan IKEv2 stack.
+
+The conftest framework can test other implementations of IKEv2 and related
+standards. It can inject or mangle packets to test the behavior of other
+implementations under certain conditions.
+
+2. Test suites
+--------------
+
+The framework can use different sets of conformance tests, called test suites.
+Each test suite contains a global suite configuration file, usually named
+suite.conf. It contains the global settings for all tests in this suite, mostly
+credentials and connection definitions.
+
+A test suite consists of several test cases. Each test has its own configuration
+file, often called test.conf. The test configuration file may contain test
+specific credentials and connection definitions, but primarily defines actions
+and hooks. Actions trigger certain protocol specific operations, such as
+initiating or terminating a tunnel. Hooks are used to change the behavior of
+the IKE stack, most likely to stress some factors of the IKE protocol and
+provoke unintended behavior in the tested platform.
+
+3. Configuration syntax
+-----------------------
+
+Both the suite and the test specific configuration file use the same syntax.
+It is the same as used by the strongswan.conf file used to configure the
+strongSwan software suite.
+
+The syntax is as follows:
+
+ settings := (section|keyvalue)*
+ section := name { settings }
+ keyvalue := key = value\n
+
+Settings contain zero or more sub-sections or key/value pairs. A section
+consists of a name, followed by curly open and close brackets. The value in the
+key/value pair starts after the equal sign and is terminated by the end of the
+line.
+
+The test specific configuration is merged to the suite configuration, resulting
+in a unified configuration. Sections are merged, keys in the test configuration
+overwrite existing identical keys in the suite configuration.
+
+4. Logging
+----------
+
+Logging verbosity can be controlled in the log section of a suite/test
+configuration. The stdout subsection takes logging facility/verbosity key
+value pairs, the different facility types are defined in debug_lower_names at
+src/libstrongswan/debug.c.
+Any other sub-section in the log section is considered as a file name to log
+to. Each section takes the same facility/verbosity keys as the special stdout
+section.
+
+5. Connections
+--------------
+
+Both the suite and test configuration may contain connection definitions under
+the configs section. Each IKE_SA configuration has a sub-section. Each IKE_SA
+sub-section contains one or more CHILD_SA configuration sub-sections:
+
+configs {
+ ike-a {
+ # ... ike options
+ child-a1 {
+ # ... child options
+ }
+ child-a2 {
+ # ...
+ }
+ }
+}
+
+Configuration names can be chosen arbitrary, but should be unique within the
+same file.
+
+The IKE_SA configuration uses the following options (as key/value pairs):
+
+ lhost: Address (IP or Hostname) of this host
+ rhost: Address (IP or Hostname) of tested host
+ lid: IKEv2 identifier of this host
+ rid: IKEv2 identifier of tested host
+ proposal: IKE_SA proposal list, comma separated, e.g.:
+ aes128-sha1-modp2048,3des-md5-sha1-modp1024-modp1536
+ Supported algorithm names are defined under
+ src/libstrongswan/crypt/proposal/proposal_keywords.txt
+ fake_nat: Fake the NAT_DETECTION_*_IP payloads to simulate a NAT
+ scenario
+ rsa_strength: connection requires a trustchain with RSA keys of given bits
+ ecdsa_strength: connection requires a trustchain with ECDSA keys of given bits
+ cert_policy: connection requries a certificate with the given OID policy
+
+The following CHILD_SA specific configuration options are supported:
+
+ lts: Local side traffic selectors, comma separated CIDR subnets
+ rts: Remote side traffic selectors, comma separated CIDR subnets
+ transport: Propose IPsec transport mode instead of tunnel mode
+ tfc_padding: Inject Traffic Flow Confidentialty bytes to align packets to the
+ given length
+
+6. Credentials
+--------------
+
+Credentials may be defined globally in the suite or locally in the test specific
+configuration file. Certificates files are defined in the certs section, either
+in the trusted or in the untrusted section. Trusted certificates are trust
+anchors, usually root CA certificates. Untrusted certificates do not build a
+trust anchor and usually contain intermediate or end entity certificates.
+
+Certificates files are loaded relative to the configuration file path and may
+be encoded either in plain ASN.1 DER or in PEM format. The prefix of the
+key/value pair is used to specify the type of the certificate, usually x509 or
+crl.
+
+Private keys can be defined in the suite or test config file under the keys
+section. The prefix of the key/value pair must be either rsa or ecdsa, the
+specified file may be encoded in ASN.1 DER or unencrypted PEM.
+
+certs {
+ trusted {
+ x509-a-ca = ca.pem
+ }
+ untrusted {
+ x509-me = /path/to/cert.pem
+ crl-from-ca = /path/to/crl.pem
+ }
+}
+keys {
+ ecdsa-me = /path/to/key.pem
+}
+
+7. Actions
+----------
+
+The actions section in the test specific configuration file defines
+the IKEv2 protocol actions to trigger. Currently, the following actions
+are supported and take these arguments (as key/value pairs):
+
+ initiate: Initiate an IKE- and CHILD_SA
+ config: name of the CHILD_SA configuration to initiate
+ delay: Delay to trigger action after startup
+ rekey_ike: Rekey an IKE_SA
+ config: name of originating IKE_SA configuration
+ delay: Delay to trigger action after startup
+ rekey_child: Rekey an CHILD_SA
+ config: name of originating CHILD_SA configuration
+ delay: Delay to trigger action after startup
+ liveness: Do a liveness check (DPD) on the IKE_SA
+ config: name of originating IKE_SA configuration
+ delay: Delay to trigger action after startup
+ close_ike: Close an IKE_SA
+ config: name of originating IKE_SA configuration
+ delay: Delay to trigger action after startup
+ close_child: Close a CHILD_SA
+ config: name of originating IKE_SA configuration
+ delay: Delay to trigger action after startup
+
+To trigger the same action multiple times, the action sections must be named
+uniquely. Append an arbitrary string to the action name. The following example
+initiates a connection and rekeys it twice:
+
+actions {
+ initiate {
+ config = child-a1
+ }
+ rekey_ike-1 {
+ config = ike-a
+ delay = 3
+ }
+ rekey_ike-2 {
+ config = ike-a
+ delay = 6
+ }
+}
+
+8. Hooks
+--------
+
+The hooks section section in the test configuration defines different hooks
+to use to mangle packets or trigger other protocol modifications. These
+hook functions are implemented in the hooks folder of conftest.
+
+Currently, the following hooks are defined with the following options:
+
+ add_notify: Add a notify to a message
+ request: yes to include in request, no in response
+ id: IKEv2 message identifier of message to add notify
+ type: notify type to add, names defined in notify_type_names
+ under src/libcharon/encoding/payloads/notify_payload.c
+ data: notification data to add, prepend 0x to interpret the
+ string as hex string
+ spi: SPI to use in notify
+ esp: yes to send an ESP protocol notify, no for IKE
+ add_payload: Add an arbitrary payload to a message
+ request: yes to include in request, no in response
+ id: IKEv2 message identifier of message to add payload
+ type: type of the payload to add, names defined in
+ payload_type_short_names in payload.c
+ data: data to append after generic payload header, use 0x
+ prefix for hex encoded data
+ critical: yes to set payload critical bit
+ replace: yes to replace an existing payload of the same type
+ custom_proposal: set a custom proposal value in the SA payload
+ request: yes to include in request, no in response
+ id: IKEv2 message identifier of message to add notify
+ The hook takes subsections with numerical names, each
+ defining a proposal substructure. The substructure
+ takes key/value pairs, where key defines the type, value
+ the specific algorithm.
+ force_cookie: Reject IKE_SA_INIT requests with a COOKIE
+ ignore_message: Ignore a specific message, simulating packet loss
+ inbound: yes to ignore incoming, no for outgoing messages
+ request: yes to ignore requests, no for responses
+ id: IKEv2 message identifier of message to ignore
+ ike_auth_fill: Fill up IKE_AUTH message to a given size using a CERT
+ payload.
+ request: yes to fill requests messages, no for responses
+ id: IKEv2 message identifier of message to fill up
+ bytes: number of bytes the final IKE_AUTH message should have
+ log_id: Comfortably log received ID payload contents
+ log_ke: Comfortably log received KE payload DH groups
+ log_proposal: Comfortably log all proposals received in SA payloads
+ log_ts: Comfortably log all received TS payloads
+ pretend_auth: magically reconstruct IKE_AUTH response even if
+ AUTHENTICATION_FAILED received
+ rebuild_auth: rebuild AUTH payload, i.e. if ID payload changed
+ reset_seq: Reset sequence numbers of an ESP SA
+ delay: Seconds to delay reset after SA established
+ set_critical: Set critical bit on existing payloads:
+ request: yes to set in request, no in response
+ id: IKEv2 message identifier of message to mangle payloads
+ payloads: space separated payload list to set critical bit on
+ set_ike_initiator: toggle IKE initiator flag in IKE header
+ request: yes to set in request, no in response
+ id: IKEv2 message identifier of message to mangle
+ set_ike_request: toggle IKE request flag in IKE header
+ request: yes to set in request, no in response
+ id: IKEv2 message identifier of message to mangle
+ set_ike_spi: set the IKE SPIs in IKE header
+ request: yes to set in request, no in response
+ id: IKEv2 message identifier of message to mangle
+ spii: initiator SPI to set (as decimal integer)
+ spir: responder SPI to set
+ set_ike_version: set version fields in IKE header
+ request: yes to set in request, no in response
+ id: IKEv2 message identifier of message to mangle
+ major: major version to set
+ minor: minor version to set
+ higher: yes to set Higher Version Supported flag
+ set_length: set the length in a payload header
+ request: yes to set in request, no in response
+ id: IKEv2 message identifier of message to mangle
+ type: payload type to mangle
+ diff: difference to add/remove from real length (+1,-3 etc.)
+ set_proposal_number:Change the number of a proposal in a SA payload
+ request: yes to set in request, no in response
+ id: IKEv2 message identifier of message to mangle
+ from: proposal number to mangle
+ to: new porposal number to set instead of from
+ set_reserved: set arbitrary reserved bits/bytes in payloads
+ request: yes to set in request, no in response
+ id: IKEv2 message identifier of message to mangle
+ The hook takes a list of subsection, each named as payload
+ type. Each section takes a bits and a bytes key, the
+ value is a comma separated list of decimal numbers of
+ bits/bytes to mangle (1 is the first reserved bit/byte
+ in the payload). The byteval key defines to which value
+ set mangled bytes in the byte list.
+ unencrypted_notify: Send an unencrypted message with a notify after
+ establishing an IKE_SA
+ id: IKEv2 message identifier of message to send
+ type: notify type to add, names defined in notify_type_names
+ under src/libcharon/encoding/payloads/notify_payload.c
+ data: notification data to add, prepend 0x to interpret the
+ string as hex string
+ spi: SPI to use in notify
+ esp: yes to send an ESP protocol notify, no for IKE
+ unsort_message: reorder the payloads in a message
+ request: yes to reorder requests messages, no for responses
+ id: IKEv2 message identifier of message to reorder
+ order: payload order, space separated payload names as defined
+ in payload_type_short_names under
+ src/libcharon/encoding/payloads/payload.c
+
+9. Invoking
+-----------
+
+Compile time options required depend on the test suite. A minimalistic
+strongSwan build with the OpenSSL crypto backend can be configured with:
+
+./configure --sysconfdir=/etc --disable-pluto --disable-scripts \
+ --disable-tools --disable-aes --disable-des --disable-md5 \
+ --disable-sha1 --disable-sha2 --disable-fips-prf --disable-gmp \
+ --disable-pubkey --disable-pgp --disable-dnskey --disable-updown \
+ --disable-attr --disable-resolve --enable-openssl --enable-conftest \
+ --enable-gcm --enable-ccm --enable-ctr
+
+The conftest utility is installed by default under /usr/local/libexec/ipsec/,
+but can be invoked with the ipsec helper script. It takes a suite specific
+configuration file after the --suite option and a test specific file with
+the --test option:
+
+ ipsec conftest --suite suite.conf --test 1.1.1/test.conf
diff --git a/src/conftest/actions.c b/src/conftest/actions.c
new file mode 100644
index 000000000..e66e9d7f1
--- /dev/null
+++ b/src/conftest/actions.c
@@ -0,0 +1,339 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "actions.h"
+#include "conftest.h"
+
+#include <daemon.h>
+#include <processing/jobs/callback_job.h>
+#include <processing/jobs/rekey_ike_sa_job.h>
+#include <processing/jobs/rekey_child_sa_job.h>
+#include <processing/jobs/send_dpd_job.h>
+
+typedef struct private_actions_t private_actions_t;
+
+/**
+ * Private data of an actions_t object.
+ */
+struct private_actions_t {
+
+ /**
+ * Public actions_t interface.
+ */
+ actions_t public;
+};
+
+/**
+ * Initiate a CHILD_SA
+ */
+static job_requeue_t initiate(char *config)
+{
+ peer_cfg_t *peer_cfg;
+ child_cfg_t *child_cfg = NULL, *current;
+ enumerator_t *enumerator;
+
+ peer_cfg = charon->backends->get_peer_cfg_by_name(charon->backends, config);
+ if (!peer_cfg)
+ {
+ DBG1(DBG_CFG, "initiating '%s' failed, config not found", config);
+ return JOB_REQUEUE_NONE;
+ }
+ enumerator = peer_cfg->create_child_cfg_enumerator(peer_cfg);
+ while (enumerator->enumerate(enumerator, &current))
+ {
+ if (streq(current->get_name(current), config))
+ {
+ child_cfg = current;
+ child_cfg->get_ref(child_cfg);
+ break;
+ }
+ }
+ enumerator->destroy(enumerator);
+ if (child_cfg)
+ {
+ DBG1(DBG_CFG, "initiating IKE_SA for CHILD_SA config '%s'", config);
+ charon->controller->initiate(charon->controller, peer_cfg, child_cfg,
+ NULL, NULL);
+ }
+ else
+ {
+ DBG1(DBG_CFG, "initiating '%s' failed, CHILD_SA config not found",
+ config);
+ }
+
+ return JOB_REQUEUE_NONE;
+}
+
+/**
+ * Rekey an IKE_SA
+ */
+static job_requeue_t rekey_ike(char *config)
+{
+ enumerator_t *enumerator;
+ job_t *job = NULL;
+ ike_sa_t *ike_sa;
+
+ enumerator = charon->controller->create_ike_sa_enumerator(charon->controller);
+ while (enumerator->enumerate(enumerator, &ike_sa))
+ {
+ if (strcaseeq(config, ike_sa->get_name(ike_sa)))
+ {
+ job = (job_t*)rekey_ike_sa_job_create(ike_sa->get_id(ike_sa), FALSE);
+ break;
+ }
+ }
+ enumerator->destroy(enumerator);
+
+ if (job)
+ {
+ DBG1(DBG_CFG, "starting rekey of IKE_SA '%s'", config);
+ lib->processor->queue_job(lib->processor, job);
+ }
+ else
+ {
+ DBG1(DBG_CFG, "rekeying '%s' failed, IKE_SA not found", config);
+ }
+ return JOB_REQUEUE_NONE;
+}
+
+/**
+ * Rekey an CHILD_SA
+ */
+static job_requeue_t rekey_child(char *config)
+{
+ enumerator_t *enumerator;
+ iterator_t *children;
+ ike_sa_t *ike_sa;
+ child_sa_t *child_sa;
+ u_int32_t reqid = 0, spi = 0;
+ protocol_id_t proto = PROTO_ESP;
+
+ enumerator = charon->controller->create_ike_sa_enumerator(charon->controller);
+ while (enumerator->enumerate(enumerator, &ike_sa))
+ {
+ children = ike_sa->create_child_sa_iterator(ike_sa);
+ while (children->iterate(children, (void**)&child_sa))
+ {
+ if (streq(config, child_sa->get_name(child_sa)))
+ {
+ reqid = child_sa->get_reqid(child_sa);
+ proto = child_sa->get_protocol(child_sa);
+ spi = child_sa->get_spi(child_sa, TRUE);
+ break;
+ }
+ }
+ children->destroy(children);
+ }
+ enumerator->destroy(enumerator);
+ if (reqid)
+ {
+ DBG1(DBG_CFG, "starting rekey of CHILD_SA '%s'", config);
+ lib->processor->queue_job(lib->processor,
+ (job_t*)rekey_child_sa_job_create(reqid, proto, spi));
+ }
+ else
+ {
+ DBG1(DBG_CFG, "rekeying '%s' failed, CHILD_SA not found", config);
+ }
+ return JOB_REQUEUE_NONE;
+}
+
+/**
+ * Do a liveness check
+ */
+static job_requeue_t liveness(char *config)
+{
+ enumerator_t *enumerator;
+ job_t *job = NULL;
+ ike_sa_t *ike_sa;
+
+ enumerator = charon->controller->create_ike_sa_enumerator(charon->controller);
+ while (enumerator->enumerate(enumerator, &ike_sa))
+ {
+ if (strcaseeq(config, ike_sa->get_name(ike_sa)))
+ {
+ job = (job_t*)send_dpd_job_create(ike_sa->get_id(ike_sa));
+ break;
+ }
+ }
+ enumerator->destroy(enumerator);
+
+ if (job)
+ {
+ DBG1(DBG_CFG, "starting liveness check of IKE_SA '%s'", config);
+ lib->processor->queue_job(lib->processor, job);
+ }
+ else
+ {
+ DBG1(DBG_CFG, "liveness check for '%s' failed, IKE_SA not found", config);
+ }
+ return JOB_REQUEUE_NONE;
+}
+
+/**
+ * Close an IKE_SA with all CHILD_SAs
+ */
+static job_requeue_t close_ike(char *config)
+{
+ enumerator_t *enumerator;
+ ike_sa_t *ike_sa;
+ int id = 0;
+
+ enumerator = charon->controller->create_ike_sa_enumerator(charon->controller);
+ while (enumerator->enumerate(enumerator, &ike_sa))
+ {
+ if (strcaseeq(config, ike_sa->get_name(ike_sa)))
+ {
+ id = ike_sa->get_unique_id(ike_sa);
+ break;
+ }
+ }
+ enumerator->destroy(enumerator);
+ if (id)
+ {
+ DBG1(DBG_CFG, "closing IKE_SA '%s'", config);
+ charon->controller->terminate_ike(charon->controller, id, NULL, NULL);
+ }
+ else
+ {
+ DBG1(DBG_CFG, "unable to close IKE_SA '%s', not found", config);
+ }
+ return JOB_REQUEUE_NONE;
+}
+
+/**
+ * Close a CHILD_SAs
+ */
+static job_requeue_t close_child(char *config)
+{
+ enumerator_t *enumerator;
+ iterator_t *children;
+ ike_sa_t *ike_sa;
+ child_sa_t *child_sa;
+ int id = 0;
+
+ enumerator = charon->controller->create_ike_sa_enumerator(charon->controller);
+ while (enumerator->enumerate(enumerator, &ike_sa))
+ {
+
+ children = ike_sa->create_child_sa_iterator(ike_sa);
+ while (children->iterate(children, (void**)&child_sa))
+ {
+ if (streq(config, child_sa->get_name(child_sa)))
+ {
+ id = child_sa->get_reqid(child_sa);
+ break;
+ }
+ }
+ children->destroy(children);
+ }
+ enumerator->destroy(enumerator);
+ if (id)
+ {
+ DBG1(DBG_CFG, "closing CHILD_SA '%s'", config);
+ charon->controller->terminate_child(charon->controller, id, NULL, NULL);
+ }
+ else
+ {
+ DBG1(DBG_CFG, "unable to close CHILD_SA '%s', not found", config);
+ }
+ return JOB_REQUEUE_NONE;
+}
+
+/**
+ * Load a single action
+ */
+static void load_action(settings_t *settings, char *action)
+{
+ static struct {
+ char *name;
+ callback_job_cb_t cb;
+ } actions[] = {
+ {"initiate", (void*)initiate},
+ {"rekey_ike", (void*)rekey_ike},
+ {"rekey_child", (void*)rekey_child},
+ {"liveness", (void*)liveness},
+ {"close_ike", (void*)close_ike},
+ {"close_child", (void*)close_child},
+ };
+ bool found = FALSE;
+ int i;
+
+ for (i = 0; i < countof(actions); i++)
+ {
+ if (strncaseeq(actions[i].name, action, strlen(actions[i].name)))
+ {
+ int delay;
+ char *config;
+
+ found = TRUE;
+ delay = settings->get_int(settings, "actions.%s.delay", 0, action);
+ config = settings->get_str(settings, "actions.%s.config",
+ NULL, action);
+ if (!config)
+ {
+ DBG1(DBG_CFG, "no config defined for action '%s'", action);
+ break;
+ }
+ lib->scheduler->schedule_job(lib->scheduler,
+ (job_t*)callback_job_create(actions[i].cb, config, NULL, NULL),
+ delay);
+ }
+ }
+ if (!found)
+ {
+ DBG1(DBG_CFG, "unknown action '%s', skipped", action);
+ }
+}
+
+/**
+ * Load configured actions
+ */
+static void load_actions(settings_t *settings)
+{
+ enumerator_t *enumerator;
+ char *action;
+
+ enumerator = settings->create_section_enumerator(settings, "actions");
+ while (enumerator->enumerate(enumerator, &action))
+ {
+ load_action(settings, action);
+ }
+ enumerator->destroy(enumerator);
+}
+
+METHOD(actions_t, destroy, void,
+ private_actions_t *this)
+{
+ free(this);
+}
+
+/**
+ * See header
+ */
+actions_t *actions_create()
+{
+ private_actions_t *this;
+
+ INIT(this,
+ .public = {
+ .destroy = _destroy,
+ },
+ );
+
+ load_actions(conftest->test);
+
+ return &this->public;
+}
diff --git a/src/conftest/actions.h b/src/conftest/actions.h
new file mode 100644
index 000000000..2e1cbbacd
--- /dev/null
+++ b/src/conftest/actions.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+/**
+ * @defgroup actions actions
+ * @{ @ingroup conftest
+ */
+
+#ifndef ACTIONS_H_
+#define ACTIONS_H_
+
+typedef struct actions_t actions_t;
+
+/**
+ * actionss to trigger based on configuration.
+ */
+struct actions_t {
+
+ /**
+ * Destroy a actions_t.
+ */
+ void (*destroy)(actions_t *this);
+};
+
+/**
+ * Create a actions instance.
+ */
+actions_t *actions_create();
+
+#endif /** ACTIONS_H_ @}*/
diff --git a/src/conftest/config.c b/src/conftest/config.c
new file mode 100644
index 000000000..952141211
--- /dev/null
+++ b/src/conftest/config.c
@@ -0,0 +1,343 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "config.h"
+
+#include <daemon.h>
+#include <conftest.h>
+
+typedef struct private_config_t private_config_t;
+
+/**
+ * Private data of an config_t object.
+ */
+struct private_config_t {
+
+ /**
+ * Public config_t interface.
+ */
+ config_t public;
+
+ /**
+ * List of loaded peer configs
+ */
+ linked_list_t *configs;
+};
+
+/**
+ * filter function for ike configs
+ */
+static bool ike_filter(void *data, peer_cfg_t **in, ike_cfg_t **out)
+{
+ *out = (*in)->get_ike_cfg(*in);
+ return TRUE;
+}
+
+METHOD(backend_t, create_ike_cfg_enumerator, enumerator_t*,
+ private_config_t *this, host_t *me, host_t *other)
+{
+
+ return enumerator_create_filter(
+ this->configs->create_enumerator(this->configs),
+ (void*)ike_filter, NULL, NULL);
+}
+
+METHOD(backend_t, create_peer_cfg_enumerator, enumerator_t*,
+ private_config_t *this, identification_t *me, identification_t *other)
+{
+ return this->configs->create_enumerator(this->configs);
+}
+
+METHOD(backend_t, get_peer_cfg_by_name, peer_cfg_t*,
+ private_config_t *this, char *name)
+{
+ enumerator_t *e1, *e2;
+ peer_cfg_t *current, *found = NULL;
+ child_cfg_t *child;
+
+ e1 = this->configs->create_enumerator(this->configs);
+ while (e1->enumerate(e1, &current))
+ {
+ e2 = current->create_child_cfg_enumerator(current);
+ while (e2->enumerate(e2, &child))
+ {
+ if (streq(child->get_name(child), name))
+ {
+ found = current;
+ found->get_ref(found);
+ break;
+ }
+ }
+ e2->destroy(e2);
+ if (found)
+ {
+ break;
+ }
+ }
+ e1->destroy(e1);
+ return found;
+}
+
+/**
+ * Load IKE config for a given section name
+ */
+static ike_cfg_t *load_ike_config(private_config_t *this,
+ settings_t *settings, char *config)
+{
+ enumerator_t *enumerator;
+ ike_cfg_t *ike_cfg;
+ proposal_t *proposal;
+ char *token;
+
+ ike_cfg = ike_cfg_create(TRUE,
+ settings->get_bool(settings, "configs.%s.fake_nat", FALSE, config),
+ settings->get_str(settings, "configs.%s.lhost", "%any", config),
+ settings->get_int(settings, "configs.%s.lport", 500, config),
+ settings->get_str(settings, "configs.%s.rhost", "%any", config),
+ settings->get_int(settings, "configs.%s.rport", 500, config));
+ token = settings->get_str(settings, "configs.%s.proposal", NULL, config);
+ if (token)
+ {
+ enumerator = enumerator_create_token(token, ",", " ");
+ while (enumerator->enumerate(enumerator, &token))
+ {
+ proposal = proposal_create_from_string(PROTO_IKE, token);
+ if (proposal)
+ {
+ ike_cfg->add_proposal(ike_cfg, proposal);
+ }
+ else
+ {
+ DBG1(DBG_CFG, "parsing proposal '%s' failed, skipped", token);
+ }
+ }
+ enumerator->destroy(enumerator);
+ }
+ else
+ {
+ ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE));
+ }
+ return ike_cfg;
+}
+/**
+ * Load CHILD config for given section names
+ */
+static child_cfg_t *load_child_config(private_config_t *this,
+ settings_t *settings, char *config, char *child)
+{
+ child_cfg_t *child_cfg;
+ lifetime_cfg_t lifetime = {};
+ enumerator_t *enumerator;
+ proposal_t *proposal;
+ traffic_selector_t *ts;
+ ipsec_mode_t mode = MODE_TUNNEL;
+ host_t *net;
+ char *token;
+ int bits;
+ u_int32_t tfc;
+
+ if (settings->get_bool(settings, "configs.%s.%s.transport",
+ FALSE, config, child))
+ {
+ mode = MODE_TRANSPORT;
+ }
+ tfc = settings->get_int(settings, "configs.%s.%s.tfc_padding",
+ 0, config, child);
+ child_cfg = child_cfg_create(child, &lifetime, NULL, FALSE, mode,
+ ACTION_NONE, ACTION_NONE, ACTION_NONE,
+ FALSE, 0, 0, NULL, NULL, tfc);
+
+ token = settings->get_str(settings, "configs.%s.%s.proposal",
+ NULL, config, child);
+ if (token)
+ {
+ enumerator = enumerator_create_token(token, ",", " ");
+ while (enumerator->enumerate(enumerator, &token))
+ {
+ proposal = proposal_create_from_string(PROTO_ESP, token);
+ if (proposal)
+ {
+ child_cfg->add_proposal(child_cfg, proposal);
+ }
+ else
+ {
+ DBG1(DBG_CFG, "parsing proposal '%s' failed, skipped", token);
+ }
+ }
+ enumerator->destroy(enumerator);
+ }
+ else
+ {
+ child_cfg->add_proposal(child_cfg, proposal_create_default(PROTO_ESP));
+ }
+
+ token = settings->get_str(settings, "configs.%s.%s.lts", NULL, config);
+ if (token)
+ {
+ enumerator = enumerator_create_token(token, ",", " ");
+ while (enumerator->enumerate(enumerator, &token))
+ {
+ net = host_create_from_subnet(token, &bits);
+ if (net)
+ {
+ ts = traffic_selector_create_from_subnet(net, bits, 0, 0);
+ child_cfg->add_traffic_selector(child_cfg, TRUE, ts);
+ }
+ else
+ {
+ DBG1(DBG_CFG, "invalid local ts: %s, skipped", token);
+ }
+ }
+ enumerator->destroy(enumerator);
+ }
+ else
+ {
+ ts = traffic_selector_create_dynamic(0, 0, 65535);
+ child_cfg->add_traffic_selector(child_cfg, TRUE, ts);
+ }
+
+ token = settings->get_str(settings, "configs.%s.%s.rts", NULL, config);
+ if (token)
+ {
+ enumerator = enumerator_create_token(token, ",", " ");
+ while (enumerator->enumerate(enumerator, &token))
+ {
+ net = host_create_from_subnet(token, &bits);
+ if (net)
+ {
+ ts = traffic_selector_create_from_subnet(net, bits, 0, 0);
+ child_cfg->add_traffic_selector(child_cfg, FALSE, ts);
+ }
+ else
+ {
+ DBG1(DBG_CFG, "invalid remote ts: %s, skipped", token);
+ }
+ }
+ enumerator->destroy(enumerator);
+ }
+ else
+ {
+ ts = traffic_selector_create_dynamic(0, 0, 65535);
+ child_cfg->add_traffic_selector(child_cfg, FALSE, ts);
+ }
+ return child_cfg;
+}
+
+/**
+ * Load peer config for a given section name
+ */
+static peer_cfg_t *load_peer_config(private_config_t *this,
+ settings_t *settings, char *config)
+{
+ ike_cfg_t *ike_cfg;
+ peer_cfg_t *peer_cfg;
+ auth_cfg_t *auth;
+ child_cfg_t *child_cfg;
+ enumerator_t *enumerator;
+ identification_t *lid, *rid;
+ char *child, *policy;
+ uintptr_t strength;
+
+ ike_cfg = load_ike_config(this, settings, config);
+ peer_cfg = peer_cfg_create(config, 2, ike_cfg, CERT_ALWAYS_SEND,
+ UNIQUE_NO, 1, 0, 0, 0, 0, FALSE, 0,
+ NULL, NULL, FALSE, NULL, NULL);
+
+ auth = auth_cfg_create();
+ auth->add(auth, AUTH_RULE_AUTH_CLASS, AUTH_CLASS_PUBKEY);
+ lid = identification_create_from_string(
+ settings->get_str(settings, "configs.%s.lid", "%any", config));
+ auth->add(auth, AUTH_RULE_IDENTITY, lid);
+ peer_cfg->add_auth_cfg(peer_cfg, auth, TRUE);
+
+ auth = auth_cfg_create();
+ auth->add(auth, AUTH_RULE_AUTH_CLASS, AUTH_CLASS_PUBKEY);
+ rid = identification_create_from_string(
+ settings->get_str(settings, "configs.%s.rid", "%any", config));
+ strength = settings->get_int(settings, "configs.%s.rsa_strength", 0);
+ if (strength)
+ {
+ auth->add(auth, AUTH_RULE_RSA_STRENGTH, strength);
+ }
+ strength = settings->get_int(settings, "configs.%s.ecdsa_strength", 0);
+ if (strength)
+ {
+ auth->add(auth, AUTH_RULE_ECDSA_STRENGTH, strength);
+ }
+ policy = settings->get_str(settings, "configs.%s.cert_policy", NULL, config);
+ if (policy)
+ {
+ auth->add(auth, AUTH_RULE_CERT_POLICY, strdup(policy));
+ }
+ auth->add(auth, AUTH_RULE_IDENTITY, rid);
+ peer_cfg->add_auth_cfg(peer_cfg, auth, FALSE);
+
+ DBG1(DBG_CFG, "loaded config %s: %Y - %Y", config, lid, rid);
+
+ enumerator = settings->create_section_enumerator(settings,
+ "configs.%s", config);
+ while (enumerator->enumerate(enumerator, &child))
+ {
+ child_cfg = load_child_config(this, settings, config, child);
+ peer_cfg->add_child_cfg(peer_cfg, child_cfg);
+ }
+ enumerator->destroy(enumerator);
+ return peer_cfg;
+}
+
+METHOD(config_t, load, void,
+ private_config_t *this, settings_t *settings)
+{
+ enumerator_t *enumerator;
+ char *config;
+
+ enumerator = settings->create_section_enumerator(settings, "configs");
+ while (enumerator->enumerate(enumerator, &config))
+ {
+ this->configs->insert_last(this->configs,
+ load_peer_config(this, settings, config));
+ }
+ enumerator->destroy(enumerator);
+}
+
+METHOD(config_t, destroy, void,
+ private_config_t *this)
+{
+ this->configs->destroy_offset(this->configs, offsetof(peer_cfg_t, destroy));
+ free(this);
+}
+
+/**
+ * See header
+ */
+config_t *config_create()
+{
+ private_config_t *this;
+
+ INIT(this,
+ .public = {
+ .backend = {
+ .create_ike_cfg_enumerator = _create_ike_cfg_enumerator,
+ .create_peer_cfg_enumerator = _create_peer_cfg_enumerator,
+ .get_peer_cfg_by_name = _get_peer_cfg_by_name,
+ },
+ .load = _load,
+ .destroy = _destroy,
+ },
+ .configs = linked_list_create(),
+ );
+
+ return &this->public;
+}
diff --git a/src/conftest/config.h b/src/conftest/config.h
new file mode 100644
index 000000000..2a62b9ce0
--- /dev/null
+++ b/src/conftest/config.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+/**
+ * @defgroup config config
+ * @{ @ingroup conftest
+ */
+
+#ifndef CONFIG_H_
+#define CONFIG_H_
+
+typedef struct config_t config_t;
+
+#include <config/backend.h>
+
+/**
+ * Conftest IKE and CHILD config backend
+ */
+struct config_t {
+
+ /**
+ * Implements the backend_t interface.
+ */
+ backend_t backend;
+
+ /**
+ * Load configurations from a settings file.
+ *
+ * @param settings settings file to load configs from
+ */
+ void (*load)(config_t *this, settings_t *settings);
+
+ /**
+ * Destroy a config_t.
+ */
+ void (*destroy)(config_t *this);
+};
+
+/**
+ * Create a config instance.
+ */
+config_t *config_create();
+
+#endif /** CONFIG_H_ @}*/
diff --git a/src/conftest/conftest.c b/src/conftest/conftest.c
new file mode 100644
index 000000000..fea88818e
--- /dev/null
+++ b/src/conftest/conftest.c
@@ -0,0 +1,550 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#define _GNU_SOURCE
+#include <unistd.h>
+#include <stdio.h>
+#include <errno.h>
+#include <signal.h>
+#include <getopt.h>
+#include <dlfcn.h>
+#include <libgen.h>
+
+#include "conftest.h"
+#include "config.h"
+#include "hooks/hook.h"
+
+#include <threading/thread.h>
+#include <credentials/certificates/x509.h>
+
+/**
+ * Conftest globals struct
+ */
+conftest_t *conftest;
+
+/**
+ * Print usage information
+ */
+static void usage(FILE *out)
+{
+ fprintf(out, "Usage:\n");
+ fprintf(out, " --help show usage information\n");
+ fprintf(out, " --version show conftest version\n");
+ fprintf(out, " --suite <file> global testsuite configuration "
+ "(default: ./suite.conf)\n");
+ fprintf(out, " --test <file> test specific configuration\n");
+}
+
+/**
+ * Handle SIGSEGV/SIGILL signals raised by threads
+ */
+static void segv_handler(int signal)
+{
+ fprintf(stderr, "thread %u received %d\n", thread_current_id(), signal);
+ abort();
+}
+
+/**
+ * Load suite and test specific configurations
+ */
+static bool load_configs(char *suite_file, char *test_file)
+{
+ if (!test_file)
+ {
+ fprintf(stderr, "Missing test configuration file.\n");
+ return FALSE;
+ }
+ if (access(suite_file, R_OK) != 0)
+ {
+ fprintf(stderr, "Reading suite configuration file '%s' failed: %s.\n",
+ suite_file, strerror(errno));
+ return FALSE;
+ }
+ if (access(test_file, R_OK) != 0)
+ {
+ fprintf(stderr, "Reading test configuration file '%s' failed: %s.\n",
+ test_file, strerror(errno));
+ return FALSE;
+ }
+ conftest->test = settings_create(suite_file);
+ conftest->test->load_files(conftest->test, test_file);
+ conftest->suite_dir = strdup(dirname(suite_file));
+ return TRUE;
+}
+
+/**
+ * Load trusted/untrusted certificates
+ */
+static bool load_cert(settings_t *settings, bool trusted)
+{
+ enumerator_t *enumerator;
+ char *key, *value;
+
+ enumerator = settings->create_key_value_enumerator(settings,
+ trusted ? "certs.trusted" : "certs.untrusted");
+ while (enumerator->enumerate(enumerator, &key, &value))
+ {
+ certificate_t *cert = NULL;
+
+ if (strncaseeq(key, "x509", strlen("x509")))
+ {
+ cert = lib->creds->create(lib->creds, CRED_CERTIFICATE,
+ CERT_X509, BUILD_FROM_FILE, value, BUILD_END);
+ }
+ else if (strncaseeq(key, "crl", strlen("crl")))
+ {
+ cert = lib->creds->create(lib->creds, CRED_CERTIFICATE,
+ CERT_X509_CRL, BUILD_FROM_FILE, value, BUILD_END);
+ }
+ else
+ {
+ fprintf(stderr, "certificate type '%s' not supported\n", key);
+ enumerator->destroy(enumerator);
+ return FALSE;
+ }
+ if (!cert)
+ {
+ fprintf(stderr, "loading %strusted certificate '%s' from '%s' "
+ "failed\n", trusted ? "" : "un", key, value);
+ enumerator->destroy(enumerator);
+ return FALSE;
+ }
+ conftest->creds->add_cert(conftest->creds, trusted, cert);
+ }
+ enumerator->destroy(enumerator);
+ return TRUE;
+}
+
+/**
+ * Load certificates from the confiuguration file
+ */
+static bool load_certs(settings_t *settings, char *dir)
+{
+ char wd[PATH_MAX];
+
+ if (getcwd(wd, sizeof(wd)) == NULL)
+ {
+ fprintf(stderr, "getting cwd failed: %s\n", strerror(errno));
+ return FALSE;
+ }
+ if (chdir(dir) != 0)
+ {
+ fprintf(stderr, "opening directory '%s' failed: %s\n",
+ dir, strerror(errno));
+ return FALSE;
+ }
+
+ if (!load_cert(settings, TRUE) ||
+ !load_cert(settings, FALSE))
+ {
+ return FALSE;
+ }
+
+ if (chdir(wd) != 0)
+ {
+ fprintf(stderr, "opening directory '%s' failed: %s\n",
+ wd, strerror(errno));
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/**
+ * Load private keys from the confiuguration file
+ */
+static bool load_keys(settings_t *settings, char *dir)
+{
+ enumerator_t *enumerator;
+ char *type, *value, wd[PATH_MAX];
+ private_key_t *key;
+ key_type_t key_type;
+
+ if (getcwd(wd, sizeof(wd)) == NULL)
+ {
+ fprintf(stderr, "getting cwd failed: %s\n", strerror(errno));
+ return FALSE;
+ }
+ if (chdir(dir) != 0)
+ {
+ fprintf(stderr, "opening directory '%s' failed: %s\n",
+ dir, strerror(errno));
+ return FALSE;
+ }
+
+ enumerator = settings->create_key_value_enumerator(settings, "keys");
+ while (enumerator->enumerate(enumerator, &type, &value))
+ {
+ if (strncaseeq(type, "ecdsa", strlen("ecdsa")))
+ {
+ key_type = KEY_ECDSA;
+ }
+ else if (strncaseeq(type, "rsa", strlen("rsa")))
+ {
+ key_type = KEY_RSA;
+ }
+ else
+ {
+ fprintf(stderr, "unknown key type: '%s'\n", type);
+ enumerator->destroy(enumerator);
+ return FALSE;
+ }
+ key = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, key_type,
+ BUILD_FROM_FILE, value, BUILD_END);
+ if (!key)
+ {
+ fprintf(stderr, "loading %s key from '%s' failed\n", type, value);
+ enumerator->destroy(enumerator);
+ return FALSE;
+ }
+ conftest->creds->add_key(conftest->creds, key);
+ }
+ enumerator->destroy(enumerator);
+
+ if (chdir(wd) != 0)
+ {
+ fprintf(stderr, "opening directory '%s' failed: %s\n",
+ wd, strerror(errno));
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/**
+ * Load certificate distribution points
+ */
+static void load_cdps(settings_t *settings)
+{
+ enumerator_t *enumerator;
+ identification_t *id;
+ char *ca, *uri, *section;
+ certificate_type_t type;
+ x509_t *x509;
+
+ enumerator = settings->create_section_enumerator(settings, "cdps");
+ while (enumerator->enumerate(enumerator, &section))
+ {
+ if (strncaseeq(section, "crl", strlen("crl")))
+ {
+ type = CERT_X509_CRL;
+ }
+ else if (strncaseeq(section, "ocsp", strlen("ocsp")))
+ {
+ type = CERT_X509_OCSP_RESPONSE;
+ }
+ else
+ {
+ fprintf(stderr, "unknown cdp type '%s', ignored\n", section);
+ continue;
+ }
+
+ uri = settings->get_str(settings, "cdps.%s.uri", NULL, section);
+ ca = settings->get_str(settings, "cdps.%s.ca", NULL, section);
+ if (!ca || !uri)
+ {
+ fprintf(stderr, "cdp '%s' misses ca/uri, ignored\n", section);
+ continue;
+ }
+ x509 = lib->creds->create(lib->creds, CRED_CERTIFICATE,
+ CERT_X509, BUILD_FROM_FILE, ca, BUILD_END);
+ if (!x509)
+ {
+ fprintf(stderr, "loading cdp '%s' ca failed, ignored\n", section);
+ continue;
+ }
+ id = identification_create_from_encoding(ID_KEY_ID,
+ x509->get_subjectKeyIdentifier(x509));
+ conftest->creds->add_cdp(conftest->creds, type, id, uri);
+ DESTROY_IF((certificate_t*)x509);
+ id->destroy(id);
+ }
+ enumerator->destroy(enumerator);
+}
+
+/**
+ * Load configured hooks
+ */
+static bool load_hooks()
+{
+ enumerator_t *enumerator;
+ char *name, *pos, buf[64];
+ hook_t *(*create)(char*);
+ hook_t *hook;
+
+ enumerator = conftest->test->create_section_enumerator(conftest->test,
+ "hooks");
+ while (enumerator->enumerate(enumerator, &name))
+ {
+ pos = strchr(name, '-');
+ if (pos)
+ {
+ snprintf(buf, sizeof(buf), "%.*s_hook_create", pos - name, name);
+ }
+ else
+ {
+ snprintf(buf, sizeof(buf), "%s_hook_create", name);
+ }
+ create = dlsym(RTLD_DEFAULT, buf);
+ if (create)
+ {
+ hook = create(name);
+ if (hook)
+ {
+ conftest->hooks->insert_last(conftest->hooks, hook);
+ charon->bus->add_listener(charon->bus, &hook->listener);
+ }
+ }
+ else
+ {
+ fprintf(stderr, "dlsym() for hook '%s' failed: %s\n", name, dlerror());
+ enumerator->destroy(enumerator);
+ return FALSE;
+ }
+ }
+ enumerator->destroy(enumerator);
+ return TRUE;
+}
+
+/**
+ * atexit() cleanup handler
+ */
+static void cleanup()
+{
+ hook_t *hook;
+
+ DESTROY_IF(conftest->test);
+ lib->credmgr->remove_set(lib->credmgr, &conftest->creds->set);
+ conftest->creds->destroy(conftest->creds);
+ DESTROY_IF(conftest->actions);
+ while (conftest->hooks->remove_last(conftest->hooks,
+ (void**)&hook) == SUCCESS)
+ {
+ charon->bus->remove_listener(charon->bus, &hook->listener);
+ hook->destroy(hook);
+ }
+ conftest->hooks->destroy(conftest->hooks);
+ if (conftest->config)
+ {
+ if (charon->backends)
+ {
+ charon->backends->remove_backend(charon->backends,
+ &conftest->config->backend);
+ }
+ conftest->config->destroy(conftest->config);
+ }
+ free(conftest->suite_dir);
+ free(conftest);
+ libcharon_deinit();
+ libhydra_deinit();
+ library_deinit();
+}
+
+/**
+ * Load log levels for a logger from section
+ */
+static void load_log_levels(file_logger_t *logger, char *section)
+{
+ debug_t group;
+ level_t def;
+
+ def = conftest->test->get_int(conftest->test, "log.%s.default", 1, section);
+ for (group = 0; group < DBG_MAX; group++)
+ {
+ logger->set_level(logger, group,
+ conftest->test->get_int(conftest->test, "log.%s.%N", def,
+ section, debug_lower_names, group));
+ }
+}
+
+/**
+ * Load logger configuration
+ */
+static void load_loggers(file_logger_t *logger)
+{
+ enumerator_t *enumerator;
+ char *section;
+ FILE *file;
+
+ load_log_levels(logger, "stdout");
+
+ enumerator = conftest->test->create_section_enumerator(conftest->test, "log");
+ while (enumerator->enumerate(enumerator, &section))
+ {
+ if (!streq(section, "stdout"))
+ {
+ file = fopen(section, "w");
+ if (file == NULL)
+ {
+ fprintf(stderr, "opening file %s for logging failed: %s",
+ section, strerror(errno));
+ continue;
+ }
+ logger = file_logger_create(file, NULL, FALSE);
+ load_log_levels(logger, section);
+ charon->bus->add_listener(charon->bus, &logger->listener);
+ charon->file_loggers->insert_last(charon->file_loggers, logger);
+ }
+ }
+ enumerator->destroy(enumerator);
+}
+
+/**
+ * Main function, starts the conftest daemon.
+ */
+int main(int argc, char *argv[])
+{
+ struct sigaction action;
+ int status = 0;
+ sigset_t set;
+ int sig;
+ char *suite_file = "suite.conf", *test_file = NULL;
+ file_logger_t *logger;
+
+ if (!library_init(NULL))
+ {
+ library_deinit();
+ return SS_RC_LIBSTRONGSWAN_INTEGRITY;
+ }
+ if (!libhydra_init("conftest"))
+ {
+ libhydra_deinit();
+ library_deinit();
+ return SS_RC_INITIALIZATION_FAILED;
+ }
+ if (!libcharon_init())
+ {
+ libcharon_deinit();
+ libhydra_deinit();
+ library_deinit();
+ return SS_RC_INITIALIZATION_FAILED;
+ }
+
+ INIT(conftest,
+ .creds = mem_cred_create(),
+ );
+
+ logger = file_logger_create(stdout, NULL, FALSE);
+ logger->set_level(logger, DBG_ANY, LEVEL_CTRL);
+ charon->bus->add_listener(charon->bus, &logger->listener);
+ charon->file_loggers->insert_last(charon->file_loggers, logger);
+
+ lib->credmgr->add_set(lib->credmgr, &conftest->creds->set);
+ conftest->hooks = linked_list_create();
+ conftest->config = config_create();
+
+ atexit(cleanup);
+
+ while (TRUE)
+ {
+ struct option long_opts[] = {
+ { "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, 'v' },
+ { "suite", required_argument, NULL, 's' },
+ { "test", required_argument, NULL, 't' },
+ { 0,0,0,0 }
+ };
+ switch (getopt_long(argc, argv, "", long_opts, NULL))
+ {
+ case EOF:
+ break;
+ case 'h':
+ usage(stdout);
+ return 0;
+ case 'v':
+ printf("strongSwan %s conftest\n", VERSION);
+ return 0;
+ case 's':
+ suite_file = optarg;
+ continue;
+ case 't':
+ test_file = optarg;
+ continue;
+ default:
+ usage(stderr);
+ return 1;
+ }
+ break;
+ }
+
+ if (!load_configs(suite_file, test_file))
+ {
+ return 1;
+ }
+ load_loggers(logger);
+
+ if (!lib->plugins->load(lib->plugins, NULL,
+ conftest->test->get_str(conftest->test, "preload", "")))
+ {
+ return 1;
+ }
+ if (!charon->initialize(charon))
+ {
+ return 1;
+ }
+ if (!load_certs(conftest->test, conftest->suite_dir))
+ {
+ return 1;
+ }
+ if (!load_keys(conftest->test, conftest->suite_dir))
+ {
+ return 1;
+ }
+ load_cdps(conftest->test);
+ if (!load_hooks())
+ {
+ return 1;
+ }
+ charon->backends->add_backend(charon->backends, &conftest->config->backend);
+ conftest->config->load(conftest->config, conftest->test);
+ conftest->actions = actions_create();
+
+ /* set up thread specific handlers */
+ action.sa_handler = segv_handler;
+ action.sa_flags = 0;
+ sigemptyset(&action.sa_mask);
+ sigaddset(&action.sa_mask, SIGINT);
+ sigaddset(&action.sa_mask, SIGTERM);
+ sigaddset(&action.sa_mask, SIGHUP);
+ sigaction(SIGSEGV, &action, NULL);
+ sigaction(SIGILL, &action, NULL);
+ sigaction(SIGBUS, &action, NULL);
+ action.sa_handler = SIG_IGN;
+ sigaction(SIGPIPE, &action, NULL);
+ pthread_sigmask(SIG_SETMASK, &action.sa_mask, NULL);
+
+ /* start thread pool */
+ charon->start(charon);
+
+ /* handle SIGINT/SIGTERM in main thread */
+ sigemptyset(&set);
+ sigaddset(&set, SIGINT);
+ sigaddset(&set, SIGHUP);
+ sigaddset(&set, SIGTERM);
+ sigprocmask(SIG_BLOCK, &set, NULL);
+
+ while (sigwait(&set, &sig) == 0)
+ {
+ switch (sig)
+ {
+ case SIGINT:
+ case SIGTERM:
+ fprintf(stderr, "\nshutting down...\n");
+ break;
+ default:
+ continue;
+ }
+ break;
+ }
+ return status;
+}
diff --git a/src/conftest/conftest.h b/src/conftest/conftest.h
new file mode 100644
index 000000000..2caf9b3ce
--- /dev/null
+++ b/src/conftest/conftest.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+/**
+ * @defgroup conftest conftest
+ */
+
+#ifndef CONFTEST_H_
+#define CONFTEST_H_
+
+#include <library.h>
+#include <hydra.h>
+#include <daemon.h>
+#include <credentials/sets/mem_cred.h>
+
+#include "config.h"
+#include "actions.h"
+
+typedef struct conftest_t conftest_t;
+
+/**
+ * Global conftest variables.
+ */
+struct conftest_t {
+
+ /**
+ * Merged suite/test configuration
+ */
+ settings_t *test;
+
+ /**
+ * Directory containing suite files
+ */
+ char *suite_dir;
+
+ /**
+ * Credentials loaded from configuration
+ */
+ mem_cred_t *creds;
+
+ /**
+ * Configurations loaded from config
+ */
+ config_t *config;
+
+ /**
+ * Loaded hooks
+ */
+ linked_list_t *hooks;
+
+ /**
+ * Action handling
+ */
+ actions_t *actions;
+};
+
+/**
+ * Conftest globals
+ */
+extern conftest_t *conftest;
+
+#endif /** CONFTEST_H_ */
diff --git a/src/conftest/hooks/add_notify.c b/src/conftest/hooks/add_notify.c
new file mode 100644
index 000000000..de46ca81f
--- /dev/null
+++ b/src/conftest/hooks/add_notify.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+typedef struct private_add_notify_t private_add_notify_t;
+
+/**
+ * Private data of an add_notify_t object.
+ */
+struct private_add_notify_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+
+ /**
+ * Alter requests or responses?
+ */
+ bool req;
+
+ /**
+ * ID of message to alter.
+ */
+ int id;
+
+ /**
+ * Notify type
+ */
+ char *type;
+
+ /**
+ * Notify data
+ */
+ char *data;
+
+ /**
+ * SPI of notify
+ */
+ int spi;
+
+ /**
+ * TRUE for a ESP protocol notify, FALSE for IKE
+ */
+ bool esp;
+};
+
+METHOD(listener_t, message, bool,
+ private_add_notify_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (!incoming &&
+ message->get_request(message) == this->req &&
+ message->get_message_id(message) == this->id)
+ {
+ notify_type_t type;
+ notify_payload_t *notify;
+ chunk_t data = chunk_empty;
+
+ type = atoi(this->type);
+ if (!type)
+ {
+ type = enum_from_name(notify_type_names, this->type);
+ if (type == -1)
+ {
+ DBG1(DBG_CFG, "unknown notify: '%s', skipped", this->type);
+ return TRUE;
+ }
+ }
+ if (strncaseeq(this->data, "0x", 2))
+ {
+ data = chunk_skip(chunk_create(this->data, strlen(this->data)), 2);
+ data = chunk_from_hex(data, NULL);
+ }
+ else if (this->data && strlen(this->data))
+ {
+ data = chunk_clone(chunk_create(this->data, strlen(this->data)));
+ }
+ notify = notify_payload_create_from_protocol_and_type(
+ this->esp ? PROTO_ESP : PROTO_IKE, type);
+ notify->set_spi(notify, this->spi);
+ if (data.len)
+ {
+ notify->set_notification_data(notify, data);
+ free(data.ptr);
+ }
+ message->add_payload(message, &notify->payload_interface);
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_add_notify_t *this)
+{
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *add_notify_hook_create(char *name)
+{
+ private_add_notify_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ .req = conftest->test->get_bool(conftest->test,
+ "hooks.%s.request", TRUE, name),
+ .id = conftest->test->get_int(conftest->test,
+ "hooks.%s.id", 0, name),
+ .type = conftest->test->get_str(conftest->test,
+ "hooks.%s.type", "", name),
+ .data = conftest->test->get_str(conftest->test,
+ "hooks.%s.data", "", name),
+ .spi = conftest->test->get_int(conftest->test,
+ "hooks.%s.spi", 0, name),
+ .esp = conftest->test->get_bool(conftest->test,
+ "hooks.%s.esp", FALSE, name),
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/add_payload.c b/src/conftest/hooks/add_payload.c
new file mode 100644
index 000000000..03a47cc23
--- /dev/null
+++ b/src/conftest/hooks/add_payload.c
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+#include <encoding/payloads/unknown_payload.h>
+
+typedef struct private_add_payload_t private_add_payload_t;
+
+/**
+ * Private data of an add_payload_t object.
+ */
+struct private_add_payload_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+
+ /**
+ * Alter requests or responses?
+ */
+ bool req;
+
+ /**
+ * ID of message to alter.
+ */
+ int id;
+
+ /**
+ * Payload type
+ */
+ char *type;
+
+ /**
+ * Payload data
+ */
+ char *data;
+
+ /**
+ * Set critical bit of the payload
+ */
+ bool critical;
+
+ /**
+ * True to replace existing payload of this type
+ */
+ bool replace;
+};
+
+METHOD(listener_t, message, bool,
+ private_add_payload_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (!incoming &&
+ message->get_request(message) == this->req &&
+ message->get_message_id(message) == this->id)
+ {
+ unknown_payload_t *unknown;
+ payload_t *payload;
+ enumerator_t *enumerator;
+ chunk_t data = chunk_empty;
+ payload_type_t type;
+
+ type = atoi(this->type);
+ if (!type)
+ {
+ type = enum_from_name(payload_type_short_names, this->type);
+ if (type == -1)
+ {
+ DBG1(DBG_CFG, "unknown payload: '%s', skipped", this->type);
+ return TRUE;
+ }
+ }
+ if (this->replace)
+ {
+ enumerator = message->create_payload_enumerator(message);
+ while (enumerator->enumerate(enumerator, &payload))
+ {
+ if (payload->get_type(payload) == type)
+ {
+ message->remove_payload_at(message, enumerator);
+ payload->destroy(payload);
+ break;
+ }
+ }
+ enumerator->destroy(enumerator);
+ }
+ if (strncaseeq(this->data, "0x", 2))
+ {
+ data = chunk_skip(chunk_create(this->data, strlen(this->data)), 2);
+ data = chunk_from_hex(data, NULL);
+ }
+ else if (this->data && strlen(this->data))
+ {
+ data = chunk_clone(chunk_create(this->data, strlen(this->data)));
+ }
+ unknown = unknown_payload_create_data(type, this->critical, data);
+ message->add_payload(message, &unknown->payload_interface);
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_add_payload_t *this)
+{
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *add_payload_hook_create(char *name)
+{
+ private_add_payload_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ .req = conftest->test->get_bool(conftest->test,
+ "hooks.%s.request", TRUE, name),
+ .id = conftest->test->get_int(conftest->test,
+ "hooks.%s.id", 0, name),
+ .type = conftest->test->get_str(conftest->test,
+ "hooks.%s.type", "", name),
+ .data = conftest->test->get_str(conftest->test,
+ "hooks.%s.data", "", name),
+ .critical = conftest->test->get_bool(conftest->test,
+ "hooks.%s.critical", FALSE, name),
+ .replace = conftest->test->get_bool(conftest->test,
+ "hooks.%s.replace", FALSE, name),
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/custom_proposal.c b/src/conftest/hooks/custom_proposal.c
new file mode 100644
index 000000000..e4acd841f
--- /dev/null
+++ b/src/conftest/hooks/custom_proposal.c
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+#include <errno.h>
+
+#include <encoding/payloads/sa_payload.h>
+#include <config/proposal.h>
+#include <crypto/proposal/proposal_keywords.h>
+
+typedef struct private_custom_proposal_t private_custom_proposal_t;
+
+/**
+ * Private data of an custom_proposal_t object.
+ */
+struct private_custom_proposal_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+
+ /**
+ * Alter requests or responses?
+ */
+ bool req;
+
+ /**
+ * ID of message to alter.
+ */
+ int id;
+
+ /**
+ * hook name
+ */
+ char *name;
+};
+
+/**
+ * Load custom proposal configuration to proposal list
+ */
+static linked_list_t* load_proposals(private_custom_proposal_t *this,
+ protocol_id_t proto, u_int64_t spi)
+{
+ enumerator_t *props, *algs;
+ char *number, *key, *value;
+ linked_list_t *list;
+
+ list = linked_list_create();
+ props = conftest->test->create_section_enumerator(conftest->test,
+ "hooks.%s", this->name);
+ while (props->enumerate(props, &number))
+ {
+ const proposal_token_t *token = NULL;
+ proposal_t *proposal;
+ u_int16_t type, alg, keysize = 0;
+ char *end;
+
+ proposal = proposal_create(proto, atoi(number));
+ proposal->set_spi(proposal, spi);
+
+ algs = conftest->test->create_key_value_enumerator(conftest->test,
+ "hooks.%s.%s", this->name, number);
+ while (algs->enumerate(algs, &key, &value))
+ {
+ errno = 0;
+ type = strtoul(key, &end, 10);
+ if (end == key || errno)
+ {
+ type = enum_from_name(transform_type_names, key);
+ if (type == -1)
+ {
+ DBG1(DBG_CFG, "unknown transform: '%s', skipped", key);
+ continue;
+ }
+ }
+ errno = 0;
+ alg = strtoul(value, &end, 10);
+ if (end == value || errno)
+ {
+ token = proposal_get_token(value, strlen(value));
+ if (!token)
+ {
+ DBG1(DBG_CFG, "unknown algorithm: '%s', skipped", value);
+ continue;
+ }
+ keysize = token->keysize;
+ alg = token->algorithm;
+ }
+ proposal->add_algorithm(proposal, type, alg, keysize);
+ }
+ algs->destroy(algs);
+ list->insert_last(list, proposal);
+ }
+ props->destroy(props);
+ return list;
+}
+
+METHOD(listener_t, message, bool,
+ private_custom_proposal_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (!incoming &&
+ message->get_request(message) == this->req &&
+ message->get_message_id(message) == this->id)
+ {
+ enumerator_t *enumerator;
+ payload_t *payload;
+ sa_payload_t *new, *old = NULL;
+ linked_list_t *new_props, *old_props;
+ proposal_t *proposal;
+
+ enumerator = message->create_payload_enumerator(message);
+ while (enumerator->enumerate(enumerator, &payload))
+ {
+ if (payload->get_type(payload) == SECURITY_ASSOCIATION)
+ {
+ old = (sa_payload_t*)payload;
+ message->remove_payload_at(message, enumerator);
+ }
+ }
+ enumerator->destroy(enumerator);
+
+ if (old)
+ {
+ old_props = old->get_proposals(old);
+ old->destroy(old);
+ enumerator = old_props->create_enumerator(old_props);
+ if (enumerator->enumerate(enumerator, &proposal))
+ {
+ new_props = load_proposals(this,
+ proposal->get_protocol(proposal),
+ proposal->get_spi(proposal));
+ DBG1(DBG_CFG, "injecting custom proposal: %#P", new_props);
+ new = sa_payload_create_from_proposal_list(new_props);
+ message->add_payload(message, (payload_t*)new);
+ new_props->destroy_offset(new_props, offsetof(proposal_t, destroy));
+ }
+ enumerator->destroy(enumerator);
+ old_props->destroy_offset(old_props, offsetof(proposal_t, destroy));
+ }
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_custom_proposal_t *this)
+{
+ free(this->name);
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *custom_proposal_hook_create(char *name)
+{
+ private_custom_proposal_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ .req = conftest->test->get_bool(conftest->test,
+ "hooks.%s.request", TRUE, name),
+ .id = conftest->test->get_int(conftest->test,
+ "hooks.%s.id", 0, name),
+ .name = strdup(name),
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/force_cookie.c b/src/conftest/hooks/force_cookie.c
new file mode 100644
index 000000000..e34f82851
--- /dev/null
+++ b/src/conftest/hooks/force_cookie.c
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+#include <encoding/payloads/unknown_payload.h>
+
+typedef struct private_force_cookie_t private_force_cookie_t;
+
+/**
+ * Private data of an force_cookie_t object.
+ */
+struct private_force_cookie_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+};
+
+METHOD(listener_t, message, bool,
+ private_force_cookie_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (incoming && message->get_request(message) &&
+ message->get_exchange_type(message) == IKE_SA_INIT)
+ {
+ enumerator_t *enumerator;
+ bool has_cookie = FALSE;
+ payload_t *payload;
+
+ enumerator = message->create_payload_enumerator(message);
+ while (enumerator->enumerate(enumerator, &payload))
+ {
+ if (payload->get_type(payload) == NOTIFY)
+ {
+ notify_payload_t *notify = (notify_payload_t*)payload;
+ chunk_t data;
+
+ if (notify->get_notify_type(notify) == COOKIE)
+ {
+ data = notify->get_notification_data(notify);
+ DBG1(DBG_CFG, "received COOKIE: %#B", &data);
+ has_cookie = TRUE;
+ break;
+ }
+ }
+ }
+ enumerator->destroy(enumerator);
+ if (!has_cookie)
+ {
+ message_t *response;
+ host_t *src, *dst;
+ packet_t *packet;
+ ike_sa_id_t *ike_sa_id;
+ chunk_t data = chunk_from_thing("COOKIE test data");
+
+ DBG1(DBG_CFG, "sending COOKIE: %#B", &data);
+ response = message_create();
+ dst = message->get_source(message);
+ src = message->get_destination(message);
+ response->set_source(response, src->clone(src));
+ response->set_destination(response, dst->clone(dst));
+ response->set_exchange_type(response, IKE_SA_INIT);
+ response->set_request(response, FALSE);
+ response->set_message_id(response, 0);
+ ike_sa_id = message->get_ike_sa_id(message);
+ ike_sa_id->switch_initiator(ike_sa_id);
+ response->set_ike_sa_id(response, ike_sa_id);
+ response->add_notify(response, FALSE, COOKIE, data);
+ if (response->generate(response, NULL, &packet) == SUCCESS)
+ {
+ charon->sender->send(charon->sender, packet);
+ response->destroy(response);
+ }
+ message->set_exchange_type(message, EXCHANGE_TYPE_UNDEFINED);
+ }
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_force_cookie_t *this)
+{
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *force_cookie_hook_create(char *name)
+{
+ private_force_cookie_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/hook.h b/src/conftest/hooks/hook.h
new file mode 100644
index 000000000..39a15f21b
--- /dev/null
+++ b/src/conftest/hooks/hook.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+/**
+ * @defgroup hook hook
+ * @{ @ingroup hooks
+ */
+
+#ifndef HOOK_H_
+#define HOOK_H_
+
+typedef struct hook_t hook_t;
+
+#include <daemon.h>
+#include <conftest.h>
+
+/**
+ * Hook providing interface.
+ */
+struct hook_t {
+
+ /**
+ * Implements listener_t.
+ */
+ listener_t listener;
+
+ /**
+ * Destroy a hook_t.
+ */
+ void (*destroy)(hook_t *this);
+};
+
+#endif /** HOOK_H_ @}*/
diff --git a/src/conftest/hooks/ignore_message.c b/src/conftest/hooks/ignore_message.c
new file mode 100644
index 000000000..210f3ac50
--- /dev/null
+++ b/src/conftest/hooks/ignore_message.c
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+typedef struct private_ignore_message_t private_ignore_message_t;
+
+/**
+ * Private data of an ignore_message_t object.
+ */
+struct private_ignore_message_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+
+ /**
+ * Drop incoming or outgoing?
+ */
+ bool in;
+
+ /**
+ * Drop requests or responses?
+ */
+ bool req;
+
+ /**
+ * ID of message to drop.
+ */
+ int id;
+};
+
+METHOD(listener_t, message, bool,
+ private_ignore_message_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (incoming == this->in &&
+ message->get_request(message) == this->req &&
+ message->get_message_id(message) == this->id)
+ {
+ DBG1(DBG_CFG, "ignoring message");
+ message->set_exchange_type(message, EXCHANGE_TYPE_UNDEFINED);
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_ignore_message_t *this)
+{
+ free(this);
+}
+
+/**
+ * Create the ignore_message hook
+ */
+hook_t *ignore_message_hook_create(char *name)
+{
+ private_ignore_message_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ .in = conftest->test->get_bool(conftest->test,
+ "hooks.%s.inbound", TRUE, name),
+ .req = conftest->test->get_bool(conftest->test,
+ "hooks.%s.request", TRUE, name),
+ .id = conftest->test->get_int(conftest->test,
+ "hooks.%s.id", 0, name),
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/ike_auth_fill.c b/src/conftest/hooks/ike_auth_fill.c
new file mode 100644
index 000000000..2843d60c1
--- /dev/null
+++ b/src/conftest/hooks/ike_auth_fill.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+#include <time.h>
+#include <netinet/udp.h>
+
+#include <encoding/payloads/cert_payload.h>
+#include <encoding/payloads/encryption_payload.h>
+
+typedef struct private_ike_auth_fill_t private_ike_auth_fill_t;
+
+/**
+ * Private data of an ike_auth_fill_t object.
+ */
+struct private_ike_auth_fill_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+
+ /**
+ * Alter requests or responses?
+ */
+ bool req;
+
+ /**
+ * ID of message to alter.
+ */
+ int id;
+
+ /**
+ * Number of bytes to fill IKE_AUTH up
+ */
+ int bytes;
+};
+
+/** size of non ESP-Marker */
+#define NON_ESP_MARKER_LEN 4
+
+/**
+ * Calculate packet size on wire (without ethernet/IP header)
+ */
+static size_t calculate_wire_size(message_t *message, ike_sa_t *ike_sa)
+{
+ enumerator_t *enumerator;
+ payload_t *payload;
+ size_t size = 0;
+
+ enumerator = message->create_payload_enumerator(message);
+ while (enumerator->enumerate(enumerator, &payload))
+ {
+ size += payload->get_length(payload);
+ }
+ enumerator->destroy(enumerator);
+
+ if (message->get_exchange_type(message) != IKE_SA_INIT)
+ {
+ keymat_t *keymat;
+ aead_t *aead;
+ size_t bs;
+
+ keymat = ike_sa->get_keymat(ike_sa);
+ aead = keymat->get_aead(keymat, FALSE);
+ if (aead)
+ {
+ bs = aead->get_block_size(aead);
+ size += ENCRYPTION_PAYLOAD_HEADER_LENGTH + NON_ESP_MARKER_LEN +
+ aead->get_icv_size(aead) + aead->get_iv_size(aead) +
+ (bs - (size % bs));
+ }
+ }
+ return sizeof(struct udphdr) + IKE_HEADER_LENGTH + size;
+}
+
+METHOD(listener_t, message, bool,
+ private_ike_auth_fill_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (!incoming &&
+ message->get_request(message) == this->req &&
+ message->get_message_id(message) == this->id)
+ {
+ cert_payload_t *pld;
+ size_t size, diff;
+ chunk_t data;
+
+ size = calculate_wire_size(message, ike_sa);
+ if (size < this->bytes - CERT_PAYLOAD_HEADER_LENGTH)
+ {
+ diff = this->bytes - size - CERT_PAYLOAD_HEADER_LENGTH;
+ data = chunk_alloc(diff);
+ memset(data.ptr, 0x12, data.len);
+ pld = cert_payload_create_custom(201, data);
+ message->add_payload(message, &pld->payload_interface);
+ DBG1(DBG_CFG, "inserting %d dummy bytes certificate payload", diff);
+ }
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_ike_auth_fill_t *this)
+{
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *ike_auth_fill_hook_create(char *name)
+{
+ private_ike_auth_fill_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ .req = conftest->test->get_bool(conftest->test,
+ "hooks.%s.request", TRUE, name),
+ .id = conftest->test->get_int(conftest->test,
+ "hooks.%s.id", 1, name),
+ .bytes = conftest->test->get_int(conftest->test,
+ "hooks.%s.bytes", 0, name),
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/log_id.c b/src/conftest/hooks/log_id.c
new file mode 100644
index 000000000..ad14cea10
--- /dev/null
+++ b/src/conftest/hooks/log_id.c
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+#include <encoding/payloads/id_payload.h>
+
+typedef struct private_log_id_t private_log_id_t;
+
+/**
+ * Private data of an log_id_t object.
+ */
+struct private_log_id_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+};
+
+METHOD(listener_t, message, bool,
+ private_log_id_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (incoming)
+ {
+ enumerator_t *enumerator;
+ payload_t *payload;
+ id_payload_t *id_payload;
+ identification_t *id;
+ chunk_t data;
+
+ enumerator = message->create_payload_enumerator(message);
+ while (enumerator->enumerate(enumerator, &payload))
+ {
+ if (payload->get_type(payload) == ID_INITIATOR ||
+ payload->get_type(payload) == ID_RESPONDER)
+ {
+ id_payload = (id_payload_t*)payload;
+ id = id_payload->get_identification(id_payload);
+ data = id->get_encoding(id);
+
+ DBG1(DBG_CFG, "%N: %N %B",
+ payload_type_short_names, payload->get_type(payload),
+ id_type_names, id->get_type(id), &data);
+ id->destroy(id);
+ }
+ }
+ enumerator->destroy(enumerator);
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_log_id_t *this)
+{
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *log_id_hook_create(char *name)
+{
+ private_log_id_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/log_ke.c b/src/conftest/hooks/log_ke.c
new file mode 100644
index 000000000..231c0a8d8
--- /dev/null
+++ b/src/conftest/hooks/log_ke.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+#include <encoding/payloads/ke_payload.h>
+
+typedef struct private_log_ke_t private_log_ke_t;
+
+/**
+ * Private data of an log_ke_t object.
+ */
+struct private_log_ke_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+};
+
+METHOD(listener_t, message, bool,
+ private_log_ke_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (incoming)
+ {
+ enumerator_t *enumerator;
+ payload_t *payload;
+ ke_payload_t *ke;
+
+ enumerator = message->create_payload_enumerator(message);
+ while (enumerator->enumerate(enumerator, &payload))
+ {
+ if (payload->get_type(payload) == KEY_EXCHANGE)
+ {
+ ke = (ke_payload_t*)payload;
+ DBG1(DBG_CFG, "received DH group %N",
+ diffie_hellman_group_names, ke->get_dh_group_number(ke));
+ }
+ }
+ enumerator->destroy(enumerator);
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_log_ke_t *this)
+{
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *log_ke_hook_create(char *name)
+{
+ private_log_ke_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/log_proposals.c b/src/conftest/hooks/log_proposals.c
new file mode 100644
index 000000000..8c330ab3d
--- /dev/null
+++ b/src/conftest/hooks/log_proposals.c
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+#include <encoding/payloads/sa_payload.h>
+
+typedef struct private_log_proposals_t private_log_proposals_t;
+
+/**
+ * Private data of an log_proposals_t object.
+ */
+struct private_log_proposals_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+};
+
+METHOD(listener_t, message, bool,
+ private_log_proposals_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (incoming)
+ {
+ enumerator_t *enumerator, *proposals;
+ payload_t *payload;
+ linked_list_t *list;
+ sa_payload_t *sa;
+ proposal_t *proposal;
+
+ enumerator = message->create_payload_enumerator(message);
+ while (enumerator->enumerate(enumerator, &payload))
+ {
+ if (payload->get_type(payload) == SECURITY_ASSOCIATION)
+ {
+ sa = (sa_payload_t*)payload;
+ list = sa->get_proposals(sa);
+ DBG1(DBG_CFG, "received %d proposal%s:", list->get_count(list),
+ list->get_count(list) == 1 ? "" : "s");
+ proposals = list->create_enumerator(list);
+ while (proposals->enumerate(proposals, &proposal))
+ {
+ u_int64_t spi = proposal->get_spi(proposal);
+
+ if (proposal->get_protocol(proposal) != PROTO_IKE)
+ {
+ spi = htonl(spi);
+ }
+ DBG1(DBG_CFG, " %d (SPI 0x%llx): %P",
+ proposal->get_number(proposal), spi, proposal);
+ }
+ proposals->destroy(proposals);
+ list->destroy_offset(list, offsetof(proposal_t, destroy));
+ }
+ }
+ enumerator->destroy(enumerator);
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_log_proposals_t *this)
+{
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *log_proposals_hook_create(char *name)
+{
+ private_log_proposals_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/log_ts.c b/src/conftest/hooks/log_ts.c
new file mode 100644
index 000000000..dacc7a58c
--- /dev/null
+++ b/src/conftest/hooks/log_ts.c
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+#include <encoding/payloads/ts_payload.h>
+
+typedef struct private_log_ts_t private_log_ts_t;
+
+/**
+ * Private data of an log_ts_t object.
+ */
+struct private_log_ts_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+};
+
+METHOD(listener_t, message, bool,
+ private_log_ts_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (incoming)
+ {
+ enumerator_t *enumerator;
+ payload_t *payload;
+ linked_list_t *list;
+ ts_payload_t *ts;
+
+ enumerator = message->create_payload_enumerator(message);
+ while (enumerator->enumerate(enumerator, &payload))
+ {
+ if (payload->get_type(payload) == TRAFFIC_SELECTOR_INITIATOR ||
+ payload->get_type(payload) == TRAFFIC_SELECTOR_RESPONDER)
+ {
+ ts = (ts_payload_t*)payload;
+ list = ts->get_traffic_selectors(ts);
+
+ DBG1(DBG_CFG, "received %N: %#R",
+ payload_type_short_names, payload->get_type(payload), list);
+ list->destroy_offset(list, offsetof(traffic_selector_t, destroy));
+ }
+ }
+ enumerator->destroy(enumerator);
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_log_ts_t *this)
+{
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *log_ts_hook_create(char *name)
+{
+ private_log_ts_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/pretend_auth.c b/src/conftest/hooks/pretend_auth.c
new file mode 100644
index 000000000..4b7168cac
--- /dev/null
+++ b/src/conftest/hooks/pretend_auth.c
@@ -0,0 +1,386 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+#include <encoding/payloads/nonce_payload.h>
+#include <encoding/payloads/cert_payload.h>
+#include <encoding/payloads/auth_payload.h>
+#include <encoding/payloads/id_payload.h>
+#include <encoding/payloads/sa_payload.h>
+#include <encoding/payloads/ts_payload.h>
+
+typedef struct private_pretend_auth_t private_pretend_auth_t;
+
+/**
+ * Private data of an pretend_auth_t object.
+ */
+struct private_pretend_auth_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+
+ /**
+ * remote peer identity
+ */
+ identification_t *id;
+
+ /**
+ * reserved bytes of ID payload
+ */
+ char reserved[3];
+
+ /**
+ * IKE_SA_INIT data for signature
+ */
+ chunk_t ike_init;
+
+ /**
+ * Nonce for signature
+ */
+ chunk_t nonce;
+
+ /**
+ * Selected CHILD_SA proposal
+ */
+ proposal_t *proposal;
+
+ /**
+ * List of initiators Traffic Selectors
+ */
+ linked_list_t *tsi;
+
+ /**
+ * List of responders Traffic Selectors
+ */
+ linked_list_t *tsr;
+};
+
+/**
+ * Process IKE_SA_INIT request message, outgoing
+ */
+static void process_init_request(private_pretend_auth_t *this,
+ ike_sa_t *ike_sa, message_t *message)
+{
+ nonce_payload_t *nonce;
+
+ nonce = (nonce_payload_t*)message->get_payload(message, NONCE);
+ if (nonce)
+ {
+ free(this->nonce.ptr);
+ this->nonce = nonce->get_nonce(nonce);
+ }
+}
+
+/**
+ * Process IKE_AUTH request message, outgoing
+ */
+static void process_auth_request(private_pretend_auth_t *this,
+ ike_sa_t *ike_sa, message_t *message)
+{
+ id_payload_t *id;
+ sa_payload_t *sa;
+ ts_payload_t *tsi, *tsr;
+ linked_list_t *proposals;
+
+ id = (id_payload_t*)message->get_payload(message, ID_RESPONDER);
+ if (id)
+ {
+ this->id->destroy(this->id);
+ this->id = id->get_identification(id);
+ }
+ sa = (sa_payload_t*)message->get_payload(message, SECURITY_ASSOCIATION);
+ if (sa)
+ {
+ proposals = sa->get_proposals(sa);
+ proposals->remove_first(proposals, (void**)&this->proposal);
+ if (this->proposal)
+ {
+ this->proposal->set_spi(this->proposal, htonl(0x12345678));
+ }
+ proposals->destroy_offset(proposals, offsetof(proposal_t, destroy));
+ }
+ tsi = (ts_payload_t*)message->get_payload(message,
+ TRAFFIC_SELECTOR_INITIATOR);
+ if (tsi)
+ {
+ this->tsi = tsi->get_traffic_selectors(tsi);
+ }
+ tsr = (ts_payload_t*)message->get_payload(message,
+ TRAFFIC_SELECTOR_RESPONDER);
+ if (tsr)
+ {
+ this->tsr = tsr->get_traffic_selectors(tsr);
+ }
+
+}
+
+/**
+ * Process IKE_SA_INIT response message, incoming
+ */
+static void process_init_response(private_pretend_auth_t *this,
+ ike_sa_t *ike_sa, message_t *message)
+{
+ this->ike_init = message->get_packet_data(message);
+}
+
+/**
+ * Build CERT payloads
+ */
+static void build_certs(private_pretend_auth_t *this,
+ ike_sa_t *ike_sa, message_t *message, auth_cfg_t *auth)
+{
+ enumerator_t *enumerator;
+ cert_payload_t *payload;
+ certificate_t *cert;
+ auth_rule_t type;
+
+ /* get subject cert first, then issuing certificates */
+ cert = auth->get(auth, AUTH_RULE_SUBJECT_CERT);
+ if (cert)
+ {
+ payload = cert_payload_create_from_cert(cert);
+ if (payload)
+ {
+ DBG1(DBG_IKE, "pretending end entity cert \"%Y\"",
+ cert->get_subject(cert));
+ message->add_payload(message, (payload_t*)payload);
+ }
+ }
+ enumerator = auth->create_enumerator(auth);
+ while (enumerator->enumerate(enumerator, &type, &cert))
+ {
+ if (type == AUTH_RULE_IM_CERT)
+ {
+ payload = cert_payload_create_from_cert(cert);
+ if (payload)
+ {
+ DBG1(DBG_IKE, "pretending issuer cert \"%Y\"",
+ cert->get_subject(cert));
+ message->add_payload(message, (payload_t*)payload);
+ }
+ }
+ }
+ enumerator->destroy(enumerator);
+}
+
+/**
+ * Build faked AUTH payload
+ */
+static bool build_auth(private_pretend_auth_t *this,
+ ike_sa_t *ike_sa, message_t *message)
+{
+ chunk_t octets, auth_data;
+ private_key_t *private;
+ auth_cfg_t *auth;
+ auth_payload_t *auth_payload;
+ auth_method_t auth_method;
+ signature_scheme_t scheme;
+ keymat_t *keymat;
+
+ auth = auth_cfg_create();
+ private = lib->credmgr->get_private(lib->credmgr, KEY_ANY, this->id, auth);
+ build_certs(this, ike_sa, message, auth);
+ auth->destroy(auth);
+ if (private == NULL)
+ {
+ DBG1(DBG_CFG, "no private key found for '%Y' to pretend AUTH", this->id);
+ return FALSE;
+ }
+
+ switch (private->get_type(private))
+ {
+ case KEY_RSA:
+ scheme = SIGN_RSA_EMSA_PKCS1_SHA1;
+ auth_method = AUTH_RSA;
+ break;
+ case KEY_ECDSA:
+ /* we try to deduct the signature scheme from the keysize */
+ switch (private->get_keysize(private))
+ {
+ case 256:
+ scheme = SIGN_ECDSA_256;
+ auth_method = AUTH_ECDSA_256;
+ break;
+ case 384:
+ scheme = SIGN_ECDSA_384;
+ auth_method = AUTH_ECDSA_384;
+ break;
+ case 521:
+ scheme = SIGN_ECDSA_521;
+ auth_method = AUTH_ECDSA_521;
+ break;
+ default:
+ DBG1(DBG_CFG, "%d bit ECDSA private key size not supported",
+ private->get_keysize(private));
+ return FALSE;
+ }
+ break;
+ default:
+ DBG1(DBG_CFG, "private key of type %N not supported",
+ key_type_names, private->get_type(private));
+ return FALSE;
+ }
+ keymat = ike_sa->get_keymat(ike_sa);
+ octets = keymat->get_auth_octets(keymat, TRUE, this->ike_init,
+ this->nonce, this->id, this->reserved);
+ if (!private->sign(private, scheme, octets, &auth_data))
+ {
+ chunk_free(&octets);
+ private->destroy(private);
+ return FALSE;
+ }
+ auth_payload = auth_payload_create();
+ auth_payload->set_auth_method(auth_payload, auth_method);
+ auth_payload->set_data(auth_payload, auth_data);
+ chunk_free(&auth_data);
+ chunk_free(&octets);
+ private->destroy(private);
+ message->add_payload(message, (payload_t*)auth_payload);
+ DBG1(DBG_CFG, "pretending AUTH payload for '%Y' with %N",
+ this->id, auth_method_names, auth_method);
+ return TRUE;
+}
+
+/**
+ * Process IKE_AUTH response message, incoming
+ */
+static void process_auth_response(private_pretend_auth_t *this,
+ ike_sa_t *ike_sa, message_t *message)
+{
+ enumerator_t *enumerator;
+ payload_t *payload;
+
+ /* check for, and remove AUTHENTICATION_FAILED notify */
+ enumerator = message->create_payload_enumerator(message);
+ while (enumerator->enumerate(enumerator, &payload))
+ {
+ notify_payload_t *notify = (notify_payload_t*)payload;
+
+ if (payload->get_type(payload) != NOTIFY ||
+ notify->get_notify_type(notify) != AUTHENTICATION_FAILED)
+ {
+ DBG1(DBG_CFG, "no %N notify found, disabling AUTH pretending",
+ notify_type_names, AUTHENTICATION_FAILED);
+ enumerator->destroy(enumerator);
+ return;
+ }
+ message->remove_payload_at(message, enumerator);
+ payload->destroy(payload);
+ }
+ enumerator->destroy(enumerator);
+
+ if (!build_auth(this, ike_sa, message))
+ {
+ message->add_notify(message, TRUE, AUTHENTICATION_FAILED, chunk_empty);
+ return;
+ }
+ message->add_payload(message, (payload_t*)
+ id_payload_create_from_identification(ID_RESPONDER, this->id));
+ if (this->proposal)
+ {
+ message->add_payload(message, (payload_t*)
+ sa_payload_create_from_proposal(this->proposal));
+ }
+ if (this->tsi)
+ {
+ message->add_payload(message, (payload_t*)
+ ts_payload_create_from_traffic_selectors(TRUE, this->tsi));
+ }
+ if (this->tsr)
+ {
+ message->add_payload(message, (payload_t*)
+ ts_payload_create_from_traffic_selectors(FALSE, this->tsr));
+ }
+}
+
+METHOD(listener_t, message, bool,
+ private_pretend_auth_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (incoming)
+ {
+ if (!message->get_request(message))
+ {
+ if (message->get_exchange_type(message) == IKE_SA_INIT)
+ {
+ process_init_response(this, ike_sa, message);
+ }
+ if (message->get_exchange_type(message) == IKE_AUTH &&
+ message->get_message_id(message) == 1)
+ {
+ process_auth_response(this, ike_sa, message);
+ }
+ }
+ }
+ else
+ {
+ if (message->get_request(message))
+ {
+ if (message->get_exchange_type(message) == IKE_SA_INIT)
+ {
+ process_init_request(this, ike_sa, message);
+ }
+ if (message->get_exchange_type(message) == IKE_AUTH &&
+ message->get_message_id(message) == 1)
+ {
+ process_auth_request(this, ike_sa, message);
+ }
+ }
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_pretend_auth_t *this)
+{
+ if (this->tsi)
+ {
+ this->tsi->destroy_offset(this->tsi, offsetof(traffic_selector_t, destroy));
+ }
+ if (this->tsr)
+ {
+ this->tsr->destroy_offset(this->tsr, offsetof(traffic_selector_t, destroy));
+ }
+ DESTROY_IF(this->proposal);
+ this->id->destroy(this->id);
+ free(this->ike_init.ptr);
+ free(this->nonce.ptr);
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *pretend_auth_hook_create(char *name)
+{
+ private_pretend_auth_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ .id = identification_create_from_string(
+ conftest->test->get_str(conftest->test,
+ "hooks.%s.peer", "%any", name)),
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/rebuild_auth.c b/src/conftest/hooks/rebuild_auth.c
new file mode 100644
index 000000000..993c952e0
--- /dev/null
+++ b/src/conftest/hooks/rebuild_auth.c
@@ -0,0 +1,243 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+#include <encoding/generator.h>
+#include <encoding/payloads/nonce_payload.h>
+#include <encoding/payloads/auth_payload.h>
+#include <encoding/payloads/id_payload.h>
+
+typedef struct private_rebuild_auth_t private_rebuild_auth_t;
+
+/**
+ * Private data of an rebuild_auth_t object.
+ */
+struct private_rebuild_auth_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+
+ /**
+ * Our IKE_SA_INIT data, required to rebuild AUTH
+ */
+ chunk_t ike_init;
+
+ /**
+ * Received NONCE, required to rebuild AUTH
+ */
+ chunk_t nonce;
+
+ /**
+ * ID to use for key lookup, if not from IDi
+ */
+ identification_t *id;
+};
+
+/**
+ * Rebuild our AUTH data
+ */
+static bool rebuild_auth(private_rebuild_auth_t *this, ike_sa_t *ike_sa,
+ message_t *message)
+{
+ enumerator_t *enumerator;
+ chunk_t octets, auth_data;
+ private_key_t *private;
+ auth_cfg_t *auth;
+ payload_t *payload;
+ auth_payload_t *auth_payload;
+ auth_method_t auth_method;
+ signature_scheme_t scheme;
+ keymat_t *keymat;
+ identification_t *id;
+ char reserved[3];
+ generator_t *generator;
+ chunk_t data;
+ u_int32_t *lenpos;
+
+ payload = message->get_payload(message,
+ message->get_request(message) ? ID_INITIATOR : ID_RESPONDER);
+ if (!payload)
+ {
+ DBG1(DBG_CFG, "ID payload not found to rebuild AUTH");
+ return FALSE;
+ }
+
+ generator = generator_create();
+ generator->generate_payload(generator, payload);
+ data = generator->get_chunk(generator, &lenpos);
+ if (data.len < 8)
+ {
+ DBG1(DBG_CFG, "ID payload invalid to rebuild AUTH");
+ generator->destroy(generator);
+ return FALSE;
+ }
+ memcpy(reserved, data.ptr + 5, 3);
+ id = identification_create_from_encoding(data.ptr[4], chunk_skip(data, 8));
+ generator->destroy(generator);
+
+ auth = auth_cfg_create();
+ private = lib->credmgr->get_private(lib->credmgr, KEY_ANY,
+ this->id ?: id, auth);
+ auth->destroy(auth);
+ if (private == NULL)
+ {
+ DBG1(DBG_CFG, "no private key found for '%Y' to rebuild AUTH",
+ this->id ?: id);
+ id->destroy(id);
+ return FALSE;
+ }
+
+ switch (private->get_type(private))
+ {
+ case KEY_RSA:
+ scheme = SIGN_RSA_EMSA_PKCS1_SHA1;
+ auth_method = AUTH_RSA;
+ break;
+ case KEY_ECDSA:
+ /* we try to deduct the signature scheme from the keysize */
+ switch (private->get_keysize(private))
+ {
+ case 256:
+ scheme = SIGN_ECDSA_256;
+ auth_method = AUTH_ECDSA_256;
+ break;
+ case 384:
+ scheme = SIGN_ECDSA_384;
+ auth_method = AUTH_ECDSA_384;
+ break;
+ case 521:
+ scheme = SIGN_ECDSA_521;
+ auth_method = AUTH_ECDSA_521;
+ break;
+ default:
+ DBG1(DBG_CFG, "%d bit ECDSA private key size not supported",
+ private->get_keysize(private));
+ id->destroy(id);
+ return FALSE;
+ }
+ break;
+ default:
+ DBG1(DBG_CFG, "private key of type %N not supported",
+ key_type_names, private->get_type(private));
+ id->destroy(id);
+ return FALSE;
+ }
+ keymat = ike_sa->get_keymat(ike_sa);
+ octets = keymat->get_auth_octets(keymat, FALSE, this->ike_init,
+ this->nonce, id, reserved);
+ if (!private->sign(private, scheme, octets, &auth_data))
+ {
+ chunk_free(&octets);
+ private->destroy(private);
+ id->destroy(id);
+ return FALSE;
+ }
+ auth_payload = auth_payload_create();
+ auth_payload->set_auth_method(auth_payload, auth_method);
+ auth_payload->set_data(auth_payload, auth_data);
+ chunk_free(&auth_data);
+ chunk_free(&octets);
+ private->destroy(private);
+
+ enumerator = message->create_payload_enumerator(message);
+ while (enumerator->enumerate(enumerator, &payload))
+ {
+ if (payload->get_type(payload) == AUTHENTICATION)
+ {
+ message->remove_payload_at(message, enumerator);
+ payload->destroy(payload);
+ }
+ }
+ enumerator->destroy(enumerator);
+
+ message->add_payload(message, (payload_t*)auth_payload);
+ DBG1(DBG_CFG, "rebuilding AUTH payload for '%Y' with %N",
+ id, auth_method_names, auth_method);
+ id->destroy(id);
+ return TRUE;
+}
+
+METHOD(listener_t, message, bool,
+ private_rebuild_auth_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (!incoming && message->get_message_id(message) == 1)
+ {
+ rebuild_auth(this, ike_sa, message);
+ }
+ if (message->get_exchange_type(message) == IKE_SA_INIT)
+ {
+ if (incoming)
+ {
+ nonce_payload_t *nonce;
+
+ nonce = (nonce_payload_t*)message->get_payload(message, NONCE);
+ if (nonce)
+ {
+ free(this->nonce.ptr);
+ this->nonce = nonce->get_nonce(nonce);
+ }
+ }
+ else
+ {
+ packet_t *packet;
+
+ if (message->generate(message, NULL, &packet) == SUCCESS)
+ {
+ free(this->ike_init.ptr);
+ this->ike_init = chunk_clone(packet->get_data(packet));
+ packet->destroy(packet);
+ }
+ }
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_rebuild_auth_t *this)
+{
+ free(this->ike_init.ptr);
+ free(this->nonce.ptr);
+ DESTROY_IF(this->id);
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *rebuild_auth_hook_create(char *name)
+{
+ private_rebuild_auth_t *this;
+ char *id;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ );
+ id = conftest->test->get_str(conftest->test, "hooks.%s.key", NULL, name);
+ if (id)
+ {
+ this->id = identification_create_from_string(id);
+ }
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/reset_seq.c b/src/conftest/hooks/reset_seq.c
new file mode 100644
index 000000000..ccf8e997d
--- /dev/null
+++ b/src/conftest/hooks/reset_seq.c
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+#include <linux/xfrm.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <processing/jobs/callback_job.h>
+#include <plugins/kernel_netlink/kernel_netlink_shared.h>
+
+#define XFRM_RTA(nlh, x) ((struct rtattr*)(NLMSG_DATA(nlh) + NLMSG_ALIGN(sizeof(x))))
+
+typedef struct private_reset_seq_t private_reset_seq_t;
+
+/**
+ * Private data of an reset_seq_t object.
+ */
+struct private_reset_seq_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+
+ /**
+ * Delay for reset
+ */
+ int delay;
+};
+
+/**
+ * Callback job
+ */
+static job_requeue_t reset_cb(struct xfrm_usersa_id *data)
+{
+ netlink_buf_t request;
+ struct nlmsghdr *hdr;
+ struct xfrm_aevent_id *id;
+ struct rtattr *rthdr;
+ struct xfrm_replay_state *replay;
+ struct sockaddr_nl addr;
+ int s, len;
+
+ DBG1(DBG_CFG, "resetting sequence number of SPI 0x%x", htonl(data->spi));
+
+ memset(&request, 0, sizeof(request));
+
+ hdr = (struct nlmsghdr*)request;
+ hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_REPLACE;
+ hdr->nlmsg_seq = 201;
+ hdr->nlmsg_pid = getpid();
+ hdr->nlmsg_type = XFRM_MSG_NEWAE;
+ hdr->nlmsg_len = NLMSG_LENGTH(sizeof(struct xfrm_aevent_id));
+
+ id = (struct xfrm_aevent_id*)NLMSG_DATA(hdr);
+ id->sa_id = *data;
+
+ rthdr = XFRM_RTA(hdr, struct xfrm_aevent_id);
+ rthdr->rta_type = XFRMA_REPLAY_VAL;
+ rthdr->rta_len = RTA_LENGTH(sizeof(struct xfrm_replay_state));
+ hdr->nlmsg_len += rthdr->rta_len;
+
+ replay = (struct xfrm_replay_state*)RTA_DATA(rthdr);
+
+ s = socket(AF_NETLINK, SOCK_RAW, NETLINK_XFRM);
+ if (s == -1)
+ {
+ DBG1(DBG_CFG, "opening XFRM socket failed: %s", strerror(errno));
+ return JOB_REQUEUE_NONE;
+ }
+ memset(&addr, 0, sizeof(addr));
+ addr.nl_family = AF_NETLINK;
+ len = sendto(s, hdr, hdr->nlmsg_len, 0,
+ (struct sockaddr*)&addr, sizeof(addr));
+ if (len != hdr->nlmsg_len)
+ {
+ DBG1(DBG_CFG, "sending XFRM aevent failed: %s", strerror(errno));
+ }
+ close(s);
+ return JOB_REQUEUE_NONE;
+}
+
+/**
+ * Schedule sequence number reset job
+ */
+static void schedule_reset_job(private_reset_seq_t *this, host_t *dst,
+ u_int32_t spi)
+{
+ struct xfrm_usersa_id *data;
+ chunk_t chunk;
+
+ INIT(data,
+ .spi = spi,
+ .family = dst->get_family(dst),
+ .proto = IPPROTO_ESP,
+ );
+
+ chunk = dst->get_address(dst);
+ memcpy(&data->daddr, chunk.ptr, min(chunk.len, sizeof(xfrm_address_t)));
+
+ lib->scheduler->schedule_job(lib->scheduler,
+ (job_t*)callback_job_create(
+ (void*)reset_cb, data, (void*)free, NULL),
+ this->delay);
+}
+
+METHOD(listener_t, child_updown, bool,
+ private_reset_seq_t *this, ike_sa_t *ike_sa, child_sa_t *child_sa,
+ bool up)
+{
+ if (up)
+ {
+ schedule_reset_job(this, ike_sa->get_other_host(ike_sa),
+ child_sa->get_spi(child_sa, FALSE));
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_reset_seq_t *this)
+{
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *reset_seq_hook_create(char *name)
+{
+ private_reset_seq_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .child_updown = _child_updown,
+ },
+ .destroy = _destroy,
+ },
+ .delay = conftest->test->get_int(conftest->test,
+ "hooks.%s.delay", 10, name),
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/set_critical.c b/src/conftest/hooks/set_critical.c
new file mode 100644
index 000000000..caf2215c3
--- /dev/null
+++ b/src/conftest/hooks/set_critical.c
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+#include <encoding/payloads/unknown_payload.h>
+
+typedef struct private_set_critical_t private_set_critical_t;
+
+/**
+ * Private data of an set_critical_t object.
+ */
+struct private_set_critical_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+
+ /**
+ * Alter requests or responses?
+ */
+ bool req;
+
+ /**
+ * ID of message to alter.
+ */
+ int id;
+
+ /**
+ * Payload types, space separated
+ */
+ char *payloads;
+};
+
+METHOD(listener_t, message, bool,
+ private_set_critical_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (!incoming &&
+ message->get_request(message) == this->req &&
+ message->get_message_id(message) == this->id)
+ {
+ enumerator_t *msg, *types;
+ payload_t *payload;
+ payload_type_t type;
+ bool *critical;
+ char *name;
+
+ types = enumerator_create_token(this->payloads, " ", "");
+ while (types->enumerate(types, &name))
+ {
+ type = atoi(name);
+ if (!type)
+ {
+ type = enum_from_name(payload_type_short_names, name);
+ if (type == -1)
+ {
+ DBG1(DBG_CFG, "invalid payload name '%s'", name);
+ break;
+ }
+ }
+ msg = message->create_payload_enumerator(message);
+ while (msg->enumerate(msg, &payload))
+ {
+ if (type == payload->get_type(payload))
+ {
+ critical = payload_get_field(payload, FLAG, 0);
+ if (critical)
+ {
+ *critical = TRUE;
+ }
+ }
+ }
+ msg->destroy(msg);
+ }
+ types->destroy(types);
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_set_critical_t *this)
+{
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *set_critical_hook_create(char *name)
+{
+ private_set_critical_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ .req = conftest->test->get_bool(conftest->test,
+ "hooks.%s.request", TRUE, name),
+ .id = conftest->test->get_int(conftest->test,
+ "hooks.%s.id", 0, name),
+ .payloads = conftest->test->get_str(conftest->test,
+ "hooks.%s.payloads", "", name),
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/set_ike_initiator.c b/src/conftest/hooks/set_ike_initiator.c
new file mode 100644
index 000000000..6ba43eaca
--- /dev/null
+++ b/src/conftest/hooks/set_ike_initiator.c
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+#include <encoding/payloads/unknown_payload.h>
+
+typedef struct private_set_ike_initiator_t private_set_ike_initiator_t;
+
+/**
+ * Private data of an set_ike_initiator_t object.
+ */
+struct private_set_ike_initiator_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+
+ /**
+ * Alter requests or responses?
+ */
+ bool req;
+
+ /**
+ * ID of message to alter.
+ */
+ int id;
+};
+
+METHOD(listener_t, message, bool,
+ private_set_ike_initiator_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (!incoming &&
+ message->get_request(message) == this->req &&
+ message->get_message_id(message) == this->id)
+ {
+ ike_sa_id_t *id;
+
+ DBG1(DBG_CFG, "toggling IKE message initiator flag");
+ id = message->get_ike_sa_id(message);
+ id->switch_initiator(id);
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_set_ike_initiator_t *this)
+{
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *set_ike_initiator_hook_create(char *name)
+{
+ private_set_ike_initiator_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ .req = conftest->test->get_bool(conftest->test,
+ "hooks.%s.request", TRUE, name),
+ .id = conftest->test->get_int(conftest->test,
+ "hooks.%s.id", 0, name),
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/set_ike_request.c b/src/conftest/hooks/set_ike_request.c
new file mode 100644
index 000000000..baabea66a
--- /dev/null
+++ b/src/conftest/hooks/set_ike_request.c
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+#include <encoding/payloads/unknown_payload.h>
+
+typedef struct private_set_ike_request_t private_set_ike_request_t;
+
+/**
+ * Private data of an set_ike_request_t object.
+ */
+struct private_set_ike_request_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+
+ /**
+ * Alter requests or responses?
+ */
+ bool req;
+
+ /**
+ * ID of message to alter.
+ */
+ int id;
+};
+
+METHOD(listener_t, message, bool,
+ private_set_ike_request_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (!incoming &&
+ message->get_request(message) == this->req &&
+ message->get_message_id(message) == this->id)
+ {
+ DBG1(DBG_CFG, "toggling IKE message request flag");
+ message->set_request(message, !this->req);
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_set_ike_request_t *this)
+{
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *set_ike_request_hook_create(char *name)
+{
+ private_set_ike_request_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ .req = conftest->test->get_bool(conftest->test,
+ "hooks.%s.request", TRUE, name),
+ .id = conftest->test->get_int(conftest->test,
+ "hooks.%s.id", 0, name),
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/set_ike_spi.c b/src/conftest/hooks/set_ike_spi.c
new file mode 100644
index 000000000..14a0da9cd
--- /dev/null
+++ b/src/conftest/hooks/set_ike_spi.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+#include <encoding/payloads/unknown_payload.h>
+
+typedef struct private_set_ike_spi_t private_set_ike_spi_t;
+
+/**
+ * Private data of an set_ike_spi_t object.
+ */
+struct private_set_ike_spi_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+
+ /**
+ * Alter requests or responses?
+ */
+ bool req;
+
+ /**
+ * ID of message to alter.
+ */
+ int id;
+
+ /**
+ * Initiator SPI
+ */
+ u_int64_t spii;
+
+ /**
+ * Responder SPI
+ */
+ u_int64_t spir;
+};
+
+METHOD(listener_t, message, bool,
+ private_set_ike_spi_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (!incoming &&
+ message->get_request(message) == this->req &&
+ message->get_message_id(message) == this->id)
+ {
+ ike_sa_id_t *id;
+
+ DBG1(DBG_CFG, "setting IKE SPIs to: 0x%llx/0x%llx",
+ this->spii, this->spir);
+
+ id = message->get_ike_sa_id(message);
+ id->set_initiator_spi(id, this->spii);
+ id->set_responder_spi(id, this->spir);
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_set_ike_spi_t *this)
+{
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *set_ike_spi_hook_create(char *name)
+{
+ private_set_ike_spi_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ .req = conftest->test->get_bool(conftest->test,
+ "hooks.%s.request", TRUE, name),
+ .id = conftest->test->get_int(conftest->test,
+ "hooks.%s.id", 0, name),
+ .spii = strtoull(conftest->test->get_str(conftest->test,
+ "hooks.%s.spii", "0", name), NULL, 16),
+ .spir = strtoull(conftest->test->get_str(conftest->test,
+ "hooks.%s.spir", "0", name), NULL, 16),
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/set_ike_version.c b/src/conftest/hooks/set_ike_version.c
new file mode 100644
index 000000000..d2de9dc81
--- /dev/null
+++ b/src/conftest/hooks/set_ike_version.c
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+#include <encoding/payloads/unknown_payload.h>
+
+typedef struct private_set_ike_version_t private_set_ike_version_t;
+
+/**
+ * Private data of an set_ike_version_t object.
+ */
+struct private_set_ike_version_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+
+ /**
+ * Alter requests or responses?
+ */
+ bool req;
+
+ /**
+ * ID of message to alter.
+ */
+ int id;
+
+ /**
+ * Major version to set
+ */
+ int major;
+
+ /**
+ * Minor version to set
+ */
+ int minor;
+
+ /**
+ * Higher version supported?
+ */
+ bool higher;
+};
+
+METHOD(listener_t, message, bool,
+ private_set_ike_version_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (!incoming &&
+ message->get_request(message) == this->req &&
+ message->get_message_id(message) == this->id)
+ {
+ DBG1(DBG_CFG, "setting IKE version of message ID %d to %d.%d",
+ this->id, this->major, this->minor);
+ message->set_major_version(message, this->major);
+ message->set_minor_version(message, this->minor);
+ if (this->higher)
+ {
+ message->set_version_flag(message);
+ }
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_set_ike_version_t *this)
+{
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *set_ike_version_hook_create(char *name)
+{
+ private_set_ike_version_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ .req = conftest->test->get_bool(conftest->test,
+ "hooks.%s.request", TRUE, name),
+ .id = conftest->test->get_int(conftest->test,
+ "hooks.%s.id", 0, name),
+ .major = conftest->test->get_int(conftest->test,
+ "hooks.%s.major", 2, name),
+ .minor = conftest->test->get_int(conftest->test,
+ "hooks.%s.minor", 0, name),
+ .higher = conftest->test->get_bool(conftest->test,
+ "hooks.%s.higher", FALSE, name),
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/set_length.c b/src/conftest/hooks/set_length.c
new file mode 100644
index 000000000..0379dcb7c
--- /dev/null
+++ b/src/conftest/hooks/set_length.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+typedef struct private_set_length_t private_set_length_t;
+
+/**
+ * Private data of an set_length_t object.
+ */
+struct private_set_length_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+
+ /**
+ * Alter requests or responses?
+ */
+ bool req;
+
+ /**
+ * ID of message to alter.
+ */
+ int id;
+
+ /**
+ * Payload type
+ */
+ char *type;
+
+ /**
+ * Difference to correct length
+ */
+ int diff;
+};
+
+METHOD(listener_t, message, bool,
+ private_set_length_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (!incoming &&
+ message->get_request(message) == this->req &&
+ message->get_message_id(message) == this->id)
+ {
+ payload_t *payload;
+ enumerator_t *enumerator;
+ payload_type_t type;
+
+ type = atoi(this->type);
+ if (!type)
+ {
+ type = enum_from_name(payload_type_short_names, this->type);
+ if (type == -1)
+ {
+ DBG1(DBG_CFG, "unknown payload: '%s', skipped", this->type);
+ return TRUE;
+ }
+ }
+ enumerator = message->create_payload_enumerator(message);
+ while (enumerator->enumerate(enumerator, &payload))
+ {
+ if (type == payload->get_type(payload))
+ {
+ encoding_rule_t *rules;
+ size_t count;
+ u_int16_t *len;
+ int i;
+
+ payload->get_encoding_rules(payload, &rules, &count);
+ for (i = 0; i < count; i++)
+ {
+ if (rules[i].type == PAYLOAD_LENGTH)
+ {
+ len = (u_int16_t*)(((void*)payload) + rules[i].offset);
+ DBG1(DBG_CFG, "adjusting length of %N payload "
+ "from %d to %d", payload_type_short_names, type,
+ *len, *len + this->diff);
+ *len = *len + this->diff;
+ }
+ }
+ }
+ }
+ enumerator->destroy(enumerator);
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_set_length_t *this)
+{
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *set_length_hook_create(char *name)
+{
+ private_set_length_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ .req = conftest->test->get_bool(conftest->test,
+ "hooks.%s.request", TRUE, name),
+ .id = conftest->test->get_int(conftest->test,
+ "hooks.%s.id", 0, name),
+ .type = conftest->test->get_str(conftest->test,
+ "hooks.%s.type", "", name),
+ .diff = conftest->test->get_int(conftest->test,
+ "hooks.%s.diff", 0, name),
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/set_proposal_number.c b/src/conftest/hooks/set_proposal_number.c
new file mode 100644
index 000000000..a59d96b6d
--- /dev/null
+++ b/src/conftest/hooks/set_proposal_number.c
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+#include <encoding/payloads/sa_payload.h>
+
+typedef struct private_set_proposal_number_t private_set_proposal_number_t;
+
+/**
+ * Private data of an set_proposal_number_t object.
+ */
+struct private_set_proposal_number_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+
+ /**
+ * Alter requests or responses?
+ */
+ bool req;
+
+ /**
+ * ID of message to alter.
+ */
+ int id;
+
+ /**
+ * Proposal number to modify
+ */
+ int from;
+
+ /**
+ * Proposal number to set
+ */
+ int to;
+};
+
+/**
+ * Copy all algs from given type from one proposal to another
+ */
+static void copy_proposal_algs(proposal_t *from, proposal_t *to,
+ transform_type_t type)
+{
+ enumerator_t *enumerator;
+ u_int16_t alg, key_size;
+
+ enumerator = from->create_enumerator(from, type);
+ while (enumerator->enumerate(enumerator, &alg, &key_size))
+ {
+ to->add_algorithm(to, type, alg, key_size);
+ }
+ enumerator->destroy(enumerator);
+}
+
+METHOD(listener_t, message, bool,
+ private_set_proposal_number_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (!incoming &&
+ message->get_request(message) == this->req &&
+ message->get_message_id(message) == this->id)
+ {
+ enumerator_t *enumerator;
+ payload_t *payload;
+ linked_list_t *list = NULL, *updated;
+ sa_payload_t *sa;
+ proposal_t *proposal, *new;
+
+ updated = linked_list_create();
+ enumerator = message->create_payload_enumerator(message);
+ while (enumerator->enumerate(enumerator, &payload))
+ {
+ if (payload->get_type(payload) == SECURITY_ASSOCIATION)
+ {
+ sa = (sa_payload_t*)payload;
+ list = sa->get_proposals(sa);
+ message->remove_payload_at(message, enumerator);
+ sa->destroy(sa);
+ }
+ }
+ enumerator->destroy(enumerator);
+
+ if (list)
+ {
+ enumerator = list->create_enumerator(list);
+ while (enumerator->enumerate(enumerator, &proposal))
+ {
+ if (proposal->get_number(proposal) == this->from)
+ {
+ DBG1(DBG_CFG, "setting proposal number from %d to %d",
+ this->from, this->to);
+ new = proposal_create(proposal->get_protocol(proposal),
+ this->to);
+ copy_proposal_algs(proposal, new, ENCRYPTION_ALGORITHM);
+ copy_proposal_algs(proposal, new, INTEGRITY_ALGORITHM);
+ copy_proposal_algs(proposal, new, PSEUDO_RANDOM_FUNCTION);
+ copy_proposal_algs(proposal, new, DIFFIE_HELLMAN_GROUP);
+ copy_proposal_algs(proposal, new, EXTENDED_SEQUENCE_NUMBERS);
+ updated->insert_last(updated, new);
+ }
+ else
+ {
+ list->remove_at(list, enumerator);
+ updated->insert_last(updated, proposal);
+ }
+ }
+ enumerator->destroy(enumerator);
+ }
+ sa = sa_payload_create_from_proposal_list(updated);
+ list->destroy_offset(list, offsetof(proposal_t, destroy));
+ updated->destroy_offset(updated, offsetof(proposal_t, destroy));
+ message->add_payload(message, (payload_t*)sa);
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_set_proposal_number_t *this)
+{
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *set_proposal_number_hook_create(char *name)
+{
+ private_set_proposal_number_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ .req = conftest->test->get_bool(conftest->test,
+ "hooks.%s.request", TRUE, name),
+ .id = conftest->test->get_int(conftest->test,
+ "hooks.%s.id", 0, name),
+ .from = conftest->test->get_int(conftest->test,
+ "hooks.%s.from", 0, name),
+ .to = conftest->test->get_int(conftest->test,
+ "hooks.%s.to", 1, name),
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/set_reserved.c b/src/conftest/hooks/set_reserved.c
new file mode 100644
index 000000000..77a605d2a
--- /dev/null
+++ b/src/conftest/hooks/set_reserved.c
@@ -0,0 +1,245 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+#include <encoding/payloads/sa_payload.h>
+
+typedef struct private_set_reserved_t private_set_reserved_t;
+
+/**
+ * Private data of an set_reserved_t object.
+ */
+struct private_set_reserved_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+
+ /**
+ * Alter requests or responses?
+ */
+ bool req;
+
+ /**
+ * ID of message to alter.
+ */
+ int id;
+
+ /**
+ * Hook name
+ */
+ char *name;
+};
+
+/**
+ * Set reserved bit of a payload
+ */
+static void set_bit(private_set_reserved_t *this, message_t *message,
+ payload_type_t type, u_int nr)
+{
+ enumerator_t *payloads;
+ payload_t *payload;
+ bool *bit;
+
+ if (type == HEADER)
+ {
+ message->set_reserved_header_bit(message, nr);
+ DBG1(DBG_CFG, "setting reserved bit %d of %N",
+ nr, payload_type_short_names, type);
+ }
+ else
+ {
+ payloads = message->create_payload_enumerator(message);
+ while (payloads->enumerate(payloads, &payload))
+ {
+ if (payload->get_type(payload) == type)
+ {
+ bit = payload_get_field(payload, RESERVED_BIT, nr);
+ if (bit)
+ {
+ DBG1(DBG_CFG, "setting reserved bit %d of %N",
+ nr, payload_type_short_names, type);
+ *bit = TRUE;
+ }
+ }
+ }
+ payloads->destroy(payloads);
+ }
+}
+
+/**
+ * Set reserved byte of a payload
+ */
+static void set_byte(private_set_reserved_t *this, message_t *message,
+ payload_type_t type, u_int nr, u_int8_t byteval)
+{
+ enumerator_t *payloads;
+ payload_t *payload;
+ u_int8_t *byte;
+
+ if (type == TRANSFORM_SUBSTRUCTURE || type == PROPOSAL_SUBSTRUCTURE)
+ {
+ enumerator_t *transforms, *proposals;
+ transform_substructure_t *transform;
+ proposal_substructure_t *proposal;
+ sa_payload_t *sa;
+
+ payloads = message->create_payload_enumerator(message);
+ while (payloads->enumerate(payloads, &payload))
+ {
+ if (payload->get_type(payload) == SECURITY_ASSOCIATION)
+ {
+ sa = (sa_payload_t*)payload;
+ proposals = sa->create_substructure_enumerator(sa);
+ while (proposals->enumerate(proposals, &proposal))
+ {
+ if (type == PROPOSAL_SUBSTRUCTURE)
+ {
+ byte = payload_get_field(&proposal->payload_interface,
+ RESERVED_BYTE, nr);
+ if (byte)
+ {
+ DBG1(DBG_CFG, "setting reserved byte %d of %N to %d",
+ nr, payload_type_short_names, type, byteval);
+ *byte = byteval;
+ }
+ }
+ else if (type == TRANSFORM_SUBSTRUCTURE)
+ {
+ transforms = proposal->create_substructure_enumerator(
+ proposal);
+ while (transforms->enumerate(transforms, &transform))
+ {
+ byte = payload_get_field(&transform->payload_interface,
+ RESERVED_BYTE, nr);
+ if (byte)
+ {
+ DBG1(DBG_CFG, "setting reserved byte %d of %N to %d",
+ nr, payload_type_short_names, type, byteval);
+ *byte = byteval;
+ }
+ }
+ transforms->destroy(transforms);
+ }
+ }
+ proposals->destroy(proposals);
+ }
+ }
+ payloads->destroy(payloads);
+ }
+ else
+ {
+ payloads = message->create_payload_enumerator(message);
+ while (payloads->enumerate(payloads, &payload))
+ {
+ if (payload->get_type(payload) == type)
+ {
+ byte = payload_get_field(payload, RESERVED_BYTE, nr);
+ if (byte)
+ {
+ DBG1(DBG_CFG, "setting reserved byte %d of %N to %d",
+ nr, payload_type_short_names, type, byteval);
+ *byte = byteval;
+ }
+ }
+ }
+ payloads->destroy(payloads);
+ }
+}
+
+METHOD(listener_t, message, bool,
+ private_set_reserved_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (!incoming &&
+ message->get_request(message) == this->req &&
+ message->get_message_id(message) == this->id)
+ {
+ enumerator_t *bits, *bytes, *types;
+ payload_type_t type;
+ char *nr, *name;
+ u_int8_t byteval;
+
+ types = conftest->test->create_section_enumerator(conftest->test,
+ "hooks.%s", this->name);
+ while (types->enumerate(types, &name))
+ {
+ type = atoi(name);
+ if (!type)
+ {
+ type = enum_from_name(payload_type_short_names, name);
+ if (type == -1)
+ {
+ DBG1(DBG_CFG, "invalid payload name '%s'", name);
+ break;
+ }
+ }
+ nr = conftest->test->get_str(conftest->test,
+ "hooks.%s.%s.bits", "", this->name, name);
+ bits = enumerator_create_token(nr, ",", " ");
+ while (bits->enumerate(bits, &nr))
+ {
+ set_bit(this, message, type, atoi(nr));
+ }
+ bits->destroy(bits);
+
+ nr = conftest->test->get_str(conftest->test,
+ "hooks.%s.%s.bytes", "", this->name, name);
+ byteval = conftest->test->get_int(conftest->test,
+ "hooks.%s.%s.byteval", 255, this->name, name);
+ bytes = enumerator_create_token(nr, ",", " ");
+ while (bytes->enumerate(bytes, &nr))
+ {
+ set_byte(this, message, type, atoi(nr), byteval);
+ }
+ bytes->destroy(bytes);
+ }
+ types->destroy(types);
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_set_reserved_t *this)
+{
+ free(this->name);
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *set_reserved_hook_create(char *name)
+{
+ private_set_reserved_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ .req = conftest->test->get_bool(conftest->test,
+ "hooks.%s.request", TRUE, name),
+ .id = conftest->test->get_int(conftest->test,
+ "hooks.%s.id", 0, name),
+ .name = strdup(name),
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/unencrypted_notify.c b/src/conftest/hooks/unencrypted_notify.c
new file mode 100644
index 000000000..80bdc64b7
--- /dev/null
+++ b/src/conftest/hooks/unencrypted_notify.c
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+typedef struct private_unencrypted_notify_t private_unencrypted_notify_t;
+
+/**
+ * Private data of an unencrypted_notify_t object.
+ */
+struct private_unencrypted_notify_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+
+ /**
+ * ID of message send.
+ */
+ int id;
+
+ /**
+ * Notify type
+ */
+ char *type;
+
+ /**
+ * Notify data
+ */
+ char *data;
+
+ /**
+ * SPI of notify
+ */
+ int spi;
+
+ /**
+ * TRUE for a ESP protocol notify, FALSE for IKE
+ */
+ bool esp;
+};
+
+METHOD(listener_t, ike_updown, bool,
+ private_unencrypted_notify_t *this, ike_sa_t *ike_sa, bool up)
+{
+ if (up)
+ {
+ message_t *message;
+ host_t *host;
+ notify_type_t type;
+ notify_payload_t *notify;
+ chunk_t data = chunk_empty;
+ packet_t *packet;
+
+ type = atoi(this->type);
+ if (!type)
+ {
+ type = enum_from_name(notify_type_names, this->type);
+ if (type == -1)
+ {
+ DBG1(DBG_CFG, "unknown notify: '%s', skipped", this->type);
+ return TRUE;
+ }
+ }
+ if (strncaseeq(this->data, "0x", 2))
+ {
+ data = chunk_skip(chunk_create(this->data, strlen(this->data)), 2);
+ data = chunk_from_hex(data, NULL);
+ }
+ else if (this->data && strlen(this->data))
+ {
+ data = chunk_clone(chunk_create(this->data, strlen(this->data)));
+ }
+ notify = notify_payload_create_from_protocol_and_type(
+ this->esp ? PROTO_ESP : PROTO_IKE, type);
+ notify->set_spi(notify, this->spi);
+ if (data.len)
+ {
+ notify->set_notification_data(notify, data);
+ free(data.ptr);
+ }
+
+ DBG1(DBG_CFG, "injecting unencrypted INFORMATIONAL message");
+
+ message = message_create();
+ message->set_message_id(message, this->id);
+ message->set_ike_sa_id(message, ike_sa->get_id(ike_sa));
+ message->set_exchange_type(message, INFORMATIONAL);
+ message->set_request(message, TRUE);
+ host = ike_sa->get_my_host(ike_sa);
+ message->set_source(message, host->clone(host));
+ host = ike_sa->get_other_host(ike_sa);
+ message->set_destination(message, host->clone(host));
+ message->add_payload(message, &notify->payload_interface);
+ if (message->generate(message, NULL, &packet) != SUCCESS)
+ {
+ DBG1(DBG_CFG, "generating message failed");
+ message->destroy(message);
+ return TRUE;
+ }
+ message->destroy(message);
+ charon->sender->send(charon->sender, packet);
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_unencrypted_notify_t *this)
+{
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *unencrypted_notify_hook_create(char *name)
+{
+ private_unencrypted_notify_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .ike_updown = _ike_updown,
+ },
+ .destroy = _destroy,
+ },
+ .id = conftest->test->get_int(conftest->test,
+ "hooks.%s.id", 2, name),
+ .type = conftest->test->get_str(conftest->test,
+ "hooks.%s.type", "", name),
+ .data = conftest->test->get_str(conftest->test,
+ "hooks.%s.data", "", name),
+ .spi = conftest->test->get_int(conftest->test,
+ "hooks.%s.spi", 0, name),
+ .esp = conftest->test->get_bool(conftest->test,
+ "hooks.%s.esp", FALSE, name),
+ );
+
+ return &this->hook;
+}
diff --git a/src/conftest/hooks/unsort_message.c b/src/conftest/hooks/unsort_message.c
new file mode 100644
index 000000000..b37b261a4
--- /dev/null
+++ b/src/conftest/hooks/unsort_message.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hook.h"
+
+typedef struct private_unsort_message_t private_unsort_message_t;
+
+/**
+ * Private data of an unsort_message_t object.
+ */
+struct private_unsort_message_t {
+
+ /**
+ * Implements the hook_t interface.
+ */
+ hook_t hook;
+
+ /**
+ * Alter requests or responses?
+ */
+ bool req;
+
+ /**
+ * ID of message to alter.
+ */
+ int id;
+
+ /**
+ * Order of payloads we want
+ */
+ char *order;
+};
+
+METHOD(listener_t, message, bool,
+ private_unsort_message_t *this, ike_sa_t *ike_sa, message_t *message,
+ bool incoming)
+{
+ if (!incoming &&
+ message->get_request(message) == this->req &&
+ message->get_message_id(message) == this->id)
+ {
+ enumerator_t *enumerator, *order;
+ linked_list_t *list;
+ payload_type_t type;
+ payload_t *payload;
+ char *name;
+
+ list = linked_list_create();
+ enumerator = message->create_payload_enumerator(message);
+ while (enumerator->enumerate(enumerator, &payload))
+ {
+ message->remove_payload_at(message, enumerator);
+ list->insert_last(list, payload);
+ }
+ enumerator->destroy(enumerator);
+
+ order = enumerator_create_token(this->order, ", ", " ");
+ while (order->enumerate(order, &name))
+ {
+ type = enum_from_name(payload_type_short_names, name);
+ if (type != -1)
+ {
+ enumerator = list->create_enumerator(list);
+ while (enumerator->enumerate(enumerator, &payload))
+ {
+ if (payload->get_type(payload) == type)
+ {
+ list->remove_at(list, enumerator);
+ message->add_payload(message, payload);
+ }
+ }
+ enumerator->destroy(enumerator);
+ }
+ else
+ {
+ DBG1(DBG_CFG, "unknown payload to sort: '%s', skipped", name);
+ }
+ }
+ order->destroy(order);
+
+ while (list->remove_first(list, (void**)&payload) == SUCCESS)
+ {
+ message->add_payload(message, payload);
+ }
+ list->destroy(list);
+
+ message->disable_sort(message);
+ }
+ return TRUE;
+}
+
+METHOD(hook_t, destroy, void,
+ private_unsort_message_t *this)
+{
+ free(this);
+}
+
+/**
+ * Create the IKE_AUTH fill hook
+ */
+hook_t *unsort_message_hook_create(char *name)
+{
+ private_unsort_message_t *this;
+
+ INIT(this,
+ .hook = {
+ .listener = {
+ .message = _message,
+ },
+ .destroy = _destroy,
+ },
+ .req = conftest->test->get_bool(conftest->test,
+ "hooks.%s.request", TRUE, name),
+ .id = conftest->test->get_int(conftest->test,
+ "hooks.%s.id", 0, name),
+ .order = conftest->test->get_str(conftest->test,
+ "hooks.%s.order", "", name),
+ );
+
+ return &this->hook;
+}