2 * Copyright (C) 2011 Andreas Steffen
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
18 * @defgroup attest_db_t attest_db
19 * @{ @ingroup attest_db
25 #include <pts/pts_meas_algo.h>
26 #include <os_info/os_info.h>
29 typedef struct attest_db_t attest_db_t
;
32 * Attestation database object
37 * Set functional component to be queried
39 * @param comp functional component
40 * @param create if TRUE create database entry if it doesn't exist
41 * @return TRUE if successful
43 bool (*set_component
)(attest_db_t
*this, char *comp
, bool create
);
46 * Set primary key of the functional component to be queried
48 * @param fid primary key of functional component
49 * @return TRUE if successful
51 bool (*set_cid
)(attest_db_t
*this, int fid
);
54 * Set directory to be queried
56 * @param dir directory
57 * @param create if TRUE create database entry if it doesn't exist
58 * @return TRUE if successful
60 bool (*set_directory
)(attest_db_t
*this, char *dir
, bool create
);
63 * Set primary key of the directory to be queried
65 * @param did primary key of directory
66 * @return TRUE if successful
68 bool (*set_did
)(attest_db_t
*this, int did
);
71 * Set measurement file to be queried
73 * @param file measurement file
74 * @param create if TRUE create database entry if it doesn't exist
75 * @return TRUE if successful
77 bool (*set_file
)(attest_db_t
*this, char *file
, bool create
);
80 * Set primary key of the measurement file to be queried
82 * @param fid primary key of measurement file
83 * @return TRUE if successful
85 bool (*set_fid
)(attest_db_t
*this, int fid
);
88 * Set functional component to be queried
91 * @param create if TRUE create database entry if it doesn't exist
92 * @return TRUE if successful
94 bool (*set_key
)(attest_db_t
*this, chunk_t key
, bool create
);
97 * Set primary key of the AIK to be queried
99 * @param kid primary key of AIK
100 * @return TRUE if successful
102 bool (*set_kid
)(attest_db_t
*this, int kid
);
105 * Set software package to be queried
107 * @param product software package
108 * @param create if TRUE create database entry if it doesn't exist
109 * @return TRUE if successful
111 bool (*set_package
)(attest_db_t
*this, char *package
, bool create
);
114 * Set primary key of the software package to be queried
116 * @param gid primary key of software package
117 * @return TRUE if successful
119 bool (*set_gid
)(attest_db_t
*this, int gid
);
122 * Set software product to be queried
124 * @param product software product
125 * @param create if TRUE create database entry if it doesn't exist
126 * @return TRUE if successful
128 bool (*set_product
)(attest_db_t
*this, char *product
, bool create
);
131 * Set primary key of the software product to be queried
133 * @param pid primary key of software product
134 * @return TRUE if successful
136 bool (*set_pid
)(attest_db_t
*this, int pid
);
139 * Set software package version to be queried
141 * @param version software package version
142 * @return TRUE if successful
144 bool (*set_version
)(attest_db_t
*this, char *version
);
147 * Set measurement hash algorithm
149 * @param algo hash algorithm
151 void (*set_algo
)(attest_db_t
*this, pts_meas_algorithms_t algo
);
154 * Set that the IMA-specific SHA-1 template hash be computed
156 void (*set_ima
)(attest_db_t
*this);
159 * Set that relative filenames are to be used
161 void (*set_relative
)(attest_db_t
*this);
164 * Set the package security state
166 void (*set_security
)(attest_db_t
*this, os_package_state_t security
);
169 * Set the sequence number
171 void (*set_sequence
)(attest_db_t
*this, int seq_no
);
174 * Set owner [user/host] of an AIK
176 * @param owner user/host name
177 * @return TRUE if successful
179 void (*set_owner
)(attest_db_t
*this, char *owner
);
182 * List all packages stored in the database
184 void (*list_packages
)(attest_db_t
*this);
187 * List all products stored in the database
189 void (*list_products
)(attest_db_t
*this);
192 * List selected files stored in the database
194 void (*list_files
)(attest_db_t
*this);
197 * List all components stored in the database
199 void (*list_components
)(attest_db_t
*this);
202 * List all devices stored in the database
204 void (*list_devices
)(attest_db_t
*this);
207 * List all AIKs stored in the database
209 void (*list_keys
)(attest_db_t
*this);
212 * List selected measurement hashes stored in the database
214 void (*list_hashes
)(attest_db_t
*this);
217 * List selected component measurement stored in the database
219 void (*list_measurements
)(attest_db_t
*this);
222 * Add an entry to the database
224 bool (*add
)(attest_db_t
*this);
227 * Delete an entry from the database
229 bool (*delete)(attest_db_t
*this);
232 * Destroy attest_db_t object
234 void (*destroy
)(attest_db_t
*this);
239 * Create an attest_db_t instance
241 * @param uri database URI
243 attest_db_t
* attest_db_create(char *uri
);
245 #endif /** ATTEST_DB_H_ @}*/