aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklin Wei <me@fwei.tk>2018-07-03 14:21:13 -0400
committerFranklin Wei <me@fwei.tk>2018-07-03 14:21:13 -0400
commitcf207a90591da839248aeffa99cb47077113a7e3 (patch)
tree56c8750fc406a7654c9a4962b74e77431a87ffdd
parent0d128a7010c9279fdf3dd51adad848135aea5cda (diff)
downloadcsaa-cf207a90591da839248aeffa99cb47077113a7e3.zip
csaa-cf207a90591da839248aeffa99cb47077113a7e3.tar.gz
csaa-cf207a90591da839248aeffa99cb47077113a7e3.tar.bz2
csaa-cf207a90591da839248aeffa99cb47077113a7e3.tar.xz
Fix warnings
-rw-r--r--Makefile2
-rw-r--r--client.c4
-rw-r--r--dummy_client.c16
-rw-r--r--dummy_service.c4
-rw-r--r--iomt.h2
-rw-r--r--service_provider.c33
-rw-r--r--trusted_module.c3
7 files changed, 27 insertions, 37 deletions
diff --git a/Makefile b/Makefile
index f68b16e..7eb9497 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
all: client server dummy_client dummy_server
-CFLAGS = -g -Wall -O0 -lsqlite3
+CFLAGS = -g -Wall -Wformat-overflow=0 -O0 -lsqlite3
sqlinit.c: sqlinit.txt
xxd -i $^ | sed 's/\([0-9a-f]\)$$/\0, 0x00/' > $@
diff --git a/client.c b/client.c
index d4cc140..f6e0398 100644
--- a/client.c
+++ b/client.c
@@ -225,7 +225,6 @@ bool parse_args(int argc, char *argv[])
if((1 << logleaves) != n / 2)
logleaves++;
- printf("ACL logleaves = %d, count = %d, mt_leafcount = %d\n", logleaves, n, 1 << logleaves);
new_acl = iomt_new(logleaves);
/* now produce IOMT */
uint64_t first_idx = acl_tuples[0];
@@ -731,9 +730,6 @@ bool server_request(const char *sockpath,
}
int main(int argc, char *argv[]) {
- char buf[100];
- int fd,rc;
-
if(!parse_args(argc, argv))
{
printf("%s\n", parse_args_fail);
diff --git a/dummy_client.c b/dummy_client.c
index 1720cdc..bf7c0dc 100644
--- a/dummy_client.c
+++ b/dummy_client.c
@@ -236,7 +236,6 @@ bool exec_request(int fd, const struct user_request *req,
}
case RETRIEVE_INFO:
{
- hash_t hmac;
struct version_info verinfo;
recv(fd, &verinfo, sizeof(verinfo), MSG_WAITALL);
*verinfo_out = verinfo;
@@ -276,12 +275,12 @@ struct version_info request_verinfo(int fd, uint64_t user_id,
struct version_info verinfo;
- bool rc = exec_request(fd, &req,
- NULL, 0,
- &verinfo,
- NULL,
- NULL,
- NULL);
+ exec_request(fd, &req,
+ NULL, 0,
+ &verinfo,
+ NULL,
+ NULL,
+ NULL);
return verinfo;
}
@@ -398,9 +397,6 @@ bool server_request(const char *sockpath,
}
int main(int argc, char *argv[]) {
- char buf[100];
- int fd,rc;
-
if(!parse_args(argc, argv))
{
printf("%s\n", parse_args_fail);
diff --git a/dummy_service.c b/dummy_service.c
index 5a974d1..f3cfdf6 100644
--- a/dummy_service.c
+++ b/dummy_service.c
@@ -446,9 +446,9 @@ static void sp_handle_client(struct service_provider *sp, int cl)
break;
}
- case USERREQ_NONE:
+ default:
{
- printf("null request\n");
+ printf("bad request\n");
exit(1);
}
}
diff --git a/iomt.h b/iomt.h
index 7dfd619..060a582 100644
--- a/iomt.h
+++ b/iomt.h
@@ -25,7 +25,7 @@ static const struct iomt_node node_null = { 0, 0, { { 0 } } };
* and so on.
*/
struct iomt {
- int mt_leafcount, mt_logleaves; /* mt_logleaves must equal 2^mt_leafcount */
+ uint64_t mt_leafcount, mt_logleaves; /* mt_logleaves must equal 2^mt_leafcount */
bool in_memory;
diff --git a/service_provider.c b/service_provider.c
index d4abed2..fa940bf 100644
--- a/service_provider.c
+++ b/service_provider.c
@@ -274,8 +274,6 @@ struct service_provider *sp_new(const void *key, size_t keylen,
printf("Initializing IOMT with %llu nodes.\n", 1ULL << logleaves);
- clock_t start = clock();
-
/* The trusted module initializes itself with a single placeholder
* node (1,0,1). We first update our list of IOMT leaves. Then we
* insert our desired number of nodes by using EQ certificates to
@@ -441,9 +439,9 @@ static void insert_version(struct service_provider *sp,
sqlite3_bind_blob(st, 5, &ver->vr_cert, sizeof(ver->vr_cert), SQLITE_TRANSIENT);
sqlite3_bind_blob(st, 6, &ver->vr_hmac, sizeof(ver->vr_hmac), SQLITE_TRANSIENT);
- sqlite3_bind_int(st, 7, ver->buildcode ? ver->buildcode->mt_logleaves : -1);
+ sqlite3_bind_int64(st, 7, ver->buildcode ? ver->buildcode->mt_logleaves : -1);
- sqlite3_bind_int(st, 8, ver->composefile ? ver->composefile->mt_logleaves : -1);
+ sqlite3_bind_int64(st, 8, ver->composefile ? ver->composefile->mt_logleaves : -1);
int rc = sqlite3_step(st);
if(rc != SQLITE_DONE)
@@ -500,18 +498,20 @@ static struct file_version *lookup_version(struct service_provider *sp,
memcpy(&ver->vr_cert, sqlite3_column_blob(st, 4), sizeof(ver->vr_cert));
memcpy(&ver->vr_hmac, sqlite3_column_blob(st, 5), sizeof(ver->vr_hmac));
- int bc_logleaves = sqlite3_column_int(st, 6);
- int cf_logleaves = sqlite3_column_int(st, 7);
- ver->buildcode = iomt_new_from_db(sp->db,
- "BCNodes", "BCLeaves",
- "FileIdx", file_idx,
- "Version", version,
- bc_logleaves);
- ver->composefile = iomt_new_from_db(sp->db,
- "CFNodes", "CFLeaves",
- "FileIdx", file_idx,
- "Version", version,
- cf_logleaves);
+ int64_t bc_logleaves = sqlite3_column_int64(st, 6);
+ int64_t cf_logleaves = sqlite3_column_int64(st, 7);
+
+ ver->buildcode = bc_logleaves >= 0 ? iomt_new_from_db(sp->db,
+ "BCNodes", "BCLeaves",
+ "FileIdx", file_idx,
+ "Version", version,
+ bc_logleaves) : NULL;
+
+ ver->composefile = cf_logleaves >= 0 ? iomt_new_from_db(sp->db,
+ "CFNodes", "CFLeaves",
+ "FileIdx", file_idx,
+ "Version", version,
+ cf_logleaves) : NULL;
return ver;
}
return NULL;
@@ -849,7 +849,6 @@ struct tm_request sp_modifyfile(struct service_provider *sp,
hash_t *ack_hmac)
{
/* modification */
- printf("Modify file %d\n", file_idx);
struct file_record *rec = lookup_record(sp, file_idx);
if(!rec)
{
diff --git a/trusted_module.c b/trusted_module.c
index b90046c..970db7d 100644
--- a/trusted_module.c
+++ b/trusted_module.c
@@ -990,9 +990,8 @@ void tm_test(void)
hash_t node_new = sha256("b", 1);
hash_t comp[] = { sha256("b", 1) };
int orders[] = { 1 }; /* complementary node is right child */
- hash_t root_1, root_2, root_3;
+ hash_t root_1, root_3;
root_1 = merkle_compute(node, comp, orders, 1);
- root_2 = merkle_compute(node_new, comp, orders, 1);
hash_t hmac;
struct tm_cert nu = tm_cert_node_update(tm, node, node_new, comp, orders, 1, &hmac);