From 613e50c433a23aa1282453108859c8e590917729 Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Mon, 6 Apr 2015 03:14:58 +0200 Subject: Verify that database entry actually contains the certificate --- src/catlfish.erl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/catlfish.erl') 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()}. -- cgit v1.1