7d6fee0898c1ec18375e6986d75c110124efe771
[strongswan.git] / src / libimcv / tcg / pts / pts.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 pts pts
18 * @{ @ingroup pts
19 */
20
21 #ifndef PTS_H_
22 #define PTS_H_
23
24 typedef struct pts_t pts_t;
25
26 #include "pts_proto_caps.h"
27 #include "pts_meas_algo.h"
28 #include "pts_file_meas.h"
29
30 #include <library.h>
31
32 /**
33 * Class implementing the TCG Platform Trust System (PTS)
34 *
35 */
36 struct pts_t {
37
38 /**
39 * Get PTS Protocol Capabilities
40 *
41 * @return protocol capabilities flags
42 */
43 pts_proto_caps_flag_t (*get_proto_caps)(pts_t *this);
44
45 /**
46 * Set PTS Protocol Capabilities
47 *
48 * @param flags protocol capabilities flags
49 */
50 void (*set_proto_caps)(pts_t *this, pts_proto_caps_flag_t flags);
51
52 /**
53 * Get PTS Measurement Algorithm
54 *
55 * @return measurement algorithm
56 */
57 pts_meas_algorithms_t (*get_meas_algorithm)(pts_t *this);
58
59 /**
60 * Set PTS Measurement Algorithm
61 *
62 * @param algorithm measurement algorithm
63 */
64 void (*set_meas_algorithm)(pts_t *this, pts_meas_algorithms_t algorithm);
65
66 /**
67 * Get Platform and OS Info
68 *
69 * @return platform and OS info
70 */
71 char* (*get_platform_info)(pts_t *this);
72
73 /**
74 * Set Platform and OS Info
75 *
76 * @param info platform and OS info
77 */
78 void (*set_platform_info)(pts_t *this, char *info);
79
80 /**
81 * Get TPM 1.2 Version Info
82 *
83 * @param info chunk containing a TPM_CAP_VERSION_INFO struct
84 * @return TRUE if TPM Version Info available
85 */
86 bool (*get_tpm_version_info)(pts_t *this, chunk_t *info);
87
88 /**
89 * Set TPM 1.2 Version Info
90 *
91 * @param info chunk containing a TPM_CAP_VERSION_INFO struct
92 */
93 void (*set_tpm_version_info)(pts_t *this, chunk_t info);
94
95 /**
96 * Get Attestation Identity Key
97 *
98 * @param aik chunk containing a AIK naked public key or certificate
99 * @param is_naked_key TRUE if AIK is naked public key, without certificate
100 * @return TRUE if AIK available
101 */
102 bool (*get_aik)(pts_t *this, chunk_t *aik, bool *is_naked_key);
103
104 /**
105 * Set Attestation Identity Key
106 *
107 * @param aik chunk containing a AIK naked public key or certificate
108 * @param is_naked_key TRUE if AIK is naked public key, without certificate
109 */
110 void (*set_aik)(pts_t *this, chunk_t aik, bool is_naked_key);
111
112 /**
113 * Do PTS File Measurements
114 *
115 * @param request_id ID of PTS File Measurement Request
116 * @param pathname Absolute pathname of file to be measured
117 * @param is_directory if TRUE directory contents are measured
118 * @return PTS File Measurements of NULL if FAILED
119 */
120 pts_file_meas_t* (*do_measurements)(pts_t *this, u_int16_t request_id,
121 char *pathname, bool is_directory);
122
123 /**
124 * Destroys a pts_t object.
125 */
126 void (*destroy)(pts_t *this);
127
128 };
129
130 /**
131 * Creates an pts_t object
132 *
133 * @param is_imc TRUE if running on an IMC
134 */
135 pts_t* pts_create(bool is_imc);
136
137 #endif /** PTS_H_ @}*/