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