created PTS Functional Component Name header file
[strongswan.git] / src / libimcv / tcg / tcg_pts_attr_simple_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_simple_comp_evid tcg_pts_attr_simple_comp_evid
18 * @{ @ingroup tcg_pts_attr_simple_comp_evid
19 */
20
21 #ifndef TCG_PTS_ATTR_SIMPLE_COMP_EVID_H_
22 #define TCG_PTS_ATTR_SIMPLE_COMP_EVID_H_
23
24 typedef struct tcg_pts_attr_simple_comp_evid_t tcg_pts_attr_simple_comp_evid_t;
25 typedef enum pts_attr_simple_comp_evid_flag_t pts_attr_simple_comp_evid_flag_t;
26 typedef enum pts_pcr_transform_t pts_pcr_transform_t;
27
28 #include "tcg_attr.h"
29 #include "tcg_pts_meas_algo.h"
30 #include "tcg_pts_funct_comp_name.h"
31 #include "pa_tnc/pa_tnc_attr.h"
32
33 /**
34 * PTS Simple Component Evidence Flags
35 */
36 enum pts_attr_simple_comp_evid_flag_t {
37 /** PCR information fields inlcuded */
38 PTS_SIMPLE_COMP_EVID_FLAG_PCR = 0,
39 /** No Validation was attempted */
40 PTS_SIMPLE_COMP_EVID_FLAG_NO_VALID = 1,
41 /** Attempted validation, unable to verify */
42 PTS_SIMPLE_COMP_EVID_FLAG_NO_VER = 2,
43 /** Attempted validation, verification failed */
44 PTS_SIMPLE_COMP_EVID_FLAG_VER_FAIL = 3,
45 /** Attempted validation, verification passed */
46 PTS_SIMPLE_COMP_EVID_FLAG_VER_PASS = 4,
47 };
48
49 /**
50 * PTS PCR Transformations
51 */
52 enum pts_pcr_transform_t {
53 /** No Transformation */
54 PTS_PCR_TRANSFORM_NO = 0,
55 /** Hash Value matched PCR size */
56 PTS_PCR_TRANSFORM_MATCH = 1,
57 /** Hash value shorter than PCR size */
58 PTS_PCR_TRANSFORM_SHORT = 2,
59 /** Hash value longer than PCR size */
60 PTS_PCR_TRANSFORM_LONG = 3,
61 };
62
63 /**
64 * Class implementing the TCG PTS Simple Component Evidence attribute
65 *
66 */
67 struct tcg_pts_attr_simple_comp_evid_t {
68
69 /**
70 * Public PA-TNC attribute interface
71 */
72 pa_tnc_attr_t pa_tnc_attribute;
73
74 /**
75 * Get flags for PTS Simple Component Evidence
76 *
77 * @return Set of flags
78 */
79 pts_attr_simple_comp_evid_flag_t (*get_flags)(tcg_pts_attr_simple_comp_evid_t *this);
80
81 /**
82 * Set flags for PTS Simple Component Evidence
83 *
84 * @param flags Set of flags
85 */
86 void (*set_flags)(tcg_pts_attr_simple_comp_evid_t *this,
87 pts_attr_simple_comp_evid_flag_t flags);
88
89 /**
90 * Get Sub-component Depth
91 *
92 * @return Sub-component Depth
93 */
94 u_int32_t (*get_sub_component_depth)(tcg_pts_attr_simple_comp_evid_t *this);
95
96 /**
97 * Get Specific Component Functional Name Vendor ID
98 *
99 * @return Component Functional Name Vendor ID
100 */
101 u_int32_t (*get_spec_comp_funct_name_vendor_id)(tcg_pts_attr_simple_comp_evid_t *this);
102
103 /**
104 * Get Family
105 *
106 * @return Functional Name Family
107 */
108 u_int8_t (*get_family)(tcg_pts_attr_simple_comp_evid_t *this);
109
110 /**
111 * Get Qualifier
112 *
113 * @return Functional Name Category Qualifier
114 */
115 pts_qualifier_t (*get_qualifier)(tcg_pts_attr_simple_comp_evid_t *this);
116
117 /**
118 * Set qualifier for Component Functional Name
119 *
120 * @param qualifier Functional Name Category Qualifier
121 */
122 void (*set_qualifier)(tcg_pts_attr_simple_comp_evid_t *this,
123 pts_qualifier_t qualifier);
124
125 /**
126 * Get Special Component Functional Name
127 *
128 * @return Component Functional Name
129 */
130 pts_funct_comp_name_t (*get_comp_funct_name)(tcg_pts_attr_simple_comp_evid_t *this);
131
132
133 /**
134 * Set Component Functional Name
135 *
136 * @param name Component Functional Name
137 */
138 void (*set_comp_funct_name)(tcg_pts_attr_simple_comp_evid_t *this,
139 pts_funct_comp_name_t name);
140
141 /**
142 * Get Measurement Type
143 *
144 * @return Measurement Type
145 */
146 u_int8_t (*get_measurement_type)(tcg_pts_attr_simple_comp_evid_t *this);
147
148 /**
149 * Get which PCR the functional component is extended into
150 *
151 * @return Number of PCR
152 */
153 u_int32_t (*get_extended_pcr)(tcg_pts_attr_simple_comp_evid_t *this);
154
155 /**
156 * Set which PCR the functional component is extended into
157 *
158 * @param pcr_number Number of PCR
159 */
160 void (*set_extended_pcr)(tcg_pts_attr_simple_comp_evid_t *this,
161 u_int32_t extended_pcr);
162
163 /**
164 * Get Hash Algorithm
165 *
166 * @return Hash Algorithm
167 */
168 pts_meas_algorithms_t (*get_hash_algorithm)(tcg_pts_attr_simple_comp_evid_t *this);
169
170 /**
171 * Set Hash Algorithm
172 *
173 * @param hash_algorithm Hash Algorithm
174 */
175 void (*set_hash_algorithm)(tcg_pts_attr_simple_comp_evid_t *this,
176 pts_meas_algorithms_t hash_algorithm);
177
178 /**
179 * Get PCR Transformation
180 *
181 * @return Transformation type of PCR
182 */
183 pts_pcr_transform_t (*get_pcr_trans)(tcg_pts_attr_simple_comp_evid_t *this);
184
185 /**
186 * Set PCR Transformation
187 *
188 * @param transformation Transformation type of PCR
189 */
190 void (*set_pcr_trans)(tcg_pts_attr_simple_comp_evid_t *this,
191 pts_pcr_transform_t transformation);
192
193 /**
194 * Get Measurement Time
195 *
196 * @return Measurement time
197 */
198 chunk_t (*get_measurement_time)(tcg_pts_attr_simple_comp_evid_t *this);
199
200 /**
201 * Set Measurement Time
202 *
203 * @param time Measurement time
204 */
205 void (*set_measurement_time)(tcg_pts_attr_simple_comp_evid_t *this,
206 chunk_t time);
207
208 /**
209 * Get Optional Policy URI
210 *
211 * @return Policy URI
212 */
213 chunk_t (*get_policy_uri)(tcg_pts_attr_simple_comp_evid_t *this);
214
215 /**
216 * Set Optional Policy URI
217 *
218 * @param policy_uri Policy URI
219 */
220 void (*set_policy_uri)(tcg_pts_attr_simple_comp_evid_t *this,
221 chunk_t policy_uri);
222
223 /**
224 * Get Optional PCR Length
225 *
226 * @return Length of PCR before/after values
227 */
228 u_int16_t (*get_pcr_len)(tcg_pts_attr_simple_comp_evid_t *this);
229
230 /**
231 * Get Optional PCR before value
232 *
233 * @return PCR before value
234 */
235 chunk_t (*get_pcr_before_value)(tcg_pts_attr_simple_comp_evid_t *this);
236
237 /**
238 * Set Optional PCR before value
239 *
240 * @param pcr_before PCR before value
241 */
242 void (*set_pcr_before_value)(tcg_pts_attr_simple_comp_evid_t *this,
243 chunk_t pcr_before);
244
245 /**
246 * Get Optional PCR after value
247 *
248 * @return PCR after value
249 */
250 chunk_t (*get_pcr_after_value)(tcg_pts_attr_simple_comp_evid_t *this);
251
252 /**
253 * Set Optional PCR after value
254 *
255 * @param pcr_after PCR after value
256 */
257 void (*set_pcr_after_value)(tcg_pts_attr_simple_comp_evid_t *this,
258 chunk_t pcr_after);
259
260 /**
261 * Get Component Measurement
262 *
263 * @return Component Measurement Hash
264 */
265 chunk_t (*get_comp_measurement)(tcg_pts_attr_simple_comp_evid_t *this);
266
267 /**
268 * Set Component Measurement
269 *
270 * @param measurement Component Measurement Hash
271 */
272 void (*set_comp_measurement)(tcg_pts_attr_simple_comp_evid_t *this,
273 chunk_t measurement);
274
275 };
276
277 /**
278 * Creates an tcg_pts_attr_simple_comp_evid_t object
279 *
280 * @param flags Set of flags
281 * @param depth Sub-component Depth
282 * @param vendor_id Component Functional Name Vendor ID
283 * @param qualifier Functional Name Category Qualifier
284 * @param name Component Functional Name
285 * @param extended_pcr Which PCR the functional component is extended into
286 * @param hash_algorithm Hash Algorithm
287 * @param transformation Transformation type for PCR
288 * @param measurement_time Measurement time
289 * @param policy_uri Optional Policy URI
290 * @param pcr_before Optional PCR before value
291 * @param pcr_after Optional PCR after value
292 * @param measurement Component Measurement
293 */
294 pa_tnc_attr_t* tcg_pts_attr_simple_comp_evid_create(pts_attr_simple_comp_evid_flag_t flags,
295 u_int32_t depth,
296 u_int32_t vendor_id,
297 pts_qualifier_t qualifier,
298 pts_funct_comp_name_t name,
299 u_int32_t extended_pcr,
300 pts_meas_algorithms_t hash_algorithm,
301 pts_pcr_transform_t transformation,
302 chunk_t measurement_time,
303 chunk_t policy_uri,
304 chunk_t pcr_before,
305 chunk_t pcr_after,
306 chunk_t measurement);
307
308 /**
309 * Creates an tcg_pts_attr_simple_comp_evid_t object from received data
310 *
311 * @param value Unparsed attribute value
312 */
313 pa_tnc_attr_t* tcg_pts_attr_simple_comp_evid_create_from_data(chunk_t value);
314
315 #endif /** TCG_PTS_ATTR_SIMPLE_COMP_EVID_H_ @}*/