summaryrefslogtreecommitdiff
path: root/src/plop.hrl
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2014-04-26 19:01:41 +0200
committerLinus Nordberg <linus@nordu.net>2014-04-26 19:01:41 +0200
commit2f733d1018c9602ecf8bac5e2516e69285120563 (patch)
tree767f19ac68b924e07a02fe8943ce51be081380cb /src/plop.hrl
parentd87227c82699ec3eefed4708a7c38df2c6e877cd (diff)
Add STH support, with failing tests due to gen_server testing woes.
Move things out of spt() for reuse by sth().
Diffstat (limited to 'src/plop.hrl')
-rw-r--r--src/plop.hrl30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/plop.hrl b/src/plop.hrl
index bfd900b..7275f5a 100644
--- a/src/plop.hrl
+++ b/src/plop.hrl
@@ -1,21 +1,29 @@
-%% A plop_entry has a type and some data.
-%% A plop_data record has the meta data necessary for constructing a
-%% signed timestamp.
+-type signature_type() :: certificate_timestamp | tree_hash | test.
+-type entry_type() :: x509 | precert | test.
--record(plop_data, {
+%% @doc The parts of an SPT which is to be signed.
+-record(spt, {
version = 1 :: integer(),
- signature_type = certificate_timestamp :: certificate_timestamp |
- tree_hash |
- test,
+ signature_type :: signature_type(),
timestamp = now :: 'now' | integer(),
entry :: plop_entry()
}).
+-type spt() :: #spt{}.
+
-record(plop_entry, {
- type = x509 :: x509 | precert | test,
+ type :: entry_type(),
data = <<>> :: binary()
}).
-
--type plop_data() :: #plop_data{}.
-type plop_entry() :: #plop_entry{}.
--export_type([plop_data/0, plop_entry/0]).
+%% @doc The parts of an STH which is to be signed.
+-record(sth, {
+ version = 1 :: integer(),
+ signature_type :: signature_type(),
+ timestamp = now :: 'now' | integer(),
+ tree_size :: integer(),
+ root_hash :: binary() % sha256
+ }).
+-type sth() :: #sth{}.
+
+-export_type([plop_entry/0, entry_type/0]).