2 * Copyright (C) 2011 Sansar Choinyambuu
3 * HSR Hochschule fuer Technik Rapperswil
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>.
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
17 * @defgroup tcg_pts_attr_simple_comp_evid tcg_pts_attr_simple_comp_evid
18 * @{ @ingroup tcg_pts_attr_simple_comp_evid
21 #ifndef TCG_PTS_ATTR_SIMPLE_COMP_EVID_H_
22 #define TCG_PTS_ATTR_SIMPLE_COMP_EVID_H_
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
;
29 #include "tcg_pts_meas_algo.h"
30 #include "pa_tnc/pa_tnc_attr.h"
32 /* For Qualifier and Component Name fields, tcg_pts_qualifier_t,
33 * pts_attr_req_funct_comp_name_bin_enum_t, pts_attr_req_funct_comp_type_t */
34 #include "tcg_pts_attr_req_funct_comp_evid.h"
37 * PTS Simple Component Evidence Flags
39 enum pts_attr_simple_comp_evid_flag_t
{
40 /** PCR information fields inlcuded */
41 PTS_SIMPLE_COMP_EVID_FLAG_PCR
= 0,
42 /** No Validation was attempted */
43 PTS_SIMPLE_COMP_EVID_FLAG_NO_VALID
= 1,
44 /** Attempted validation, unable to verify */
45 PTS_SIMPLE_COMP_EVID_FLAG_NO_VER
= 2,
46 /** Attempted validation, verification failed */
47 PTS_SIMPLE_COMP_EVID_FLAG_VER_FAIL
= 3,
48 /** Attempted validation, verification passed */
49 PTS_SIMPLE_COMP_EVID_FLAG_VER_PASS
= 4,
53 * PTS PCR Transformations
55 enum pts_pcr_transform_t
{
56 /** No Transformation */
57 PTS_PCR_TRANSFORM_NO
= 0,
58 /** Hash Value matched PCR size */
59 PTS_PCR_TRANSFORM_MATCH
= 1,
60 /** Hash value shorter than PCR size */
61 PTS_PCR_TRANSFORM_SHORT
= 2,
62 /** Hash value longer than PCR size */
63 PTS_PCR_TRANSFORM_LONG
= 3,
67 * Class implementing the TCG PTS Simple Component Evidence attribute
70 struct tcg_pts_attr_simple_comp_evid_t
{
73 * Public PA-TNC attribute interface
75 pa_tnc_attr_t pa_tnc_attribute
;
78 * Get flags for PTS Simple Component Evidence
80 * @return Set of flags
82 pts_attr_simple_comp_evid_flag_t (*get_flags
)(tcg_pts_attr_simple_comp_evid_t
*this);
85 * Set flags for PTS Simple Component Evidence
87 * @param flags Set of flags
89 void (*set_flags
)(tcg_pts_attr_simple_comp_evid_t
*this,
90 pts_attr_simple_comp_evid_flag_t flags
);
93 * Get Sub-component Depth
95 * @return Sub-component Depth
97 u_int32_t (*get_sub_component_depth
)(tcg_pts_attr_simple_comp_evid_t
*this);
100 * Get Specific Component Functional Name Vendor ID
102 * @return Component Functional Name Vendor ID
104 u_int32_t (*get_spec_comp_funct_name_vendor_id
)(tcg_pts_attr_simple_comp_evid_t
*this);
109 * @return Functional Name Family
111 u_int8_t (*get_family
)(tcg_pts_attr_simple_comp_evid_t
*this);
116 * @return Functional Name Category Qualifier
118 tcg_pts_qualifier_t (*get_qualifier
)(tcg_pts_attr_simple_comp_evid_t
*this);
121 * Set qualifier for Component Functional Name
123 * @param qualifier Functional Name Category Qualifier
125 void (*set_qualifier
)(tcg_pts_attr_simple_comp_evid_t
*this,
126 tcg_pts_qualifier_t qualifier
);
129 * Get Special Component Functional Name
131 * @return Component Functional Name
133 pts_attr_req_funct_comp_name_bin_enum_t (*get_comp_funct_name
)(tcg_pts_attr_simple_comp_evid_t
*this);
137 * Set Component Functional Name
139 * @param name Component Functional Name
141 void (*set_comp_funct_name
)(tcg_pts_attr_simple_comp_evid_t
*this,
142 pts_attr_req_funct_comp_name_bin_enum_t name
);
145 * Get Measurement Type
147 * @return Measurement Type
149 u_int8_t (*get_measurement_type
)(tcg_pts_attr_simple_comp_evid_t
*this);
152 * Get which PCR the functional component is extended into
154 * @return Number of PCR
156 u_int32_t (*get_extended_pcr
)(tcg_pts_attr_simple_comp_evid_t
*this);
159 * Set which PCR the functional component is extended into
161 * @param pcr_number Number of PCR
163 void (*set_extended_pcr
)(tcg_pts_attr_simple_comp_evid_t
*this,
164 u_int32_t extended_pcr
);
169 * @return Hash Algorithm
171 pts_meas_algorithms_t (*get_hash_algorithm
)(tcg_pts_attr_simple_comp_evid_t
*this);
176 * @param hash_algorithm Hash Algorithm
178 void (*set_hash_algorithm
)(tcg_pts_attr_simple_comp_evid_t
*this,
179 pts_meas_algorithms_t hash_algorithm
);
182 * Get PCR Transformation
184 * @return Transformation type of PCR
186 pts_pcr_transform_t (*get_pcr_trans
)(tcg_pts_attr_simple_comp_evid_t
*this);
189 * Set PCR Transformation
191 * @param transformation Transformation type of PCR
193 void (*set_pcr_trans
)(tcg_pts_attr_simple_comp_evid_t
*this,
194 pts_pcr_transform_t transformation
);
197 * Get Measurement Time
199 * @return Measurement time
201 chunk_t (*get_measurement_time
)(tcg_pts_attr_simple_comp_evid_t
*this);
204 * Set Measurement Time
206 * @param time Measurement time
208 void (*set_measurement_time
)(tcg_pts_attr_simple_comp_evid_t
*this,
212 * Get Optional Policy URI
216 chunk_t (*get_policy_uri
)(tcg_pts_attr_simple_comp_evid_t
*this);
219 * Set Optional Policy URI
221 * @param policy_uri Policy URI
223 void (*set_policy_uri
)(tcg_pts_attr_simple_comp_evid_t
*this,
227 * Get Optional PCR Length
229 * @return Length of PCR before/after values
231 u_int16_t (*get_pcr_len
)(tcg_pts_attr_simple_comp_evid_t
*this);
234 * Get Optional PCR before value
236 * @return PCR before value
238 chunk_t (*get_pcr_before_value
)(tcg_pts_attr_simple_comp_evid_t
*this);
241 * Set Optional PCR before value
243 * @param pcr_before PCR before value
245 void (*set_pcr_before_value
)(tcg_pts_attr_simple_comp_evid_t
*this,
249 * Get Optional PCR after value
251 * @return PCR after value
253 chunk_t (*get_pcr_after_value
)(tcg_pts_attr_simple_comp_evid_t
*this);
256 * Set Optional PCR after value
258 * @param pcr_after PCR after value
260 void (*set_pcr_after_value
)(tcg_pts_attr_simple_comp_evid_t
*this,
264 * Get Component Measurement
266 * @return Component Measurement Hash
268 chunk_t (*get_comp_measurement
)(tcg_pts_attr_simple_comp_evid_t
*this);
271 * Set Component Measurement
273 * @param measurement Component Measurement Hash
275 void (*set_comp_measurement
)(tcg_pts_attr_simple_comp_evid_t
*this,
276 chunk_t measurement
);
281 * Creates an tcg_pts_attr_simple_comp_evid_t object
283 * @param flags Set of flags
284 * @param depth Sub-component Depth
285 * @param vendor_id Component Functional Name Vendor ID
286 * @param qualifier Functional Name Category Qualifier
287 * @param name Component Functional Name
288 * @param extended_pcr Which PCR the functional component is extended into
289 * @param hash_algorithm Hash Algorithm
290 * @param transformation Transformation type for PCR
291 * @param measurement_time Measurement time
292 * @param policy_uri Optional Policy URI
293 * @param pcr_before Optional PCR before value
294 * @param pcr_after Optional PCR after value
295 * @param measurement Component Measurement
297 pa_tnc_attr_t
* tcg_pts_attr_simple_comp_evid_create(pts_attr_simple_comp_evid_flag_t flags
,
300 tcg_pts_qualifier_t qualifier
,
301 pts_attr_req_funct_comp_name_bin_enum_t name
,
302 u_int32_t extended_pcr
,
303 pts_meas_algorithms_t hash_algorithm
,
304 pts_pcr_transform_t transformation
,
305 chunk_t measurement_time
,
309 chunk_t measurement
);
312 * Creates an tcg_pts_attr_simple_comp_evid_t object from received data
314 * @param value unparsed attribute value
316 pa_tnc_attr_t
* tcg_pts_attr_simple_comp_evid_create_from_data(chunk_t value
);
318 #endif /** TCG_PTS_ATTR_SIMPLE_COMP_EVID_H_ @}*/