summaryrefslogtreecommitdiff
path: root/src/libpts/plugins
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2013-08-25 15:37:26 +0200
committerYves-Alexis Perez <corsac@debian.org>2013-08-25 15:37:26 +0200
commit6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349 (patch)
tree009fc492961e13860d2a4bc2de8caf2bbe2975e7 /src/libpts/plugins
parentc83921a2b566aa9d55d8ccc7258f04fca6292ee6 (diff)
downloadvyos-strongswan-6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349.tar.gz
vyos-strongswan-6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349.zip
Imported Upstream version 5.1.0
Diffstat (limited to 'src/libpts/plugins')
-rw-r--r--src/libpts/plugins/imc_attestation/Makefile.am12
-rw-r--r--src/libpts/plugins/imc_attestation/Makefile.in81
-rw-r--r--src/libpts/plugins/imv_attestation/Makefile.am13
-rw-r--r--src/libpts/plugins/imv_attestation/Makefile.in90
-rw-r--r--src/libpts/plugins/imv_attestation/attest.c53
-rw-r--r--src/libpts/plugins/imv_attestation/attest_db.c937
-rw-r--r--src/libpts/plugins/imv_attestation/attest_db.h14
-rw-r--r--src/libpts/plugins/imv_attestation/data.sql1666
-rw-r--r--src/libpts/plugins/imv_attestation/imv_attestation.c484
-rw-r--r--src/libpts/plugins/imv_attestation/imv_attestation_agent.c616
-rw-r--r--src/libpts/plugins/imv_attestation/imv_attestation_agent.h36
-rw-r--r--src/libpts/plugins/imv_attestation/imv_attestation_build.c88
-rw-r--r--src/libpts/plugins/imv_attestation/imv_attestation_process.c130
-rw-r--r--src/libpts/plugins/imv_attestation/imv_attestation_process.h4
-rw-r--r--src/libpts/plugins/imv_attestation/imv_attestation_state.c123
-rw-r--r--src/libpts/plugins/imv_attestation/imv_attestation_state.h40
-rw-r--r--src/libpts/plugins/imv_attestation/tables.sql146
17 files changed, 1609 insertions, 2924 deletions
diff --git a/src/libpts/plugins/imc_attestation/Makefile.am b/src/libpts/plugins/imc_attestation/Makefile.am
index 9d78b935a..18c756884 100644
--- a/src/libpts/plugins/imc_attestation/Makefile.am
+++ b/src/libpts/plugins/imc_attestation/Makefile.am
@@ -1,8 +1,11 @@
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/libstrongswan \
+ -I$(top_srcdir)/src/libtncif \
+ -I$(top_srcdir)/src/libimcv \
+ -I$(top_srcdir)/src/libpts
-INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libtncif \
- -I$(top_srcdir)/src/libimcv -I$(top_srcdir)/src/libpts
-
-AM_CFLAGS = -rdynamic
+AM_CFLAGS = \
+ -rdynamic
imcv_LTLIBRARIES = imc-attestation.la
@@ -15,4 +18,3 @@ imc_attestation_la_SOURCES = imc_attestation.c \
imc_attestation_process.h imc_attestation_process.c
imc_attestation_la_LDFLAGS = -module -avoid-version
-
diff --git a/src/libpts/plugins/imc_attestation/Makefile.in b/src/libpts/plugins/imc_attestation/Makefile.in
index c30945b79..b129f9274 100644
--- a/src/libpts/plugins/imc_attestation/Makefile.in
+++ b/src/libpts/plugins/imc_attestation/Makefile.in
@@ -62,7 +62,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/config/libtool.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
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -105,22 +105,39 @@ imc_attestation_la_DEPENDENCIES = \
am_imc_attestation_la_OBJECTS = imc_attestation.lo \
imc_attestation_state.lo imc_attestation_process.lo
imc_attestation_la_OBJECTS = $(am_imc_attestation_la_OBJECTS)
-imc_attestation_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(imc_attestation_la_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+imc_attestation_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(imc_attestation_la_LDFLAGS) \
+ $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
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)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(imc_attestation_la_SOURCES)
DIST_SOURCES = $(imc_attestation_la_SOURCES)
am__can_run_installinfo = \
@@ -134,6 +151,7 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
@@ -146,6 +164,8 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CHECK_CFLAGS = @CHECK_CFLAGS@
CHECK_LIBS = @CHECK_LIBS@
+COVERAGE_CFLAGS = @COVERAGE_CFLAGS@
+COVERAGE_LDFLAGS = @COVERAGE_LDFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
@@ -161,6 +181,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
+GENHTML = @GENHTML@
GPERF = @GPERF@
GPRBUILD = @GPRBUILD@
GREP = @GREP@
@@ -169,6 +190,7 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LCOV = @LCOV@
LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
@@ -215,6 +237,7 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOCKLIB = @SOCKLIB@
STRIP = @STRIP@
+UNWINDLIB = @UNWINDLIB@
VERSION = @VERSION@
YACC = @YACC@
YFLAGS = @YFLAGS@
@@ -243,6 +266,7 @@ charon_natt_port = @charon_natt_port@
charon_plugins = @charon_plugins@
charon_udp_port = @charon_udp_port@
clearsilver_LIBS = @clearsilver_LIBS@
+cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
dbusservicedir = @dbusservicedir@
@@ -320,10 +344,15 @@ top_srcdir = @top_srcdir@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
-INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libtncif \
- -I$(top_srcdir)/src/libimcv -I$(top_srcdir)/src/libpts
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/libstrongswan \
+ -I$(top_srcdir)/src/libtncif \
+ -I$(top_srcdir)/src/libimcv \
+ -I$(top_srcdir)/src/libpts
+
+AM_CFLAGS = \
+ -rdynamic
-AM_CFLAGS = -rdynamic
imcv_LTLIBRARIES = imc-attestation.la
imc_attestation_la_LIBADD = $(top_builddir)/src/libimcv/libimcv.la \
$(top_builddir)/src/libstrongswan/libstrongswan.la \
@@ -401,7 +430,7 @@ clean-imcvLTLIBRARIES:
rm -f "$${dir}/so_locations"; \
done
imc-attestation.la: $(imc_attestation_la_OBJECTS) $(imc_attestation_la_DEPENDENCIES) $(EXTRA_imc_attestation_la_DEPENDENCIES)
- $(imc_attestation_la_LINK) -rpath $(imcvdir) $(imc_attestation_la_OBJECTS) $(imc_attestation_la_LIBADD) $(LIBS)
+ $(AM_V_CCLD)$(imc_attestation_la_LINK) -rpath $(imcvdir) $(imc_attestation_la_OBJECTS) $(imc_attestation_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -414,25 +443,25 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imc_attestation_state.Plo@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@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(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@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(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@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
diff --git a/src/libpts/plugins/imv_attestation/Makefile.am b/src/libpts/plugins/imv_attestation/Makefile.am
index 5e7465195..ae5225ae3 100644
--- a/src/libpts/plugins/imv_attestation/Makefile.am
+++ b/src/libpts/plugins/imv_attestation/Makefile.am
@@ -1,11 +1,12 @@
-
-INCLUDES = \
+AM_CPPFLAGS = \
-I$(top_srcdir)/src/libstrongswan \
-I$(top_srcdir)/src/libtncif \
-I$(top_srcdir)/src/libimcv \
- -I$(top_srcdir)/src/libpts
+ -I$(top_srcdir)/src/libpts \
+ -DPLUGINS=\""${attest_plugins}\""
-AM_CFLAGS = -rdynamic -DPLUGINS=\""${attest_plugins}\""
+AM_CFLAGS = \
+ -rdynamic
imcv_LTLIBRARIES = imv-attestation.la
@@ -16,6 +17,7 @@ imv_attestation_la_LIBADD = \
imv_attestation_la_SOURCES = imv_attestation.c \
imv_attestation_state.h imv_attestation_state.c \
+ imv_attestation_agent.h imv_attestation_agent.c \
imv_attestation_process.h imv_attestation_process.c \
imv_attestation_build.h imv_attestation_build.c
@@ -24,8 +26,7 @@ imv_attestation_la_LDFLAGS = -module -avoid-version
ipsec_PROGRAMS = attest
attest_SOURCES = attest.c \
attest_usage.h attest_usage.c \
- attest_db.h attest_db.c \
- tables.sql data.sql
+ attest_db.h attest_db.c
attest_LDADD = \
$(top_builddir)/src/libimcv/libimcv.la \
$(top_builddir)/src/libpts/libpts.la \
diff --git a/src/libpts/plugins/imv_attestation/Makefile.in b/src/libpts/plugins/imv_attestation/Makefile.in
index 153865d30..36b440e82 100644
--- a/src/libpts/plugins/imv_attestation/Makefile.in
+++ b/src/libpts/plugins/imv_attestation/Makefile.in
@@ -64,7 +64,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/config/libtool.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
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -105,12 +105,16 @@ imv_attestation_la_DEPENDENCIES = \
$(top_builddir)/src/libstrongswan/libstrongswan.la \
$(top_builddir)/src/libpts/libpts.la
am_imv_attestation_la_OBJECTS = imv_attestation.lo \
- imv_attestation_state.lo imv_attestation_process.lo \
- imv_attestation_build.lo
+ imv_attestation_state.lo imv_attestation_agent.lo \
+ imv_attestation_process.lo imv_attestation_build.lo
imv_attestation_la_OBJECTS = $(am_imv_attestation_la_OBJECTS)
-imv_attestation_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(imv_attestation_la_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+imv_attestation_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(imv_attestation_la_LDFLAGS) \
+ $(LDFLAGS) -o $@
PROGRAMS = $(ipsec_PROGRAMS)
am_attest_OBJECTS = attest.$(OBJEXT) attest_usage.$(OBJEXT) \
attest_db.$(OBJEXT)
@@ -124,13 +128,26 @@ 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)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(imv_attestation_la_SOURCES) $(attest_SOURCES)
DIST_SOURCES = $(imv_attestation_la_SOURCES) $(attest_SOURCES)
am__can_run_installinfo = \
@@ -144,6 +161,7 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
@@ -156,6 +174,8 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CHECK_CFLAGS = @CHECK_CFLAGS@
CHECK_LIBS = @CHECK_LIBS@
+COVERAGE_CFLAGS = @COVERAGE_CFLAGS@
+COVERAGE_LDFLAGS = @COVERAGE_LDFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
@@ -171,6 +191,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
+GENHTML = @GENHTML@
GPERF = @GPERF@
GPRBUILD = @GPRBUILD@
GREP = @GREP@
@@ -179,6 +200,7 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LCOV = @LCOV@
LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
@@ -225,6 +247,7 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOCKLIB = @SOCKLIB@
STRIP = @STRIP@
+UNWINDLIB = @UNWINDLIB@
VERSION = @VERSION@
YACC = @YACC@
YFLAGS = @YFLAGS@
@@ -253,6 +276,7 @@ charon_natt_port = @charon_natt_port@
charon_plugins = @charon_plugins@
charon_udp_port = @charon_udp_port@
clearsilver_LIBS = @clearsilver_LIBS@
+cmd_plugins = @cmd_plugins@
datadir = @datadir@
datarootdir = @datarootdir@
dbusservicedir = @dbusservicedir@
@@ -330,13 +354,16 @@ top_srcdir = @top_srcdir@
urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
-INCLUDES = \
+AM_CPPFLAGS = \
-I$(top_srcdir)/src/libstrongswan \
-I$(top_srcdir)/src/libtncif \
-I$(top_srcdir)/src/libimcv \
- -I$(top_srcdir)/src/libpts
+ -I$(top_srcdir)/src/libpts \
+ -DPLUGINS=\""${attest_plugins}\""
+
+AM_CFLAGS = \
+ -rdynamic
-AM_CFLAGS = -rdynamic -DPLUGINS=\""${attest_plugins}\""
imcv_LTLIBRARIES = imv-attestation.la
imv_attestation_la_LIBADD = \
$(top_builddir)/src/libimcv/libimcv.la \
@@ -345,14 +372,14 @@ imv_attestation_la_LIBADD = \
imv_attestation_la_SOURCES = imv_attestation.c \
imv_attestation_state.h imv_attestation_state.c \
+ imv_attestation_agent.h imv_attestation_agent.c \
imv_attestation_process.h imv_attestation_process.c \
imv_attestation_build.h imv_attestation_build.c
imv_attestation_la_LDFLAGS = -module -avoid-version
attest_SOURCES = attest.c \
attest_usage.h attest_usage.c \
- attest_db.h attest_db.c \
- tables.sql data.sql
+ attest_db.h attest_db.c
attest_LDADD = \
$(top_builddir)/src/libimcv/libimcv.la \
@@ -427,7 +454,7 @@ clean-imcvLTLIBRARIES:
rm -f "$${dir}/so_locations"; \
done
imv-attestation.la: $(imv_attestation_la_OBJECTS) $(imv_attestation_la_DEPENDENCIES) $(EXTRA_imv_attestation_la_DEPENDENCIES)
- $(imv_attestation_la_LINK) -rpath $(imcvdir) $(imv_attestation_la_OBJECTS) $(imv_attestation_la_LIBADD) $(LIBS)
+ $(AM_V_CCLD)$(imv_attestation_la_LINK) -rpath $(imcvdir) $(imv_attestation_la_OBJECTS) $(imv_attestation_la_LIBADD) $(LIBS)
install-ipsecPROGRAMS: $(ipsec_PROGRAMS)
@$(NORMAL_INSTALL)
@list='$(ipsec_PROGRAMS)'; test -n "$(ipsecdir)" || list=; \
@@ -476,7 +503,7 @@ clean-ipsecPROGRAMS:
rm -f $$list
attest$(EXEEXT): $(attest_OBJECTS) $(attest_DEPENDENCIES) $(EXTRA_attest_DEPENDENCIES)
@rm -f attest$(EXEEXT)
- $(LINK) $(attest_OBJECTS) $(attest_LDADD) $(LIBS)
+ $(AM_V_CCLD)$(LINK) $(attest_OBJECTS) $(attest_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -488,30 +515,31 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/attest_db.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/attest_usage.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imv_attestation.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imv_attestation_agent.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imv_attestation_build.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imv_attestation_process.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imv_attestation_state.Plo@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@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(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@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(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@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
diff --git a/src/libpts/plugins/imv_attestation/attest.c b/src/libpts/plugins/imv_attestation/attest.c
index 1cdacaeeb..4d25df3f4 100644
--- a/src/libpts/plugins/imv_attestation/attest.c
+++ b/src/libpts/plugins/imv_attestation/attest.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2012 Andreas Steffen
+ * Copyright (C) 2011-2013 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -20,6 +20,7 @@
#include <string.h>
#include <errno.h>
#include <syslog.h>
+#include <libgen.h>
#include <library.h>
#include <utils/debug.h>
@@ -81,6 +82,7 @@ static void attest_dbg(debug_t group, level_t level, char *fmt, ...)
*/
attest_db_t *attest;
+
/**
* atexit handler to close db on shutdown
*/
@@ -100,11 +102,13 @@ static void do_args(int argc, char *argv[])
OP_KEYS,
OP_COMPONENTS,
OP_DEVICES,
+ OP_DIRECTORIES,
OP_FILES,
OP_HASHES,
OP_MEASUREMENTS,
OP_PACKAGES,
OP_PRODUCTS,
+ OP_SESSIONS,
OP_ADD,
OP_DEL,
} op = OP_UNDEF;
@@ -120,15 +124,19 @@ static void do_args(int argc, char *argv[])
{ "help", no_argument, NULL, 'h' },
{ "components", no_argument, NULL, 'c' },
{ "devices", no_argument, NULL, 'e' },
+ { "directories", no_argument, NULL, 'd' },
+ { "dirs", no_argument, NULL, 'd' },
{ "files", no_argument, NULL, 'f' },
{ "keys", no_argument, NULL, 'k' },
{ "packages", no_argument, NULL, 'g' },
{ "products", no_argument, NULL, 'p' },
{ "hashes", no_argument, NULL, 'H' },
{ "measurements", no_argument, NULL, 'm' },
+ { "sessions", no_argument, NULL, 's' },
{ "add", no_argument, NULL, 'a' },
- { "delete", no_argument, NULL, 'd' },
- { "del", no_argument, NULL, 'd' },
+ { "delete", no_argument, NULL, 'r' },
+ { "del", no_argument, NULL, 'r' },
+ { "remove", no_argument, NULL, 'r' },
{ "aik", required_argument, NULL, 'A' },
{ "blacklist", no_argument, NULL, 'B' },
{ "component", required_argument, NULL, 'C' },
@@ -171,6 +179,9 @@ static void do_args(int argc, char *argv[])
case 'c':
op = OP_COMPONENTS;
continue;
+ case 'd':
+ op = OP_DIRECTORIES;
+ continue;
case 'e':
op = OP_DEVICES;
continue;
@@ -192,10 +203,13 @@ static void do_args(int argc, char *argv[])
case 'm':
op = OP_MEASUREMENTS;
continue;
+ case 's':
+ op = OP_SESSIONS;
+ continue;
case 'a':
op = OP_ADD;
continue;
- case 'd':
+ case 'r':
op = OP_DEL;
continue;
case 'A':
@@ -236,7 +250,7 @@ static void do_args(int argc, char *argv[])
continue;
}
case 'B':
- attest->set_security(attest, OS_PACKAGE_STATE_BLACKLIST);
+ attest->set_package_state(attest, OS_PACKAGE_STATE_BLACKLIST);
continue;
case 'C':
if (!attest->set_component(attest, optarg, op == OP_ADD))
@@ -251,11 +265,26 @@ static void do_args(int argc, char *argv[])
}
continue;
case 'F':
- if (!attest->set_file(attest, optarg, op == OP_ADD))
+ {
+ char *path = strdup(optarg);
+ char *dir = dirname(path);
+ char *file = basename(optarg);
+
+ if (*dir != '.')
+ {
+ if (!attest->set_directory(attest, dir, op == OP_ADD))
+ {
+ free(path);
+ exit(EXIT_FAILURE);
+ }
+ }
+ free(path);
+ if (!attest->set_file(attest, file, op == OP_ADD))
{
exit(EXIT_FAILURE);
}
continue;
+ }
case 'G':
if (!attest->set_package(attest, optarg, op == OP_ADD))
{
@@ -301,7 +330,7 @@ static void do_args(int argc, char *argv[])
}
continue;
case 'Y':
- attest->set_security(attest, OS_PACKAGE_STATE_SECURITY);
+ attest->set_package_state(attest, OS_PACKAGE_STATE_SECURITY);
continue;
case '1':
attest->set_algo(attest, PTS_MEAS_ALGO_SHA1);
@@ -372,6 +401,9 @@ static void do_args(int argc, char *argv[])
case OP_DEVICES:
attest->list_devices(attest);
break;
+ case OP_DIRECTORIES:
+ attest->list_directories(attest);
+ break;
case OP_FILES:
attest->list_files(attest);
break;
@@ -381,6 +413,9 @@ static void do_args(int argc, char *argv[])
case OP_MEASUREMENTS:
attest->list_measurements(attest);
break;
+ case OP_SESSIONS:
+ attest->list_sessions(attest);
+ break;
case OP_ADD:
attest->add(attest);
break;
@@ -408,7 +443,7 @@ int main(int argc, char *argv[])
{
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
}
- if (!lib->plugins->load(lib->plugins, NULL,
+ if (!lib->plugins->load(lib->plugins,
lib->settings->get_str(lib->settings, "attest.load", PLUGINS)))
{
exit(SS_RC_INITIALIZATION_FAILED);
@@ -426,7 +461,7 @@ int main(int argc, char *argv[])
exit(SS_RC_INITIALIZATION_FAILED);
}
atexit(cleanup);
- libimcv_init();
+ libimcv_init(FALSE);
libpts_init();
do_args(argc, argv);
diff --git a/src/libpts/plugins/imv_attestation/attest_db.c b/src/libpts/plugins/imv_attestation/attest_db.c
index b2116c0ff..d7654ab43 100644
--- a/src/libpts/plugins/imv_attestation/attest_db.c
+++ b/src/libpts/plugins/imv_attestation/attest_db.c
@@ -13,6 +13,14 @@
* for more details.
*/
+#define _GNU_SOURCE
+
+#include <stdio.h>
+#include <libgen.h>
+#include <time.h>
+
+#include <tncif_names.h>
+
#include "attest_db.h"
#include "libpts.h"
@@ -20,10 +28,8 @@
#include "pts/pts_file_meas.h"
#include "pts/components/pts_comp_func_name.h"
-#include <libgen.h>
-#include <time.h>
-
#define IMA_MAX_NAME_LEN 255
+#define DEVICE_MAX_LEN 20
typedef struct private_attest_db_t private_attest_db_t;
@@ -63,11 +69,6 @@ struct private_attest_db_t {
int did;
/**
- * TRUE if directory has been set
- */
- bool dir_set;
-
- /**
* Measurement file to be queried
*/
char *file;
@@ -78,11 +79,6 @@ struct private_attest_db_t {
int fid;
/**
- * TRUE if file has been set
- */
- bool file_set;
-
- /**
* AIK to be queried
*/
chunk_t key;
@@ -148,9 +144,9 @@ struct private_attest_db_t {
bool utc;
/**
- * Package security state
+ * Package security or blacklist state
*/
- os_package_state_t security;
+ os_package_state_t package_state;
/**
* Sequence number for ordering entries
@@ -304,35 +300,35 @@ METHOD(attest_db_t, set_directory, bool,
private_attest_db_t *this, char *dir, bool create)
{
enumerator_t *e;
+ int did;
size_t len;
- if (this->dir_set)
+ if (this->did)
{
printf("directory has already been set\n");
return FALSE;
}
- free(this->dir);
- /* remove trailing '/' character */
+ /* remove trailing '/' character if not root directory */
len = strlen(dir);
- if (len && dir[len-1] == '/')
+ if (len > 1 && dir[len-1] == '/')
{
dir[len-1] = '\0';
}
this->dir = strdup(dir);
e = this->db->query(this->db,
- "SELECT id FROM files WHERE type = 1 AND path = ?",
+ "SELECT id FROM directories WHERE path = ?",
DB_TEXT, dir, DB_INT);
if (e)
{
- if (e->enumerate(e, &this->did))
+ if (e->enumerate(e, &did))
{
- this->dir_set = TRUE;
+ this->did = did;
}
e->destroy(e);
}
- if (this->dir_set)
+ if (this->did)
{
return TRUE;
}
@@ -344,14 +340,15 @@ METHOD(attest_db_t, set_directory, bool,
}
/* Add a new database entry */
- this->dir_set = this->db->execute(this->db, &this->did,
- "INSERT INTO files (type, path) VALUES (1, ?)",
- DB_TEXT, dir) == 1;
-
+ if (1 == this->db->execute(this->db, &did,
+ "INSERT INTO directories (path) VALUES (?)", DB_TEXT, dir))
+ {
+ this->did = did;
+ }
printf("directory '%s' %sinserted into database\n", dir,
- this->dir_set ? "" : "could not be ");
+ this->did ? "" : "could not be ");
- return this->dir_set;
+ return this->did > 0;
}
METHOD(attest_db_t, set_did, bool,
@@ -360,22 +357,20 @@ METHOD(attest_db_t, set_did, bool,
enumerator_t *e;
char *dir;
- if (this->dir_set)
+ if (this->did)
{
printf("directory has already been set\n");
return FALSE;
}
- this->did = did;
- e = this->db->query(this->db, "SELECT path FROM files WHERE id = ?",
+ e = this->db->query(this->db, "SELECT path FROM directories WHERE id = ?",
DB_UINT, did, DB_TEXT);
if (e)
{
if (e->enumerate(e, &dir))
{
- free(this->dir);
this->dir = strdup(dir);
- this->dir_set = TRUE;
+ this->did = did;
}
else
{
@@ -383,76 +378,88 @@ METHOD(attest_db_t, set_did, bool,
}
e->destroy(e);
}
- return this->dir_set;
+ return this->did > 0;
}
METHOD(attest_db_t, set_file, bool,
private_attest_db_t *this, char *file, bool create)
{
+ int fid;
+ char *sep;
enumerator_t *e;
- char *filename;
- if (this->file_set)
+ if (this->file)
{
printf("file has already been set\n");
return FALSE;
}
this->file = strdup(file);
- filename = this->relative ? basename(file) : file;
- e = this->db->query(this->db, "SELECT id FROM files WHERE path = ?",
- DB_TEXT, filename, DB_INT);
+ if (!this->did)
+ {
+ return TRUE;
+ }
+ sep = streq(this->dir, "/") ? "" : "/";
+ e = this->db->query(this->db, "SELECT id FROM files "
+ "WHERE dir = ? AND name = ?",
+ DB_INT, this->did, DB_TEXT, file, DB_INT);
if (e)
{
- if (e->enumerate(e, &this->fid))
+ if (e->enumerate(e, &fid))
{
- this->file_set = TRUE;
+ this->fid = fid;
}
e->destroy(e);
}
- if (this->file_set)
+ if (this->fid)
{
return TRUE;
}
if (!create)
{
- printf("file '%s' not found in database\n", file);
+ printf("file '%s%s%s' not found in database\n", this->dir, sep, file);
return FALSE;
}
/* Add a new database entry */
- this->file_set = this->db->execute(this->db, &this->fid,
- "INSERT INTO files (type, path) VALUES (0, ?)",
- DB_TEXT, filename) == 1;
-
- printf("file '%s' %sinserted into database\n", filename,
- this->file_set ? "" : "could not be ");
+ if (1 == this->db->execute(this->db, &fid,
+ "INSERT INTO files (dir, name) VALUES (?, ?)",
+ DB_INT, this->did, DB_TEXT, file))
+ {
+ this->fid = fid;
+ }
+ printf("file '%s%s%s' %sinserted into database\n", this->dir, sep, file,
+ this->fid ? "" : "could not be ");
- return this->file_set;
+ return this->fid > 0;
}
METHOD(attest_db_t, set_fid, bool,
private_attest_db_t *this, int fid)
{
enumerator_t *e;
+ int did;
char *file;
- if (this->file_set)
+ if (this->fid)
{
printf("file has already been set\n");
return FALSE;
}
- this->fid = fid;
- e = this->db->query(this->db, "SELECT path FROM files WHERE id = ?",
- DB_UINT, fid, DB_TEXT);
+ e = this->db->query(this->db, "SELECT dir, name FROM files WHERE id = ?",
+ DB_UINT, fid, DB_INT, DB_TEXT);
if (e)
{
- if (e->enumerate(e, &file))
+ if (e->enumerate(e, &did, &file))
{
+ if (did)
+ {
+ set_did(this, did);
+ }
this->file = strdup(file);
- this->file_set = TRUE;
+ this->fid = fid;
}
else
{
@@ -460,7 +467,7 @@ METHOD(attest_db_t, set_fid, bool,
}
e->destroy(e);
}
- return this->file_set;
+ return this->fid > 0;
}
METHOD(attest_db_t, set_key, bool,
@@ -726,10 +733,10 @@ METHOD(attest_db_t, set_relative, void,
this->relative = TRUE;
}
-METHOD(attest_db_t, set_security, void,
- private_attest_db_t *this, os_package_state_t security)
+METHOD(attest_db_t, set_package_state, void,
+ private_attest_db_t *this, os_package_state_t package_state)
{
- this->security = security;
+ this->package_state = package_state;
}
METHOD(attest_db_t, set_sequence, void,
@@ -805,44 +812,42 @@ METHOD(attest_db_t, list_devices, void,
private_attest_db_t *this)
{
enumerator_t *e, *e_ar;
- chunk_t value, ar_id_value = chunk_empty;
- char *product;
+ chunk_t ar_id_value = chunk_empty;
+ char *product, *device;
time_t timestamp;
int id, last_id = 0, ar_id = 0, last_ar_id = 0, device_count = 0;
- int count, count_update, count_blacklist;
+ int session_id, rec;
u_int32_t ar_id_type;
- u_int tstamp, flags = 0;
+ u_int tstamp;
e = this->db->query(this->db,
- "SELECT d.id, d.value, i.time, i.count, i.count_update, "
- "i.count_blacklist, i.flags, i.ar_id, p.name FROM devices AS d "
- "JOIN device_infos AS i ON d.id = i.device "
- "JOIN products AS p ON p.id = i.product "
- "ORDER BY d.value, i.time DESC",
- DB_INT, DB_BLOB, DB_UINT, DB_INT, DB_INT, DB_INT, DB_UINT,
- DB_INT, DB_TEXT);
+ "SELECT d.id, d.value, s.id, s.time, s.identity, s.rec, p.name "
+ "FROM devices AS d "
+ "JOIN sessions AS s ON d.id = s.device "
+ "JOIN products AS p ON p.id = s.product "
+ "ORDER BY d.value, s.time DESC", DB_INT, DB_TEXT, DB_INT, DB_UINT,
+ DB_INT, DB_INT, DB_TEXT);
if (e)
{
- while (e->enumerate(e, &id, &value, &tstamp, &count, &count_update,
- &count_blacklist, &flags, &ar_id, &product))
+ while (e->enumerate(e, &id, &device, &session_id, &tstamp, &ar_id, &rec,
+ &product))
{
if (id != last_id)
{
- printf("%4d: %.*s\n", id, (int)value.len, value.ptr);
+ printf("%4d: %s - %s\n", id, device, product);
device_count++;
last_id = id;
}
timestamp = tstamp;
- printf(" %T, %4d, %3d, %3d, %1u, '%s'", &timestamp, this->utc,
- count, count_update, count_blacklist, flags, product);
+ printf("%4d: %T", session_id, &timestamp, this->utc);
if (ar_id)
{
if (ar_id != last_ar_id)
{
chunk_free(&ar_id_value);
e_ar = this->db->query(this->db,
- "SELECT type, data FROM identities "
+ "SELECT type, value FROM identities "
"WHERE id = ?", DB_INT, ar_id, DB_INT, DB_BLOB);
if (e_ar)
{
@@ -857,7 +862,7 @@ METHOD(attest_db_t, list_devices, void,
}
last_ar_id = ar_id;
}
- printf("\n");
+ printf(" - %N\n", TNC_IMV_Action_Recommendation_names, rec);
}
e->destroy(e);
free(ar_id_value.ptr);
@@ -920,53 +925,92 @@ METHOD(attest_db_t, list_files, void,
private_attest_db_t *this)
{
enumerator_t *e;
- char *file, *file_type[] = { " ", "d", "r" };
- int fid, type, meas, meta, count = 0;
+ char *dir, *file;
+ int did, last_did = 0, fid, count = 0;
- if (this->pid)
+ if (this->did)
{
e = this->db->query(this->db,
- "SELECT f.id, f.type, f.path, pf.measurement, pf.metadata "
- "FROM files AS f "
- "JOIN product_file AS pf ON f.id = pf.file "
- "WHERE pf.product = ? ORDER BY f.path",
- DB_UINT, this->pid, DB_INT, DB_INT, DB_TEXT, DB_INT, DB_INT);
+ "SELECT id, name FROM files WHERE dir = ? ORDER BY name",
+ DB_INT, this->did, DB_INT, DB_TEXT);
if (e)
{
- while (e->enumerate(e, &fid, &type, &file, &meas, &meta))
+ while (e->enumerate(e, &fid, &file))
{
- type = (type < 0 || type > 2) ? 0 : type;
- printf("%4d: |%s%s| %s %s\n", fid, meas ? "M":" ", meta ? "T":" ",
- file_type[type], file);
+ printf("%4d: %s\n", fid, file);
count++;
}
e->destroy(e);
}
+ printf("%d file%s found in directory '%s'\n", count,
+ (count == 1) ? "" : "s", this->dir);
}
else
{
e = this->db->query(this->db,
- "SELECT id, type, path FROM files "
- "ORDER BY path",
- DB_INT, DB_INT, DB_TEXT);
+ "SELECT d.id, d.path, f.id, f.name FROM files AS f "
+ "JOIN directories AS d ON f.dir = d.id "
+ "ORDER BY d.path, f.name",
+ DB_INT, DB_TEXT, DB_INT, DB_TEXT);
if (e)
{
- while (e->enumerate(e, &fid, &type, &file))
+ while (e->enumerate(e, &did, &dir, &fid, &file))
{
- type = (type < 0 || type > 2) ? 0 : type;
- printf("%4d: %s %s\n", fid, file_type[type], file);
+ if (did != last_did)
+ {
+ printf("%4d: %s\n", did, dir);
+ last_did = did;
+ }
+ printf("%4d: %s\n", fid, file);
count++;
}
e->destroy(e);
}
+ printf("%d file%s found\n", count, (count == 1) ? "" : "s");
}
+}
- printf("%d file%s found", count, (count == 1) ? "" : "s");
- if (this->product_set)
+METHOD(attest_db_t, list_directories, void,
+ private_attest_db_t *this)
+{
+ enumerator_t *e;
+ char *dir;
+ int did, count = 0;
+
+ if (this->file)
{
- printf(" for product '%s'", this->product);
+ e = this->db->query(this->db,
+ "SELECT d.id, d.path FROM directories AS d "
+ "JOIN files AS f ON f.dir = d.id WHERE f.name = ? "
+ "ORDER BY path", DB_TEXT, this->file, DB_INT, DB_TEXT);
+ if (e)
+ {
+ while (e->enumerate(e, &did, &dir))
+ {
+ printf("%4d: %s\n", did, dir);
+ count++;
+ }
+ e->destroy(e);
+ }
+ printf("%d director%s found containing file '%s'\n", count,
+ (count == 1) ? "y" : "ies", this->file);
+ }
+ else
+ {
+ e = this->db->query(this->db,
+ "SELECT id, path FROM directories ORDER BY path",
+ DB_INT, DB_TEXT);
+ if (e)
+ {
+ while (e->enumerate(e, &did, &dir))
+ {
+ printf("%4d: %s\n", did, dir);
+ count++;
+ }
+ e->destroy(e);
+ }
+ printf("%d director%s found\n", count, (count == 1) ? "y" : "ies");
}
- printf("\n");
}
METHOD(attest_db_t, list_packages, void,
@@ -974,20 +1018,23 @@ METHOD(attest_db_t, list_packages, void,
{
enumerator_t *e;
char *package, *version;
- os_package_state_t security;
- int gid, gid_old = 0, spaces, count = 0, t;
+ os_package_state_t package_state;
+ int blacklist, security, gid, gid_old = 0, spaces, count = 0, t;
time_t timestamp;
if (this->pid)
{
e = this->db->query(this->db,
- "SELECT p.id, p.name, v.release, v.security, v.time "
+ "SELECT p.id, p.name, "
+ "v.release, v.security, v.blacklist, v.time "
"FROM packages AS p JOIN versions AS v ON v.package = p.id "
"WHERE v.product = ? ORDER BY p.name, v.release",
- DB_INT, this->pid, DB_INT, DB_TEXT, DB_TEXT, DB_INT, DB_INT);
+ DB_INT, this->pid,
+ DB_INT, DB_TEXT, DB_TEXT, DB_INT, DB_INT, DB_INT);
if (e)
{
- while (e->enumerate(e, &gid, &package, &version, &security, &t))
+ while (e->enumerate(e, &gid, &package,
+ &version, &security, &blacklist, &t))
{
if (gid != gid_old)
{
@@ -1003,8 +1050,17 @@ METHOD(attest_db_t, list_packages, void,
}
}
timestamp = t;
+ if (blacklist)
+ {
+ package_state = OS_PACKAGE_STATE_BLACKLIST;
+ }
+ else
+ {
+ package_state = security ? OS_PACKAGE_STATE_SECURITY :
+ OS_PACKAGE_STATE_UPDATE;
+ }
printf(" %T (%s)%N\n", &timestamp, this->utc, version,
- os_package_state_names, security);
+ os_package_state_names, package_state);
count++;
}
e->destroy(e);
@@ -1077,74 +1133,70 @@ METHOD(attest_db_t, list_products, void,
}
printf("%d product%s found", count, (count == 1) ? "" : "s");
- if (this->file_set)
+ if (this->fid)
{
printf(" for file '%s'", this->file);
}
printf("\n");
}
-/**
- * get the directory if there is one from the files tables
- */
-static void get_directory(private_attest_db_t *this, int did, char **directory)
+METHOD(attest_db_t, list_hashes, void,
+ private_attest_db_t *this)
{
enumerator_t *e;
- char *dir;
-
- free(*directory);
- *directory = strdup("");
+ chunk_t hash;
+ char *file, *dir, *product;
+ int id, fid, fid_old = 0, did, did_old = 0, pid, pid_old = 0, count = 0;
- if (did)
+ if (this->pid && this->fid && this->did)
{
+ printf("%4d: %s\n", this->did, this->dir);
+ printf("%4d: %s\n", this->fid, this->file);
e = this->db->query(this->db,
- "SELECT path from files WHERE id = ?",
- DB_UINT, did, DB_TEXT);
+ "SELECT id, hash FROM file_hashes "
+ "WHERE algo = ? AND file = ? AND product = ?",
+ DB_INT, this->algo, DB_INT, this->fid, DB_INT, this->pid,
+ DB_INT, DB_BLOB);
if (e)
{
- if (e->enumerate(e, &dir))
+ while (e->enumerate(e, &id, &hash))
{
- free(*directory);
- *directory = strdup(dir);
+ printf("%4d: %#B\n", id, &hash);
+ count++;
}
e->destroy(e);
+
+ printf("%d %N value%s found for product '%s'\n", count,
+ pts_meas_algorithm_names, this->algo,
+ (count == 1) ? "" : "s", this->product);
}
}
-}
-
-static bool slash(char *directory, char *file)
-{
- return *file != '/' && directory[max(0, strlen(directory)-1)] != '/';
-}
-
-METHOD(attest_db_t, list_hashes, void,
- private_attest_db_t *this)
-{
- enumerator_t *e;
- chunk_t hash;
- char *file, *dir, *product;
- int fid, fid_old = 0, did, did_old = 0, count = 0;
-
- dir = strdup("");
-
- if (this->pid && this->fid & this->did)
+ else if (this->pid && this->file)
{
e = this->db->query(this->db,
- "SELECT hash FROM file_hashes "
- "WHERE algo = ? AND file = ? AND directory = ? AND product = ?",
- DB_INT, this->algo, DB_INT, this->fid, DB_INT, this->did,
- DB_INT, this->pid, DB_BLOB);
+ "SELECT h.id, h.hash, f.id, d.id, d.path "
+ "FROM file_hashes AS h "
+ "JOIN files AS f ON h.file = f.id "
+ "JOIN directories AS d ON f.dir = d.id "
+ "WHERE h.algo = ? AND h.product = ? AND f.name = ? "
+ "ORDER BY d.path, f.name, h.hash",
+ DB_INT, this->algo, DB_INT, this->pid, DB_TEXT, this->file,
+ DB_INT, DB_BLOB, DB_INT, DB_INT, DB_TEXT);
if (e)
{
- while (e->enumerate(e, &hash))
+ while (e->enumerate(e, &id, &hash, &fid, &did, &dir))
{
- if (this->fid != fid_old)
+ if (did != did_old)
{
- printf("%4d: %s%s%s\n", this->fid, this->dir,
- slash(this->dir, this->file) ? "/" : "", this->file);
- fid_old = this->fid;
+ printf("%4d: %s\n", did, dir);
+ did_old = did;
}
- printf(" %#B\n", &hash);
+ if (fid != fid_old)
+ {
+ printf("%4d: %s\n", fid, this->file);
+ fid_old = fid;
+ }
+ printf("%4d: %#B\n", id, &hash);
count++;
}
e->destroy(e);
@@ -1154,22 +1206,27 @@ METHOD(attest_db_t, list_hashes, void,
(count == 1) ? "" : "s", this->product);
}
}
- else if (this->pid && this->fid)
+ else if (this->pid && this->did)
{
+ printf("%4d: %s\n", this->did, this->dir);
e = this->db->query(this->db,
- "SELECT f.path, fh.hash FROM file_hashes AS fh "
- "JOIN files AS f ON f.id = fh.file "
- "WHERE algo = ? AND file = ? AND product = ?",
- DB_INT, this->algo, DB_INT, this->fid, DB_INT, this->pid,
- DB_TEXT, DB_BLOB);
+ "SELECT h.id, h.hash, f.id, f.name "
+ "FROM file_hashes AS h "
+ "JOIN files AS f ON h.file = f.id "
+ "WHERE h.algo = ? AND h.product = ? AND f.dir = ? "
+ "ORDER BY f.name, h.hash",
+ DB_INT, this->algo, DB_INT, this->pid, DB_INT, this->did,
+ DB_INT, DB_BLOB, DB_INT, DB_TEXT);
if (e)
{
- free(dir);
- while (e->enumerate(e, &dir, &hash))
+ while (e->enumerate(e, &id, &hash, &fid, &file))
{
- printf("%4d: %s%s%s\n", this->fid, dir,
- slash(dir, this->file) ? "/" : "", this->file);
- printf(" %#B\n", &hash);
+ if (fid != fid_old)
+ {
+ printf("%4d: %s\n", fid, file);
+ fid_old = fid;
+ }
+ printf("%4d: %#B\n", id, &hash);
count++;
}
e->destroy(e);
@@ -1177,35 +1234,34 @@ METHOD(attest_db_t, list_hashes, void,
printf("%d %N value%s found for product '%s'\n", count,
pts_meas_algorithm_names, this->algo,
(count == 1) ? "" : "s", this->product);
- dir = NULL;
}
}
else if (this->pid)
{
e = this->db->query(this->db,
- "SELECT f.id, f. f.path, fh.hash, fh.directory "
- "FROM file_hashes AS fh "
- "JOIN files AS f ON f.id = fh.file "
- "WHERE fh.algo = ? AND fh.product = ? "
- "ORDER BY fh.directory, f.path",
- DB_INT, this->algo, DB_UINT, this->pid,
- DB_INT, DB_TEXT, DB_BLOB, DB_INT);
+ "SELECT h.id, h.hash, f.id, f.name, d.id, d.path "
+ "FROM file_hashes AS h "
+ "JOIN files AS f ON h.file = f.id "
+ "JOIN directories AS d ON f.dir = d.id "
+ "WHERE h.algo = ? AND h.product = ? "
+ "ORDER BY d.path, f.name, h.hash",
+ DB_INT, this->algo, DB_INT, this->pid,
+ DB_INT, DB_BLOB, DB_INT, DB_TEXT, DB_INT, DB_TEXT);
if (e)
{
- while (e->enumerate(e, &fid, &file, &hash, &did))
+ while (e->enumerate(e, &id, &hash, &fid, &file, &did, &dir))
{
- if (fid != fid_old || did != did_old)
+ if (did != did_old)
{
- if (did != did_old)
- {
- get_directory(this, did, &dir);
- }
- printf("%4d: %s%s%s\n", fid,
- dir, slash(dir, file) ? "/" : "", file);
- fid_old = fid;
+ printf("%4d: %s\n", did, dir);
did_old = did;
}
- printf(" %#B\n", &hash);
+ if (fid != fid_old)
+ {
+ printf("%4d: %s\n", fid, file);
+ fid_old = fid;
+ }
+ printf("%4d: %#B\n", id, &hash);
count++;
}
e->destroy(e);
@@ -1215,58 +1271,147 @@ METHOD(attest_db_t, list_hashes, void,
(count == 1) ? "" : "s", this->product);
}
}
- else if (this->fid)
+ else if (this->fid && this->did)
{
e = this->db->query(this->db,
- "SELECT p.name, fh.hash, fh.directory "
- "FROM file_hashes AS fh "
- "JOIN products AS p ON p.id = fh.product "
- "WHERE fh.algo = ? AND fh.file = ? AND fh.directory = ?"
- "ORDER BY p.name",
- DB_INT, this->algo, DB_UINT, this->fid, DB_UINT, this->did,
- DB_TEXT, DB_BLOB, DB_INT);
+ "SELECT h.id, h.hash, p.id, p.name FROM file_hashes AS h "
+ "JOIN products AS p ON h.product = p.id "
+ "WHERE h.algo = ? AND h.file = ? "
+ "ORDER BY p.name, h.hash",
+ DB_INT, this->algo, DB_INT, this->fid,
+ DB_INT, DB_BLOB, DB_INT, DB_TEXT);
if (e)
{
- while (e->enumerate(e, &product, &hash, &did))
+ while (e->enumerate(e, &id, &hash, &pid, &product))
{
- printf("%#B '%s'\n", &hash, product);
+ if (pid != pid_old)
+ {
+ printf("%4d: %s\n", pid, product);
+ pid_old = pid;
+ }
+ printf("%4d: %#B\n", id, &hash);
count++;
}
e->destroy(e);
- printf("%d %N value%s found for file '%s%s%s'\n",
- count, pts_meas_algorithm_names, this->algo,
+ printf("%d %N value%s found for file '%s%s%s'\n", count,
+ pts_meas_algorithm_names, this->algo,
(count == 1) ? "" : "s", this->dir,
- slash(this->dir, this->file) ? "/" : "", this->file);
+ streq(this->dir, "/") ? "" : "/", this->file);
+ }
+ }
+ else if (this->file)
+ {
+ e = this->db->query(this->db,
+ "SELECT h.id, h.hash, f.id, d.id, d.path, p.id, p.name "
+ "FROM file_hashes AS h "
+ "JOIN files AS f ON h.file = f.id "
+ "JOIN directories AS d ON f.dir = d.id "
+ "JOIN products AS p ON h.product = p.id "
+ "WHERE h.algo = ? AND f.name = ? "
+ "ORDER BY d.path, f.name, p.name, h.hash",
+ DB_INT, this->algo, DB_TEXT, this->file,
+ DB_INT, DB_BLOB, DB_INT, DB_INT, DB_TEXT, DB_INT, DB_TEXT);
+ if (e)
+ {
+ while (e->enumerate(e, &id, &hash, &fid, &did, &dir, &pid, &product))
+ {
+ if (did != did_old)
+ {
+ printf("%4d: %s\n", did, dir);
+ did_old = did;
+ }
+ if (fid != fid_old)
+ {
+ printf("%4d: %s\n", fid, this->file);
+ fid_old = fid;
+ pid_old = 0;
+ }
+ if (pid != pid_old)
+ {
+ printf("%4d: %s\n", pid, product);
+ pid_old = pid;
+ }
+ printf("%4d: %#B\n", id, &hash);
+ count++;
+ }
+ e->destroy(e);
+
+ printf("%d %N value%s found\n", count, pts_meas_algorithm_names,
+ this->algo, (count == 1) ? "" : "s");
+ }
+
+ }
+ else if (this->did)
+ {
+ e = this->db->query(this->db,
+ "SELECT h.id, h.hash, f.id, f.name, p.id, p.name "
+ "FROM file_hashes AS h "
+ "JOIN files AS f ON h.file = f.id "
+ "JOIN products AS p ON h.product = p.id "
+ "WHERE h.algo = ? AND f.dir = ? "
+ "ORDER BY f.name, p.name, h.hash",
+ DB_INT, this->algo, DB_INT, this->did,
+ DB_INT, DB_BLOB, DB_INT, DB_TEXT, DB_INT, DB_TEXT);
+ if (e)
+ {
+ while (e->enumerate(e, &id, &hash, &fid, &file, &pid, &product))
+ {
+ if (fid != fid_old)
+ {
+ printf("%4d: %s\n", fid, file);
+ fid_old = fid;
+ pid_old = 0;
+ }
+ if (pid != pid_old)
+ {
+ printf("%4d: %s\n", pid, product);
+ pid_old = pid;
+ }
+ printf("%4d: %#B\n", id, &hash);
+ count++;
+ }
+ e->destroy(e);
+
+ printf("%d %N value%s found for directory '%s'\n", count,
+ pts_meas_algorithm_names, this->algo,
+ (count == 1) ? "" : "s", this->dir);
}
}
else
{
e = this->db->query(this->db,
- "SELECT f.id, f.path, p.name, fh.hash, fh.directory "
- "FROM file_hashes AS fh "
- "JOIN files AS f ON f.id = fh.file "
- "JOIN products AS p ON p.id = fh.product "
- "WHERE fh.algo = ? "
- "ORDER BY fh.directory, f.path, p.name",
- DB_INT, this->algo,
- DB_INT, DB_TEXT, DB_TEXT, DB_BLOB, DB_INT);
+ "SELECT h.id, h.hash, f.id, f.name, d.id, d.path, p.id, p.name "
+ "FROM file_hashes AS h "
+ "JOIN files AS f ON h.file = f.id "
+ "JOIN directories AS d ON f.dir = d.id "
+ "JOIN products AS p on h.product = p.id "
+ "WHERE h.algo = ? "
+ "ORDER BY d.path, f.name, p.name, h.hash",
+ DB_INT, this->algo, DB_INT, DB_BLOB, DB_INT, DB_TEXT,
+ DB_INT, DB_TEXT, DB_INT, DB_TEXT);
if (e)
{
- while (e->enumerate(e, &fid, &file, &product, &hash, &did))
+ while (e->enumerate(e, &id, &hash, &fid, &file, &did, &dir, &pid,
+ &product))
{
- if (fid != fid_old || did != did_old)
+ if (did != did_old)
{
- if (did != did_old)
- {
- get_directory(this, did, &dir);
- did_old = did;
- }
- printf("%4d: %s%s%s\n", fid,
- dir, slash(dir, file) ? "/" : "", file);
+ printf("%4d: %s\n", did, dir);
+ did_old = did;
+ }
+ if (fid != fid_old)
+ {
+ printf("%4d: %s\n", fid, file);
fid_old = fid;
+ pid_old = 0;
}
- printf(" %#B '%s'\n", &hash, product);
+ if (pid != pid_old)
+ {
+ printf("%4d: %s\n", pid, product);
+ pid_old = pid;
+ }
+ printf("%4d: %#B\n", id, &hash);
count++;
}
e->destroy(e);
@@ -1275,7 +1420,6 @@ METHOD(attest_db_t, list_hashes, void,
this->algo, (count == 1) ? "" : "s");
}
}
- free(dir);
}
METHOD(attest_db_t, list_measurements, void,
@@ -1382,9 +1526,50 @@ METHOD(attest_db_t, list_measurements, void,
}
}
-bool insert_file_hash(private_attest_db_t *this, pts_meas_algorithms_t algo,
- chunk_t measurement, int fid, int did, bool ima,
- int *hashes_added, int *hashes_updated)
+METHOD(attest_db_t, list_sessions, void,
+ private_attest_db_t *this)
+{
+ enumerator_t *e;
+ chunk_t identity;
+ char *product, *device;
+ int session_id, conn_id, rec, device_len;
+ time_t created;
+ u_int t;
+
+ e = this->db->query(this->db,
+ "SELECT s.id, s.time, s.connection, s.rec, p.name, d.value, i.value "
+ "FROM sessions AS s "
+ "LEFT JOIN products AS p ON s.product = p.id "
+ "LEFT JOIN devices AS d ON s.device = d.id "
+ "LEFT JOIN identities AS i ON s.identity = i.id "
+ "ORDER BY s.time DESC",
+ DB_INT, DB_UINT, DB_INT, DB_INT, DB_TEXT, DB_TEXT, DB_BLOB);
+ if (e)
+ {
+ while (e->enumerate(e, &session_id, &t, &conn_id, &rec, &product,
+ &device, &identity))
+ {
+ created = t;
+ product = product ? product : "-";
+ device = strlen(device) ? device : "-";
+ device_len = min(strlen(device), DEVICE_MAX_LEN);
+ identity = identity.len ? identity : chunk_from_str("-");
+ printf("%4d: %T %2d %-20s %.*s%*s%.*s - %N\n", session_id, &created,
+ FALSE, conn_id, product, device_len, device,
+ DEVICE_MAX_LEN - device_len + 1, " ", (int)identity.len,
+ identity.ptr, TNC_IMV_Action_Recommendation_names, rec);
+ }
+ e->destroy(e);
+ }
+}
+
+/**
+ * Insert a file hash into the database
+ */
+static bool insert_file_hash(private_attest_db_t *this,
+ pts_meas_algorithms_t algo,
+ chunk_t measurement, int fid, bool ima,
+ int *hashes_added, int *hashes_updated)
{
enumerator_t *e;
chunk_t hash;
@@ -1394,8 +1579,8 @@ bool insert_file_hash(private_attest_db_t *this, pts_meas_algorithms_t algo,
e = this->db->query(this->db,
"SELECT hash FROM file_hashes WHERE algo = ? "
- "AND file = ? AND directory = ? AND product = ? and key = 0",
- DB_INT, algo, DB_UINT, fid, DB_UINT, did, DB_UINT, this->pid, DB_BLOB);
+ "AND file = ? AND product = ? AND device = 0",
+ DB_INT, algo, DB_UINT, fid, DB_UINT, this->pid, DB_BLOB);
if (!e)
{
printf("file_hashes query failed\n");
@@ -1411,8 +1596,8 @@ bool insert_file_hash(private_attest_db_t *this, pts_meas_algorithms_t algo,
{
if (this->db->execute(this->db, NULL,
"UPDATE file_hashes SET hash = ? WHERE algo = ? "
- "AND file = ? AND directory = ? AND product = ? and key = 0",
- DB_BLOB, measurement, DB_INT, algo, DB_UINT, fid, DB_UINT, did,
+ "AND file = ? AND product = ? and device = 0",
+ DB_BLOB, measurement, DB_INT, algo, DB_UINT, fid,
DB_UINT, this->pid) == 1)
{
label = "updated";
@@ -1424,9 +1609,9 @@ bool insert_file_hash(private_attest_db_t *this, pts_meas_algorithms_t algo,
{
if (this->db->execute(this->db, NULL,
"INSERT INTO file_hashes "
- "(file, directory, product, key, algo, hash) "
- "VALUES (?, ?, ?, 0, ?, ?)",
- DB_UINT, fid, DB_UINT, did, DB_UINT, this->pid,
+ "(file, product, device, algo, hash) "
+ "VALUES (?, ?, 0, ?, ?)",
+ DB_UINT, fid, DB_UINT, this->pid,
DB_INT, algo, DB_BLOB, measurement) == 1)
{
label = "created";
@@ -1439,77 +1624,75 @@ bool insert_file_hash(private_attest_db_t *this, pts_meas_algorithms_t algo,
return TRUE;
}
-METHOD(attest_db_t, add, bool,
- private_attest_db_t *this)
+/**
+ * Add hash measurement for a single file or all files in a directory
+ */
+static bool add_hash(private_attest_db_t *this)
{
- bool success = FALSE;
-
- /* add key/component pair */
- if (this->kid && this->cid)
- {
- success = this->db->execute(this->db, NULL,
- "INSERT INTO key_component (key, component, seq_no) "
- "VALUES (?, ?, ?)",
- DB_UINT, this->kid, DB_UINT, this->cid,
- DB_UINT, this->seq_no) == 1;
-
- printf("key/component pair (%d/%d) %sinserted into database at "
- "position %d\n", this->kid, this->cid,
- success ? "" : "could not be ", this->seq_no);
-
- return success;
- }
-
- /* add directory or file measurement for a given product */
- if ((this->did || this->fid) && this->pid)
- {
- char *pathname, *filename, *label;
- char ima_buffer[IMA_MAX_NAME_LEN + 1];
- chunk_t measurement, ima_template;
- pts_file_meas_t *measurements;
- hasher_t *hasher = NULL;
- bool ima = FALSE;
- int fid, did;
- int files_added = 0, hashes_added = 0, hashes_updated = 0;
- int ima_hashes_added = 0, ima_hashes_updated = 0;
- enumerator_t *enumerator, *e;
-
- if (this->algo == PTS_MEAS_ALGO_SHA1_IMA)
+ char *pathname, *filename, *sep, *label, *pos;
+ char ima_buffer[IMA_MAX_NAME_LEN + 1];
+ chunk_t measurement, ima_template;
+ pts_file_meas_t *measurements;
+ hasher_t *hasher = NULL;
+ bool ima = FALSE;
+ int fid, files_added = 0, hashes_added = 0, hashes_updated = 0;
+ int len, ima_hashes_added = 0, ima_hashes_updated = 0;
+ enumerator_t *enumerator, *e;
+
+ if (this->algo == PTS_MEAS_ALGO_SHA1_IMA)
+ {
+ ima = TRUE;
+ this->algo = PTS_MEAS_ALGO_SHA1;
+ hasher = lib->crypto->create_hasher(lib->crypto, HASH_SHA1);
+ if (!hasher)
{
- ima = TRUE;
- this->algo = PTS_MEAS_ALGO_SHA1;
- hasher = lib->crypto->create_hasher(lib->crypto, HASH_SHA1);
- if (!hasher)
- {
- printf("could not create hasher\n");
- return FALSE;
- }
+ printf("could not create hasher\n");
+ return FALSE;
}
+ }
+ sep = streq(this->dir, "/") ? "" : "/";
- pathname = this->did ? this->dir : this->file;
- measurements = pts_file_meas_create_from_path(0, pathname, this->did,
- this->relative, this->algo);
- if (!measurements)
+ if (this->fid)
+ {
+ /* build pathname from directory path and relative filename */
+ if (asprintf(&pathname, "%s%s%s", this->dir, sep, this->file) == -1)
{
- printf("file measurement failed\n");
- DESTROY_IF(hasher);
return FALSE;
}
- if (this->fid && this->relative)
+ measurements = pts_file_meas_create_from_path(0, pathname, FALSE,
+ TRUE, this->algo);
+ free(pathname);
+ }
+ else
+ {
+ measurements = pts_file_meas_create_from_path(0, this->dir, TRUE,
+ TRUE, this->algo);
+ }
+ if (!measurements)
+ {
+ printf("file measurement failed\n");
+ DESTROY_IF(hasher);
+ return FALSE;
+ }
+
+ enumerator = measurements->create_enumerator(measurements);
+ while (enumerator->enumerate(enumerator, &filename, &measurement))
+ {
+ if (this->fid)
{
- set_directory(this, dirname(pathname), TRUE);
+ /* a single file already exists */
+ filename = this->file;
+ fid = this->fid;
+ label = "exists";
}
- did = this->relative ? this->did : 0;
-
- enumerator = measurements->create_enumerator(measurements);
- while (enumerator->enumerate(enumerator, &filename, &measurement))
+ else
{
/* retrieve or create filename */
label = "could not be created";
e = this->db->query(this->db,
- "SELECT id FROM files WHERE path = ?",
- DB_TEXT, filename, DB_INT);
+ "SELECT id FROM files WHERE name = ? AND dir = ?",
+ DB_TEXT, filename, DB_INT, this->did, DB_INT);
if (!e)
{
printf("files query failed\n");
@@ -1522,82 +1705,123 @@ METHOD(attest_db_t, add, bool,
else
{
if (this->db->execute(this->db, &fid,
- "INSERT INTO files (type, path) VALUES (0, ?)",
- DB_TEXT, filename) == 1)
+ "INSERT INTO files (name, dir) VALUES (?, ?)",
+ DB_TEXT, filename, DB_INT, this->did) == 1)
{
label = "created";
files_added++;
}
}
e->destroy(e);
+ }
+ printf("%4d: %s - %s\n", fid, filename, label);
- printf("%4d: %s - %s\n", fid, filename, label);
-
- /* compute file measurement hash */
- if (!insert_file_hash(this, this->algo, measurement,
- fid, did, FALSE,
- &hashes_added, &hashes_updated))
- {
- break;
- }
-
- if (!ima)
- {
- continue;
- }
-
- /* compute IMA template hash */
- strncpy(ima_buffer, filename, IMA_MAX_NAME_LEN);
- ima_buffer[IMA_MAX_NAME_LEN] = '\0';
- ima_template = chunk_create(ima_buffer, sizeof(ima_buffer));
- if (!hasher->get_hash(hasher, measurement, NULL) ||
- !hasher->get_hash(hasher, ima_template, measurement.ptr))
- {
- printf("could not compute IMA template hash\n");
- break;
- }
- if (!insert_file_hash(this, PTS_MEAS_ALGO_SHA1_IMA, measurement,
- fid, did, TRUE,
- &ima_hashes_added, &ima_hashes_updated))
- {
- break;
- }
+ /* compute file measurement hash */
+ if (!insert_file_hash(this, this->algo, measurement, fid, FALSE,
+ &hashes_added, &hashes_updated))
+ {
+ break;
+ }
+ if (!ima)
+ {
+ continue;
}
- enumerator->destroy(enumerator);
- printf("%d measurements, added %d new files, %d file hashes",
- measurements->get_file_count(measurements), files_added,
- hashes_added);
- if (ima)
+ /* compute IMA template hash */
+ pos = ima_buffer;
+ len = IMA_MAX_NAME_LEN;
+ if (!this->relative)
+ {
+ strncpy(pos, this->dir, len);
+ len = max(0, len - strlen(this->dir));
+ pos = ima_buffer + IMA_MAX_NAME_LEN - len;
+ strncpy(pos, sep, len);
+ len = max(0, len - strlen(sep));
+ pos = ima_buffer + IMA_MAX_NAME_LEN - len;
+ }
+ strncpy(pos, filename, len);
+ ima_buffer[IMA_MAX_NAME_LEN] = '\0';
+ ima_template = chunk_create(ima_buffer, sizeof(ima_buffer));
+ if (!hasher->get_hash(hasher, measurement, NULL) ||
+ !hasher->get_hash(hasher, ima_template, measurement.ptr))
{
- printf(", %d ima hashes", ima_hashes_added);
- hasher->destroy(hasher);
+ printf("could not compute IMA template hash\n");
+ break;
}
- printf(", updated %d file hashes", hashes_updated);
- if (ima)
+ if (!insert_file_hash(this, PTS_MEAS_ALGO_SHA1_IMA, measurement, fid,
+ TRUE, &ima_hashes_added, &ima_hashes_updated))
{
- printf(", %d ima hashes", ima_hashes_updated);
+ break;
}
- printf("\n");
- measurements->destroy(measurements);
- success = TRUE;
+ }
+ enumerator->destroy(enumerator);
+
+ printf("%d measurements, added %d new files, %d file hashes",
+ measurements->get_file_count(measurements), files_added,
+ hashes_added);
+ if (ima)
+ {
+ printf(", %d ima hashes", ima_hashes_added);
+ hasher->destroy(hasher);
+ }
+ printf(", updated %d file hashes", hashes_updated);
+ if (ima)
+ {
+ printf(", %d ima hashes", ima_hashes_updated);
+ }
+ printf("\n");
+ measurements->destroy(measurements);
+
+ return TRUE;
+}
+
+METHOD(attest_db_t, add, bool,
+ private_attest_db_t *this)
+{
+ bool success = FALSE;
+
+ /* add key/component pair */
+ if (this->kid && this->cid)
+ {
+ success = this->db->execute(this->db, NULL,
+ "INSERT INTO key_component (key, component, seq_no) "
+ "VALUES (?, ?, ?)",
+ DB_UINT, this->kid, DB_UINT, this->cid,
+ DB_UINT, this->seq_no) == 1;
+
+ printf("key/component pair (%d/%d) %sinserted into database at "
+ "position %d\n", this->kid, this->cid,
+ success ? "" : "could not be ", this->seq_no);
+
+ return success;
+ }
+
+ /* add directory or file hash measurement for a given product */
+ if (this->did && this->pid)
+ {
+ return add_hash(this);
}
/* insert package version */
if (this->version_set && this->gid && this->pid)
{
time_t t = time(NULL);
+ int security, blacklist;
+
+ security = this->package_state == OS_PACKAGE_STATE_SECURITY;
+ blacklist = this->package_state == OS_PACKAGE_STATE_BLACKLIST;
success = this->db->execute(this->db, NULL,
"INSERT INTO versions "
- "(package, product, release, security, time) "
- "VALUES (?, ?, ?, ?, ?)",
- DB_UINT, this->gid, DB_UINT, this->pid, DB_TEXT,
- this->version, DB_UINT, this->security, DB_INT, t) == 1;
+ "(package, product, release, security, blacklist, time) "
+ "VALUES (?, ?, ?, ?, ?, ?)",
+ DB_UINT, this->gid, DB_INT, this->pid, DB_TEXT,
+ this->version, DB_INT, security, DB_INT, blacklist,
+ DB_INT, t) == 1;
printf("'%s' package %s (%s)%N %sinserted into database\n",
this->product, this->package, this->version,
- os_package_state_names, this->security,
+ os_package_state_names, this->package_state,
success ? "" : "could not be ");
}
return success;
@@ -1607,19 +1831,21 @@ METHOD(attest_db_t, delete, bool,
private_attest_db_t *this)
{
bool success;
+ int id, count = 0;
+ char *name;
+ enumerator_t *e;
/* delete a file measurement hash for a given product */
if (this->algo && this->pid && this->fid)
{
success = this->db->execute(this->db, NULL,
"DELETE FROM file_hashes "
- "WHERE algo = ? AND product = ? "
- "AND file = ? AND directory = ?",
+ "WHERE algo = ? AND product = ? AND file = ?",
DB_UINT, this->algo, DB_UINT, this->pid,
- DB_UINT, this->fid, DB_UINT, this->did) > 0;
+ DB_UINT, this->fid) > 0;
- printf("%4d: %s%s%s\n", this->fid, this->dir, this->did ? "/":"",
- this->file);
+ printf("%4d: %s%s%s\n", this->fid, this->dir,
+ streq(this->dir, "/") ? "" : "/", this->file);
printf("%N value for product '%s' %sdeleted from database\n",
pts_meas_algorithm_names, this->algo, this->product,
success ? "" : "could not be ");
@@ -1667,24 +1893,44 @@ METHOD(attest_db_t, delete, bool,
return success;
}
- if (this->did)
+ if (this->fid)
{
success = this->db->execute(this->db, NULL,
- "DELETE FROM files WHERE type = 1 AND id = ?",
- DB_UINT, this->did) > 0;
+ "DELETE FROM files WHERE id = ?",
+ DB_UINT, this->fid) > 0;
- printf("directory '%s' %sdeleted from database\n", this->dir,
+ printf("file '%s%s%s' %sdeleted from database\n", this->dir,
+ streq(this->dir, "/") ? "" : "/", this->file,
success ? "" : "could not be ");
return success;
}
- if (this->fid)
+ if (this->did)
{
- success = this->db->execute(this->db, NULL,
- "DELETE FROM files WHERE id = ?",
- DB_UINT, this->fid) > 0;
+ e = this->db->query(this->db,
+ "SELECT id, name FROM files WHERE dir = ? ORDER BY name",
+ DB_INT, this->did, DB_INT, DB_TEXT);
+ if (e)
+ {
+ while (e->enumerate(e, &id, &name))
+ {
+ printf("%4d: %s\n", id, name);
+ count++;
+ }
+ e->destroy(e);
- printf("file '%s' %sdeleted from database\n", this->file,
+ if (count)
+ {
+ printf("%d dependent file%s found, "
+ "directory '%s' could not deleted\n",
+ count, (count == 1) ? "" : "s", this->dir);
+ return FALSE;
+ }
+ }
+ success = this->db->execute(this->db, NULL,
+ "DELETE FROM directories WHERE id = ?",
+ DB_UINT, this->did) > 0;
+ printf("directory '%s' %sdeleted from database\n", this->dir,
success ? "" : "could not be ");
return success;
}
@@ -1753,23 +1999,24 @@ attest_db_t *attest_db_create(char *uri)
.set_version = _set_version,
.set_algo = _set_algo,
.set_relative = _set_relative,
- .set_security = _set_security,
+ .set_package_state = _set_package_state,
.set_sequence = _set_sequence,
.set_owner = _set_owner,
.set_utc = _set_utc,
.list_packages = _list_packages,
.list_products = _list_products,
.list_files = _list_files,
+ .list_directories = _list_directories,
.list_components = _list_components,
.list_devices = _list_devices,
.list_keys = _list_keys,
.list_hashes = _list_hashes,
.list_measurements = _list_measurements,
+ .list_sessions = _list_sessions,
.add = _add,
.delete = _delete,
.destroy = _destroy,
},
- .dir = strdup(""),
.db = lib->db->create(lib->db, uri),
);
diff --git a/src/libpts/plugins/imv_attestation/attest_db.h b/src/libpts/plugins/imv_attestation/attest_db.h
index a20023fcd..d0a48d844 100644
--- a/src/libpts/plugins/imv_attestation/attest_db.h
+++ b/src/libpts/plugins/imv_attestation/attest_db.h
@@ -160,9 +160,9 @@ struct attest_db_t {
void (*set_relative)(attest_db_t *this);
/**
- * Set the package security state
+ * Set the package security or blacklist state
*/
- void (*set_security)(attest_db_t *this, os_package_state_t security);
+ void (*set_package_state)(attest_db_t *this, os_package_state_t package_state);
/**
* Set the sequence number
@@ -193,6 +193,11 @@ struct attest_db_t {
void (*list_products)(attest_db_t *this);
/**
+ * List all directories stored in the database
+ */
+ void (*list_directories)(attest_db_t *this);
+
+ /**
* List selected files stored in the database
*/
void (*list_files)(attest_db_t *this);
@@ -223,6 +228,11 @@ struct attest_db_t {
void (*list_measurements)(attest_db_t *this);
/**
+ * List sessions stored in the database
+ */
+ void (*list_sessions)(attest_db_t *this);
+
+ /**
* Add an entry to the database
*/
bool (*add)(attest_db_t *this);
diff --git a/src/libpts/plugins/imv_attestation/data.sql b/src/libpts/plugins/imv_attestation/data.sql
deleted file mode 100644
index 60c312e30..000000000
--- a/src/libpts/plugins/imv_attestation/data.sql
+++ /dev/null
@@ -1,1666 +0,0 @@
-/* Products */
-
-INSERT INTO products (
- name
-) VALUES (
- 'Ubuntu 11.04 i686'
-);
-
-INSERT INTO products (
- name
-) VALUES (
- 'Ubuntu 11.04 x86_64'
-);
-
-INSERT INTO products (
- name
-) VALUES (
- 'CentOS release 5.6 (Final) x86_64'
-);
-
-INSERT INTO products (
- name
-) VALUES (
- 'Ubuntu 10.10 x86_64'
-);
-
-INSERT INTO products (
- name
-) VALUES (
- 'Ubuntu 10.10 i686'
-);
-
-INSERT INTO products (
- name
-) VALUES (
- 'Gentoo Base System release 1.12.11.1 i686'
-);
-
-INSERT INTO products (
- name
-) VALUES (
- 'Ubuntu 11.10 i686'
-);
-
-INSERT INTO products (
- name
-) VALUES (
- 'Ubuntu 12.04 LTS i686'
-);
-
-INSERT INTO products (
- name
-) VALUES (
- 'Ubuntu 12.04 i686'
-);
-
-/* Files */
-
-INSERT INTO files ( /* 1 */
- type, path
-) VALUES (
- 0, '/lib/i386-linux-gnu/libdl.so.2'
-);
-
-INSERT INTO files (
- type, path
-) VALUES (
- 0, '/lib/x86_64-linux-gnu/libdl.so.2'
-);
-
-INSERT INTO files (
- type, path
-) VALUES (
- 0, '/lib/libdl.so.2'
-);
-
-INSERT INTO files (
- type, path
-) VALUES (
- 0, '/sbin/iptables'
-);
-
-INSERT INTO files ( /* 5 */
- type, path
-) VALUES (
- 0, '/lib/libxtables.so.5'
-);
-
-INSERT INTO files (
- type, path
-) VALUES (
- 0, '/lib/libxtables.so.2'
-);
-
-INSERT INTO files (
- type, path
-) VALUES (
- 1, '/lib/xtables'
-);
-
-INSERT INTO files (
- type, path
-) VALUES (
- 0, 'libxt_udp.so'
-);
-
-INSERT INTO files (
- type, path
-) VALUES (
- 0, 'libxt_tcp.so'
-);
-
-INSERT INTO files ( /* 10 */
- type, path
-) VALUES (
- 0, 'libxt_esp.so'
-);
-
-INSERT INTO files (
- type, path
-) VALUES (
- 0, 'libxt_policy.so'
-);
-
-INSERT INTO files (
- type, path
-) VALUES (
- 0, 'libxt_conntrack.so'
-);
-
-INSERT INTO files (
- type, path
-) VALUES (
- 0, 'libipt_SNAT.so'
-);
-
-INSERT INTO files (
- type, path
-) VALUES (
- 0, 'libipt_DNAT.so'
-);
-
-INSERT INTO files ( /* 15 */
- type, path
-) VALUES (
- 0, 'libipt_MASQUERADE.so'
-);
-
-INSERT INTO files (
- type, path
-) VALUES (
- 0, 'libipt_LOG.so'
-);
-
-INSERT INTO files (
- type, path
-) VALUES (
- 0, '/sbin/ip6tables'
-);
-
-INSERT INTO files (
- type, path
-) VALUES (
- 0, 'libip6t_LOG.so'
-);
-
-INSERT INTO files (
- type, path
-) VALUES (
- 0, 'libxt_mark.so'
-);
-
-INSERT INTO files ( /* 20 */
- type, path
-) VALUES (
- 0, 'libxt_MARK.so'
-);
-
-INSERT INTO files (
- type, path
-) VALUES (
- 1, '/lib/iptables'
-);
-
-INSERT INTO files (
- type, path
-) VALUES (
- 0, '/etc/tnc_config'
-);
-
-INSERT INTO files (
- type, path
-) VALUES (
- 0, '/lib/libxtables.so.7'
-);
-
-INSERT INTO files (
- type, path
-) VALUES (
- 0, '/sbin/xtables-multi'
-);
-
-
-/* Product-File */
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 1, 1, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 1, 4, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 1, 5, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 1, 7, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 1, 17, 1
-);
-
-INSERT INTO product_file (
- product, file, metadata
-) VALUES (
- 1, 22, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 2, 2, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 2, 4, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 2, 5, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 2, 7, 1
-);
-
-INSERT INTO product_file (
- product, file, metadata
-) VALUES (
- 2, 22, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 3, 3, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 3, 4, 1
-);
-
-INSERT INTO product_file (
- product, file, metadata
-) VALUES (
- 3, 22, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 4, 3, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 4, 4, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 4, 6, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 4, 7, 1
-);
-
-INSERT INTO product_file (
- product, file, metadata
-) VALUES (
- 4, 22, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 5, 3, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 5, 4, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 5, 6, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 5, 7, 1
-);
-
-INSERT INTO product_file (
- product, file, metadata
-) VALUES (
- 5, 22, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 6, 3, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 6, 4, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 6, 17, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 6, 21, 1
-);
-
-INSERT INTO product_file (
- product, file, metadata
-) VALUES (
- 6, 22, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 7, 1, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 7, 4, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 7, 5, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 7, 7, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 7, 17, 1
-);
-
-INSERT INTO product_file (
- product, file, metadata
-) VALUES (
- 7, 22, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 8, 1, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 8, 7, 1
-);
-
-INSERT INTO product_file (
- product, file, metadata
-) VALUES (
- 8, 22, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 8, 23, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 8, 24, 1
-);
-
-INSERT INTO product_file (
- product, file, measurement
-) VALUES (
- 9, 1, 1
-);
-
-INSERT INTO product_file (
- product, file, metadata
-) VALUES (
- 9, 22, 1
-);
-
-/* File Hashes */
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 1, 1, 32768, X'409bb1a97e26ea1144cdd6801b8159f17f376b8f'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 1, 1, 16384, X'675172775cfd2b73ed1e249e4a730921f06c2f86fffdce4c71674cc654f37ed7'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 1, 1, 8192, X'abc8ce3fc99b6dcec6745ffc2f59e35372b9b126491480d04b0f93076beded06cccb27b61f1170868fada8cddefa7be4'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 1, 7, 32768, X'40763935cdea25119002c42f984b994d8d2a6d75'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 1, 7, 16384, X'27c4f867d3f994a361e0b25d7846b3698d29f82b38662f233a97cafc60c44189'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 1, 7, 8192, X'301dad8829308f5a68c603a87bf961b91365f0346ac2f322de3ddcbb4645f56c0e6d2dc503ec2abff8fe8e895ce9304d'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 1, 8, 32768, X'9c3ed3179990c0ffb3a65b75a09b61faa4aca907'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 1, 8, 16384, X'af474dd532c9f2d85c12368334eda3609a7c6287e08940f078547ab0f2871c94'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 1, 8, 8192, X'a23fa7034dabdce2d10f2893d52b21d14fe24c6ae4c8570fb6c7190228046e4c064c4d29d736cd84ca42a3d9abf9bfde'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 1, 9, 32768, X'9c3ed3179990c0ffb3a65b75a09b61faa4aca907'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 1, 9, 16384, X'af474dd532c9f2d85c12368334eda3609a7c6287e08940f078547ab0f2871c94'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 1, 9, 8192, X'a23fa7034dabdce2d10f2893d52b21d14fe24c6ae4c8570fb6c7190228046e4c064c4d29d736cd84ca42a3d9abf9bfde'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 2, 2, 32768, X'2a4047437e6fb346e2d854fc415e16b80e75bf6b'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 2, 2, 16384, X'86aa0bf93dade999277d963338402ed437271f3436f594a49ffca85b6c487523'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 2, 2, 8192, X'6090441219c0b478d294ae88e006d85ac0d94464573bcca7d180618a612bd170e3ee47c1545861b0f06fe0db85544c59'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 3, 3, 32768, X'07d8c0218a5b3469b409dc95cf8f77a341a595fb'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 3, 3, 16384, X'b083699fbc4c9f9e0d463361118904a3832670ad2fe3d6b42f811061188d509f'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 3, 3, 8192, X'b14908de476467a11a7a98835d1cf8317c7b80a684692426ddd7b0014e00b70b3d1b4fc1dd02ad440447612ee9dadb52'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 3, 4, 32768, X'4350f082511c742cc05050d18a23d1da9fb09340'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 3, 4, 16384, X'f9e12408828b5842c45503342dc2af78bc74d701a19c5fd5483df0e203315e0a'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 3, 4, 8192, X'1a5ea36e4ab0cda550c0da2af6a62d9310981d2f170c9e75bff1770be2efb9ddccc451743ff4c3d76876364f19fdf8c1'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 3, 6, 32768, X'91f4bb52404ca26b3a797152076ca5d233b93c1d'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 3, 6, 16384, X'59bced619eabbde5dd3ef74b92ba660349e105d36be9756c8d1598abd4bc066c'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 3, 6, 8192, X'fc6b1350067d23fca711b8a674e0367ad255bae0ddb2efe10dca1b18b18985bd09a7459937fda729d349874bb2701df3'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 4, 1, 32768, X'ff6deca0eeb7a257205c5f0ab5f5d821ea184098'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 4, 1, 16384, X'5c84fdf7c529d3c65a001587eda641fe489f83961a621fe514e7852a842690d6'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 4, 1, 8192, X'8bd699f85f5b3efb27204b4699c518f871ef245d03b4bf8d1cc00456025017546030c2f493525754cffcd24cdbc03b21'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 4, 2, 32768, X'1118805b490051637e93e592f4c71e0ee78a2422'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 4, 2, 16384, X'5ea7229ebef5dc8f9fb2118676b773dd62cf89dc21657e3b8fbbcbc70ee24bd3'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 4, 2, 8192, X'3b8da9e704e644eb7b196981624a2f6826c401d689e00ba47e42ff46351d27c6b9e91b1e8351ee01f66e5244b4c2a9b0'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 4, 3, 32768, X'b5cd500ec15d6bfcae15e0af1dc121df7114b97d'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 4, 3, 16384, X'b94f1cba12abb0ec79d207142526388ec0d127c4f2aad4a46a623a1f69bac84f'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 4, 3, 8192, X'6663d66ff0e93b1b8a1edcdbe45d64834e29dc9c2b1d23126fd370a85b2c56da5cadcbc65b6e8afbb1e18bea8e413bd1'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 4, 4, 32768, X'86c4463293859874243d8374f7f3ef60f44f9309'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 4, 4, 16384, X'348b711f16ee9810738857c8ffbc54f8e16a393df8635cb29b02fc62daeefc14'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 4, 4, 8192, X'0cb6b7d91148b1bb1b9333bc71de01509cb6d12c646a6756e6942647046286fbbca92b25dc1999e8f81be1264061ee4d'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 4, 6, 32768, X'e3cf3ef2ee5df0117972808bfa93b7795f5da873'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 4, 6, 16384, X'fde81f544e49c44aabe0e312a00a7f8af01a0e3123dc5c54c65e3e78ba475b22'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 4, 6, 8192, X'e0cc89d1f229f9f35109bef3b163badc0941ca0a957d09e397a8d06e2b32e737f1f1135ebf0c0546d3d4c5354aaca40f'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 4, 7, 32768, X'ff6deca0eeb7a257205c5f0ab5f5d821ea184098'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 4, 7, 16384, X'5c84fdf7c529d3c65a001587eda641fe489f83961a621fe514e7852a842690d6'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 4, 7, 8192, X'8bd699f85f5b3efb27204b4699c518f871ef245d03b4bf8d1cc00456025017546030c2f493525754cffcd24cdbc03b21'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 5, 1, 32768, X'7a3ca72158e60b0c91e48a420848f1b693aea26c'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 5, 1, 16384, X'f9693c7d36c087d51f5012897fa0e8bb94081854d080c84f831f4d693d22f645'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 5, 1, 8192, X'4ec135e54c8840ab575fcdf00c66f996f763863ad30800b0f0a0b02e7899697d6ab9ccfe185ccbc16c19f38d0a27becb'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 5, 2, 32768, X'5d36a26856021d68a42f8bd7ca22365579d43891'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 5, 2, 16384, X'411be0558ad0cef33b437dafeed40104917e2079646524145abf9d05ddc6c1c5'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 5, 2, 8192, X'237f4691f9b780bec7aff217d64a9780ceed2973a41e86c92e0d6dab81cc5d13a9b99ba408302264f5665de1f42ef6e1'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 5, 7, 32768, X'7a3ca72158e60b0c91e48a420848f1b693aea26c'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 5, 7, 16384, X'f9693c7d36c087d51f5012897fa0e8bb94081854d080c84f831f4d693d22f645'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 5, 7, 8192, X'4ec135e54c8840ab575fcdf00c66f996f763863ad30800b0f0a0b02e7899697d6ab9ccfe185ccbc16c19f38d0a27becb'
-);
-
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 6, 4, 32768, X'92e66ae282947f66544682039a33fd1dbd402244'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 6, 4, 16384, X'dc6bad544f72c4538fb92f777646fd734b49ce95f41b2c96b74a21addbc86ed8'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 6, 4, 8192, X'08fd91f9017763212d1491f178e4d7e41d34a21b0117ee3321d832f5b8e02d4c7152a6cdc53bb4ca7e8aad5b1f279d1f'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 8, 7, 1, 32768, X'11ce3b45feb3e66a75490d42ba95071ac6f40a7f'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 8, 7, 1, 16384, X'468ef70f19372bc4a2b1805ffa3621515061fc19fa361374788bd362d638ac02'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 8, 7, 1, 8192, X'63076ae505ce52c37878c9b6891ac516320046403aec25bf347c7011c2d28d5db7e2946d1fae3006ab4ef43716ff4558'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 8, 7, 4, 32768, X'200eab67377bf3d5a25372838c38841658a718e4'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 8, 7, 4, 16384, X'31045af9a12efdc58155a177e9391dd28b93fa38af58ce00f49259cc26e97687'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 8, 7, 4, 8192, X'e8c64b508171d947069382da58dc7e39a97ce878a07f494a6fb370efb09116d32f1d4cdddeef85f22e14d1c5d5a37625'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 8, 7, 7, 32768, X'11ce3b45feb3e66a75490d42ba95071ac6f40a7f'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 8, 7, 7, 16384, X'468ef70f19372bc4a2b1805ffa3621515061fc19fa361374788bd362d638ac02'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 8, 7, 7, 8192, X'63076ae505ce52c37878c9b6891ac516320046403aec25bf347c7011c2d28d5db7e2946d1fae3006ab4ef43716ff4558'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 8, 7, 8, 32768, X'a93f870078b69ba530e6335eaee698908b12078f'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 8, 7, 8, 16384, X'0c31c1f41a57f4b15fafeb541de475e6da88380c911bb606b35413fda8428006'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 8, 7, 8, 8192, X'bb8fc7073691910d315621de176be64316923782df8d836b384414fd9a3d293be5bea51811ee6ef68a497f12384bba42'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 8, 21, 6, 32768, X'010873de0d682a26e1c6795dd4992248cc47cdd1'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 8, 21, 6, 16384, X'bfb45524d81a3645bf216a6cf52cd5624aadf6717012bf722afce2db3e31f712'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 8, 21, 6, 8192, X'f69b3f60b904f2deb39ea1fb9b0132638f0aea27357e365297f6b2ec895d42b260143b5e912d00df1a4a1d75a1b508fa'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 9, 7, 1, 32768, X'1d740abd38f9f4bc81ca434a0e25b6e21704248b'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 9, 7, 1, 16384, X'e26bb7175956dc8747a81431e810f830413b6c63756bf5156ab51367fe4f48a0'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 9, 7, 1, 8192, X'5d3637413b9e318d0e0be6a9da86121062b99d1bdb084dfda4222baa71b250de644b4024281760b4eae926e03fac4fdb'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 9, 7, 4, 32768, X'd2bf3556a0b38cfba2962d058fa8ea777397e82d'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 9, 7, 4, 16384, X'4ec845e828af69dcbde3ecb981096ac1e25c9e3e607e9a24b27da7e44527edf9'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 9, 7, 4, 8192, X'3204a34ca409730298f60361865dace24900827ee9f3bc87884d50827911b4b17beb4c09bad77e43f28938f10bc5138a'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 9, 7, 7, 32768, X'1d740abd38f9f4bc81ca434a0e25b6e21704248b'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 9, 7, 7, 16384, X'e26bb7175956dc8747a81431e810f830413b6c63756bf5156ab51367fe4f48a0'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 9, 7, 7, 8192, X'5d3637413b9e318d0e0be6a9da86121062b99d1bdb084dfda4222baa71b250de644b4024281760b4eae926e03fac4fdb'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 9, 7, 8, 32768, X'225836cb243c3502d90c92c3eb54310403303270'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 9, 7, 8, 16384, X'7862ed16eeb35d2f10e6d416a6fcbe8000ba1bbc2daddd15f43b375686308d7d'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 9, 7, 8, 8192, X'd4b6b939d0fdcd84bbc66fbf9bd044a61de823b4acb52e0ead7ae7f955d9b2d6399da1f673eadbb4792b819923e5e845'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 9, 21, 6, 32768, X'e1df4f3949b09c25e15b9c9b7088a60d683903a8'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 9, 21, 6, 16384, X'46f0ec6b0a2c3a24157019ed60f03de2ec9160d07f12b7e0b3d3f02b609a151d'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 9, 21, 6, 8192, X'4f73eae305e01e9ad57b5b1271a16bb8518fb82135aeb27311aa390d0d3a564b596adb723137f15bbf1db38b8dcbbdae'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 10, 7, 1, 32768, X'339a58a1b313830c3cc74cb3fb52a5b8152f44e6'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 10, 7, 1, 16384, X'789f2c6a9382bb342964a12947ddf84735d3e3ed3aefbae407098738cdf7c686'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 10, 7, 1, 8192, X'858310a6e4b6311c491c4370990bfd6b9f03a49bb5ddf45b0d788f7043f130016e11be6bd95db66e49e2906a87adf8cb'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 10, 7, 7, 32768, X'339a58a1b313830c3cc74cb3fb52a5b8152f44e6'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 10, 7, 7, 16384, X'789f2c6a9382bb342964a12947ddf84735d3e3ed3aefbae407098738cdf7c686'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 10, 7, 7, 8192, X'858310a6e4b6311c491c4370990bfd6b9f03a49bb5ddf45b0d788f7043f130016e11be6bd95db66e49e2906a87adf8cb'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 10, 7, 8, 32768, X'008374e704c81351c333a214f4ee2d89e996f344'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 10, 7, 8, 16384, X'0e28034f99a3e0cdffa64bf126858afb48ee25b5cbfc70bbcd997bab7ef1e056'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 10, 7, 8, 8192, X'b6e01ba0706e48ce37abef3fbc59a45fd50c7abd3bb7950b1d892bc4a0db3f9784f573d74ef51376267183d26513d1d0'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 10, 21, 6, 32768, X'87df2d01b85d8354819b431bae0a0a65bfc5d2db'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 10, 21, 6, 16384, X'a25fef11c899d826ea61996f0bc05330bc88428eafb792be0182ad97b6283aae'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 10, 21, 6, 8192, X'357e5756dbfa22c21d3666521e644eefdf532b7d371cca62fc099579f3c98b97cb51d005dcbaf805f8a7def26dfde142'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 11, 7, 1, 32768, X'2d32ef93126abf8c660d57c67e5076c6394cabe8'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 11, 7, 1, 16384, X'ced29aca7fc2dd0b01d5d544dfb2e1640a6a79c657f589e7dd6636cfd63eda3b'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 11, 7, 1, 8192, X'a2d33fa2d0ee7bffa5e628f88ccb83cd61bb4c5fe6d2edb8b853b83d8c43f498fa6e8da70510f0a1a3ddb36060bbd4d8'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 11, 7, 7, 32768, X'2d32ef93126abf8c660d57c67e5076c6394cabe8'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 11, 7, 7, 16384, X'ced29aca7fc2dd0b01d5d544dfb2e1640a6a79c657f589e7dd6636cfd63eda3b'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 11, 7, 7, 8192, X'a2d33fa2d0ee7bffa5e628f88ccb83cd61bb4c5fe6d2edb8b853b83d8c43f498fa6e8da70510f0a1a3ddb36060bbd4d8'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 11, 7, 8, 32768, X'105fc70c5ecde30ebe841ac0a229b77b6d5f3d8a'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 11, 7, 8, 16384, X'e4cdc17b835eabe06d719bccada0e59d3ee5eb3759ca75eb9c037166e8dafd30'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 11, 7, 8, 8192, X'a9f6a18ff6f85208583e0b3fdd2fdafc4575baf5d973c7a831ce74d8bb5a24b8ae8e4504ddefa4a2c2b91f31cd68edea'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 12, 7, 1, 32768, X'6c0b2df4fc4c9122b5762ae140d53fdd1cf9e89b'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 12, 7, 1, 16384, X'53c3f2bd5aaf8ef4c40f9af92a67621f5e67840b5ff2db67d1bccbcb56f7eef1'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 12, 7, 1, 8192, X'1a4a6d91bda3ce59e6c444ccc1e758c9c6f0e223fd8c5aac369260cdfa83081c0e8f3753f100490910ec161902f10ba7'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 12, 7, 7, 32768, X'6c0b2df4fc4c9122b5762ae140d53fdd1cf9e89b'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 12, 7, 7, 16384, X'53c3f2bd5aaf8ef4c40f9af92a67621f5e67840b5ff2db67d1bccbcb56f7eef1'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 12, 7, 7, 8192, X'1a4a6d91bda3ce59e6c444ccc1e758c9c6f0e223fd8c5aac369260cdfa83081c0e8f3753f100490910ec161902f10ba7'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 12, 7, 8, 32768, X'a9d8ea0203810d269b3ef3d974fed2ac4d486bae'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 12, 7, 8, 16384, X'c071aedaa6f66f8ab45ce037d72bbc42fb1894ac69ab689ad21ce6ff0c1c5d6a'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 12, 7, 8, 8192, X'1612eb51a3be3fcba24808326e29967b6f798c5140aefc8279601c5f5600030148fd01e8fbe737fba9c3972832e67601'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 13, 7, 1, 32768, X'e2f7b92abda769f82796f57a29801870585dcea3'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 13, 7, 1, 16384, X'6d3fe67a040dbb469ef498b26cece45806cb7ca04787bba53b7ba1c18e2abd0a'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 13, 7, 1, 8192, X'014852b73cd3eabfa955b7bd56b269d5a0590a2770cf3d656b3d68dbad30884327fc81ff96c6f661c9c4189c3aefa346'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 13, 7, 7, 32768, X'e2f7b92abda769f82796f57a29801870585dcea3'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 13, 7, 7, 16384, X'6d3fe67a040dbb469ef498b26cece45806cb7ca04787bba53b7ba1c18e2abd0a'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 13, 7, 7, 8192, X'014852b73cd3eabfa955b7bd56b269d5a0590a2770cf3d656b3d68dbad30884327fc81ff96c6f661c9c4189c3aefa346'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 13, 7, 8, 32768, X'da655441bf10f7dc32978474c77903f2f9120cc4'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 13, 7, 8, 16384, X'ec6a4bb332af51cf60cc30ce95197a8c89d42e6135d6e0d4e1d9e4bcc88e838c'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 13, 7, 8, 8192, X'135a84e988f219d5bcd7cb4e7ada6f9239c0164a0021262be0c4f9c00d8bece341aa88e0e35011b195c737e438225f4b'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 14, 7, 1, 32768, X'160d2b04d11eb225fb148615b699081869e15b6c'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 14, 7, 1, 16384, X'1f5a2ceae1418f9c1fbf51eb7d84f74d488908cde5931a5461746d1e24682a25'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 14, 7, 1, 8192, X'f701cb25b0e9a9f32d3bba9b274ca0e8838363d13b7283b842d6c9673442890e538127c3b64ca4b177de1d243b44cf0d'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 14, 7, 7, 32768, X'160d2b04d11eb225fb148615b699081869e15b6c'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 14, 7, 7, 16384, X'1f5a2ceae1418f9c1fbf51eb7d84f74d488908cde5931a5461746d1e24682a25'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 14, 7, 7, 8192, X'f701cb25b0e9a9f32d3bba9b274ca0e8838363d13b7283b842d6c9673442890e538127c3b64ca4b177de1d243b44cf0d'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 14, 7, 8, 32768, X'7b401b741cc32bcc86c3eac43059c9dd26e99a40'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 14, 7, 8, 16384, X'9a7cf37befecc40b494f9176bb887dd478e72c750fed8d540e5d7bbf4b5f2765'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 14, 7, 8, 8192, X'161c2f502f10a72ef159b6308219c38cb13387e21645e4357e6934d7afc62727cd76fd518dc6f676e2db47125eb9a2f6'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 15, 7, 1, 32768, X'5a0d07ab036603a76759e5f61f7d04f2d3c056cc'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 15, 7, 1, 16384, X'85491714e860062c441ff50d93ad79350449596b89b2e409b513c2d883321c9d'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 15, 7, 1, 8192, X'8038830a994c779bc200e844d8768280feca9dd5d58de6cd359b87cc68846799edfd16e36e83002da4bb309cfd3b353d'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 15, 7, 7, 32768, X'5a0d07ab036603a76759e5f61f7d04f2d3c056cc'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 15, 7, 7, 16384, X'85491714e860062c441ff50d93ad79350449596b89b2e409b513c2d883321c9d'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 15, 7, 7, 8192, X'8038830a994c779bc200e844d8768280feca9dd5d58de6cd359b87cc68846799edfd16e36e83002da4bb309cfd3b353d'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 15, 7, 8, 32768, X'129f6ecfb596fd751e33209b2ad2a28f2d243fdc'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 15, 7, 8, 16384, X'2fd1e8874b2faf18973881af54bd3e1fd21aaa8ee181313919569715885e69bc'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 15, 7, 8, 8192, X'3862f52ec823474ccfffeb6ead7c6a18b132057018704cb2fa05b08aaee3a1abfaf0eb4c826348f427dfbbb5b3e56647'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 16, 7, 1, 32768, X'd6c8dfbaae7ab28b5cef2626a2af3f99a6ea4365'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 16, 7, 1, 16384, X'd0d6f784e937227cce99e3be860be078d0397a6fb5a5bc9d95a19ef855609dbc'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 16, 7, 1, 8192, X'4be6e7978a6e4fb8a792815f2bbe28c2e66276401fb98ca90e49a5c2f2c94a1c7aac635d501d35d1db0fd53a0cb9d0fa'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 16, 7, 7, 32768, X'd6c8dfbaae7ab28b5cef2626a2af3f99a6ea4365'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 16, 7, 7, 16384, X'd0d6f784e937227cce99e3be860be078d0397a6fb5a5bc9d95a19ef855609dbc'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 16, 7, 7, 8192, X'4be6e7978a6e4fb8a792815f2bbe28c2e66276401fb98ca90e49a5c2f2c94a1c7aac635d501d35d1db0fd53a0cb9d0fa'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 16, 7, 8, 32768, X'2b686cd8359dea842cfdcacf39d22f5e0e6d06f2'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 16, 7, 8, 16384, X'e14fb3f87b9539108e023660f2d7b4fc728b0622a85de89bdc1fe20162f200a3'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 16, 7, 8, 8192, X'6f55292ad4061b0575dca0a3e6abe5f86d5288e0b860e6f76715bd5c9df8b5f751bc547d3147e9da12593b56a3f83252'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 17, 1, 32768, X'8a7c41167bc0fcc1dec8329a868ba265c23857f5'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 17, 1, 16384, X'f8eb857d7bb850f44c15363ba699442c2810663ac5a83a5f49e06e0fd8144b0e'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 17, 1, 8192, X'f40cb6e557ab18d70080e7995e3f96cc272842e822bf52bc1c59075313c2cd832f96cf03a8524905f3d3f7a61441c651'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 17, 6, 32768, X'8178f18dcb836e7f7432c4ad568bfd66b7ef4a96'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 17, 6, 16384, X'2d6aaed577bfac626ff4958ee1076bc343f8db46538aa6c381521bac94c5ca9e'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 17, 6, 8192, X'747bbaee322f9bf1849308f8907e2a43868eae8559a7be718113abb4ce535f6d509d005e51788cf3e83e148487fe7bf3'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 17, 7, 32768, X'8a7c41167bc0fcc1dec8329a868ba265c23857f5'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 17, 7, 16384, X'f8eb857d7bb850f44c15363ba699442c2810663ac5a83a5f49e06e0fd8144b0e'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 17, 7, 8192, X'f40cb6e557ab18d70080e7995e3f96cc272842e822bf52bc1c59075313c2cd832f96cf03a8524905f3d3f7a61441c651'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 18, 7, 1, 32768, X'23296f48276e160b6d99b1b42a9114df720bb1ab'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 18, 7, 1, 16384, X'78cd0a598080e31453f477e8d8a12ec794e859f4076ed92e53d2053d6d16762c'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 18, 7, 1, 8192, X'4da3955f1fd968ecf95cff825d42715b544e577f28f411a020a270834235125bc0c8872bac8dd3466349ac8ab0aa2d74'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 18, 7, 7, 32768, X'23296f48276e160b6d99b1b42a9114df720bb1ab'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 18, 7, 7, 16384, X'78cd0a598080e31453f477e8d8a12ec794e859f4076ed92e53d2053d6d16762c'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 18, 7, 7, 8192, X'4da3955f1fd968ecf95cff825d42715b544e577f28f411a020a270834235125bc0c8872bac8dd3466349ac8ab0aa2d74'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 18, 7, 8, 32768, X'9ff04217b3b40cb328440e40b6dc1c283f9f71ec'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 18, 7, 8, 16384, X'76de3b5b8df6d685e522aeea01d79ac457808437c02d40eb2e6ff06098057d41'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 18, 7, 8, 8192, X'ca1c0f6e3516f82a40cbaaea84dd42a8c97cea6b729dc07343f18a5d1b898a94e861b0dfb574c3efad64c363bb07ebf5'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 19, 7, 1, 32768, X'd537d437f058136eb3d7be517dbe7647b623c619'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 19, 7, 1, 16384, X'6a837037ad3fc4d06270d99cee2714dcf96b91aeb54d3483009219337961f834'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 19, 7, 1, 8192, X'7b5b16840da590a995fab23533f41982c5b136bff8e9b9a90b3c919a12cee20d312091455057a8bba9d9fbe314e6203d'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 19, 7, 7, 32768, X'd537d437f058136eb3d7be517dbe7647b623c619'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 19, 7, 7, 16384, X'6a837037ad3fc4d06270d99cee2714dcf96b91aeb54d3483009219337961f834'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 19, 7, 7, 8192, X'7b5b16840da590a995fab23533f41982c5b136bff8e9b9a90b3c919a12cee20d312091455057a8bba9d9fbe314e6203d'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 19, 7, 8, 32768, X'b3d6df204cc27f59704c19ab501172892a9c7c5d'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 19, 7, 8, 16384, X'9168ba26a67a3daf0ad3ea956d88358235ebb968b95f91bd110eab34ba75e4f8'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 19, 7, 8, 8192, X'e3a69702f9d07ea6e1f7cb85157f3d76d7e7dc577fd48ca7f6cf8f917ca7e5015e0f7dd463e1229aebf18aabcfd39cc3'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 20, 7, 1, 32768, X'f9e3531abb67a020cf667d46ca823675dd0a0dd4'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 20, 7, 1, 16384, X'569bafa2dabbcfa0ba9c7c411eacfeb8930f9d856a1a43cf8aa3662a67c13e35'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 20, 7, 1, 8192, X'84200bd318bb022915150842ddf4002e061ef593604ad0d07021dc662cc40bfa749cce084ddf25d0e5137f6380f613d8'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 20, 7, 7, 32768, X'f9e3531abb67a020cf667d46ca823675dd0a0dd4'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 20, 7, 7, 16384, X'569bafa2dabbcfa0ba9c7c411eacfeb8930f9d856a1a43cf8aa3662a67c13e35'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 20, 7, 7, 8192, X'84200bd318bb022915150842ddf4002e061ef593604ad0d07021dc662cc40bfa749cce084ddf25d0e5137f6380f613d8'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 20, 7, 8, 32768, X'8696176c12bf8291b6b9989ec5c94c3fdf26b14f'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 20, 7, 8, 16384, X'e7b5896d1dbe17f501f20424e8ed7d2de14d79e984e0c0a032ea70ca2f44e83a'
-);
-
-INSERT INTO file_hashes (
- file, directory, product, algo, hash
-) VALUES (
- 20, 7, 8, 8192, X'0d87fb31cf84b57b5b872af0b5e65610df929e48877f5ea199c073da6087c7a0e4b4c186545f654bb5db94284fde6274'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 23, 8, 32768, X'a67433717c2b9e2a9293f15a88456efbf7998a84'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 23, 8, 16384, X'1453d3ceaea4043cecd34f1eb24e0fbbe9fe04978077d06a0f728de849e71365'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 23, 8, 8192, X'abd1134f68a2daf92183aeae372f970cb076164468d4df08b8cb53743cae0867c17231e8f087e3367b6ec6905eb03c16'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 24, 8, 32768, X'bc3f9d1edeb00192c5c040a53823b58642ed8f41'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 24, 8, 16384, X'78f76b5c274705d09cd73cfad04791b8009c56d00849a00613909a659dc9ac63'
-);
-
-INSERT INTO file_hashes (
- file, product, algo, hash
-) VALUES (
- 24, 8, 8192, X'52cea5a859d0a1e06ffa8c1fc4f7b8dffde2de99915d660b2d3756315efdd873bee67ba3732f2c1ec692c38a8780cd72'
-);
-
-/* AIKs */
-
-INSERT INTO keys (
- keyid, owner
-) VALUES (
- X'b772a6730776b9f028e5adfccd40b55c320a13b6', 'Andreas, merthyr (Fujitsu Siemens Lifebook S6420)'
-);
-
-/* Components */
-
-INSERT INTO components (
- vendor_id, name, qualifier
-) VALUES (
- 36906, 1, 33 /* ITA TGRUB */
-);
-
-INSERT INTO components (
- vendor_id, name, qualifier
-) VALUES (
- 36906, 2, 33 /* ITA TBOOT */
-);
-
-INSERT INTO components (
- vendor_id, name, qualifier
-) VALUES (
- 36906, 3, 33 /* ITA IMA - Trusted Platform */
-);
-
-INSERT INTO components (
- vendor_id, name, qualifier
-) VALUES (
- 36906, 3, 34 /* ITA IMA - Operating System */
-);
-
-/* AIK Component */
-
-INSERT INTO key_component (
- key, component, depth, seq_no
-) VALUES (
- 1, 3, 0, 1
-);
-
-INSERT INTO key_component (
- key, component, depth, seq_no
-) VALUES (
- 1, 2, 0, 2
-);
-
-INSERT INTO key_component (
- key, component, depth, seq_no
-) VALUES (
- 1, 4, 0, 3
-);
-
diff --git a/src/libpts/plugins/imv_attestation/imv_attestation.c b/src/libpts/plugins/imv_attestation/imv_attestation.c
index 3c5488eba..542a561aa 100644
--- a/src/libpts/plugins/imv_attestation/imv_attestation.c
+++ b/src/libpts/plugins/imv_attestation/imv_attestation.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
+ * Copyright (C) 2013 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -13,486 +13,12 @@
* for more details.
*/
-#include "imv_attestation_state.h"
-#include "imv_attestation_process.h"
-#include "imv_attestation_build.h"
-
-#include <imv/imv_agent.h>
-#include <imv/imv_msg.h>
-#include <ietf/ietf_attr.h>
-#include <ietf/ietf_attr_pa_tnc_error.h>
-#include <ietf/ietf_attr_product_info.h>
-#include <ietf/ietf_attr_string_version.h>
-
-#include <libpts.h>
-
-#include <pts/pts.h>
-#include <pts/pts_database.h>
-#include <pts/pts_creds.h>
-
-#include <tcg/tcg_attr.h>
-
-#include <tncif_pa_subtypes.h>
-
-#include <pen/pen.h>
-#include <utils/debug.h>
-#include <credentials/credential_manager.h>
-#include <collections/linked_list.h>
-
-/* IMV definitions */
+#include "imv_attestation_agent.h"
static const char imv_name[] = "Attestation";
+static const imv_agent_create_t imv_agent_create = imv_attestation_agent_create;
-static pen_type_t msg_types[] = {
- { PEN_TCG, PA_SUBTYPE_TCG_PTS },
- { PEN_IETF, PA_SUBTYPE_IETF_OPERATING_SYSTEM }
-};
-
-static imv_agent_t *imv_attestation;
-
-/**
- * Supported PTS measurement algorithms
- */
-static pts_meas_algorithms_t supported_algorithms = PTS_MEAS_ALGO_NONE;
-
-/**
- * Supported PTS Diffie Hellman Groups
- */
-static pts_dh_group_t supported_dh_groups = PTS_DH_GROUP_NONE;
-
-/**
- * PTS file measurement database
- */
-static pts_database_t *pts_db;
-
-/**
- * PTS credentials
- */
-static pts_creds_t *pts_creds;
-
-/**
- * PTS credential manager
- */
-static credential_manager_t *pts_credmgr;
-
-/**
- * see section 3.8.1 of TCG TNC IF-IMV Specification 1.3
- */
-TNC_Result TNC_IMV_Initialize(TNC_IMVID imv_id,
- TNC_Version min_version,
- TNC_Version max_version,
- TNC_Version *actual_version)
-{
- char *hash_alg, *dh_group, *uri, *cadir;
-
- if (imv_attestation)
- {
- DBG1(DBG_IMV, "IMV \"%s\" has already been initialized", imv_name);
- return TNC_RESULT_ALREADY_INITIALIZED;
- }
- if (!pts_meas_algo_probe(&supported_algorithms) ||
- !pts_dh_group_probe(&supported_dh_groups))
- {
- return TNC_RESULT_FATAL;
- }
- imv_attestation = imv_agent_create(imv_name, msg_types, countof(msg_types),
- imv_id, actual_version);
- if (!imv_attestation)
- {
- return TNC_RESULT_FATAL;
- }
-
- libpts_init();
-
- if (min_version > TNC_IFIMV_VERSION_1 || max_version < TNC_IFIMV_VERSION_1)
- {
- DBG1(DBG_IMV, "no common IF-IMV version");
- return TNC_RESULT_NO_COMMON_VERSION;
- }
-
- hash_alg = lib->settings->get_str(lib->settings,
- "libimcv.plugins.imv-attestation.hash_algorithm", "sha256");
- dh_group = lib->settings->get_str(lib->settings,
- "libimcv.plugins.imv-attestation.dh_group", "ecp256");
-
- if (!pts_meas_algo_update(hash_alg, &supported_algorithms) ||
- !pts_dh_group_update(dh_group, &supported_dh_groups))
- {
- return TNC_RESULT_FATAL;
- }
-
- /* create a PTS credential manager */
- pts_credmgr = credential_manager_create();
-
- /* create PTS credential set */
- cadir = lib->settings->get_str(lib->settings,
- "libimcv.plugins.imv-attestation.cadir", NULL);
- pts_creds = pts_creds_create(cadir);
- if (pts_creds)
- {
- pts_credmgr->add_set(pts_credmgr, pts_creds->get_set(pts_creds));
- }
-
- /* attach file measurement database */
- uri = lib->settings->get_str(lib->settings,
- "libimcv.plugins.imv-attestation.database", NULL);
- pts_db = pts_database_create(uri);
-
- return TNC_RESULT_SUCCESS;
-}
-
-/**
- * see section 3.8.2 of TCG TNC IF-IMV Specification 1.3
- */
-TNC_Result TNC_IMV_NotifyConnectionChange(TNC_IMVID imv_id,
- TNC_ConnectionID connection_id,
- TNC_ConnectionState new_state)
-{
- imv_state_t *state;
-
- if (!imv_attestation)
- {
- DBG1(DBG_IMV, "IMV \"%s\" has not been initialized", imv_name);
- return TNC_RESULT_NOT_INITIALIZED;
- }
- switch (new_state)
- {
- case TNC_CONNECTION_STATE_CREATE:
- state = imv_attestation_state_create(connection_id);
- return imv_attestation->create_state(imv_attestation, state);
- case TNC_CONNECTION_STATE_DELETE:
- return imv_attestation->delete_state(imv_attestation, connection_id);
- case TNC_CONNECTION_STATE_HANDSHAKE:
- default:
- return imv_attestation->change_state(imv_attestation, connection_id,
- new_state, NULL);
- }
-}
-
-static TNC_Result send_message(imv_state_t *state, imv_msg_t *out_msg)
-{
- imv_attestation_state_t *attestation_state;
- TNC_Result result;
-
- attestation_state = (imv_attestation_state_t*)state;
-
- if (imv_attestation_build(out_msg, attestation_state, supported_algorithms,
- supported_dh_groups, pts_db))
- {
- result = out_msg->send(out_msg, TRUE);
- }
- else
- {
- result = TNC_RESULT_FATAL;
- }
-
- return result;
-}
-
-static TNC_Result receive_message(imv_state_t *state, imv_msg_t *in_msg)
-{
- imv_attestation_state_t *attestation_state;
- imv_msg_t *out_msg;
- enumerator_t *enumerator;
- pa_tnc_attr_t *attr;
- pen_type_t type;
- TNC_Result result;
- pts_t *pts;
- chunk_t os_name = chunk_empty;
- chunk_t os_version = chunk_empty;
- bool fatal_error = FALSE;
+/* include generic TGC TNC IF-IMV API code below */
- /* parse received PA-TNC message and handle local and remote errors */
- result = in_msg->receive(in_msg, &fatal_error);
- if (result != TNC_RESULT_SUCCESS)
- {
- return result;
- }
+#include <imv/imv_if.h>
- attestation_state = (imv_attestation_state_t*)state;
- pts = attestation_state->get_pts(attestation_state);
-
- out_msg = imv_msg_create_as_reply(in_msg);
- out_msg->set_msg_type(out_msg, msg_types[0]);
-
- /* analyze PA-TNC attributes */
- enumerator = in_msg->create_attribute_enumerator(in_msg);
- while (enumerator->enumerate(enumerator, &attr))
- {
- type = attr->get_type(attr);
-
- if (type.vendor_id == PEN_IETF)
- {
- switch (type.type)
- {
- case IETF_ATTR_PA_TNC_ERROR:
- {
- ietf_attr_pa_tnc_error_t *error_attr;
- pen_type_t error_code;
- chunk_t msg_info;
-
- error_attr = (ietf_attr_pa_tnc_error_t*)attr;
- error_code = error_attr->get_error_code(error_attr);
-
- if (error_code.vendor_id == PEN_TCG)
- {
- msg_info = error_attr->get_msg_info(error_attr);
-
- DBG1(DBG_IMV, "received TCG-PTS error '%N'",
- pts_error_code_names, error_code.type);
- DBG1(DBG_IMV, "error information: %B", &msg_info);
-
- result = TNC_RESULT_FATAL;
- }
- break;
- }
- case IETF_ATTR_PRODUCT_INFORMATION:
- {
- ietf_attr_product_info_t *attr_cast;
-
- attr_cast = (ietf_attr_product_info_t*)attr;
- os_name = attr_cast->get_info(attr_cast, NULL, NULL);
- break;
- }
- case IETF_ATTR_STRING_VERSION:
- {
- ietf_attr_string_version_t *attr_cast;
-
- attr_cast = (ietf_attr_string_version_t*)attr;
- os_version = attr_cast->get_version(attr_cast, NULL, NULL);
- break;
- }
- default:
- break;
- }
- }
- else if (type.vendor_id == PEN_TCG)
- {
- if (!imv_attestation_process(attr, out_msg, attestation_state,
- supported_algorithms,supported_dh_groups, pts_db, pts_credmgr))
- {
- result = TNC_RESULT_FATAL;
- break;
- }
- }
- }
- enumerator->destroy(enumerator);
-
- if (os_name.len && os_version.len)
- {
- pts->set_platform_info(pts, os_name, os_version);
- }
-
- if (fatal_error || result != TNC_RESULT_SUCCESS)
- {
- state->set_recommendation(state,
- TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION,
- TNC_IMV_EVALUATION_RESULT_ERROR);
- result = out_msg->send_assessment(out_msg);
- out_msg->destroy(out_msg);
- if (result != TNC_RESULT_SUCCESS)
- {
- return result;
- }
- return imv_attestation->provide_recommendation(imv_attestation, state);
- }
-
- /* send PA-TNC message with excl flag set */
- result = out_msg->send(out_msg, TRUE);
-
- if (result != TNC_RESULT_SUCCESS)
- {
- out_msg->destroy(out_msg);
- return result;
- }
-
- /* check the IMV state for the next PA-TNC attributes to send */
- result = send_message(state, out_msg);
-
- if (result != TNC_RESULT_SUCCESS)
- {
- state->set_recommendation(state,
- TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION,
- TNC_IMV_EVALUATION_RESULT_ERROR);
- result = out_msg->send_assessment(out_msg);
- out_msg->destroy(out_msg);
- if (result != TNC_RESULT_SUCCESS)
- {
- return result;
- }
- return imv_attestation->provide_recommendation(imv_attestation, state);
- }
-
- if (attestation_state->get_handshake_state(attestation_state) ==
- IMV_ATTESTATION_STATE_END)
- {
- if (attestation_state->get_file_meas_request_count(attestation_state))
- {
- DBG1(DBG_IMV, "failure due to %d pending file measurements",
- attestation_state->get_file_meas_request_count(attestation_state));
- attestation_state->set_measurement_error(attestation_state,
- IMV_ATTESTATION_ERROR_FILE_MEAS_PEND);
- }
- if (attestation_state->get_measurement_error(attestation_state))
- {
- state->set_recommendation(state,
- TNC_IMV_ACTION_RECOMMENDATION_ISOLATE,
- TNC_IMV_EVALUATION_RESULT_NONCOMPLIANT_MAJOR);
- }
- else
- {
- state->set_recommendation(state,
- TNC_IMV_ACTION_RECOMMENDATION_ALLOW,
- TNC_IMV_EVALUATION_RESULT_COMPLIANT);
- }
- result = out_msg->send_assessment(out_msg);
- out_msg->destroy(out_msg);
- if (result != TNC_RESULT_SUCCESS)
- {
- return result;
- }
- return imv_attestation->provide_recommendation(imv_attestation, state);
- }
- out_msg->destroy(out_msg);
-
- return result;
-}
-
-/**
- * see section 3.8.4 of TCG TNC IF-IMV Specification 1.3
- */
-TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
- TNC_ConnectionID connection_id,
- TNC_BufferReference msg,
- TNC_UInt32 msg_len,
- TNC_MessageType msg_type)
-{
- imv_state_t *state;
- imv_msg_t *in_msg;
- TNC_Result result;
-
- if (!imv_attestation)
- {
- DBG1(DBG_IMV, "IMV \"%s\" has not been initialized", imv_name);
- return TNC_RESULT_NOT_INITIALIZED;
- }
- if (!imv_attestation->get_state(imv_attestation, connection_id, &state))
- {
- return TNC_RESULT_FATAL;
- }
- in_msg = imv_msg_create_from_data(imv_attestation, state, connection_id,
- msg_type, chunk_create(msg, msg_len));
- result = receive_message(state, in_msg);
- in_msg->destroy(in_msg);
-
- return result;
-}
-
-/**
- * see section 3.8.6 of TCG TNC IF-IMV Specification 1.3
- */
-TNC_Result TNC_IMV_ReceiveMessageLong(TNC_IMVID imv_id,
- TNC_ConnectionID connection_id,
- TNC_UInt32 msg_flags,
- TNC_BufferReference msg,
- TNC_UInt32 msg_len,
- TNC_VendorID msg_vid,
- TNC_MessageSubtype msg_subtype,
- TNC_UInt32 src_imc_id,
- TNC_UInt32 dst_imv_id)
-{
- imv_state_t *state;
- imv_msg_t *in_msg;
- TNC_Result result;
-
- if (!imv_attestation)
- {
- DBG1(DBG_IMV, "IMV \"%s\" has not been initialized", imv_name);
- return TNC_RESULT_NOT_INITIALIZED;
- }
- if (!imv_attestation->get_state(imv_attestation, connection_id, &state))
- {
- return TNC_RESULT_FATAL;
- }
- in_msg = imv_msg_create_from_long_data(imv_attestation, state, connection_id,
- src_imc_id, dst_imv_id, msg_vid, msg_subtype,
- chunk_create(msg, msg_len));
- result =receive_message(state, in_msg);
- in_msg->destroy(in_msg);
-
- return result;
-}
-
-/**
- * see section 3.8.7 of TCG TNC IF-IMV Specification 1.3
- */
-TNC_Result TNC_IMV_SolicitRecommendation(TNC_IMVID imv_id,
- TNC_ConnectionID connection_id)
-{
- imv_state_t *state;
-
- if (!imv_attestation)
- {
- DBG1(DBG_IMV, "IMV \"%s\" has not been initialized", imv_name);
- return TNC_RESULT_NOT_INITIALIZED;
- }
- if (!imv_attestation->get_state(imv_attestation, connection_id, &state))
- {
- return TNC_RESULT_FATAL;
- }
- return imv_attestation->provide_recommendation(imv_attestation, state);
-}
-
-/**
- * see section 3.8.8 of TCG TNC IF-IMV Specification 1.3
- */
-TNC_Result TNC_IMV_BatchEnding(TNC_IMVID imv_id,
- TNC_ConnectionID connection_id)
-{
- if (!imv_attestation)
- {
- DBG1(DBG_IMV, "IMV \"%s\" has not been initialized", imv_name);
- return TNC_RESULT_NOT_INITIALIZED;
- }
- return TNC_RESULT_SUCCESS;
-}
-
-/**
- * see section 3.8.9 of TCG TNC IF-IMV Specification 1.3
- */
-TNC_Result TNC_IMV_Terminate(TNC_IMVID imv_id)
-{
- if (!imv_attestation)
- {
- DBG1(DBG_IMV, "IMV \"%s\" has not been initialized", imv_name);
- return TNC_RESULT_NOT_INITIALIZED;
- }
- if (pts_creds)
- {
- pts_credmgr->remove_set(pts_credmgr, pts_creds->get_set(pts_creds));
- pts_creds->destroy(pts_creds);
- }
- DESTROY_IF(pts_db);
- DESTROY_IF(pts_credmgr);
-
- libpts_deinit();
-
- imv_attestation->destroy(imv_attestation);
- imv_attestation = NULL;
-
- return TNC_RESULT_SUCCESS;
-}
-
-/**
- * see section 4.2.8.1 of TCG TNC IF-IMV Specification 1.3
- */
-TNC_Result TNC_IMV_ProvideBindFunction(TNC_IMVID imv_id,
- TNC_TNCS_BindFunctionPointer bind_function)
-{
- if (!imv_attestation)
- {
- DBG1(DBG_IMV, "IMV \"%s\" has not been initialized", imv_name);
- return TNC_RESULT_NOT_INITIALIZED;
- }
- return imv_attestation->bind_functions(imv_attestation, bind_function);
-}
diff --git a/src/libpts/plugins/imv_attestation/imv_attestation_agent.c b/src/libpts/plugins/imv_attestation/imv_attestation_agent.c
new file mode 100644
index 000000000..fb934127e
--- /dev/null
+++ b/src/libpts/plugins/imv_attestation/imv_attestation_agent.c
@@ -0,0 +1,616 @@
+/*
+ * Copyright (C) 2011-2012 Sansar Choinyambuu
+ * Copyright (C) 2011-2013 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * 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 "imv_attestation_agent.h"
+#include "imv_attestation_state.h"
+#include "imv_attestation_process.h"
+#include "imv_attestation_build.h"
+
+#include <imcv.h>
+#include <imv/imv_agent.h>
+#include <imv/imv_msg.h>
+#include <ietf/ietf_attr.h>
+#include <ietf/ietf_attr_attr_request.h>
+#include <ietf/ietf_attr_pa_tnc_error.h>
+#include <ietf/ietf_attr_product_info.h>
+#include <ietf/ietf_attr_string_version.h>
+
+#include <libpts.h>
+
+#include <pts/pts.h>
+#include <pts/pts_database.h>
+#include <pts/pts_creds.h>
+
+#include <tcg/tcg_attr.h>
+#include <tcg/tcg_pts_attr_req_file_meas.h>
+#include <tcg/tcg_pts_attr_req_file_meta.h>
+
+#include <tncif_pa_subtypes.h>
+
+#include <pen/pen.h>
+#include <utils/debug.h>
+#include <credentials/credential_manager.h>
+#include <collections/linked_list.h>
+
+typedef struct private_imv_attestation_agent_t private_imv_attestation_agent_t;
+
+/* Subscribed PA-TNC message subtypes */
+static pen_type_t msg_types[] = {
+ { PEN_TCG, PA_SUBTYPE_TCG_PTS },
+ { PEN_IETF, PA_SUBTYPE_IETF_OPERATING_SYSTEM }
+};
+
+/**
+ * Private data of an imv_attestation_agent_t object.
+ */
+struct private_imv_attestation_agent_t {
+
+ /**
+ * Public members of imv_attestation_agent_t
+ */
+ imv_agent_if_t public;
+
+ /**
+ * IMV agent responsible for generic functions
+ */
+ imv_agent_t *agent;
+
+ /**
+ * Supported PTS measurement algorithms
+ */
+ pts_meas_algorithms_t supported_algorithms;
+
+ /**
+ * Supported PTS Diffie Hellman Groups
+ */
+ pts_dh_group_t supported_dh_groups;
+
+ /**
+ * PTS file measurement database
+ */
+ pts_database_t *pts_db;
+
+ /**
+ * PTS credentials
+ */
+ pts_creds_t *pts_creds;
+
+ /**
+ * PTS credential manager
+ */
+ credential_manager_t *pts_credmgr;
+
+};
+
+METHOD(imv_agent_if_t, bind_functions, TNC_Result,
+ private_imv_attestation_agent_t *this, TNC_TNCS_BindFunctionPointer bind_function)
+{
+ return this->agent->bind_functions(this->agent, bind_function);
+}
+
+METHOD(imv_agent_if_t, notify_connection_change, TNC_Result,
+ private_imv_attestation_agent_t *this, TNC_ConnectionID id,
+ TNC_ConnectionState new_state)
+{
+ imv_state_t *state;
+
+ switch (new_state)
+ {
+ case TNC_CONNECTION_STATE_CREATE:
+ state = imv_attestation_state_create(id);
+ return this->agent->create_state(this->agent, state);
+ case TNC_CONNECTION_STATE_DELETE:
+ return this->agent->delete_state(this->agent, id);
+ default:
+ return this->agent->change_state(this->agent, id, new_state, NULL);
+ }
+}
+
+/**
+ * Process a received message
+ */
+static TNC_Result receive_msg(private_imv_attestation_agent_t *this,
+ imv_state_t *state, imv_msg_t *in_msg)
+{
+ imv_attestation_state_t *attestation_state;
+ imv_msg_t *out_msg;
+ enumerator_t *enumerator;
+ pa_tnc_attr_t *attr;
+ pen_type_t type;
+ TNC_Result result;
+ pts_t *pts;
+ chunk_t os_name = chunk_empty;
+ chunk_t os_version = chunk_empty;
+ bool fatal_error = FALSE;
+
+ /* parse received PA-TNC message and handle local and remote errors */
+ result = in_msg->receive(in_msg, &fatal_error);
+ if (result != TNC_RESULT_SUCCESS)
+ {
+ return result;
+ }
+
+ attestation_state = (imv_attestation_state_t*)state;
+ pts = attestation_state->get_pts(attestation_state);
+
+ out_msg = imv_msg_create_as_reply(in_msg);
+ out_msg->set_msg_type(out_msg, msg_types[0]);
+
+ /* analyze PA-TNC attributes */
+ enumerator = in_msg->create_attribute_enumerator(in_msg);
+ while (enumerator->enumerate(enumerator, &attr))
+ {
+ type = attr->get_type(attr);
+
+ if (type.vendor_id == PEN_IETF)
+ {
+ switch (type.type)
+ {
+ case IETF_ATTR_PA_TNC_ERROR:
+ {
+ ietf_attr_pa_tnc_error_t *error_attr;
+ pen_type_t error_code;
+ chunk_t msg_info;
+
+ error_attr = (ietf_attr_pa_tnc_error_t*)attr;
+ error_code = error_attr->get_error_code(error_attr);
+
+ if (error_code.vendor_id == PEN_TCG)
+ {
+ msg_info = error_attr->get_msg_info(error_attr);
+
+ DBG1(DBG_IMV, "received TCG-PTS error '%N'",
+ pts_error_code_names, error_code.type);
+ DBG1(DBG_IMV, "error information: %B", &msg_info);
+ fatal_error = TRUE;
+ }
+ break;
+ }
+ case IETF_ATTR_PRODUCT_INFORMATION:
+ {
+ ietf_attr_product_info_t *attr_cast;
+
+ attr_cast = (ietf_attr_product_info_t*)attr;
+ os_name = attr_cast->get_info(attr_cast, NULL, NULL);
+ break;
+ }
+ case IETF_ATTR_STRING_VERSION:
+ {
+ ietf_attr_string_version_t *attr_cast;
+
+ attr_cast = (ietf_attr_string_version_t*)attr;
+ os_version = attr_cast->get_version(attr_cast, NULL, NULL);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ else if (type.vendor_id == PEN_TCG)
+ {
+ if (!imv_attestation_process(attr, out_msg, state,
+ this->supported_algorithms, this->supported_dh_groups,
+ this->pts_db, this->pts_credmgr))
+ {
+ result = TNC_RESULT_FATAL;
+ break;
+ }
+ }
+ }
+ enumerator->destroy(enumerator);
+
+ /**
+ * The IETF Product Information and String Version attributes
+ * are supposed to arrive in the same PA-TNC message
+ */
+ if (os_name.len && os_version.len)
+ {
+ pts->set_platform_info(pts, os_name, os_version);
+ }
+
+ if (fatal_error || result != TNC_RESULT_SUCCESS)
+ {
+ state->set_recommendation(state,
+ TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION,
+ TNC_IMV_EVALUATION_RESULT_ERROR);
+ result = out_msg->send_assessment(out_msg);
+ out_msg->destroy(out_msg);
+ if (result != TNC_RESULT_SUCCESS)
+ {
+ return result;
+ }
+ return this->agent->provide_recommendation(this->agent, state);
+ }
+
+ /* send PA-TNC message with excl flag set */
+ result = out_msg->send(out_msg, TRUE);
+ out_msg->destroy(out_msg);
+
+ return result;
+}
+
+METHOD(imv_agent_if_t, receive_message, TNC_Result,
+ private_imv_attestation_agent_t *this, TNC_ConnectionID id,
+ TNC_MessageType msg_type, chunk_t msg)
+{
+ imv_state_t *state;
+ imv_msg_t *in_msg;
+ TNC_Result result;
+
+ if (!this->agent->get_state(this->agent, id, &state))
+ {
+ return TNC_RESULT_FATAL;
+ }
+ in_msg = imv_msg_create_from_data(this->agent, state, id, msg_type, msg);
+ result = receive_msg(this, state, in_msg);
+ in_msg->destroy(in_msg);
+
+ return result;
+}
+
+METHOD(imv_agent_if_t, receive_message_long, TNC_Result,
+ private_imv_attestation_agent_t *this, TNC_ConnectionID id,
+ TNC_UInt32 src_imc_id, TNC_UInt32 dst_imv_id,
+ TNC_VendorID msg_vid, TNC_MessageSubtype msg_subtype, chunk_t msg)
+{
+ imv_state_t *state;
+ imv_msg_t *in_msg;
+ TNC_Result result;
+
+ if (!this->agent->get_state(this->agent, id, &state))
+ {
+ return TNC_RESULT_FATAL;
+ }
+ in_msg = imv_msg_create_from_long_data(this->agent, state, id,
+ src_imc_id, dst_imv_id, msg_vid, msg_subtype, msg);
+ result = receive_msg(this, state, in_msg);
+ in_msg->destroy(in_msg);
+
+ return result;
+}
+
+METHOD(imv_agent_if_t, batch_ending, TNC_Result,
+ private_imv_attestation_agent_t *this, TNC_ConnectionID id)
+{
+ imv_msg_t *out_msg;
+ imv_state_t *state;
+ imv_session_t *session;
+ imv_attestation_state_t *attestation_state;
+ TNC_IMVID imv_id;
+ TNC_Result result = TNC_RESULT_SUCCESS;
+ pts_t *pts;
+ char *platform_info;
+
+ if (!this->agent->get_state(this->agent, id, &state))
+ {
+ return TNC_RESULT_FATAL;
+ }
+ attestation_state = (imv_attestation_state_t*)state;
+ pts = attestation_state->get_pts(attestation_state);
+ platform_info = pts->get_platform_info(pts);
+ session = state->get_session(state);
+ imv_id = this->agent->get_id(this->agent);
+
+ /* exit if a recommendation has already been provided */
+ if (state->get_action_flags(state) & IMV_ATTESTATION_FLAG_REC)
+ {
+ return TNC_RESULT_SUCCESS;
+ }
+
+ /* send an IETF attribute request if no platform info was received */
+ if (!platform_info &&
+ !(state->get_action_flags(state) & IMV_ATTESTATION_FLAG_ATTR_REQ))
+ {
+ pa_tnc_attr_t *attr;
+ ietf_attr_attr_request_t *attr_cast;
+ imv_msg_t *os_msg;
+
+ attr = ietf_attr_attr_request_create(PEN_IETF,
+ IETF_ATTR_PRODUCT_INFORMATION);
+ attr_cast = (ietf_attr_attr_request_t*)attr;
+ attr_cast->add(attr_cast, PEN_IETF, IETF_ATTR_STRING_VERSION);
+
+ os_msg = imv_msg_create(this->agent, state, id, imv_id, TNC_IMCID_ANY,
+ msg_types[1]);
+ os_msg->add_attribute(os_msg, attr);
+ result = os_msg->send(os_msg, FALSE);
+ os_msg->destroy(os_msg);
+
+ if (result != TNC_RESULT_SUCCESS)
+ {
+ return result;
+ }
+ state->set_action_flags(state, IMV_ATTESTATION_FLAG_ATTR_REQ);
+ }
+
+ /* create an empty out message - we might need it */
+ out_msg = imv_msg_create(this->agent, state, id, imv_id, TNC_IMCID_ANY,
+ msg_types[0]);
+
+ if (platform_info && session &&
+ (state->get_action_flags(state) & IMV_ATTESTATION_FLAG_ALGO) &&
+ !(state->get_action_flags(state) & IMV_ATTESTATION_FLAG_FILE_MEAS))
+ {
+ imv_workitem_t *workitem;
+ bool is_dir, no_workitems = TRUE;
+ u_int32_t delimiter = SOLIDUS_UTF;
+ u_int16_t request_id;
+ pa_tnc_attr_t *attr;
+ char *pathname;
+ enumerator_t *enumerator;
+
+ enumerator = session->create_workitem_enumerator(session);
+ if (enumerator)
+ {
+ while (enumerator->enumerate(enumerator, &workitem))
+ {
+ if (workitem->get_imv_id(workitem) != TNC_IMVID_ANY)
+ {
+ continue;
+ }
+
+ switch (workitem->get_type(workitem))
+ {
+ case IMV_WORKITEM_FILE_REF_MEAS:
+ case IMV_WORKITEM_FILE_MEAS:
+ case IMV_WORKITEM_FILE_META:
+ is_dir = FALSE;
+ break;
+ case IMV_WORKITEM_DIR_REF_MEAS:
+ case IMV_WORKITEM_DIR_MEAS:
+ case IMV_WORKITEM_DIR_META:
+ is_dir = TRUE;
+ break;
+ default:
+ continue;
+ }
+
+ pathname = this->pts_db->get_pathname(this->pts_db, is_dir,
+ workitem->get_arg_int(workitem));
+ if (!pathname)
+ {
+ continue;
+ }
+ workitem->set_imv_id(workitem, imv_id);
+ no_workitems = FALSE;
+
+ if (workitem->get_type(workitem) == IMV_WORKITEM_FILE_META)
+ {
+ TNC_IMV_Action_Recommendation rec;
+ TNC_IMV_Evaluation_Result eval;
+ char result_str[BUF_LEN];
+
+ DBG2(DBG_IMV, "IMV %d requests metadata for %s '%s'",
+ imv_id, is_dir ? "directory" : "file", pathname);
+
+ /* currently just fire and forget metadata requests */
+ attr = tcg_pts_attr_req_file_meta_create(is_dir,
+ delimiter, pathname);
+ snprintf(result_str, BUF_LEN, "%s metadata requested",
+ is_dir ? "directory" : "file");
+ eval = TNC_IMV_EVALUATION_RESULT_COMPLIANT;
+ session->remove_workitem(session, enumerator);
+ rec = workitem->set_result(workitem, result_str, eval);
+ state->update_recommendation(state, rec, eval);
+ imcv_db->finalize_workitem(imcv_db, workitem);
+ workitem->destroy(workitem);
+ }
+ else
+ {
+ /* use lower 16 bits of the workitem ID as request ID */
+ request_id = workitem->get_id(workitem) & 0xffff;
+
+ DBG2(DBG_IMV, "IMV %d requests measurement %d for %s '%s'",
+ imv_id, request_id, is_dir ? "directory" : "file",
+ pathname);
+ attr = tcg_pts_attr_req_file_meas_create(is_dir, request_id,
+ delimiter, pathname);
+ }
+ free(pathname);
+ attr->set_noskip_flag(attr, TRUE);
+ out_msg->add_attribute(out_msg, attr);
+ }
+ enumerator->destroy(enumerator);
+
+ /* sent all file and directory measurement and metadata requests */
+ state->set_action_flags(state, IMV_ATTESTATION_FLAG_FILE_MEAS);
+
+ if (no_workitems)
+ {
+ DBG2(DBG_IMV, "IMV %d has no workitems - "
+ "no evaluation requested", imv_id);
+ state->set_recommendation(state,
+ TNC_IMV_ACTION_RECOMMENDATION_ALLOW,
+ TNC_IMV_EVALUATION_RESULT_DONT_KNOW);
+ }
+ }
+ }
+
+ /* check the IMV state for the next PA-TNC attributes to send */
+ if (!imv_attestation_build(out_msg, attestation_state,
+ this->supported_algorithms,
+ this->supported_dh_groups, this->pts_db))
+ {
+ state->set_recommendation(state,
+ TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION,
+ TNC_IMV_EVALUATION_RESULT_ERROR);
+ result = out_msg->send_assessment(out_msg);
+ out_msg->destroy(out_msg);
+ state->set_action_flags(state, IMV_ATTESTATION_FLAG_REC);
+
+ if (result != TNC_RESULT_SUCCESS)
+ {
+ return result;
+ }
+ return this->agent->provide_recommendation(this->agent, state);
+ }
+
+ /* finalized all workitems? */
+ if (session && session->get_policy_started(session) &&
+ session->get_workitem_count(session, imv_id) == 0 &&
+ attestation_state->get_handshake_state(attestation_state) ==
+ IMV_ATTESTATION_STATE_END)
+ {
+ result = out_msg->send_assessment(out_msg);
+ out_msg->destroy(out_msg);
+ state->set_action_flags(state, IMV_ATTESTATION_FLAG_REC);
+
+ if (result != TNC_RESULT_SUCCESS)
+ {
+ return result;
+ }
+ return this->agent->provide_recommendation(this->agent, state);
+ }
+
+ /* send non-empty PA-TNC message with excl flag not set */
+ if (out_msg->get_attribute_count(out_msg))
+ {
+ result = out_msg->send(out_msg, FALSE);
+ }
+ out_msg->destroy(out_msg);
+
+ return result;
+}
+
+METHOD(imv_agent_if_t, solicit_recommendation, TNC_Result,
+ private_imv_attestation_agent_t *this, TNC_ConnectionID id)
+{
+ TNC_IMVID imv_id;
+ imv_state_t *state;
+ imv_attestation_state_t *attestation_state;
+ imv_session_t *session;
+
+ if (!this->agent->get_state(this->agent, id, &state))
+ {
+ return TNC_RESULT_FATAL;
+ }
+ attestation_state = (imv_attestation_state_t*)state;
+ session = state->get_session(state);
+ imv_id = this->agent->get_id(this->agent);
+
+ if (session)
+ {
+ imv_workitem_t *workitem;
+ enumerator_t *enumerator;
+ int pending_file_meas = 0;
+
+ enumerator = session->create_workitem_enumerator(session);
+ if (enumerator)
+ {
+ while (enumerator->enumerate(enumerator, &workitem))
+ {
+ if (workitem->get_imv_id(workitem) != imv_id)
+ {
+ continue;
+ }
+ switch (workitem->get_type(workitem))
+ {
+ case IMV_WORKITEM_FILE_REF_MEAS:
+ case IMV_WORKITEM_FILE_MEAS:
+ case IMV_WORKITEM_DIR_REF_MEAS:
+ case IMV_WORKITEM_DIR_MEAS:
+ pending_file_meas++;
+ break;
+ default:
+ break;
+ }
+ }
+ enumerator->destroy(enumerator);
+
+ if (pending_file_meas)
+ {
+ DBG1(DBG_IMV, "failure due to %d pending file measurements",
+ pending_file_meas);
+ attestation_state->set_measurement_error(attestation_state,
+ IMV_ATTESTATION_ERROR_FILE_MEAS_PEND);
+ }
+ }
+ }
+ return this->agent->provide_recommendation(this->agent, state);
+}
+
+METHOD(imv_agent_if_t, destroy, void,
+ private_imv_attestation_agent_t *this)
+{
+ if (this->pts_creds)
+ {
+ this->pts_credmgr->remove_set(this->pts_credmgr,
+ this->pts_creds->get_set(this->pts_creds));
+ this->pts_creds->destroy(this->pts_creds);
+ }
+ DESTROY_IF(this->pts_db);
+ DESTROY_IF(this->pts_credmgr);
+ DESTROY_IF(this->agent);
+ free(this);
+ libpts_deinit();
+}
+
+/**
+ * Described in header.
+ */
+imv_agent_if_t *imv_attestation_agent_create(const char *name, TNC_IMVID id,
+ TNC_Version *actual_version)
+{
+ private_imv_attestation_agent_t *this;
+ char *hash_alg, *dh_group, *cadir;
+
+ hash_alg = lib->settings->get_str(lib->settings,
+ "libimcv.plugins.imv-attestation.hash_algorithm", "sha256");
+ dh_group = lib->settings->get_str(lib->settings,
+ "libimcv.plugins.imv-attestation.dh_group", "ecp256");
+ cadir = lib->settings->get_str(lib->settings,
+ "libimcv.plugins.imv-attestation.cadir", NULL);
+
+ INIT(this,
+ .public = {
+ .bind_functions = _bind_functions,
+ .notify_connection_change = _notify_connection_change,
+ .receive_message = _receive_message,
+ .receive_message_long = _receive_message_long,
+ .batch_ending = _batch_ending,
+ .solicit_recommendation = _solicit_recommendation,
+ .destroy = _destroy,
+ },
+ .agent = imv_agent_create(name, msg_types, countof(msg_types), id,
+ actual_version),
+ .supported_algorithms = PTS_MEAS_ALGO_NONE,
+ .supported_dh_groups = PTS_DH_GROUP_NONE,
+ .pts_credmgr = credential_manager_create(),
+ .pts_creds = pts_creds_create(cadir),
+ .pts_db = pts_database_create(imcv_db),
+ );
+
+ libpts_init();
+
+ if (!this->agent ||
+ !pts_meas_algo_probe(&this->supported_algorithms) ||
+ !pts_dh_group_probe(&this->supported_dh_groups) ||
+ !pts_meas_algo_update(hash_alg, &this->supported_algorithms) ||
+ !pts_dh_group_update(dh_group, &this->supported_dh_groups))
+ {
+ destroy(this);
+ return NULL;
+ }
+
+ if (this->pts_creds)
+ {
+ this->pts_credmgr->add_set(this->pts_credmgr,
+ this->pts_creds->get_set(this->pts_creds));
+ }
+
+ return &this->public;
+}
+
diff --git a/src/libpts/plugins/imv_attestation/imv_attestation_agent.h b/src/libpts/plugins/imv_attestation/imv_attestation_agent.h
new file mode 100644
index 000000000..cc421a29a
--- /dev/null
+++ b/src/libpts/plugins/imv_attestation/imv_attestation_agent.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2013 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * 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 imv_attestation_agent_t imv_attestation_agent
+ * @{ @ingroup imv_attestation
+ */
+
+#ifndef IMV_ATTESTATION_AGENT_H_
+#define IMV_ATTESTATION_AGENT_H_
+
+#include <imv/imv_agent_if.h>
+
+/**
+ * Creates a Attestation IMV agent
+ *
+ * @param name Name of the IMV
+ * @param id ID of the IMV
+ * @param actual_version TNC IF-IMV version
+ */
+imv_agent_if_t* imv_attestation_agent_create(const char* name, TNC_IMVID id,
+ TNC_Version *actual_version);
+
+#endif /** IMV_ATTESTATION_AGENT_H_ @}*/
diff --git a/src/libpts/plugins/imv_attestation/imv_attestation_build.c b/src/libpts/plugins/imv_attestation/imv_attestation_build.c
index b4feec7cd..3e09f7204 100644
--- a/src/libpts/plugins/imv_attestation/imv_attestation_build.c
+++ b/src/libpts/plugins/imv_attestation/imv_attestation_build.c
@@ -24,8 +24,6 @@
#include <tcg/tcg_pts_attr_get_aik.h>
#include <tcg/tcg_pts_attr_req_func_comp_evid.h>
#include <tcg/tcg_pts_attr_gen_attest_evid.h>
-#include <tcg/tcg_pts_attr_req_file_meas.h>
-#include <tcg/tcg_pts_attr_req_file_meta.h>
#include <utils/debug.h>
@@ -49,8 +47,7 @@ bool imv_attestation_build(imv_msg_t *out_msg,
if (handshake_state == IMV_ATTESTATION_STATE_NONCE_REQ &&
!(pts->get_proto_caps(pts) & PTS_PROTO_CAPS_D))
{
- DBG2(DBG_IMV, "PTS-IMC does not support DH Nonce negotiation - "
- "advancing to TPM Initialization");
+ DBG2(DBG_IMV, "PTS-IMC does not support DH Nonce negotiation");
handshake_state = IMV_ATTESTATION_STATE_TPM_INIT;
}
@@ -61,9 +58,8 @@ bool imv_attestation_build(imv_msg_t *out_msg,
if (handshake_state == IMV_ATTESTATION_STATE_TPM_INIT &&
!(pts->get_proto_caps(pts) & PTS_PROTO_CAPS_T))
{
- DBG2(DBG_IMV, "PTS-IMC made no TPM available - "
- "advancing to File Measurements");
- handshake_state = IMV_ATTESTATION_STATE_MEAS;
+ DBG2(DBG_IMV, "PTS-IMC made no TPM available");
+ handshake_state = IMV_ATTESTATION_STATE_END;
}
switch (handshake_state)
@@ -130,82 +126,8 @@ bool imv_attestation_build(imv_msg_t *out_msg,
out_msg->add_attribute(out_msg, attr);
attestation_state->set_handshake_state(attestation_state,
- IMV_ATTESTATION_STATE_MEAS);
- break;
- }
- case IMV_ATTESTATION_STATE_MEAS:
- {
- enumerator_t *enumerator;
- u_int32_t delimiter = SOLIDUS_UTF;
- char *platform_info, *pathname;
- u_int16_t request_id;
- int id, type;
- bool is_dir, have_request = FALSE;
-
- attestation_state->set_handshake_state(attestation_state,
IMV_ATTESTATION_STATE_COMP_EVID);
-
- /* Get Platform and OS of the PTS-IMC */
- platform_info = pts->get_platform_info(pts);
-
- if (!pts_db || !platform_info)
- {
- DBG1(DBG_IMV, "%s%s%s not available",
- (pts_db) ? "" : "pts database",
- (!pts_db && !platform_info) ? "and" : "",
- (platform_info) ? "" : "platform info");
- break;
- }
- DBG1(DBG_IMV, "platform is '%s'", platform_info);
-
- /* Send Request File Metadata attribute */
- enumerator = pts_db->create_file_meta_enumerator(pts_db,
- platform_info);
- if (!enumerator)
- {
- break;
- }
- while (enumerator->enumerate(enumerator, &type, &pathname))
- {
- is_dir = (type != 0);
- DBG2(DBG_IMV, "metadata request for %s '%s'",
- is_dir ? "directory" : "file", pathname);
- attr = tcg_pts_attr_req_file_meta_create(is_dir, delimiter,
- pathname);
- attr->set_noskip_flag(attr, TRUE);
- out_msg->add_attribute(out_msg, attr);
- have_request = TRUE;
- }
- enumerator->destroy(enumerator);
-
- /* Send Request File Measurement attribute */
- enumerator = pts_db->create_file_meas_enumerator(pts_db,
- platform_info);
- if (!enumerator)
- {
- break;
- }
- while (enumerator->enumerate(enumerator, &id, &type, &pathname))
- {
- is_dir = (type != 0);
- request_id = attestation_state->add_file_meas_request(
- attestation_state, id, is_dir);
- DBG2(DBG_IMV, "measurement request %d for %s '%s'",
- request_id, is_dir ? "directory" : "file", pathname);
- attr = tcg_pts_attr_req_file_meas_create(is_dir, request_id,
- delimiter, pathname);
- attr->set_noskip_flag(attr, TRUE);
- out_msg->add_attribute(out_msg, attr);
- have_request = TRUE;
- }
- enumerator->destroy(enumerator);
-
- /* do we have any file metadata or measurement requests? */
- if (have_request)
- {
- break;
- }
- /* fall through to next state */
+ break;
}
case IMV_ATTESTATION_STATE_COMP_EVID:
{
@@ -304,6 +226,8 @@ bool imv_attestation_build(imv_msg_t *out_msg,
}
break;
case IMV_ATTESTATION_STATE_END:
+ attestation_state->set_handshake_state(attestation_state,
+ IMV_ATTESTATION_STATE_END);
break;
}
return TRUE;
diff --git a/src/libpts/plugins/imv_attestation/imv_attestation_process.c b/src/libpts/plugins/imv_attestation/imv_attestation_process.c
index 4541075ef..d422ebcda 100644
--- a/src/libpts/plugins/imv_attestation/imv_attestation_process.c
+++ b/src/libpts/plugins/imv_attestation/imv_attestation_process.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
+ * Copyright (C) 2011-2013 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -15,6 +15,7 @@
#include "imv_attestation_process.h"
+#include <imcv.h>
#include <ietf/ietf_attr_pa_tnc_error.h>
#include <pts/pts.h>
@@ -35,15 +36,17 @@
#include <inttypes.h>
bool imv_attestation_process(pa_tnc_attr_t *attr, imv_msg_t *out_msg,
- imv_attestation_state_t *attestation_state,
+ imv_state_t *state,
pts_meas_algorithms_t supported_algorithms,
pts_dh_group_t supported_dh_groups,
pts_database_t *pts_db,
credential_manager_t *pts_credmgr)
{
+ imv_attestation_state_t *attestation_state;
pen_type_t attr_type;
pts_t *pts;
+ attestation_state = (imv_attestation_state_t*)state;
pts = attestation_state->get_pts(attestation_state);
attr_type = attr->get_type(attr);
@@ -73,6 +76,7 @@ bool imv_attestation_process(pa_tnc_attr_t *attr, imv_msg_t *out_msg,
return FALSE;
}
pts->set_meas_algorithm(pts, selected_algorithm);
+ state->set_action_flags(state, IMV_ATTESTATION_FLAG_ALGO);
break;
}
case TCG_PTS_DH_NONCE_PARAMS_RESP:
@@ -190,28 +194,26 @@ bool imv_attestation_process(pa_tnc_attr_t *attr, imv_msg_t *out_msg,
}
case TCG_PTS_FILE_MEAS:
{
+ TNC_IMV_Evaluation_Result eval;
+ TNC_IMV_Action_Recommendation rec;
tcg_pts_attr_file_meas_t *attr_cast;
u_int16_t request_id;
- int file_count, file_id;
+ int arg_int, file_count;
pts_meas_algorithms_t algo;
pts_file_meas_t *measurements;
- char *platform_info;
- enumerator_t *e_hash;
- bool is_dir;
-
+ imv_session_t *session;
+ imv_workitem_t *workitem, *found = NULL;
+ imv_workitem_type_t type;
+ char result_str[BUF_LEN], *platform_info;
+ bool is_dir, correct;
+ enumerator_t *enumerator;
+
+ eval = TNC_IMV_EVALUATION_RESULT_COMPLIANT;
+ session = state->get_session(state);
+ algo = pts->get_meas_algorithm(pts);
platform_info = pts->get_platform_info(pts);
- if (!pts_db || !platform_info)
- {
- DBG1(DBG_IMV, "%s%s%s not available",
- (pts_db) ? "" : "pts database",
- (!pts_db && !platform_info) ? "and" : "",
- (platform_info) ? "" : "platform info");
- break;
- }
-
attr_cast = (tcg_pts_attr_file_meas_t*)attr;
measurements = attr_cast->get_measurements(attr_cast);
- algo = pts->get_meas_algorithm(pts);
request_id = measurements->get_request_id(measurements);
file_count = measurements->get_file_count(measurements);
@@ -220,23 +222,101 @@ bool imv_attestation_process(pa_tnc_attr_t *attr, imv_msg_t *out_msg,
if (request_id)
{
- if (!attestation_state->check_off_file_meas_request(
- attestation_state, request_id, &file_id, &is_dir))
+ enumerator = session->create_workitem_enumerator(session);
+ while (enumerator->enumerate(enumerator, &workitem))
+ {
+ /* request ID consist of lower 16 bits of workitem ID */
+ if ((workitem->get_id(workitem) & 0xffff) == request_id)
+ {
+ found = workitem;
+ break;
+ }
+ }
+
+ if (!found)
{
DBG1(DBG_IMV, " no entry found for file measurement "
"request %d", request_id);
+ enumerator->destroy(enumerator);
break;
}
+ type = found->get_type(found);
+ arg_int = found->get_arg_int(found);
+
+ switch (type)
+ {
+ default:
+ case IMV_WORKITEM_FILE_REF_MEAS:
+ case IMV_WORKITEM_FILE_MEAS:
+ is_dir = FALSE;
+ break;
+ case IMV_WORKITEM_DIR_REF_MEAS:
+ case IMV_WORKITEM_DIR_MEAS:
+ is_dir = TRUE;
+ }
- /* check hashes from database against measurements */
- e_hash = pts_db->create_file_hash_enumerator(pts_db,
- platform_info, algo, file_id, is_dir);
- if (!measurements->verify(measurements, e_hash, is_dir))
+ switch (type)
{
- attestation_state->set_measurement_error(attestation_state,
+ case IMV_WORKITEM_FILE_MEAS:
+ case IMV_WORKITEM_DIR_MEAS:
+ {
+ enumerator_t *e;
+
+ /* check hashes from database against measurements */
+ e = pts_db->create_file_hash_enumerator(pts_db,
+ platform_info, algo, is_dir, arg_int);
+ if (!e)
+ {
+ eval = TNC_IMV_EVALUATION_RESULT_ERROR;
+ break;
+ }
+ correct = measurements->verify(measurements, e, is_dir);
+ if (!correct)
+ {
+ attestation_state->set_measurement_error(
+ attestation_state,
IMV_ATTESTATION_ERROR_FILE_MEAS_FAIL);
+ eval = TNC_IMV_EVALUATION_RESULT_NONCOMPLIANT_MINOR;
+ }
+ e->destroy(e);
+
+ snprintf(result_str, BUF_LEN, "%s measurement%s correct",
+ is_dir ? "directory" : "file",
+ correct ? "" : " not");
+ break;
+ }
+ case IMV_WORKITEM_FILE_REF_MEAS:
+ case IMV_WORKITEM_DIR_REF_MEAS:
+ {
+ enumerator_t *e;
+ char *filename;
+ chunk_t measurement;
+
+ e = measurements->create_enumerator(measurements);
+ while (e->enumerate(e, &filename, &measurement))
+ {
+ if (pts_db->add_file_measurement(pts_db,
+ platform_info, algo, measurement, filename,
+ is_dir, arg_int) != SUCCESS)
+ {
+ eval = TNC_IMV_EVALUATION_RESULT_ERROR;
+ }
+ }
+ e->destroy(e);
+ snprintf(result_str, BUF_LEN, "%s reference measurement "
+ "successful", is_dir ? "directory" : "file");
+ break;
+ }
+ default:
+ break;
}
- e_hash->destroy(e_hash);
+
+ session->remove_workitem(session, enumerator);
+ enumerator->destroy(enumerator);
+ rec = found->set_result(found, result_str, eval);
+ state->update_recommendation(state, rec, eval);
+ imcv_db->finalize_workitem(imcv_db, found);
+ found->destroy(found);
}
else
{
diff --git a/src/libpts/plugins/imv_attestation/imv_attestation_process.h b/src/libpts/plugins/imv_attestation/imv_attestation_process.h
index 74e4644b4..af8666b66 100644
--- a/src/libpts/plugins/imv_attestation/imv_attestation_process.h
+++ b/src/libpts/plugins/imv_attestation/imv_attestation_process.h
@@ -40,7 +40,7 @@
*
* @param attr PA-TNC attribute to be processed
* @param out_msg PA-TNC message containing error messages
- * @param attestation_state attestation state of a given connection
+ * @param state state of a given connection
* @param supported_algorithms supported PTS measurement algorithms
* @param supported_dh_groups supported DH groups
* @param pts_db PTS configuration database
@@ -48,7 +48,7 @@
* @return TRUE if successful
*/
bool imv_attestation_process(pa_tnc_attr_t *attr, imv_msg_t *out_msg,
- imv_attestation_state_t *attestation_state,
+ imv_state_t *state,
pts_meas_algorithms_t supported_algorithms,
pts_dh_group_t supported_dh_groups,
pts_database_t *pts_db,
diff --git a/src/libpts/plugins/imv_attestation/imv_attestation_state.c b/src/libpts/plugins/imv_attestation/imv_attestation_state.c
index fc4246614..27b2655f8 100644
--- a/src/libpts/plugins/imv_attestation/imv_attestation_state.c
+++ b/src/libpts/plugins/imv_attestation/imv_attestation_state.c
@@ -21,6 +21,8 @@
#include <imv/imv_lang_string.h>
#include "imv/imv_reason_string.h"
+#include <tncif_policy.h>
+
#include <collections/linked_list.h>
#include <utils/debug.h>
@@ -64,6 +66,11 @@ struct private_imv_attestation_state_t {
u_int32_t max_msg_len;
/**
+ * Flags set for completed actions
+ */
+ u_int32_t action_flags;
+
+ /**
* Access Requestor ID Type
*/
u_int32_t ar_id_type;
@@ -74,6 +81,11 @@ struct private_imv_attestation_state_t {
chunk_t ar_id_value;
/**
+ * IMV database session associated with TNCCS connection
+ */
+ imv_session_t *session;
+
+ /**
* IMV Attestation handshake state
*/
imv_attestation_handshake_state_t handshake_state;
@@ -89,16 +101,6 @@ struct private_imv_attestation_state_t {
TNC_IMV_Evaluation_Result eval;
/**
- * File Measurement Request counter
- */
- u_int16_t file_meas_request_counter;
-
- /**
- * List of PTS File/Directory Measurement requests
- */
- linked_list_t *file_meas_requests;
-
- /**
* List of Functional Components
*/
linked_list_t *components;
@@ -121,15 +123,6 @@ struct private_imv_attestation_state_t {
};
/**
- * PTS File/Directory Measurement request entry
- */
-struct file_meas_request_t {
- u_int16_t id;
- int file_id;
- bool is_dir;
-};
-
-/**
* PTS Functional Component entry
*/
struct func_comp_t {
@@ -226,6 +219,18 @@ METHOD(imv_state_t, get_max_msg_len, u_int32_t,
return this->max_msg_len;
}
+METHOD(imv_state_t, set_action_flags, void,
+ private_imv_attestation_state_t *this, u_int32_t flags)
+{
+ this->action_flags |= flags;
+}
+
+METHOD(imv_state_t, get_action_flags, u_int32_t,
+ private_imv_attestation_state_t *this)
+{
+ return this->action_flags;
+}
+
METHOD(imv_state_t, set_ar_id, void,
private_imv_attestation_state_t *this, u_int32_t id_type, chunk_t id_value)
{
@@ -243,6 +248,18 @@ METHOD(imv_state_t, get_ar_id, chunk_t,
return this->ar_id_value;
}
+METHOD(imv_state_t, set_session, void,
+ private_imv_attestation_state_t *this, imv_session_t *session)
+{
+ this->session = session;
+}
+
+METHOD(imv_state_t, get_session, imv_session_t*,
+ private_imv_attestation_state_t *this)
+{
+ return this->session;
+}
+
METHOD(imv_state_t, change_state, void,
private_imv_attestation_state_t *this, TNC_ConnectionState new_state)
{
@@ -251,7 +268,7 @@ METHOD(imv_state_t, change_state, void,
METHOD(imv_state_t, get_recommendation, void,
private_imv_attestation_state_t *this, TNC_IMV_Action_Recommendation *rec,
- TNC_IMV_Evaluation_Result *eval)
+ TNC_IMV_Evaluation_Result *eval)
{
*rec = this->rec;
*eval = this->eval;
@@ -259,12 +276,20 @@ METHOD(imv_state_t, get_recommendation, void,
METHOD(imv_state_t, set_recommendation, void,
private_imv_attestation_state_t *this, TNC_IMV_Action_Recommendation rec,
- TNC_IMV_Evaluation_Result eval)
+ TNC_IMV_Evaluation_Result eval)
{
this->rec = rec;
this->eval = eval;
}
+METHOD(imv_state_t, update_recommendation, void,
+ private_imv_attestation_state_t *this, TNC_IMV_Action_Recommendation rec,
+ TNC_IMV_Evaluation_Result eval)
+{
+ this->rec = tncif_policy_update_recommendation(this->rec, rec);
+ this->eval = tncif_policy_update_evaluation(this->eval, eval);
+}
+
METHOD(imv_state_t, get_reason_string, bool,
private_imv_attestation_state_t *this, enumerator_t *language_enumerator,
chunk_t *reason_string, char **reason_language)
@@ -316,8 +341,8 @@ METHOD(imv_state_t, get_remediation_instructions, bool,
METHOD(imv_state_t, destroy, void,
private_imv_attestation_state_t *this)
{
+ DESTROY_IF(this->session);
DESTROY_IF(this->reason_string);
- this->file_meas_requests->destroy_function(this->file_meas_requests, free);
this->components->destroy_function(this->components, (void *)free_func_comp);
this->pts->destroy(this->pts);
free(this->ar_id_value.ptr);
@@ -343,51 +368,6 @@ METHOD(imv_attestation_state_t, get_pts, pts_t*,
return this->pts;
}
-METHOD(imv_attestation_state_t, add_file_meas_request, u_int16_t,
- private_imv_attestation_state_t *this, int file_id, bool is_dir)
-{
- file_meas_request_t *request;
-
- request = malloc_thing(file_meas_request_t);
- request->id = ++this->file_meas_request_counter;
- request->file_id = file_id;
- request->is_dir = is_dir;
- this->file_meas_requests->insert_last(this->file_meas_requests, request);
-
- return this->file_meas_request_counter;
-}
-
-METHOD(imv_attestation_state_t, check_off_file_meas_request, bool,
- private_imv_attestation_state_t *this, u_int16_t id, int *file_id,
- bool* is_dir)
-{
- enumerator_t *enumerator;
- file_meas_request_t *request;
- bool found = FALSE;
-
- enumerator = this->file_meas_requests->create_enumerator(this->file_meas_requests);
- while (enumerator->enumerate(enumerator, &request))
- {
- if (request->id == id)
- {
- found = TRUE;
- *file_id = request->file_id;
- *is_dir = request->is_dir;
- this->file_meas_requests->remove_at(this->file_meas_requests, enumerator);
- free(request);
- break;
- }
- }
- enumerator->destroy(enumerator);
- return found;
-}
-
-METHOD(imv_attestation_state_t, get_file_meas_request_count, int,
- private_imv_attestation_state_t *this)
-{
- return this->file_meas_requests->get_count(this->file_meas_requests);
-}
-
METHOD(imv_attestation_state_t, create_component, pts_component_t*,
private_imv_attestation_state_t *this, pts_comp_func_name_t *name,
u_int32_t depth, pts_database_t *pts_db)
@@ -508,11 +488,16 @@ imv_state_t *imv_attestation_state_create(TNC_ConnectionID connection_id)
.set_flags = _set_flags,
.set_max_msg_len = _set_max_msg_len,
.get_max_msg_len = _get_max_msg_len,
+ .set_action_flags = _set_action_flags,
+ .get_action_flags = _get_action_flags,
.set_ar_id = _set_ar_id,
.get_ar_id = _get_ar_id,
+ .set_session = _set_session,
+ .get_session = _get_session,
.change_state = _change_state,
.get_recommendation = _get_recommendation,
.set_recommendation = _set_recommendation,
+ .update_recommendation = _update_recommendation,
.get_reason_string = _get_reason_string,
.get_remediation_instructions = _get_remediation_instructions,
.destroy = _destroy,
@@ -520,9 +505,6 @@ imv_state_t *imv_attestation_state_create(TNC_ConnectionID connection_id)
.get_handshake_state = _get_handshake_state,
.set_handshake_state = _set_handshake_state,
.get_pts = _get_pts,
- .add_file_meas_request = _add_file_meas_request,
- .check_off_file_meas_request = _check_off_file_meas_request,
- .get_file_meas_request_count = _get_file_meas_request_count,
.create_component = _create_component,
.get_component = _get_component,
.finalize_components = _finalize_components,
@@ -535,7 +517,6 @@ imv_state_t *imv_attestation_state_create(TNC_ConnectionID connection_id)
.handshake_state = IMV_ATTESTATION_STATE_INIT,
.rec = TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION,
.eval = TNC_IMV_EVALUATION_RESULT_DONT_KNOW,
- .file_meas_requests = linked_list_create(),
.components = linked_list_create(),
.pts = pts_create(FALSE),
);
diff --git a/src/libpts/plugins/imv_attestation/imv_attestation_state.h b/src/libpts/plugins/imv_attestation/imv_attestation_state.h
index ab77d3042..f3edd5fa1 100644
--- a/src/libpts/plugins/imv_attestation/imv_attestation_state.h
+++ b/src/libpts/plugins/imv_attestation/imv_attestation_state.h
@@ -31,17 +31,27 @@
#include <library.h>
typedef struct imv_attestation_state_t imv_attestation_state_t;
+typedef enum imv_attestation_flag_t imv_attestation_flag_t;
typedef enum imv_attestation_handshake_state_t imv_attestation_handshake_state_t;
typedef enum imv_meas_error_t imv_meas_error_t;
/**
+ * IMV Attestation Flags set for completed actions
+ */
+enum imv_attestation_flag_t {
+ IMV_ATTESTATION_FLAG_ATTR_REQ = (1<<0),
+ IMV_ATTESTATION_FLAG_ALGO = (1<<1),
+ IMV_ATTESTATION_FLAG_FILE_MEAS = (1<<2),
+ IMV_ATTESTATION_FLAG_REC = (1<<3)
+};
+
+/**
* IMV Attestation Handshake States (state machine)
*/
enum imv_attestation_handshake_state_t {
IMV_ATTESTATION_STATE_INIT,
IMV_ATTESTATION_STATE_NONCE_REQ,
IMV_ATTESTATION_STATE_TPM_INIT,
- IMV_ATTESTATION_STATE_MEAS,
IMV_ATTESTATION_STATE_COMP_EVID,
IMV_ATTESTATION_STATE_EVID_FINAL,
IMV_ATTESTATION_STATE_END,
@@ -92,34 +102,6 @@ struct imv_attestation_state_t {
pts_t* (*get_pts)(imv_attestation_state_t *this);
/**
- * Add an entry to the list of pending file/directory measurement requests
- *
- * @param file_id primary key into file table
- * @param is_dir TRUE if directory
- * @return unique request ID
- */
- u_int16_t (*add_file_meas_request)(imv_attestation_state_t *this,
- int file_id, bool is_dir);
-
- /**
- * Returns the number of pending file/directory measurement requests
- *
- * @return number of pending requests
- */
- int (*get_file_meas_request_count)(imv_attestation_state_t *this);
-
- /**
- * Check for presence of request_id and if found remove it from the list
- *
- * @param id unique request ID
- * @param file_id primary key into file table
- * @param is_dir return TRUE if request was for a directory
- * @return TRUE if request ID found, FALSE otherwise
- */
- bool (*check_off_file_meas_request)(imv_attestation_state_t *this,
- u_int16_t id, int *file_id, bool *is_dir);
-
- /**
* Create and add an entry to the list of Functional Components
*
* @param name Component Functional Name
diff --git a/src/libpts/plugins/imv_attestation/tables.sql b/src/libpts/plugins/imv_attestation/tables.sql
deleted file mode 100644
index 0c038d365..000000000
--- a/src/libpts/plugins/imv_attestation/tables.sql
+++ /dev/null
@@ -1,146 +0,0 @@
-/* PTS SQLite database */
-
-DROP TABLE IF EXISTS files;
-CREATE TABLE files (
- id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
- type INTEGER NOT NULL,
- path TEXT NOT NULL
-);
-DROP INDEX IF EXISTS files_path;
-CREATE INDEX files_path ON files (
- path
-);
-
-DROP TABLE IF EXISTS products;
-CREATE TABLE products (
- id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
- name TEXT NOT NULL
-);
-DROP INDEX IF EXISTS products_name;
-CREATE INDEX products_name ON products (
- name
-);
-
-DROP TABLE IF EXISTS product_file;
-CREATE TABLE product_file (
- product INTEGER NOT NULL,
- file INTEGER NOT NULL,
- measurement INTEGER DEFAULT 0,
- metadata INTEGER DEFAULT 0,
- PRIMARY KEY (product, file)
-);
-
-DROP TABLE IF EXISTS file_hashes;
-CREATE TABLE file_hashes (
- file INTEGER NOT NULL,
- directory INTEGER DEFAULT 0,
- product INTEGER NOT NULL,
- key INTEGER DEFAULT 0,
- algo INTEGER NOT NULL,
- hash BLOB NOT NULL,
- PRIMARY KEY(file, directory, product, algo)
-);
-
-DROP TABLE IF EXISTS keys;
-CREATE TABLE keys (
- id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
- keyid BLOB NOT NULL,
- owner TEXT NOT NULL
-);
-DROP INDEX IF EXISTS keys_keyid;
-CREATE INDEX keys_keyid ON keys (
- keyid
-);
-DROP INDEX IF EXISTS keys_owner;
-CREATE INDEX keys_owner ON keys (
- owner
-);
-
-DROP TABLE IF EXISTS components;
-CREATE TABLE components (
- id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
- vendor_id INTEGER NOT NULL,
- name INTEGER NOT NULL,
- qualifier INTEGER DEFAULT 0
-);
-
-
-DROP TABLE IF EXISTS key_component;
-CREATE TABLE key_component (
- key INTEGER NOT NULL,
- component INTEGER NOT NULL,
- depth INTEGER DEFAULT 0,
- seq_no INTEGER DEFAULT 0,
- PRIMARY KEY (key, component)
-);
-
-
-DROP TABLE IF EXISTS component_hashes;
-CREATE TABLE component_hashes (
- component INTEGER NOT NULL,
- key INTEGER NOT NULL,
- seq_no INTEGER NOT NULL,
- pcr INTEGER NOT NULL,
- algo INTEGER NOT NULL,
- hash BLOB NOT NULL,
- PRIMARY KEY(component, key, seq_no, algo)
-);
-
-DROP TABLE IF EXISTS packages;
-CREATE TABLE packages (
- id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
- name TEXT NOT NULL
-);
-DROP INDEX IF EXISTS packages_name;
-CREATE INDEX packages_name ON packages (
- name
-);
-
-DROP TABLE IF EXISTS versions;
-CREATE TABLE versions (
- id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
- package INTEGER NOT NULL,
- product INTEGER NOT NULL,
- release TEXT NOT NULL,
- security INTEGER DEFAULT 0,
- time INTEGER DEFAULT 0
-);
-DROP INDEX IF EXISTS versions_release;
-CREATE INDEX versions_release ON versions (
- release
-);
-DROP INDEX IF EXISTS versions_package_product;
-CREATE INDEX versions_package_product ON versions (
- package, product
-);
-
-DROP TABLE IF EXISTS devices;
-CREATE TABLE devices (
- id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
- value BLOB NOT NULL
-);
-DROP INDEX IF EXISTS devices_id;
-CREATE INDEX devices_value ON devices (
- value
-);
-
-DROP TABLE IF EXISTS device_infos;
-CREATE TABLE device_infos (
- id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
- device INTEGER NOT NULL,
- time INTEGER NOT NULL,
- ar_id INTEGER DEFAULT 0,
- product INTEGER DEFAULT 0,
- count INTEGER DEFAULT 0,
- count_update INTEGER DEFAULT 0,
- count_blacklist INTEGER DEFAULT 0,
- flags INTEGER DEFAULT 0
-);
-
-DROP TABLE IF EXISTS identities;
-CREATE TABLE identities (
- id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
- type INTEGER NOT NULL,
- data BLOB NOT NULL,
- UNIQUE (type, data)
-);