summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2017-02-28 17:06:08 +0100
committerLinus Nordberg <linus@nordu.net>2017-02-28 17:06:08 +0100
commitbfdce2f5ca404c0c7c5dec43c22fa62b1bd4583f (patch)
treec6b6c43708fccd4c6b95bb8881d145273e38b755
parent88a9c02a19a9dabc375a40da8c8ed36c44807b65 (diff)
Rename a couple functions and variables; add two comments.
-rw-r--r--src/catlfish.erl25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/catlfish.erl b/src/catlfish.erl
index 04b3332..6d8d430 100644
--- a/src/catlfish.erl
+++ b/src/catlfish.erl
@@ -103,9 +103,9 @@ sct_data(TimestampedEntry) ->
serialise_signature_type(certificate_timestamp),
serialise(TimestampedEntry)]).
-calc_sct(TimestampedEntry, Signatures) ->
+calc_sct_sig(TimestampedEntry, Signatures) ->
plop:serialise(
- plop:spt(sct_data(TimestampedEntry), Signatures)).
+ plop:spt_sig(sct_data(TimestampedEntry), Signatures)).
create_logentry(Type, LeafCert, CertChain) ->
EntryType = case Type of
@@ -126,16 +126,21 @@ get_ratelimit_token(Type) ->
maybe_add_to_db(Hash, LogEntry, TimestampedEntry, HasEntry) ->
- CachedSCTSig = plop:get_spt(Hash),
-
- case {HasEntry, CachedSCTSig} of
- {true, SCT} when is_binary(SCT) ->
- SCT;
+ CachedSCTSig = plop:get_spt_sig(Hash),
+ HasSig = is_binary(CachedSCTSig),
+
+ case {HasEntry, HasSig} of
+ {true, true} ->
+ %% Entry is present in the database and a signature was
+ %% found in the SCT cache.
+ CachedSCTSig;
_ ->
+ %% We don't have the entry or we don't have the SCT in the
+ %% cache.
{ok, Signatures} = plop:add(LogEntry, Hash),
- SCT = calc_sct(TimestampedEntry, Signatures),
- plop:add_spt(Hash, SCT),
- SCT
+ SCT_sig = calc_sct_sig(TimestampedEntry, Signatures),
+ ok = plop:add_spt_sig(Hash, SCT_sig),
+ SCT_sig
end.
-spec add_chain(binary(), [binary()], normal|precert) -> {[{_,_},...]}.