aboutsummaryrefslogtreecommitdiffstats
path: root/src/libpts
diff options
context:
space:
mode:
authorSansar Choinyambuu <schoinya@hsr.ch>2011-11-18 09:40:22 +0100
committerAndreas Steffen <andreas.steffen@strongswan.org>2011-11-28 21:20:23 +0100
commit0975b00d06e0564675e52367a95d3c4ed05ea05d (patch)
tree479682bc82862392a50f236ea1cff8cd02ef0aa4 /src/libpts
parent40cfe6db6a04bcb04249c0c4991faab0c5e667ee (diff)
downloadstrongswan-0975b00d06e0564675e52367a95d3c4ed05ea05d.tar.bz2
strongswan-0975b00d06e0564675e52367a95d3c4ed05ea05d.tar.xz
component_hashes new table added
measurements added for tboot component create_comp_hash_enumerator modified accordingly
Diffstat (limited to 'src/libpts')
-rw-r--r--src/libpts/pts/pts_database.c21
-rw-r--r--src/libpts/pts/pts_database.h10
2 files changed, 18 insertions, 13 deletions
diff --git a/src/libpts/pts/pts_database.c b/src/libpts/pts/pts_database.c
index 0db5c2089..57613bd5c 100644
--- a/src/libpts/pts/pts_database.c
+++ b/src/libpts/pts/pts_database.c
@@ -85,7 +85,7 @@ METHOD(pts_database_t, create_comp_evid_enumerator, enumerator_t*,
}
-METHOD(pts_database_t, create_hash_enumerator, enumerator_t*,
+METHOD(pts_database_t, create_file_hash_enumerator, enumerator_t*,
private_pts_database_t *this, char *product, pts_meas_algorithms_t algo,
int id, bool is_dir)
{
@@ -114,17 +114,20 @@ METHOD(pts_database_t, create_hash_enumerator, enumerator_t*,
}
METHOD(pts_database_t, create_comp_hash_enumerator, enumerator_t*,
- private_pts_database_t *this, char *product,
- pts_meas_algorithms_t algo, char *comp_name)
+ private_pts_database_t *this, char *product, pts_meas_algorithms_t algo,
+ pts_comp_func_name_t *comp_name)
{
enumerator_t *e;
e = this->db->query(this->db,
- "SELECT fh.hash FROM file_hashes AS fh "
- "JOIN files AS f ON fh.file = f.id "
- "JOIN products AS p ON fh.product = p.id "
- "WHERE p.name = ? AND f.path = ? AND fh.algo = ? ",
- DB_TEXT, product, DB_TEXT, comp_name, DB_INT, algo, DB_BLOB);
+ "SELECT ch.hash FROM component_hashes AS ch "
+ "JOIN components AS c ON ch.component = c.id "
+ "JOIN products AS p ON ch.product = p.id "
+ "WHERE p.name = ? AND c.vendor_id = ? "
+ "AND c.name = ? AND c.qualifier = ? AND ch.algo = ? ",
+ DB_TEXT, product, DB_INT, comp_name->vendor_id,
+ DB_INT, comp_name->name, DB_INT, comp_name->qualifier,
+ DB_INT, algo, DB_BLOB);
return e;
}
@@ -148,7 +151,7 @@ pts_database_t *pts_database_create(char *uri)
.create_file_meas_enumerator = _create_file_meas_enumerator,
.create_file_meta_enumerator = _create_file_meta_enumerator,
.create_comp_evid_enumerator = _create_comp_evid_enumerator,
- .create_hash_enumerator = _create_hash_enumerator,
+ .create_file_hash_enumerator = _create_file_hash_enumerator,
.create_comp_hash_enumerator = _create_comp_hash_enumerator,
.destroy = _destroy,
},
diff --git a/src/libpts/pts/pts_database.h b/src/libpts/pts/pts_database.h
index 0279f4e9e..b07b8beab 100644
--- a/src/libpts/pts/pts_database.h
+++ b/src/libpts/pts/pts_database.h
@@ -68,7 +68,8 @@ struct pts_database_t {
* @param is_dir TRUE if directory was measured
* @return enumerator over all matching measurement hashes
*/
- enumerator_t* (*create_hash_enumerator)(pts_database_t *this, char *product,
+ enumerator_t* (*create_file_hash_enumerator)(
+ pts_database_t *this, char *product,
pts_meas_algorithms_t algo,
int id, bool is_dir);
@@ -77,11 +78,12 @@ struct pts_database_t {
*
* @param product software product (os, vpn client, etc.)
* @param algo hash algorithm used for measurement
- * @param comp_name value of path column in files table
+ * @param comp_name functional component name object
* @return enumerator over all matching measurement hashes
*/
- enumerator_t* (*create_comp_hash_enumerator)(pts_database_t *this, char *product,
- pts_meas_algorithms_t algo, char *comp_name);
+ enumerator_t* (*create_comp_hash_enumerator)(pts_database_t *this,
+ char *product, pts_meas_algorithms_t algo,
+ pts_comp_func_name_t *comp_name);
/**
* Destroys a pts_database_t object.