From 8da0cd730c74436b8e390c75455dc2dbda7c7460 Mon Sep 17 00:00:00 2001
From: Linus Nordberg <linus@nordu.net>
Date: Thu, 16 Jul 2015 10:36:51 +0200
Subject: Have add_chain() take a blob instead of a cert leaf and a chain.

---
 src/catlfish.erl | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

(limited to 'src')

diff --git a/src/catlfish.erl b/src/catlfish.erl
index e48f788..35cee4e 100644
--- a/src/catlfish.erl
+++ b/src/catlfish.erl
@@ -2,7 +2,7 @@
 %%% See LICENSE for licensing information.
 
 -module(catlfish).
--export([add_chain/3, entries/2, entry_and_proof/2]).
+-export([add_chain/2, entries/2, entry_and_proof/2]).
 -export([known_roots/0, update_known_roots/0]).
 -export([init_cache_table/0]).
 -export([entryhash_from_entry/1, verify_entry/1, verify_entry/2]).
@@ -144,15 +144,15 @@ add_to_db(Type, LeafCert, CertChain, EntryHash) ->
 get_ratelimit_token(Type) ->
     ratelimit:get_token(Type).
 
--spec add_chain(binary(), [binary()], normal|precert) -> {[{_,_},...]}.
-add_chain(LeafCert, CertChain, Type) ->
-    EntryHash = crypto:hash(sha256, [LeafCert | CertChain]),
+-spec add_chain(binary(), normal) -> {[{_,_},...]}.
+add_chain(Blob, Type) ->
+    EntryHash = crypto:hash(sha256, Blob),
     {TimestampedEntry, Hash} =
         case plop:get(EntryHash) of
             notfound ->
                 case get_ratelimit_token(add_chain) of
                     ok ->
-                        add_to_db(Type, LeafCert, CertChain, EntryHash);
+                        add_to_db(Type, Blob, [], EntryHash);
                     _ ->
                         exit({internalerror, "Rate limiting"})
                 end;
-- 
cgit v1.1