summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2014-10-28 16:03:11 +0100
committerMagnus Ahltorp <map@kth.se>2014-10-28 16:03:11 +0100
commit8de65ab10cbdf6ea5509f321f025686e6ab0ecaf (patch)
treeaffde38623b763a10c5afc2a5a180b18364b634f
parent89b8a59da38daf465a934f039cc7cf3efaf1468e (diff)
certtools.py: fix bug in build_merkle_tree
-rw-r--r--tools/certtools.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/certtools.py b/tools/certtools.py
index 0ce8885..cbb4ff7 100644
--- a/tools/certtools.py
+++ b/tools/certtools.py
@@ -264,8 +264,11 @@ def next_merkle_layer(layer):
return [internal_hash(pair) for pair in chunks(layer, 2)]
def build_merkle_tree(layer0):
+ if len(layer0) == 0:
+ return [[hashlib.sha256().digest()]]
layers = []
current_layer = layer0
+ layers.append(current_layer)
while len(current_layer) > 1:
current_layer = next_merkle_layer(current_layer)
layers.append(current_layer)