Defined functional components within ITA namespace
[strongswan.git] / src / libpts / tcg / tcg_pts_attr_simple_comp_evid.c
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 #include "tcg_pts_attr_simple_comp_evid.h"
17
18 #include <pa_tnc/pa_tnc_msg.h>
19 #include <bio/bio_writer.h>
20 #include <bio/bio_reader.h>
21 #include <debug.h>
22
23 typedef struct private_tcg_pts_attr_simple_comp_evid_t private_tcg_pts_attr_simple_comp_evid_t;
24
25 /**
26 * Simple Component Evidence
27 * see section 3.15.1 of PTS Protocol: Binding to TNC IF-M Specification
28 *
29 * 1 2 3
30 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
31 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
32 * | Flags | Sub-Component Depth |
33 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
34 * | Specific Functional Component |
35 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
36 * | Specific Functional Component |
37 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
38 * | Measure. Type | Extended into PCR |
39 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
40 * | Hash Algorithm | PCR Transform | Reserved |
41 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
42 * | Measurement Date/Time |
43 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
44 * | Measurement Date/Time |
45 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
46 * | Measurement Date/Time |
47 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
48 * | Measurement Date/Time |
49 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
50 * | Measurement Date/Time |
51 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
52 * | Optional Policy URI Length | Opt. Verification Policy URI ~
53 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
54 * ~ Optional Verification Policy URI ~
55 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
56 * | Optional PCR Length | Optional PCR Before Value ~
57 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
58 * ~ Optional PCR Before Value (Variable Length) ~
59 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
60 * ~ Optional PCR After Value (Variable Length) ~
61 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
62 * ~ Component Measurement (Variable Length) ~
63 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
64 */
65
66 /**
67 * Specific Functional Component -> Component Functional Name Structure
68 * see section 5.1 of PTS Protocol: Binding to TNC IF-M Specification
69 *
70 * 1 2 3
71 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
72 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
73 * | Component Functional Name Vendor ID |Fam| Qualifier |
74 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
75 * | Component Functional Name |
76 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
77 *
78 */
79
80 /**
81 * Qualifier for Functional Component
82 * see section 5.2 of PTS Protocol: Binding to TNC IF-M Specification
83 *
84 *
85 * 0 1 2 3 4 5
86 * +-+-+-+-+-+-+
87 * |K|S| Type |
88 * +-+-+-+-+-+-+
89 */
90
91
92
93 #define PTS_SIMPLE_COMP_EVID_SIZE 40
94 #define PTS_SIMPLE_COMP_EVID_MEASUREMENT_TIME_SIZE 20
95 #define PTS_SIMPLE_COMP_EVID_RESERVED 0x00
96 #define PTS_REQ_FUNCT_COMP_FAM_BIN_ENUM 0x00
97
98 /**
99 * Private data of an tcg_pts_attr_simple_comp_evid_t object.
100 */
101 struct private_tcg_pts_attr_simple_comp_evid_t {
102
103 /**
104 * Public members of tcg_pts_attr_simple_comp_evid_t
105 */
106 tcg_pts_attr_simple_comp_evid_t public;
107
108 /**
109 * Attribute vendor ID
110 */
111 pen_t vendor_id;
112
113 /**
114 * Attribute type
115 */
116 u_int32_t type;
117
118 /**
119 * Attribute value
120 */
121 chunk_t value;
122
123 /**
124 * Noskip flag
125 */
126 bool noskip_flag;
127
128 /**
129 * Set of flags for Simple Component Evidence
130 */
131 pts_attr_simple_comp_evid_flag_t flags;
132
133 /**
134 * PCR Information included
135 */
136 bool pcr_info_included;
137
138 /**
139 * Sub-component Depth
140 */
141 u_int32_t depth;
142
143 /**
144 * Component Functional Name Vendor ID
145 */
146 u_int32_t comp_vendor_id;
147
148 /**
149 * Functional Name Encoding Family
150 */
151 u_int8_t family;
152
153 /**
154 * Functional Name Category Qualifier
155 */
156 pts_qualifier_t qualifier;
157
158 /**
159 * Component Functional Name
160 */
161 pts_ita_funct_comp_name_t name;
162
163 /**
164 * Measurement type
165 */
166 u_int8_t measurement_type;
167
168 /**
169 * Which PCR the functional component is extended into
170 */
171 u_int32_t extended_pcr;
172
173 /**
174 * Hash Algorithm
175 */
176 pts_meas_algorithms_t hash_algorithm;
177
178 /**
179 * Transformation type for PCR
180 */
181 pts_pcr_transform_t transformation;
182
183 /**
184 * Measurement time
185 */
186 chunk_t measurement_time;
187
188 /**
189 * Optional Policy URI
190 */
191 chunk_t policy_uri;
192
193 /**
194 * Optional PCR before value
195 */
196 chunk_t pcr_before;
197
198 /**
199 * Optional PCR after value
200 */
201 chunk_t pcr_after;
202
203 /**
204 * Component Measurement
205 */
206 chunk_t measurement;
207
208 };
209
210 METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
211 private_tcg_pts_attr_simple_comp_evid_t *this)
212 {
213 return this->vendor_id;
214 }
215
216 METHOD(pa_tnc_attr_t, get_type, u_int32_t,
217 private_tcg_pts_attr_simple_comp_evid_t *this)
218 {
219 return this->type;
220 }
221
222 METHOD(pa_tnc_attr_t, get_value, chunk_t,
223 private_tcg_pts_attr_simple_comp_evid_t *this)
224 {
225 return this->value;
226 }
227
228 METHOD(pa_tnc_attr_t, get_noskip_flag, bool,
229 private_tcg_pts_attr_simple_comp_evid_t *this)
230 {
231 return this->noskip_flag;
232 }
233
234 METHOD(pa_tnc_attr_t, set_noskip_flag,void,
235 private_tcg_pts_attr_simple_comp_evid_t *this, bool noskip)
236 {
237 this->noskip_flag = noskip;
238 }
239
240 METHOD(pa_tnc_attr_t, build, void,
241 private_tcg_pts_attr_simple_comp_evid_t *this)
242 {
243 bio_writer_t *writer;
244 u_int8_t flags = 0, qualifier = 0;
245
246 writer = bio_writer_create(PTS_SIMPLE_COMP_EVID_SIZE);
247 /* Determine the flags to set*/
248 if (this->pcr_info_included)
249 {
250 flags += 128;
251 }
252 if (this->flags == PTS_SIMPLE_COMP_EVID_FLAG_NO_VER)
253 {
254 flags += 32;
255 }
256 else if (this->flags == PTS_SIMPLE_COMP_EVID_FLAG_VER_FAIL)
257 {
258 flags += 64;
259 }
260 else if (this->flags == PTS_SIMPLE_COMP_EVID_FLAG_VER_PASS)
261 {
262 flags += 96;
263 }
264
265 writer->write_uint8(writer, flags);
266 writer->write_uint24 (writer, this->depth);
267 writer->write_uint24 (writer, this->comp_vendor_id);
268
269 if (this->family != PTS_REQ_FUNCT_COMP_FAM_BIN_ENUM)
270 {
271 DBG1(DBG_TNC, "Functional Name Encoding Family is not set to 00");
272 }
273
274 qualifier += this->qualifier.type;
275 if (this->qualifier.kernel)
276 {
277 qualifier += 16;
278 }
279 if (this->qualifier.sub_component)
280 {
281 qualifier += 32;
282 }
283
284 /* Unknown or Wildcard should not be used for Qualification*/
285 if (!qualifier || qualifier == 63)
286 {
287 DBG1(DBG_TNC, "Unknown or Wildcard should not be used for"
288 " Functional Name Qualifier");
289 }
290
291 writer->write_uint8 (writer, qualifier);
292 writer->write_uint32(writer, this->name);
293
294 writer->write_uint8 (writer, (this->measurement_type << 7));
295 writer->write_uint24(writer, this->extended_pcr);
296 writer->write_uint16(writer, this->hash_algorithm);
297 writer->write_uint8 (writer, this->transformation);
298 writer->write_data (writer, this->measurement_time);
299
300 /* Optional fields */
301 if (this->policy_uri.ptr && this->policy_uri.len > 0)
302 {
303 writer->write_uint16(writer, this->policy_uri.len);
304 writer->write_data (writer, this->policy_uri);
305 }
306 if (this->pcr_before.ptr && this->pcr_after.ptr &&
307 this->pcr_before.len == this->pcr_after.len &&
308 this->pcr_before.len > 0 && this->pcr_after.len > 0)
309 {
310 writer->write_uint16(writer, this->pcr_before.len);
311 writer->write_data (writer, this->pcr_before);
312 writer->write_data (writer, this->pcr_after);
313 }
314
315 if (this->measurement.ptr && this->measurement.len > 0)
316 {
317 writer->write_data (writer, this->measurement);
318 }
319
320 this->value = chunk_clone(writer->get_buf(writer));
321 writer->destroy(writer);
322 }
323
324 METHOD(pa_tnc_attr_t, process, status_t,
325 private_tcg_pts_attr_simple_comp_evid_t *this, u_int32_t *offset)
326 {
327 bio_reader_t *reader;
328 u_int8_t flags;
329 u_int8_t fam_and_qualifier;
330 u_int8_t measurement_type;
331 u_int16_t algorithm;
332 u_int8_t transformation;
333 u_int32_t measurement_len;
334
335 if (this->value.len < PTS_SIMPLE_COMP_EVID_SIZE)
336 {
337 DBG1(DBG_TNC, "insufficient data for Simple Component Evidence");
338 *offset = 0;
339 return FAILED;
340 }
341 reader = bio_reader_create(this->value);
342
343 reader->read_uint8(reader, &flags);
344 /* Determine the flags to set*/
345 if ((flags >> 7) & 1)
346 {
347 this->pcr_info_included = TRUE;
348 }
349 if (!((flags >> 6) & 1) && !((flags >> 5) & 1))
350 {
351 this->flags = PTS_SIMPLE_COMP_EVID_FLAG_NO_VALID;
352 }
353 else if (!((flags >> 6) & 1) && ((flags >> 5) & 1))
354 {
355 this->flags = PTS_SIMPLE_COMP_EVID_FLAG_NO_VER;
356 }
357 else if (((flags >> 6) & 1) && !((flags >> 5) & 1))
358 {
359 this->flags = PTS_SIMPLE_COMP_EVID_FLAG_VER_FAIL;
360 }
361 else if (((flags >> 6) & 1) && ((flags >> 5) & 1))
362 {
363 this->flags = PTS_SIMPLE_COMP_EVID_FLAG_VER_PASS;
364 }
365
366 reader->read_uint24(reader, &this->depth);
367 reader->read_uint24(reader, &this->comp_vendor_id);
368 reader->read_uint8(reader, &fam_and_qualifier);
369
370 if (((fam_and_qualifier >> 6) & 1) )
371 {
372 this->family += 1;
373 }
374 if (((fam_and_qualifier >> 7) & 1) )
375 {
376 this->family += 2;
377 }
378
379 if (((fam_and_qualifier >> 5) & 1) )
380 {
381 this->qualifier.kernel = true;
382 }
383 if (((fam_and_qualifier >> 4) & 1) )
384 {
385 this->qualifier.sub_component = true;
386 }
387 this->qualifier.type = ( fam_and_qualifier & 0xF );
388
389 /* Unknown or Wildcard should not be used for Qualification*/
390 if (!(fam_and_qualifier & 0x3F) || (fam_and_qualifier & 0x3F) == 0x3F)
391 {
392 DBG1(DBG_TNC, "Unknown or Wildcard should not be used for"
393 " Functional Name Qualifier");
394 }
395
396 reader->read_uint32(reader, &this->name);
397 reader->read_uint8(reader, &measurement_type);
398 this->measurement_type = (measurement_type >> 7 ) & 1;
399
400 reader->read_uint24(reader, &this->extended_pcr);
401 reader->read_uint16(reader, &algorithm);
402 this->hash_algorithm = algorithm;
403
404 reader->read_uint8(reader, &transformation);
405 this->transformation = transformation;
406
407 reader->read_data(reader, PTS_SIMPLE_COMP_EVID_MEASUREMENT_TIME_SIZE,
408 &this->measurement_time);
409 this->measurement_time = chunk_clone(this->measurement_time);
410
411 /* Optional Policy URI field is included */
412 if ((this->flags == PTS_SIMPLE_COMP_EVID_FLAG_VER_FAIL) ||
413 (this->flags == PTS_SIMPLE_COMP_EVID_FLAG_VER_PASS))
414 {
415 u_int16_t policy_uri_len;
416 reader->read_uint16(reader, &policy_uri_len);
417 reader->read_data(reader, policy_uri_len, &this->policy_uri);
418 this->policy_uri = chunk_clone(this->policy_uri);
419 }
420
421 /* Optional PCR value fields are included */
422 if (this->pcr_info_included)
423 {
424 u_int16_t pcr_value_len;
425 reader->read_uint16(reader, &pcr_value_len);
426 reader->read_data(reader, pcr_value_len, &this->pcr_before);
427 this->pcr_before = chunk_clone(this->pcr_before);
428 reader->read_data(reader, pcr_value_len, &this->pcr_after);
429 this->pcr_after = chunk_clone(this->pcr_after);
430 }
431 measurement_len = reader->remaining(reader);
432 reader->read_data(reader, measurement_len, &this->measurement);
433 this->measurement = chunk_clone(this->measurement);
434
435 reader->destroy(reader);
436 return SUCCESS;
437 }
438
439 METHOD(pa_tnc_attr_t, destroy, void,
440 private_tcg_pts_attr_simple_comp_evid_t *this)
441 {
442 free(this->value.ptr);
443 free(this->measurement_time.ptr);
444 free(this->policy_uri.ptr);
445 free(this->pcr_before.ptr);
446 free(this->pcr_after.ptr);
447 free(this->measurement.ptr);
448 free(this);
449 }
450
451 METHOD(tcg_pts_attr_simple_comp_evid_t, is_pcr_info_included, bool,
452 private_tcg_pts_attr_simple_comp_evid_t *this)
453 {
454 return this->pcr_info_included;
455 }
456
457 METHOD(tcg_pts_attr_simple_comp_evid_t, get_flags, pts_attr_simple_comp_evid_flag_t,
458 private_tcg_pts_attr_simple_comp_evid_t *this)
459 {
460 return this->flags;
461 }
462
463 METHOD(tcg_pts_attr_simple_comp_evid_t, get_sub_component_depth, u_int32_t,
464 private_tcg_pts_attr_simple_comp_evid_t *this)
465 {
466 return this->depth;
467 }
468
469 METHOD(tcg_pts_attr_simple_comp_evid_t, get_spec_comp_funct_name_vendor_id, u_int32_t,
470 private_tcg_pts_attr_simple_comp_evid_t *this)
471 {
472 return this->comp_vendor_id;
473 }
474
475 METHOD(tcg_pts_attr_simple_comp_evid_t, get_family, u_int8_t,
476 private_tcg_pts_attr_simple_comp_evid_t *this)
477 {
478 return this->family;
479 }
480
481 METHOD(tcg_pts_attr_simple_comp_evid_t, get_qualifier, pts_qualifier_t,
482 private_tcg_pts_attr_simple_comp_evid_t *this)
483 {
484 return this->qualifier;
485 }
486
487 METHOD(tcg_pts_attr_simple_comp_evid_t, get_comp_funct_name, pts_ita_funct_comp_name_t,
488 private_tcg_pts_attr_simple_comp_evid_t *this)
489 {
490 return this->name;
491 }
492
493 METHOD(tcg_pts_attr_simple_comp_evid_t, get_measurement_type, u_int8_t,
494 private_tcg_pts_attr_simple_comp_evid_t *this)
495 {
496 return this->measurement_type;
497 }
498
499 METHOD(tcg_pts_attr_simple_comp_evid_t, get_extended_pcr, u_int32_t,
500 private_tcg_pts_attr_simple_comp_evid_t *this)
501 {
502 return this->extended_pcr;
503 }
504
505 METHOD(tcg_pts_attr_simple_comp_evid_t, get_hash_algorithm, pts_meas_algorithms_t,
506 private_tcg_pts_attr_simple_comp_evid_t *this)
507 {
508 return this->hash_algorithm;
509 }
510
511 METHOD(tcg_pts_attr_simple_comp_evid_t, get_pcr_trans, pts_pcr_transform_t,
512 private_tcg_pts_attr_simple_comp_evid_t *this)
513 {
514 return this->transformation;
515 }
516
517 METHOD(tcg_pts_attr_simple_comp_evid_t, get_measurement_time, chunk_t,
518 private_tcg_pts_attr_simple_comp_evid_t *this)
519 {
520 return this->measurement_time;
521 }
522
523 METHOD(tcg_pts_attr_simple_comp_evid_t, get_policy_uri, chunk_t,
524 private_tcg_pts_attr_simple_comp_evid_t *this)
525 {
526 return this->policy_uri;
527 }
528
529 METHOD(tcg_pts_attr_simple_comp_evid_t, get_pcr_before_value, chunk_t,
530 private_tcg_pts_attr_simple_comp_evid_t *this)
531 {
532 return this->pcr_before;
533 }
534
535 METHOD(tcg_pts_attr_simple_comp_evid_t, get_pcr_after_value, chunk_t,
536 private_tcg_pts_attr_simple_comp_evid_t *this)
537 {
538 return this->pcr_after;
539 }
540
541 METHOD(tcg_pts_attr_simple_comp_evid_t, get_pcr_len, u_int16_t,
542 private_tcg_pts_attr_simple_comp_evid_t *this)
543 {
544 if (this->pcr_before.ptr && this->pcr_after.ptr &&
545 this->pcr_before.len == this->pcr_after.len &&
546 this->pcr_before.len > 0 && this->pcr_after.len > 0)
547 {
548 return this->pcr_before.len;
549 }
550 return 0;
551 }
552
553 METHOD(tcg_pts_attr_simple_comp_evid_t, get_comp_measurement, chunk_t,
554 private_tcg_pts_attr_simple_comp_evid_t *this)
555 {
556 return this->measurement;
557 }
558
559 /**
560 * Described in header.
561 */
562 pa_tnc_attr_t *tcg_pts_attr_simple_comp_evid_create(tcg_pts_attr_simple_comp_evid_params_t params)
563 {
564 private_tcg_pts_attr_simple_comp_evid_t *this;
565
566 INIT(this,
567 .public = {
568 .pa_tnc_attribute = {
569 .get_vendor_id = _get_vendor_id,
570 .get_type = _get_type,
571 .get_value = _get_value,
572 .get_noskip_flag = _get_noskip_flag,
573 .set_noskip_flag = _set_noskip_flag,
574 .build = _build,
575 .process = _process,
576 .destroy = _destroy,
577 },
578 .is_pcr_info_included = _is_pcr_info_included,
579 .get_flags= _get_flags,
580 .get_sub_component_depth = _get_sub_component_depth,
581 .get_spec_comp_funct_name_vendor_id = _get_spec_comp_funct_name_vendor_id,
582 .get_family = _get_family,
583 .get_qualifier = _get_qualifier,
584 .get_comp_funct_name = _get_comp_funct_name,
585 .get_measurement_type = _get_measurement_type,
586 .get_extended_pcr = _get_extended_pcr,
587 .get_hash_algorithm = _get_hash_algorithm,
588 .get_pcr_trans = _get_pcr_trans,
589 .get_measurement_time = _get_measurement_time,
590 .get_policy_uri = _get_policy_uri,
591 .get_pcr_before_value = _get_pcr_before_value,
592 .get_pcr_after_value = _get_pcr_after_value,
593 .get_pcr_len = _get_pcr_len,
594 .get_comp_measurement = _get_comp_measurement,
595 },
596 .vendor_id = PEN_TCG,
597 .type = TCG_PTS_SIMPLE_COMP_EVID,
598 .pcr_info_included = params.pcr_info_included,
599 .flags = params.flags,
600 .depth = params.depth,
601 .comp_vendor_id = params.vendor_id,
602 .family = PTS_REQ_FUNCT_COMP_FAM_BIN_ENUM,
603 .qualifier = params.qualifier,
604 .name = params.name,
605 .extended_pcr = params.extended_pcr,
606 .hash_algorithm = params.hash_algorithm,
607 .transformation = params.transformation,
608 .measurement_time = params.measurement_time,
609 .policy_uri = chunk_clone(params.policy_uri),
610 .pcr_before = params.pcr_before,
611 .pcr_after = params.pcr_after,
612 .measurement = chunk_clone(params.measurement),
613 );
614
615 return &this->public.pa_tnc_attribute;
616 }
617
618
619 /**
620 * Described in header.
621 */
622 pa_tnc_attr_t *tcg_pts_attr_simple_comp_evid_create_from_data(chunk_t data)
623 {
624 private_tcg_pts_attr_simple_comp_evid_t *this;
625
626 INIT(this,
627 .public = {
628 .pa_tnc_attribute = {
629 .get_vendor_id = _get_vendor_id,
630 .get_type = _get_type,
631 .get_value = _get_value,
632 .get_noskip_flag = _get_noskip_flag,
633 .set_noskip_flag = _set_noskip_flag,
634 .build = _build,
635 .process = _process,
636 .destroy = _destroy,
637 },
638 .is_pcr_info_included = _is_pcr_info_included,
639 .get_flags= _get_flags,
640 .get_sub_component_depth = _get_sub_component_depth,
641 .get_spec_comp_funct_name_vendor_id = _get_spec_comp_funct_name_vendor_id,
642 .get_family = _get_family,
643 .get_qualifier = _get_qualifier,
644 .get_comp_funct_name = _get_comp_funct_name,
645 .get_measurement_type = _get_measurement_type,
646 .get_extended_pcr = _get_extended_pcr,
647 .get_hash_algorithm = _get_hash_algorithm,
648 .get_pcr_trans = _get_pcr_trans,
649 .get_measurement_time = _get_measurement_time,
650 .get_policy_uri = _get_policy_uri,
651 .get_pcr_before_value = _get_pcr_before_value,
652 .get_pcr_after_value = _get_pcr_after_value,
653 .get_pcr_len = _get_pcr_len,
654 .get_comp_measurement = _get_comp_measurement,
655 },
656 .vendor_id = PEN_TCG,
657 .type = TCG_PTS_SIMPLE_COMP_EVID,
658 .family = PTS_REQ_FUNCT_COMP_FAM_BIN_ENUM,
659 .value = chunk_clone(data),
660 );
661
662 return &this->public.pa_tnc_attribute;
663 }