aboutsummaryrefslogtreecommitdiff
path: root/iomt.c
diff options
context:
space:
mode:
authorFranklin Wei <me@fwei.tk>2018-06-30 20:01:43 -0400
committerFranklin Wei <me@fwei.tk>2018-06-30 20:01:43 -0400
commitf0519032a59aff4ca9edcb2916e094db93e08942 (patch)
tree2888deb8615fb03f30bab36773a9605a0546160d /iomt.c
parent03a354b8d0f2a8820db9571c639804648d804ac4 (diff)
downloadcsaa-f0519032a59aff4ca9edcb2916e094db93e08942.zip
csaa-f0519032a59aff4ca9edcb2916e094db93e08942.tar.gz
csaa-f0519032a59aff4ca9edcb2916e094db93e08942.tar.bz2
csaa-f0519032a59aff4ca9edcb2916e094db93e08942.tar.xz
Add dummy client/server for comparison; fix bugs and polish database code
Diffstat (limited to 'iomt.c')
-rw-r--r--iomt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/iomt.c b/iomt.c
index 1a92568..2b1fb33 100644
--- a/iomt.c
+++ b/iomt.c
@@ -306,7 +306,9 @@ void merkle_update(struct iomt *tree, uint64_t leafidx, hash_t newval, hash_t **
hash_t iomt_getroot(const struct iomt *tree)
{
- return iomt_getnode(tree, 0);
+ if(tree)
+ return iomt_getnode(tree, 0);
+ return hash_null;
}
/* find a node with given idx */
@@ -570,6 +572,7 @@ struct iomt *iomt_dup(const struct iomt *oldtree)
newtree->mt_leafcount = oldtree->mt_leafcount;
newtree->mt_logleaves = oldtree->mt_logleaves;
+ newtree->in_memory = true;
newtree->mem.mt_leaves = calloc(oldtree->mt_leafcount, sizeof(struct iomt_node));
newtree->mem.mt_nodes = calloc(2 * oldtree->mt_leafcount - 1, sizeof(hash_t));