summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2014-11-18 10:58:21 +0100
committerLinus Nordberg <linus@nordberg.se>2014-11-18 10:58:21 +0100
commit293b1df48c6d376dee0f1f2512486b8a68488a9c (patch)
tree17a6fb1aefa489a856fb1d81645c3b7b200a5f11 /src
parent3ef550cb6f1e8ac7e4142cc1620eb36be747b30d (diff)
Entry hash runs over leaf plus chain.
Closes CATLFISH-5.
Diffstat (limited to 'src')
-rw-r--r--src/catlfish.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/catlfish.erl b/src/catlfish.erl
index 3ca190a..98ec4dd 100644
--- a/src/catlfish.erl
+++ b/src/catlfish.erl
@@ -71,7 +71,7 @@ build_mtl(Timestamp, LeafCert) ->
-spec add_chain(binary(), [binary()]) -> nonempty_string().
add_chain(LeafCert, CertChain) ->
- EntryHash = crypto:hash(sha256, LeafCert),
+ EntryHash = crypto:hash(sha256, [LeafCert | CertChain]),
TimestampedEntry =
case plop:get(EntryHash) of
notfound ->
@@ -85,7 +85,7 @@ add_chain(LeafCert, CertChain) ->
ok = plop:add(
serialise_logentry(Timestamp, LeafCert, CertChain),
ht:leaf_hash(serialise(MTL)),
- crypto:hash(sha256, LeafCert)),
+ EntryHash),
TSE;
{_Index, _MTLHash, Entry} ->
<<Timestamp:64, _LogEntry/binary>> = Entry,