2 * Copyright (C) 2011 Sansar Choinyambuu
3 * HSR Hochschule fuer Technik Rapperswil
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>.
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
24 typedef struct pts_t pts_t
;
26 #include "pts_error.h"
27 #include "pts_proto_caps.h"
28 #include "pts_meas_algo.h"
29 #include "pts_file_meas.h"
34 * UTF-8 encoding of the character used to delimiter the filename
36 #define SOLIDUS_UTF 0x002F
37 #define REVERSE_SOLIDUS_UTF 0x005C
40 * Class implementing the TCG Platform Trust System (PTS)
46 * Get PTS Protocol Capabilities
48 * @return protocol capabilities flags
50 pts_proto_caps_flag_t (*get_proto_caps
)(pts_t
*this);
53 * Set PTS Protocol Capabilities
55 * @param flags protocol capabilities flags
57 void (*set_proto_caps
)(pts_t
*this, pts_proto_caps_flag_t flags
);
60 * Get PTS Measurement Algorithm
62 * @return measurement algorithm
64 pts_meas_algorithms_t (*get_meas_algorithm
)(pts_t
*this);
67 * Set PTS Measurement Algorithm
69 * @param algorithm measurement algorithm
71 void (*set_meas_algorithm
)(pts_t
*this, pts_meas_algorithms_t algorithm
);
74 * Get Platform and OS Info
76 * @return platform and OS info
78 char* (*get_platform_info
)(pts_t
*this);
81 * Set Platform and OS Info
83 * @param info platform and OS info
85 void (*set_platform_info
)(pts_t
*this, char *info
);
88 * Get TPM 1.2 Version Info
90 * @param info chunk containing a TPM_CAP_VERSION_INFO struct
91 * @return TRUE if TPM Version Info available
93 bool (*get_tpm_version_info
)(pts_t
*this, chunk_t
*info
);
96 * Set TPM 1.2 Version Info
98 * @param info chunk containing a TPM_CAP_VERSION_INFO struct
100 void (*set_tpm_version_info
)(pts_t
*this, chunk_t info
);
103 * Get Attestation Identity Certificate or Public Key
105 * @return AIK Certificate or Public Key
107 certificate_t
* (*get_aik
)(pts_t
*this);
110 * Set Attestation Identity Certificate or Public Key
112 * @param aik AIK Certificate or Public Key
114 void (*set_aik
)(pts_t
*this, certificate_t
*aik
);
117 * Check whether path is valid file/directory on filesystem
119 * @param path Absolute path
120 * @param error_code Output variable for PTS error code
121 * @return TRUE if path is valid or file/directory doesn't exist
123 * FALSE if local error occurred within stat function
125 bool (*is_path_valid
)(pts_t
*this, char *path
, pts_error_code_t
*error_code
);
128 * Do PTS File Measurements
130 * @param request_id ID of PTS File Measurement Request
131 * @param pathname Absolute pathname of file to be measured
132 * @param is_directory if TRUE directory contents are measured
133 * @return PTS File Measurements of NULL if FAILED
135 pts_file_meas_t
* (*do_measurements
)(pts_t
*this, u_int16_t request_id
,
136 char *pathname
, bool is_directory
);
139 * Destroys a pts_t object.
141 void (*destroy
)(pts_t
*this);
146 * Creates an pts_t object
148 * @param is_imc TRUE if running on an IMC
150 pts_t
* pts_create(bool is_imc
);
152 #endif /** PTS_H_ @}*/