From 7062a5789410e34a4ca4d16786a4f46983acf893 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Mon, 19 May 2014 16:24:38 +0200 Subject: Change default protocol version from 1 to 0. RFC6962 "v1" is 0, not 1. Also, use a define and not a literal. Also also, move the define to plop.hrl. --- include/plop.hrl | 4 +++- src/plop.erl | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/plop.hrl b/include/plop.hrl index 354a0f2..b1b4661 100644 --- a/include/plop.hrl +++ b/include/plop.hrl @@ -2,6 +2,8 @@ %%% database storage, some for interfacing with consumers and some are %%% for serialisation. +-define(PLOPVERSION, 0). + -type signature_type() :: certificate_timestamp | tree_hash | test. % uint8 -type entry_type() :: x509 | precert | test. % uint16 -type leaf_type() :: timestamped_entry | test. % uint8 @@ -10,7 +12,7 @@ %% get-entries requests and also the input to the hash function for %% leaf hashes in the tree. RFC 6962 sect 3.4. -record(mtl, { - version = 1 :: pos_integer(), + version = ?PLOPVERSION :: pos_integer(), leaf_type = timestamped_entry :: leaf_type(), entry :: timestamped_entry() }). diff --git a/src/plop.erl b/src/plop.erl index eb16aa8..d7d25ba 100644 --- a/src/plop.erl +++ b/src/plop.erl @@ -27,7 +27,6 @@ -include_lib("public_key/include/public_key.hrl"). -include_lib("eunit/include/eunit.hrl"). --define(PLOPVERSION, 1). -define(TESTPRIVKEYFILE, "test/eckey.pem"). -define(TESTPUBKEYFILE, "test/eckey-public.pem"). @@ -39,7 +38,7 @@ %% @doc The parts of an STH which is to be signed. Used as the %% interface to plop:sth/1, for testing. -record(sth_signed, { - version = 1 :: pos_integer(), + version = ?PLOPVERSION :: pos_integer(), signature_type :: signature_type(), timestamp = now :: 'now' | integer(), tree_size :: integer(), @@ -50,7 +49,7 @@ %% @doc What's signed in an SPT. Used for serialisation before hasning %% and signing. FIXME: Overlapping #spt{} -- merge somehow? -record(spt_signed, { - version :: pos_integer(), + version = ?PLOPVERSION :: pos_integer(), signature_type :: signature_type(), timestamp :: integer(), entry_type :: entry_type(), @@ -180,7 +179,6 @@ spt(LogID, PrivKey, #timestamped_entry{ }) -> BinToSign = list_to_binary(serialise(#spt_signed{ - version = 1, signature_type = certificate_timestamp, timestamp = Timestamp, entry_type = EntryType, -- cgit v1.1