summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2015-04-07 16:37:53 +0200
committerLinus Nordberg <linus@nordberg.se>2015-04-07 16:37:53 +0200
commit158e9f83d017ba87c3bdbbfe9a54d16bc7eb2311 (patch)
tree7c2f36c319894b7f415c5e0d2a762702198fc19a /src
parent2267289c354e440efecfb8a6e19cb965bd1bbbbc (diff)
parentf364054054477ed7ac7c15dd1199b7bac2e1cef7 (diff)
Merge branch 'mergeverify2'.
Minor tweaks on map/mergeverify2.
Diffstat (limited to 'src')
-rw-r--r--src/catlfish.erl9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/catlfish.erl b/src/catlfish.erl
index ed75495..d98e741 100644
--- a/src/catlfish.erl
+++ b/src/catlfish.erl
@@ -5,7 +5,7 @@
-export([add_chain/3, entries/2, entry_and_proof/2]).
-export([known_roots/0, update_known_roots/0]).
-export([init_cache_table/0]).
--export([entryhash_from_entry/1]).
+-export([entryhash_from_entry/1, chain_from_entry/1]).
-include_lib("eunit/include/eunit.hrl").
-define(PROTOCOL_VERSION, 0).
@@ -252,7 +252,7 @@ deserialise_extra_data(ExtraData) ->
[E | deserialise_extra_data(Rest)]
end.
-entryhash_from_entry(Entry) ->
+chain_from_entry(Entry) ->
{MTLText, ExtraDataPacked} = unpack_entry(Entry),
{ExtraData, <<>>} = decode_tls_vector(ExtraDataPacked, 3),
MTL = deserialise_mtl(MTLText),
@@ -266,7 +266,10 @@ entryhash_from_entry(Entry) ->
precert_entry ->
Chain
end,
- crypto:hash(sha256, Data).
+ Data.
+
+entryhash_from_entry(Entry) ->
+ crypto:hash(sha256, chain_from_entry(Entry)).
%% Private functions.
-spec unpack_entry(binary()) -> {binary(), binary()}.