finished refactoring functional components
[strongswan.git] / src / libpts / pts / components / ita / ita_comp_tboot.c
1 /*
2 * Copyright (C) 2011 Andreas Steffen
3 *
4 * HSR Hochschule fuer Technik Rapperswil
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17 #include "ita_comp_tboot.h"
18 #include "ita_comp_func_name.h"
19
20 #include "pts/pts_func_comp_evid_req.h"
21 #include "pts/components/pts_component.h"
22
23 #include <debug.h>
24 #include <pen/pen.h>
25
26 typedef struct pts_ita_comp_tboot_t pts_ita_comp_tboot_t;
27
28 /**
29 * Private data of a pts_ita_comp_tboot_t object.
30 *
31 */
32 struct pts_ita_comp_tboot_t {
33
34 /**
35 * Public pts_component_manager_t interface.
36 */
37 pts_component_t public;
38
39 /**
40 * Component Functional Name
41 */
42 pts_comp_func_name_t *name;
43 };
44
45 METHOD(pts_component_t, get_comp_func_name, pts_comp_func_name_t*,
46 pts_ita_comp_tboot_t *this)
47 {
48 return this->name;
49 }
50
51 METHOD(pts_component_t, get_evidence_flags, u_int8_t,
52 pts_ita_comp_tboot_t *this)
53 {
54 return PTS_REQ_FUNC_COMP_FLAG_PCR;
55 }
56
57 METHOD(pts_component_t, measure, bool,
58 pts_ita_comp_tboot_t *this)
59 {
60 /* TODO measure the tboot functional component */
61 return FALSE;
62 }
63
64 METHOD(pts_component_t, verify, bool,
65 pts_ita_comp_tboot_t *this)
66 {
67 /* TODO verify the measurement of the tboot functional component */
68 return FALSE;
69 }
70
71 METHOD(pts_component_t, destroy, void,
72 pts_ita_comp_tboot_t *this)
73 {
74 this->name->destroy(this->name);
75 free(this);
76 }
77
78 /**
79 * See header
80 */
81 pts_component_t *pts_ita_comp_tboot_create(u_int8_t qualifier)
82 {
83 pts_ita_comp_tboot_t *this;
84
85 INIT(this,
86 .public = {
87 .get_comp_func_name = _get_comp_func_name,
88 .get_evidence_flags = _get_evidence_flags,
89 .measure = _measure,
90 .verify = _verify,
91 .destroy = _destroy,
92 },
93 .name = pts_comp_func_name_create(PEN_ITA, PTS_ITA_COMP_FUNC_NAME_TBOOT,
94 qualifier),
95 );
96
97 return &this->public;
98 }
99