aboutsummaryrefslogtreecommitdiff
path: root/service_provider.c
diff options
context:
space:
mode:
authorFranklin Wei <me@fwei.tk>2018-08-03 18:51:27 +0000
committerFranklin Wei <me@fwei.tk>2018-08-03 18:51:27 +0000
commit15c809cc72125c149a56eaaa67b6fd546e2302ae (patch)
treea80852bff9d77c0b40ae949fd6c8b7012486def9 /service_provider.c
parente33211c2bd96994e6da361239ed8714b8cea32c0 (diff)
downloadcsaa-15c809cc72125c149a56eaaa67b6fd546e2302ae.zip
csaa-15c809cc72125c149a56eaaa67b6fd546e2302ae.tar.gz
csaa-15c809cc72125c149a56eaaa67b6fd546e2302ae.tar.bz2
csaa-15c809cc72125c149a56eaaa67b6fd546e2302ae.tar.xz
Adapt dummy service and client for new profiling method
This moves the profiling code to crypto.c (which should probably be renamed util.c at some point). Test scripts and data processing scripts have been updated as well to deal with the new data.
Diffstat (limited to 'service_provider.c')
-rw-r--r--service_provider.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/service_provider.c b/service_provider.c
index 1844533..0959155 100644
--- a/service_provider.c
+++ b/service_provider.c
@@ -73,23 +73,6 @@ struct service_provider {
struct server_profile profile;
};
-/* Profiling */
-static void prof_reset(struct server_profile *prof)
-{
- memset(prof, 0, sizeof(*prof));
-}
-
-static void prof_add(struct server_profile *prof, const char *label)
-{
- if(prof->n_times < MAX_TIMES)
- {
- prof->times[prof->n_times] = clock();
- strcpy(prof->labels[prof->n_times], label);
-
- prof->n_times++;
- }
-}
-
/* Generate an EQ certificate for inserting a placeholder with index
* placeholder_idx, given an encloser (which must actually enclose
* a). Note: this function will modify the *mt_nodes array to reflect
@@ -432,6 +415,8 @@ void sp_free(struct service_provider *sp)
}
}
+/* DB lookup. Copies result into a dynamically allocated structure
+ that should be freed with free_record() */
static struct file_record *lookup_record(struct service_provider *sp, uint64_t idx)
{
sqlite3_stmt *st = sp->lookup_record;
@@ -481,10 +466,7 @@ static void insert_record(struct service_provider *sp, const struct file_record
assert(sqlite3_step(st) == SQLITE_DONE);
}
-/* Should we insert sorted (for O(logn) lookup), or just at the end to
- * avoid copying (O(n) lookup, O(1) insertion)? Eventually this will
- * be replaced with a SQL backend. We do not check to ensure that
- * there are no duplicate file indices; that is up to the caller. */
+/* This *might* not be O(log n) time. TODO: check this. */
static void update_record(struct service_provider *sp,
const struct file_record *rec)
{
@@ -581,8 +563,8 @@ static struct file_version *lookup_version(struct service_provider *sp,
return NULL;
}
-/* This does the majority of the work that actually modifies or
- * creates a file. It expects a filled and signed tm_request
+/* This function does the majority of the work that actually modifies
+ * or creates a file. It expects a filled and signed tm_request
* structure, req, and will return the resulting FR certificate and
* its signature in *hmac_out. Additionally, the module's
* authenticated acknowledgement (equal to HMAC(req | 0), where |