shortened type name to pts_pcr_transform_t
[strongswan.git] / src / libimcv / tcg / tcg_pts_attr_req_funct_comp_evid.h
1 /*
2 * Copyright (C) 2011 Sansar Choinyambuu
3 * HSR Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup tcg_pts_attr_req_funct_comp_evid tcg_pts_attr_req_funct_comp_evid
18 * @{ @ingroup tcg_pts_attr_req_funct_comp_evid
19 */
20
21 #ifndef TCG_PTS_ATTR_REQ_FUNCT_COMP_EVID_H_
22 #define TCG_PTS_ATTR_REQ_FUNCT_COMP_EVID_H_
23
24 typedef struct tcg_pts_attr_req_funct_comp_evid_t tcg_pts_attr_req_funct_comp_evid_t;
25 typedef enum pts_attr_req_funct_comp_evid_flag_t pts_attr_req_funct_comp_evid_flag_t;
26 typedef enum pts_attr_req_funct_comp_type_t pts_attr_req_funct_comp_type_t;
27 typedef enum pts_attr_req_funct_comp_name_bin_enum_t pts_attr_req_funct_comp_name_bin_enum_t;
28 typedef struct tcg_pts_qualifier_t tcg_pts_qualifier_t;
29
30 #include "tcg_attr.h"
31 #include "pa_tnc/pa_tnc_attr.h"
32
33 /**
34 * PTS Request Functional Component Evidence Flags
35 */
36 enum pts_attr_req_funct_comp_evid_flag_t {
37 /** Transitive Trust Chain flag */
38 PTS_REQ_FUNC_COMP_FLAG_TTC = (1<<0),
39 /** Verify Component flag */
40 PTS_REQ_FUNC_COMP_FLAG_VER = (1<<1),
41 /** Current Evidence flag */
42 PTS_REQ_FUNC_COMP_FLAG_CURR = (1<<2),
43 /** PCR Information flag */
44 PTS_REQ_FUNC_COMP_FLAG_PCR = (1<<3),
45 };
46
47 /**
48 * PTS Component Functional Type for Qualifier field
49 */
50 enum pts_attr_req_funct_comp_type_t {
51 /** Unknown */
52 PTS_FUNC_COMP_TYPE_UNKNOWN = 0x0,
53 /** Trusted Platform */
54 PTS_FUNC_COMP_TYPE_TRUSTED = 0x1,
55 /** Operating System */
56 PTS_FUNC_COMP_TYPE_OS = 0x2,
57 /** Graphical User Interface */
58 PTS_FUNC_COMP_TYPE_GUI = 0x3,
59 /** Application */
60 PTS_FUNC_COMP_TYPE_APP = 0x4,
61 /** Networking */
62 PTS_FUNC_COMP_TYPE_NET = 0x5,
63 /** Library */
64 PTS_FUNC_COMP_TYPE_LIB = 0x6,
65 /** TNC Defined Component */
66 PTS_FUNC_COMP_TYPE_TNC = 0x7,
67 /** All matching Components */
68 PTS_FUNC_COMP_TYPE_ALL = 0xF,
69 };
70
71 /**
72 * PTS Component Functional Name Binary Enumeration
73 */
74 enum pts_attr_req_funct_comp_name_bin_enum_t {
75 /** Ignore */
76 PTS_FUNC_COMP_NAME_IGNORE = 0x0000,
77 /** CRTM */
78 PTS_FUNC_COMP_NAME_CRTM = 0x0001,
79 /** BIOS */
80 PTS_FUNC_COMP_NAME_BIOS = 0x0002,
81 /** Platform Extensions */
82 PTS_FUNC_COMP_NAME_PLAT_EXT = 0x0003,
83 /** Motherboard firmware */
84 PTS_FUNC_COMP_NAME_BOARD = 0x0004,
85 /** Initial Program Loader */
86 PTS_FUNC_COMP_NAME_INIT_LOADER = 0x0005,
87 /** Option ROMs */
88 PTS_FUNC_COMP_NAME_OPT_ROMS = 0x0006,
89 };
90
91 /**
92 * Qualifier for Functional Component
93 */
94 struct tcg_pts_qualifier_t {
95 bool kernel;
96 bool sub_component;
97 pts_attr_req_funct_comp_type_t type;
98 };
99
100 /**
101 * Class implementing the TCG PTS Request Functional Component Evidence attribute
102 *
103 */
104 struct tcg_pts_attr_req_funct_comp_evid_t {
105
106 /**
107 * Public PA-TNC attribute interface
108 */
109 pa_tnc_attr_t pa_tnc_attribute;
110
111 /**
112 * Get flags for PTS Request Functional Component Evidence
113 *
114 * @return Set of flags
115 */
116 pts_attr_req_funct_comp_evid_flag_t (*get_flags)(tcg_pts_attr_req_funct_comp_evid_t *this);
117
118 /**
119 * Set flags for PTS Request Functional Component Evidence
120 *
121 * @param flags Set of flags
122 */
123 void (*set_flags)(tcg_pts_attr_req_funct_comp_evid_t *this,
124 pts_attr_req_funct_comp_evid_flag_t flags);
125
126 /**
127 * Get Sub-component Depth
128 *
129 * @return Sub-component Depth
130 */
131 u_int32_t (*get_sub_component_depth)(tcg_pts_attr_req_funct_comp_evid_t *this);
132
133 /**
134 * Get Component Functional Name Vendor ID
135 *
136 * @return Component Functional Name Vendor ID
137 */
138 u_int32_t (*get_comp_funct_name_vendor_id)(tcg_pts_attr_req_funct_comp_evid_t *this);
139
140 /**
141 * Get Family
142 *
143 * @return Functional Name Family
144 */
145 u_int8_t (*get_family)(tcg_pts_attr_req_funct_comp_evid_t *this);
146
147 /**
148 * Get Qualifier
149 *
150 * @return Functional Name Category Qualifier
151 */
152 tcg_pts_qualifier_t (*get_qualifier)(tcg_pts_attr_req_funct_comp_evid_t *this);
153
154 /**
155 * Set qualifier for Component Functional Name
156 *
157 * @param qualifier Functional Name Category Qualifier
158 */
159 void (*set_qualifier)(tcg_pts_attr_req_funct_comp_evid_t *this,
160 tcg_pts_qualifier_t qualifier);
161
162 /**
163 * Get Component Functional Name
164 *
165 * @return Component Functional Name
166 */
167 pts_attr_req_funct_comp_name_bin_enum_t (*get_comp_funct_name)(tcg_pts_attr_req_funct_comp_evid_t *this);
168
169
170 /**
171 * Set Component Functional Name
172 *
173 * @param name Component Functional Name
174 */
175 void (*set_comp_funct_name)(tcg_pts_attr_req_funct_comp_evid_t *this,
176 pts_attr_req_funct_comp_name_bin_enum_t name);
177
178
179 };
180
181 /**
182 * Creates an tcg_pts_attr_req_funct_comp_evid_t object
183 *
184 * @param flags Set of flags
185 * @param depth Sub-component Depth
186 * @param vendor_id Component Functional Name Vendor ID
187 * @param qualifier Functional Name Category Qualifier
188 * @param name Component Functional Name
189 */
190 pa_tnc_attr_t* tcg_pts_attr_req_funct_comp_evid_create(pts_attr_req_funct_comp_evid_flag_t flags,
191 u_int32_t depth,
192 u_int32_t vendor_id,
193 tcg_pts_qualifier_t qualifier,
194 pts_attr_req_funct_comp_name_bin_enum_t name);
195
196 /**
197 * Creates an tcg_pts_attr_req_funct_comp_evid_t object from received data
198 *
199 * @param value unparsed attribute value
200 */
201 pa_tnc_attr_t* tcg_pts_attr_req_funct_comp_evid_create_from_data(chunk_t value);
202
203 #endif /** TCG_PTS_ATTR_REQ_FUNCT_COMP_EVID_H_ @}*/