refactored PTS measurement algorithms
[strongswan.git] / src / libimcv / tcg / tcg_pts_attr_simple_evid_final.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_evid_final tcg_pts_attr_simple_evid_final
18 * @{ @ingroup tcg_pts_attr_simple_evid_final
19 */
20
21 #ifndef TCG_PTS_ATTR_SIMPLE_EVID_FINAL_H_
22 #define TCG_PTS_ATTR_SIMPLE_EVID_FINAL_H_
23
24 typedef struct tcg_pts_attr_simple_evid_final_t tcg_pts_attr_simple_evid_final_t;
25 typedef enum pts_simple_evid_final_flag_t pts_simple_evid_final_flag_t;
26
27 #include "tcg_attr.h"
28 #include "pa_tnc/pa_tnc_attr.h"
29
30 /* For Optional Composite Hash Algorithm field, pts_attr_meas_algorithms_t*/
31 #include "tcg_pts_attr_meas_algo.h"
32
33 /**
34 * PTS Simple Evidence Final Flags
35 */
36 enum pts_simple_evid_final_flag_t {
37 /** No Optional TPM PCR Composite nor Optional TPM Quote Signature fields included */
38 PTS_SIMPLE_EVID_FINAL_FLAG_NO = 0,
39 /** Optional TPM PCR Composite and Optional TPM Quote Signature fields included */
40 /** using TPM_QUOTE_INFO */
41 PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO = 1,
42 /** Optional TPM PCR Composite and Optional TPM Quote Signature fields included */
43 /** using TPM_QUOTE_INFO2, TPM_CAP_VERSION_INFO was not appended */
44 PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO2 = 2,
45 /** Optional TPM PCR Composite and Optional TPM Quote Signature fields included */
46 /** using TPM_QUOTE_INFO2, TPM_CAP_VERSION_INFO was appended */
47 PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO2_CAP_VER = 3,
48 /** Optional Evidence Signature included */
49 PTS_SIMPLE_EVID_FINAL_FLAG_EVID = 4,
50 };
51
52 /**
53 * Class implementing the TCG PTS Simple Evidence Final attribute
54 *
55 */
56 struct tcg_pts_attr_simple_evid_final_t {
57
58 /**
59 * Public PA-TNC attribute interface
60 */
61 pa_tnc_attr_t pa_tnc_attribute;
62
63 /**
64 * Get flags for PTS Simple Evidence Final
65 *
66 * @return Set of flags
67 */
68 pts_simple_evid_final_flag_t (*get_flags)(tcg_pts_attr_simple_evid_final_t *this);
69
70 /**
71 * Set flags for PTS Simple Evidence Final
72 *
73 * @param flags Set of flags
74 */
75 void (*set_flags)(tcg_pts_attr_simple_evid_final_t *this,
76 pts_simple_evid_final_flag_t flags);
77
78 /**
79 * Get Optional Composite Hash Algorithm
80 *
81 * @return Composite Hash Algorithm
82 */
83 pts_meas_algorithms_t (*get_comp_hash_algorithm)(tcg_pts_attr_simple_evid_final_t *this);
84
85 /**
86 * Set Optional Composite Hash Algorithm
87 *
88 * @param hash_algorithm Composite Hash Algorithm
89 */
90 void (*set_comp_hash_algorithm)(tcg_pts_attr_simple_evid_final_t *this,
91 pts_meas_algorithms_t hash_algorithm);
92
93 /**
94 * Get Optional TPM PCR Composite Length
95 *
96 * @return Length of Composite PCR Length
97 */
98 u_int32_t (*get_comp_pcr_len)(tcg_pts_attr_simple_evid_final_t *this);
99
100 /**
101 * Get Optional TPM PCR Composite
102 *
103 * @return PCR Composite
104 */
105 chunk_t (*get_pcr_comp)(tcg_pts_attr_simple_evid_final_t *this);
106
107 /**
108 * Set Optional TPM PCR Composite
109 *
110 * @param pcr_comp PCR Composite
111 */
112 void (*set_pcr_comp)(tcg_pts_attr_simple_evid_final_t *this,
113 chunk_t pcr_comp);
114
115 /**
116 * Get Optional TPM Quote Signature Length
117 *
118 * @return TPM Quote Signature Length
119 */
120 u_int32_t (*get_tpm_quote_sign_len)(tcg_pts_attr_simple_evid_final_t *this);
121
122 /**
123 * Get Optional TPM Quote Signature
124 *
125 * @return TPM Quote Signature
126 */
127 chunk_t (*get_tpm_quote_sign)(tcg_pts_attr_simple_evid_final_t *this);
128
129 /**
130 * Set Optional TPM Quote Signature
131 *
132 * @param tpm_quote_sign TPM Quote Signature
133 */
134 void (*set_tpm_quote_sign)(tcg_pts_attr_simple_evid_final_t *this,
135 chunk_t tpm_quote_sign);
136
137 /**
138 * Get Optional Evidence Signature
139 *
140 * @return Optional Evidence Signature
141 */
142 chunk_t (*get_evid_sign)(tcg_pts_attr_simple_evid_final_t *this);
143
144 /**
145 * Set Optional Evidence Signature
146 *
147 * @param signature Optional Evidence Signature
148 */
149 void (*set_evid_sign)(tcg_pts_attr_simple_evid_final_t *this,
150 chunk_t signature);
151
152 };
153
154 /**
155 * Creates an tcg_pts_attr_simple_evid_final_t object
156 *
157 * @param flags Set of flags
158 * @param comp_hash_algorithm Composite Hash Algorithm
159 * @param pcr_comp Optional TPM PCR Composite
160 * @param tpm_quote_sign Optional TPM Quote Signature
161 * @param evid_sign Optional Evidence Signature
162 */
163 pa_tnc_attr_t* tcg_pts_attr_simple_evid_final_create(pts_simple_evid_final_flag_t flags,
164 pts_meas_algorithms_t comp_hash_algorithm,
165 chunk_t pcr_comp,
166 chunk_t tpm_quote_sign,
167 chunk_t evid_sign);
168
169 /**
170 * Creates an tcg_pts_attr_simple_evid_final_t object from received data
171 *
172 * @param value unparsed attribute value
173 */
174 pa_tnc_attr_t* tcg_pts_attr_simple_evid_final_create_from_data(chunk_t value);
175
176 #endif /** TCG_PTS_ATTR_SIMPLE_EVID_FINAL_H_ @}*/