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 "tcg_pts_funct_comp_name.h"
31 #include "pa_tnc/pa_tnc_attr.h"
34 * PTS Simple Component Evidence Flags
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,
50 * PTS PCR Transformations
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,
64 * Class implementing the TCG PTS Simple Component Evidence attribute
67 struct tcg_pts_attr_simple_comp_evid_t
{
70 * Public PA-TNC attribute interface
72 pa_tnc_attr_t pa_tnc_attribute
;
75 * Get flags for PTS Simple Component Evidence
77 * @return Set of flags
79 pts_attr_simple_comp_evid_flag_t (*get_flags
)(tcg_pts_attr_simple_comp_evid_t
*this);
82 * Set flags for PTS Simple Component Evidence
84 * @param flags Set of flags
86 void (*set_flags
)(tcg_pts_attr_simple_comp_evid_t
*this,
87 pts_attr_simple_comp_evid_flag_t flags
);
90 * Get Sub-component Depth
92 * @return Sub-component Depth
94 u_int32_t (*get_sub_component_depth
)(tcg_pts_attr_simple_comp_evid_t
*this);
97 * Get Specific Component Functional Name Vendor ID
99 * @return Component Functional Name Vendor ID
101 u_int32_t (*get_spec_comp_funct_name_vendor_id
)(tcg_pts_attr_simple_comp_evid_t
*this);
106 * @return Functional Name Family
108 u_int8_t (*get_family
)(tcg_pts_attr_simple_comp_evid_t
*this);
113 * @return Functional Name Category Qualifier
115 pts_qualifier_t (*get_qualifier
)(tcg_pts_attr_simple_comp_evid_t
*this);
118 * Set qualifier for Component Functional Name
120 * @param qualifier Functional Name Category Qualifier
122 void (*set_qualifier
)(tcg_pts_attr_simple_comp_evid_t
*this,
123 pts_qualifier_t qualifier
);
126 * Get Special Component Functional Name
128 * @return Component Functional Name
130 pts_funct_comp_name_t (*get_comp_funct_name
)(tcg_pts_attr_simple_comp_evid_t
*this);
134 * Set Component Functional Name
136 * @param name Component Functional Name
138 void (*set_comp_funct_name
)(tcg_pts_attr_simple_comp_evid_t
*this,
139 pts_funct_comp_name_t name
);
142 * Get Measurement Type
144 * @return Measurement Type
146 u_int8_t (*get_measurement_type
)(tcg_pts_attr_simple_comp_evid_t
*this);
149 * Get which PCR the functional component is extended into
151 * @return Number of PCR
153 u_int32_t (*get_extended_pcr
)(tcg_pts_attr_simple_comp_evid_t
*this);
156 * Set which PCR the functional component is extended into
158 * @param pcr_number Number of PCR
160 void (*set_extended_pcr
)(tcg_pts_attr_simple_comp_evid_t
*this,
161 u_int32_t extended_pcr
);
166 * @return Hash Algorithm
168 pts_meas_algorithms_t (*get_hash_algorithm
)(tcg_pts_attr_simple_comp_evid_t
*this);
173 * @param hash_algorithm Hash Algorithm
175 void (*set_hash_algorithm
)(tcg_pts_attr_simple_comp_evid_t
*this,
176 pts_meas_algorithms_t hash_algorithm
);
179 * Get PCR Transformation
181 * @return Transformation type of PCR
183 pts_pcr_transform_t (*get_pcr_trans
)(tcg_pts_attr_simple_comp_evid_t
*this);
186 * Set PCR Transformation
188 * @param transformation Transformation type of PCR
190 void (*set_pcr_trans
)(tcg_pts_attr_simple_comp_evid_t
*this,
191 pts_pcr_transform_t transformation
);
194 * Get Measurement Time
196 * @return Measurement time
198 chunk_t (*get_measurement_time
)(tcg_pts_attr_simple_comp_evid_t
*this);
201 * Set Measurement Time
203 * @param time Measurement time
205 void (*set_measurement_time
)(tcg_pts_attr_simple_comp_evid_t
*this,
209 * Get Optional Policy URI
213 chunk_t (*get_policy_uri
)(tcg_pts_attr_simple_comp_evid_t
*this);
216 * Set Optional Policy URI
218 * @param policy_uri Policy URI
220 void (*set_policy_uri
)(tcg_pts_attr_simple_comp_evid_t
*this,
224 * Get Optional PCR Length
226 * @return Length of PCR before/after values
228 u_int16_t (*get_pcr_len
)(tcg_pts_attr_simple_comp_evid_t
*this);
231 * Get Optional PCR before value
233 * @return PCR before value
235 chunk_t (*get_pcr_before_value
)(tcg_pts_attr_simple_comp_evid_t
*this);
238 * Set Optional PCR before value
240 * @param pcr_before PCR before value
242 void (*set_pcr_before_value
)(tcg_pts_attr_simple_comp_evid_t
*this,
246 * Get Optional PCR after value
248 * @return PCR after value
250 chunk_t (*get_pcr_after_value
)(tcg_pts_attr_simple_comp_evid_t
*this);
253 * Set Optional PCR after value
255 * @param pcr_after PCR after value
257 void (*set_pcr_after_value
)(tcg_pts_attr_simple_comp_evid_t
*this,
261 * Get Component Measurement
263 * @return Component Measurement Hash
265 chunk_t (*get_comp_measurement
)(tcg_pts_attr_simple_comp_evid_t
*this);
268 * Set Component Measurement
270 * @param measurement Component Measurement Hash
272 void (*set_comp_measurement
)(tcg_pts_attr_simple_comp_evid_t
*this,
273 chunk_t measurement
);
278 * Creates an tcg_pts_attr_simple_comp_evid_t object
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
294 pa_tnc_attr_t
* tcg_pts_attr_simple_comp_evid_create(pts_attr_simple_comp_evid_flag_t flags
,
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
,
306 chunk_t measurement
);
309 * Creates an tcg_pts_attr_simple_comp_evid_t object from received data
311 * @param value Unparsed attribute value
313 pa_tnc_attr_t
* tcg_pts_attr_simple_comp_evid_create_from_data(chunk_t value
);
315 #endif /** TCG_PTS_ATTR_SIMPLE_COMP_EVID_H_ @}*/