aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libcharon/plugins/tnccs_11/tnccs_11.c33
-rw-r--r--src/libcharon/plugins/tnccs_20/messages/pb_pa_msg.c12
-rw-r--r--src/libcharon/plugins/tnccs_20/messages/pb_pa_msg.h21
-rw-r--r--src/libcharon/plugins/tnccs_20/tnccs_20.c15
-rw-r--r--src/libimcv/plugins/imc_test/imc_test.c3
-rw-r--r--src/libimcv/plugins/imv_test/imv_test.c3
-rw-r--r--src/libtncif/Makefile.am3
-rw-r--r--src/libtncif/tncif_pa_subtypes.c73
-rw-r--r--src/libtncif/tncif_pa_subtypes.h94
9 files changed, 215 insertions, 42 deletions
diff --git a/src/libcharon/plugins/tnccs_11/tnccs_11.c b/src/libcharon/plugins/tnccs_11/tnccs_11.c
index 97a8bb483..c16078f23 100644
--- a/src/libcharon/plugins/tnccs_11/tnccs_11.c
+++ b/src/libcharon/plugins/tnccs_11/tnccs_11.c
@@ -23,6 +23,7 @@
#include "messages/tnccs_recommendation_msg.h"
#include <tncif_names.h>
+#include <tncif_pa_subtypes.h>
#include <daemon.h>
#include <debug.h>
@@ -99,6 +100,8 @@ METHOD(tnccs_t, send_msg, TNC_Result,
TNC_MessageType msg_type)
{
tnccs_msg_t *tnccs_msg;
+ u_int32_t vendor_id, subtype;
+ enum_name_t *pa_subtype_names;
if (!this->send_msg)
{
@@ -107,6 +110,19 @@ METHOD(tnccs_t, send_msg, TNC_Result,
this->is_server ? imv_id : imc_id);
return TNC_RESULT_ILLEGAL_OPERATION;
}
+ vendor_id = msg_type >> 8;
+ subtype = msg_type && 0xff;
+ pa_subtype_names = get_pa_subtype_names(vendor_id);
+ if (pa_subtype_names)
+ {
+ DBG2(DBG_TNC, "creating IMC-IMV message type '%N/%N' 0x%06x/0x%02x",
+ pen_names, vendor_id, pa_subtype_names, subtype, vendor_id, subtype);
+ }
+ else
+ {
+ DBG2(DBG_TNC, "creating PB-PA message type '%N' 0x%06x/0x%02x",
+ pen_names, vendor_id, vendor_id, subtype);
+ }
tnccs_msg = imc_imv_msg_create(msg_type, chunk_create(msg, msg_len));
/* adding an IMC-IMV Message to TNCCS batch */
@@ -132,12 +148,27 @@ static void handle_message(private_tnccs_11_t *this, tnccs_msg_t *msg)
imc_imv_msg_t *imc_imv_msg;
TNC_MessageType msg_type;
chunk_t msg_body;
+ u_int32_t vendor_id, subtype;
+ enum_name_t *pa_subtype_names;
imc_imv_msg = (imc_imv_msg_t*)msg;
msg_type = imc_imv_msg->get_msg_type(imc_imv_msg);
msg_body = imc_imv_msg->get_msg_body(imc_imv_msg);
+ vendor_id = msg_type >> 8;
+ subtype = msg_type && 0xff;
- DBG2(DBG_TNC, "handling IMC_IMV message type 0x%08x", msg_type);
+ pa_subtype_names = get_pa_subtype_names(vendor_id);
+ if (pa_subtype_names)
+ {
+ DBG2(DBG_TNC, "handling IMC-IMV message type '%N/%N' 0x%06x/0x%02x",
+ pen_names, vendor_id, pa_subtype_names, subtype,
+ vendor_id, subtype);
+ }
+ else
+ {
+ DBG2(DBG_TNC, "handling IMC-IMV message type '%N' 0x%06x/0x%02x",
+ pen_names, vendor_id, vendor_id, subtype);
+ }
this->send_msg = TRUE;
if (this->is_server)
diff --git a/src/libcharon/plugins/tnccs_20/messages/pb_pa_msg.c b/src/libcharon/plugins/tnccs_20/messages/pb_pa_msg.c
index 9126a0f91..8a5a031e1 100644
--- a/src/libcharon/plugins/tnccs_20/messages/pb_pa_msg.c
+++ b/src/libcharon/plugins/tnccs_20/messages/pb_pa_msg.c
@@ -23,18 +23,6 @@
#include <pen/pen.h>
#include <debug.h>
-ENUM(pa_tnc_subtype_names, PA_SUBTYPE_TESTING, PA_SUBTYPE_NEA_CLIENT,
- "Testing",
- "Operating System",
- "Anti-Virus",
- "Anti-Spyware",
- "Anti-Malware",
- "Firewall",
- "IDPS",
- "VPN",
- "NEA Client"
-);
-
typedef struct private_pb_pa_msg_t private_pb_pa_msg_t;
/**
diff --git a/src/libcharon/plugins/tnccs_20/messages/pb_pa_msg.h b/src/libcharon/plugins/tnccs_20/messages/pb_pa_msg.h
index 366d790f6..eb087e9e7 100644
--- a/src/libcharon/plugins/tnccs_20/messages/pb_pa_msg.h
+++ b/src/libcharon/plugins/tnccs_20/messages/pb_pa_msg.h
@@ -21,32 +21,11 @@
#ifndef PB_PA_MSG_H_
#define PB_PA_MSG_H_
-typedef enum pa_tnc_subtype_t pa_tnc_subtype_t;
typedef struct pb_pa_msg_t pb_pa_msg_t;
#include "pb_tnc_msg.h"
/**
- * PA-TNC Subtypes as defined in section 3.5 of RFC 5792
- */
- enum pa_tnc_subtype_t {
- PA_SUBTYPE_TESTING = 0,
- PA_SUBTYPE_OPERATING_SYSTEM = 1,
- PA_SUBTYPE_ANTI_VIRUS = 2,
- PA_SUBTYPE_ANTI_SPYWARE = 3,
- PA_SUBTYPE_ANTI_MALWARE = 4,
- PA_SUBTYPE_FIREWALL = 5,
- PA_SUBTYPE_IDPS = 6,
- PA_SUBTYPE_VPN = 7,
- PA_SUBTYPE_NEA_CLIENT = 8
-};
-
-/**
- * enum name for pa_tnc_subtype_t.
- */
-extern enum_name_t *pa_tnc_subtype_names;
-
-/**
* Class representing the PB-PA message type.
*/
struct pb_pa_msg_t {
diff --git a/src/libcharon/plugins/tnccs_20/tnccs_20.c b/src/libcharon/plugins/tnccs_20/tnccs_20.c
index e74485890..db1a4ba2b 100644
--- a/src/libcharon/plugins/tnccs_20/tnccs_20.c
+++ b/src/libcharon/plugins/tnccs_20/tnccs_20.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2010 Sansar Choinyanbuu
- * Copyright (C) 2010 Andreas Steffen
+ * Copyright (C) 2010-2011 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
#include "state_machine/pb_tnc_state_machine.h"
#include <tncif_names.h>
+#include <tncif_pa_subtypes.h>
#include <debug.h>
#include <daemon.h>
@@ -102,6 +103,7 @@ METHOD(tnccs_t, send_msg, TNC_Result,
TNC_VendorID msg_vendor_id;
pb_tnc_msg_t *pb_tnc_msg;
pb_tnc_batch_type_t batch_type;
+ enum_name_t *pa_subtype_names;
if (!this->send_msg)
{
@@ -117,10 +119,11 @@ METHOD(tnccs_t, send_msg, TNC_Result,
pb_tnc_msg = pb_pa_msg_create(msg_vendor_id, msg_sub_type, imc_id, imv_id,
chunk_create(msg, msg_len));
- if (msg_vendor_id == PEN_IETF)
+ pa_subtype_names = get_pa_subtype_names(msg_vendor_id);
+ if (pa_subtype_names)
{
DBG2(DBG_TNC, "creating PB-PA message type '%N/%N' 0x%06x/0x%02x",
- pen_names, msg_vendor_id, pa_tnc_subtype_names, msg_sub_type,
+ pen_names, msg_vendor_id, pa_subtype_names, msg_sub_type,
msg_vendor_id, msg_sub_type);
}
else
@@ -164,16 +167,18 @@ static void handle_message(private_tnccs_20_t *this, pb_tnc_msg_t *msg)
TNC_MessageType msg_type;
u_int32_t vendor_id, subtype;
chunk_t msg_body;
+ enum_name_t *pa_subtype_names;
pa_msg = (pb_pa_msg_t*)msg;
vendor_id = pa_msg->get_vendor_id(pa_msg, &subtype);
msg_type = (vendor_id << 8) | (subtype & 0xff);
msg_body = pa_msg->get_body(pa_msg);
- if (vendor_id == PEN_IETF)
+ pa_subtype_names = get_pa_subtype_names(vendor_id);
+ if (pa_subtype_names)
{
DBG2(DBG_TNC, "handling PB-PA message type '%N/%N' 0x%06x/0x%02x",
- pen_names, vendor_id, pa_tnc_subtype_names, subtype,
+ pen_names, vendor_id, pa_subtype_names, subtype,
vendor_id, subtype);
}
else
diff --git a/src/libimcv/plugins/imc_test/imc_test.c b/src/libimcv/plugins/imc_test/imc_test.c
index 7a2bb5e36..8cbfa900b 100644
--- a/src/libimcv/plugins/imc_test/imc_test.c
+++ b/src/libimcv/plugins/imc_test/imc_test.c
@@ -21,6 +21,7 @@
#include <ita/ita_attr_command.h>
#include <tncif_names.h>
+#include <tncif_pa_subtypes.h>
#include <pen/pen.h>
#include <debug.h>
@@ -30,7 +31,7 @@
static const char imc_name[] = "Test";
#define IMC_VENDOR_ID PEN_ITA
-#define IMC_SUBTYPE 0x01
+#define IMC_SUBTYPE PA_SUBTYPE_ITA_TEST
static imc_agent_t *imc_test;
diff --git a/src/libimcv/plugins/imv_test/imv_test.c b/src/libimcv/plugins/imv_test/imv_test.c
index 6ef6ab661..22163aefd 100644
--- a/src/libimcv/plugins/imv_test/imv_test.c
+++ b/src/libimcv/plugins/imv_test/imv_test.c
@@ -21,6 +21,7 @@
#include <ita/ita_attr_command.h>
#include <tncif_names.h>
+#include <tncif_pa_subtypes.h>
#include <pen/pen.h>
#include <debug.h>
@@ -30,7 +31,7 @@
static const char imv_name[] = "Test";
#define IMV_VENDOR_ID PEN_ITA
-#define IMV_SUBTYPE 0x01
+#define IMV_SUBTYPE PA_SUBTYPE_ITA_TEST
static imv_agent_t *imv_test;
diff --git a/src/libtncif/Makefile.am b/src/libtncif/Makefile.am
index 706556c2d..c18c93c71 100644
--- a/src/libtncif/Makefile.am
+++ b/src/libtncif/Makefile.am
@@ -2,4 +2,5 @@ INCLUDES = -I$(top_srcdir)/src/libstrongswan
noinst_LTLIBRARIES = libtncif.la
-libtncif_la_SOURCES = tncif.h tncifimc.h tncifimv.h tncif_names.h tncif_names.c
+libtncif_la_SOURCES = tncif.h tncifimc.h tncifimv.h tncif_names.h tncif_names.c \
+ tncif_pa_subtypes.h tncif_pa_subtypes.c
diff --git a/src/libtncif/tncif_pa_subtypes.c b/src/libtncif/tncif_pa_subtypes.c
new file mode 100644
index 000000000..adf501eed
--- /dev/null
+++ b/src/libtncif/tncif_pa_subtypes.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2010-2011 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 "tncif_pa_subtypes.h"
+
+ENUM(ietf_pa_subtype_names, PA_SUBTYPE_IETF_TESTING, PA_SUBTYPE_IETF_NEA_CLIENT,
+ "Testing",
+ "Operating System",
+ "Anti-Virus",
+ "Anti-Spyware",
+ "Anti-Malware",
+ "Firewall",
+ "IDPS",
+ "VPN",
+ "NEA Client"
+);
+
+ENUM(pa_subtype_tcg_names, PA_SUBTYPE_TCG_PTS, PA_SUBTYPE_TCG_PTS,
+ "PTS"
+);
+
+ENUM_BEGIN(pa_subtype_fhh_names, PA_SUBTYPE_FHH_HOSTSCANNER, PA_SUBTYPE_FHH_DUMMY,
+ "HostScanner",
+ "Dummy"
+);
+ENUM_NEXT(pa_subtype_fhh_names, PA_SUBTYPE_FHH_PLATID, PA_SUBTYPE_FHH_ATTESTATION,
+ PA_SUBTYPE_FHH_DUMMY,
+ "PlatformID",
+ "Attestation"
+);
+ENUM_NEXT(pa_subtype_fhh_names, PA_SUBTYPE_FHH_CLAMAV, PA_SUBTYPE_FHH_CLAMAV,
+ PA_SUBTYPE_FHH_ATTESTATION,
+ "ClamAV"
+);
+ENUM_END(pa_subtype_fhh_names, PA_SUBTYPE_FHH_CLAMAV);
+
+ENUM(pa_subtype_ita_names, PA_SUBTYPE_ITA_TEST, PA_SUBTYPE_ITA_TEST,
+ "Test"
+);
+
+/**
+ * See header
+ */
+enum_name_t* get_pa_subtype_names(pen_t pen)
+{
+ switch (pen)
+ {
+ case PEN_IETF:
+ return pa_subtype_ita_names;
+ case PEN_TCG:
+ return pa_subtype_tcg_names;
+ case PEN_FHH:
+ return pa_subtype_fhh_names;
+ case PEN_ITA:
+ return pa_subtype_ita_names;
+ default:
+ break;
+ }
+ return NULL;
+}
diff --git a/src/libtncif/tncif_pa_subtypes.h b/src/libtncif/tncif_pa_subtypes.h
new file mode 100644
index 000000000..27546430b
--- /dev/null
+++ b/src/libtncif/tncif_pa_subtypes.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+#ifndef TNCIF_PA_SUBTYPES_H_
+#define TNCIF_PA_SUBTYPES_H_
+
+typedef enum pa_subtype_ietf_t pa_subtype_ietf_t;
+typedef enum pa_subtype_tcg_t pa_subtype_tcg_t;
+typedef enum pa_subtype_fhh_t pa_subtype_fhh_t;
+typedef enum pa_subtype_ita_t pa_subtype_ita_t;
+
+#include <library.h>
+#include <pen/pen.h>
+
+/**
+ * PA-TNC IETF Standard Subtypes as defined in section 3.5 of RFC 5792
+ */
+ enum pa_subtype_ietf_t {
+ PA_SUBTYPE_IETF_TESTING = 0,
+ PA_SUBTYPE_IETF_OPERATING_SYSTEM = 1,
+ PA_SUBTYPE_IETF_ANTI_VIRUS = 2,
+ PA_SUBTYPE_IETF_ANTI_SPYWARE = 3,
+ PA_SUBTYPE_IETF_ANTI_MALWARE = 4,
+ PA_SUBTYPE_IETF_FIREWALL = 5,
+ PA_SUBTYPE_IETF_IDPS = 6,
+ PA_SUBTYPE_IETF_VPN = 7,
+ PA_SUBTYPE_IETF_NEA_CLIENT = 8
+};
+
+/**
+ * enum name for pa_subtype_ietf_t.
+ */
+extern enum_name_t *pa_subtype_ietf_names;
+
+/**
+ * PA-TNC TCG Subtypes
+ */
+ enum pa_subtype_tcg_t {
+ PA_SUBTYPE_TCG_PTS = 1
+};
+
+/**
+ * enum name for pa_subtype_tcg_t.
+ */
+extern enum_name_t *pa_subtype_tcg_names;
+
+/**
+ * PA-TNC FHH Subtypes
+ */
+ enum pa_subtype_fhh_t {
+ PA_SUBTYPE_FHH_HOSTSCANNER = 0x30,
+ PA_SUBTYPE_FHH_DUMMY = 0x31,
+ PA_SUBTYPE_FHH_PLATID = 0x33,
+ PA_SUBTYPE_FHH_ATTESTATION = 0x34,
+ PA_SUBTYPE_FHH_CLAMAV = 0x41
+};
+
+/**
+ * enum name for pa_subtype_fhh_t.
+ */
+extern enum_name_t *pa_subtype_fhh_names;
+
+/**
+ * PA-TNC ITA-HSR Subtypes
+ */
+ enum pa_subtype_ita_t {
+ PA_SUBTYPE_ITA_TEST = 1
+};
+
+/**
+ * enum name for pa_subtype_ita_t.
+ */
+extern enum_name_t *pa_subtype_ita_names;
+
+/**
+ * Return the pa_subtype_names for a given PEN
+ *
+ * @param pen Private Enterprise Number (PEN)
+ * @return pa_subtype_names if found, NULL else
+ */
+extern enum_name_t* get_pa_subtype_names(pen_t pen);
+
+#endif /** TNCIF_PA_SUBTYPES_H_ @}*/