Defined PWG HCD IF-M attributes
authorAndreas Steffen <andreas.steffen@strongswan.org>
Sat, 16 May 2015 20:44:40 +0000 (22:44 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 18 Aug 2015 19:25:38 +0000 (21:25 +0200)
src/libimcv/Makefile.am
src/libimcv/imcv.c
src/libimcv/pwg/pwg_attr.c [new file with mode: 0644]
src/libimcv/pwg/pwg_attr.h [new file with mode: 0644]
src/libstrongswan/pen/pen.c
src/libstrongswan/pen/pen.h

index a613827..6dd5663 100644 (file)
@@ -84,6 +84,7 @@ libimcv_la_SOURCES = \
        pts/components/ita/ita_comp_tboot.h pts/components/ita/ita_comp_tboot.c \
        pts/components/ita/ita_comp_tgrub.h pts/components/ita/ita_comp_tgrub.c \
        pts/components/tcg/tcg_comp_func_name.h pts/components/tcg/tcg_comp_func_name.c \
+       pwg/pwg_attr.h pwg/pwg_attr.c \
        seg/seg_contract.h seg/seg_contract.c \
        seg/seg_contract_manager.h seg/seg_contract_manager.c \
        seg/seg_env.h seg/seg_env.c \
index bd4156c..ec6ea42 100644 (file)
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2011 Andreas Steffen, HSR Hochschule fuer Technik Rapperswil
+ * Copyright (C) 2011-2015 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
@@ -15,6 +16,7 @@
 #include "imcv.h"
 #include "ietf/ietf_attr.h"
 #include "ita/ita_attr.h"
+#include "pwg/pwg_attr.h"
 #include "tcg/tcg_attr.h"
 #include "pts/components/pts_component.h"
 #include "pts/components/pts_component_manager.h"
@@ -179,6 +181,8 @@ bool libimcv_init(bool is_imv)
                                                        ietf_attr_create_from_data, ietf_attr_names);
                imcv_pa_tnc_attributes->add_vendor(imcv_pa_tnc_attributes, PEN_ITA,
                                                        ita_attr_create_from_data, ita_attr_names);
+               imcv_pa_tnc_attributes->add_vendor(imcv_pa_tnc_attributes, PEN_PWG,
+                                                       pwg_attr_create_from_data, pwg_attr_names);
                imcv_pa_tnc_attributes->add_vendor(imcv_pa_tnc_attributes, PEN_TCG,
                                                        tcg_attr_create_from_data, tcg_attr_names);
 
@@ -235,6 +239,7 @@ void libimcv_deinit(void)
 
                imcv_pa_tnc_attributes->remove_vendor(imcv_pa_tnc_attributes, PEN_IETF);
                imcv_pa_tnc_attributes->remove_vendor(imcv_pa_tnc_attributes, PEN_ITA);
+               imcv_pa_tnc_attributes->remove_vendor(imcv_pa_tnc_attributes, PEN_PWG);
                imcv_pa_tnc_attributes->remove_vendor(imcv_pa_tnc_attributes, PEN_TCG);
                DESTROY_IF(imcv_pa_tnc_attributes);
                imcv_pa_tnc_attributes = NULL;
diff --git a/src/libimcv/pwg/pwg_attr.c b/src/libimcv/pwg/pwg_attr.c
new file mode 100644 (file)
index 0000000..5fd887b
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2015 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 "pwg_attr.h"
+
+ENUM_BEGIN(pwg_attr_names,     PWG_HCD_ATTRS_NATURAL_LANG,
+                                                       PWG_HCD_VENDOR_SMI_CODE,
+       "HCD AttributesNaturalLanguage",
+       "HCD MachineTypeModel",
+       "HCD VendorName",
+       "HCD VendorSMICode");
+ENUM_NEXT(pwg_attr_names,      PWG_HCD_DEFAULT_PWD_ENABLED,
+                                                       PWG_HCD_FORWARDING_ENABLED,
+                                                       PWG_HCD_VENDOR_SMI_CODE,
+       "HCD DefaultPasswordEnabled",
+       "HCD FirewallSetting",
+       "HCD ForwardingEnabled");
+ENUM_NEXT(pwg_attr_names,      PWG_HCD_PSTN_FAX_ENABLED,
+                                                       PWG_HCD_PSTN_FAX_ENABLED,
+                                                       PWG_HCD_FORWARDING_ENABLED,
+       "HCD PSTNFaxEnabled");
+ENUM_NEXT(pwg_attr_names,      PWG_HCD_TIME_SOURCE,
+                                                       PWG_HCD_TIME_SOURCE,
+                                                       PWG_HCD_PSTN_FAX_ENABLED,
+       "HCD TimeSource");
+ENUM_NEXT(pwg_attr_names,      PWG_HCD_FIRMWARE_NAME,
+                                                       PWG_HCD_FIRMWARE_VERSION,
+                                                       PWG_HCD_TIME_SOURCE,
+       "HCD FirmwareName",
+       "HCD FirmwarePatches",
+       "HCD FirmwareStringVersion",
+       "HCD FirmwareVersion");
+ENUM_NEXT(pwg_attr_names,      PWG_HCD_RESIDENT_APP_NAME,
+                                                       PWG_HCD_RESIDENT_APP_VERSION,
+                                                       PWG_HCD_FIRMWARE_VERSION,
+       "HCD ResidentApplicationName",
+       "HCD ResidentApplicationPatches",
+       "HCD ResidentApplicationStringVersion",
+       "HCD ResidentApplicationVersion");
+ENUM_NEXT(pwg_attr_names,      PWG_HCD_USER_APP_NAME,
+                                                       PWG_HCD_USER_APP_PERSIST_ENABLED,
+                                                       PWG_HCD_RESIDENT_APP_VERSION,
+       "HCD UserApplicationName",
+       "HCD UserApplicationPatches",
+       "HCD UserApplicationStringVersion",
+       "HCD UserApplicationVersion",
+       "HCD UserApplicationEnabled",
+       "HCD UserApplicationPersistenceEnabled");
+ENUM_NEXT(pwg_attr_names,      PWG_HCD_CERTIFICATION_STATE,
+                                                       PWG_HCD_CONFIGURATION_STATE,
+                                                       PWG_HCD_USER_APP_PERSIST_ENABLED,
+       "HCD CertificationState",
+       "HCD ConfigurationState");
+ENUM_END(pwg_attr_names,       PWG_HCD_CONFIGURATION_STATE);
+
+/**
+ * See header
+ */
+pa_tnc_attr_t* pwg_attr_create_from_data(u_int32_t type, size_t length, chunk_t value)
+{
+       switch (type)
+       {
+               case PWG_HCD_ATTRS_NATURAL_LANG:
+               case PWG_HCD_MACHINE_TYPE_MODEL:
+               case PWG_HCD_VENDOR_NAME:
+               case PWG_HCD_VENDOR_SMI_CODE:
+               case PWG_HCD_DEFAULT_PWD_ENABLED:
+               case PWG_HCD_FIREWALL_SETTING:
+               case PWG_HCD_FORWARDING_ENABLED:
+       case PWG_HCD_PSTN_FAX_ENABLED:
+               case PWG_HCD_TIME_SOURCE:
+       case PWG_HCD_FIRMWARE_NAME:
+       case PWG_HCD_FIRMWARE_PATCHES:
+               case PWG_HCD_FIRMWARE_STRING_VERSION:
+               case PWG_HCD_FIRMWARE_VERSION:
+               case PWG_HCD_RESIDENT_APP_NAME:
+               case PWG_HCD_RESIDENT_APP_PATCHES:
+               case PWG_HCD_RESIDENT_APP_STRING_VERSION:
+               case PWG_HCD_RESIDENT_APP_VERSION:
+               case PWG_HCD_USER_APP_NAME:
+               case PWG_HCD_USER_APP_PATCHES:
+               case PWG_HCD_USER_APP_STRING_VERSION:
+               case PWG_HCD_USER_APP_VERSION:
+               case PWG_HCD_USER_APP_ENABLE:
+               case PWG_HCD_USER_APP_PERSIST_ENABLED:
+               case PWG_HCD_CERTIFICATION_STATE:
+               case PWG_HCD_CONFIGURATION_STATE:
+               default:
+                       return NULL;
+       }
+}
diff --git a/src/libimcv/pwg/pwg_attr.h b/src/libimcv/pwg/pwg_attr.h
new file mode 100644 (file)
index 0000000..01db42c
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2015 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 pwg_attr pwg_attr
+ * @{ @ingroup libimcv
+ */
+
+#ifndef PWG_ATTR_H_
+#define PWG_ATTR_H_
+
+#include <pa_tnc/pa_tnc_attr.h>
+#include <library.h>
+
+typedef enum pwg_attr_t pwg_attr_t;
+
+/**
+ * PWG HCD IF-M Attributes (Hardcopy Device Health Assessment TNC Binding)
+ */
+enum pwg_attr_t {
+       PWG_HCD_ATTRS_NATURAL_LANG =          0x00000001, /*   1 */
+       PWG_HCD_MACHINE_TYPE_MODEL =          0x00000002, /*   2 */
+       PWG_HCD_VENDOR_NAME =                 0x00000003, /*   3 */
+       PWG_HCD_VENDOR_SMI_CODE =             0x00000004, /*   4 */
+       PWG_HCD_DEFAULT_PWD_ENABLED =         0x00000014, /*  20 */
+       PWG_HCD_FIREWALL_SETTING =            0x00000015, /*  21 */
+       PWG_HCD_FORWARDING_ENABLED =          0x00000016, /*  22 */
+       PWG_HCD_PSTN_FAX_ENABLED =            0x00000028, /*  40 */
+       PWG_HCD_TIME_SOURCE =                 0x00000032, /*  50 ??? */
+       PWG_HCD_FIRMWARE_NAME =               0x0000003C, /*  60 */
+       PWG_HCD_FIRMWARE_PATCHES =            0x0000003D, /*  61 */
+       PWG_HCD_FIRMWARE_STRING_VERSION =     0x0000003E, /*  62 */
+       PWG_HCD_FIRMWARE_VERSION =            0x0000003F, /*  63 */
+       PWG_HCD_RESIDENT_APP_NAME =           0x00000050, /*  80 */
+       PWG_HCD_RESIDENT_APP_PATCHES =        0x00000051, /*  81 */
+       PWG_HCD_RESIDENT_APP_STRING_VERSION = 0x00000052, /*  82 */
+       PWG_HCD_RESIDENT_APP_VERSION =        0x00000053, /*  83 */
+       PWG_HCD_USER_APP_NAME =               0x00000064, /* 100 */
+       PWG_HCD_USER_APP_PATCHES =            0x00000065, /* 101 */
+       PWG_HCD_USER_APP_STRING_VERSION =     0x00000066, /* 102 */
+       PWG_HCD_USER_APP_VERSION =            0x00000067, /* 103 */
+       PWG_HCD_USER_APP_ENABLED =            0x00000068, /* 104 */
+       PWG_HCD_USER_APP_PERSIST_ENABLED =    0x00000069, /* 105 */
+       PWG_HCD_CERTIFICATION_STATE =         0x000000C8, /* 200 */
+       PWG_HCD_CONFIGURATION_STATE =         0x000000C9, /* 201 */
+};
+
+/**
+ * enum name for pwg_attr_t.
+ */
+extern enum_name_t *pwg_attr_names;
+
+/**
+ * Create a TCG PA-TNC attribute from data
+ *
+ * @param type                         attribute type
+ * @param length                       attribute length
+ * @param value                                attribute value or segment
+ */
+pa_tnc_attr_t* pwg_attr_create_from_data(u_int32_t type, size_t length,
+                                                                                chunk_t value);
+
+#endif /** PWG_ATTR_H_ @}*/
index 474a7a8..9fe4754 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Andreas Steffen
+ * Copyright (C) 2011-2015 Andreas Steffen
  * HSR Hochschule fuer Technik Rapperswil
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -23,7 +23,9 @@ ENUM_NEXT(pen_names, PEN_MICROSOFT, PEN_MICROSOFT, PEN_IBM,
        "Microsoft");
 ENUM_NEXT(pen_names, PEN_REDHAT, PEN_REDHAT, PEN_MICROSOFT,
        "Redhat");
-ENUM_NEXT(pen_names, PEN_ALTIGA, PEN_ALTIGA, PEN_REDHAT,
+ENUM_NEXT(pen_names, PEN_PWG, PEN_PWG, PEN_REDHAT,
+       "PWG");
+ENUM_NEXT(pen_names, PEN_ALTIGA, PEN_ALTIGA, PEN_PWG,
        "Altiga");
 ENUM_NEXT(pen_names, PEN_OSC, PEN_OSC, PEN_ALTIGA,
        "OSC");
index 1760a05..2c55923 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011-2012 Andreas Steffen
+ * Copyright (C) 2011-2015 Andreas Steffen
  * HSR Hochschule fuer Technik Rapperswil
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -39,6 +39,7 @@ enum pen_t {
        PEN_IBM =                       0x000002,       /*        2 */
        PEN_MICROSOFT =         0x000137,       /*      311 */
        PEN_REDHAT =            0x000908,       /*     2312 */
+       PEN_PWG =                       0x000A8B,       /*     2699 */
        PEN_ALTIGA =            0x000c04,       /*     3076 */
        PEN_OSC =                       0x002358,       /*     9048 */
        PEN_DEBIAN =            0x002572,       /*     9586 */