summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2014-09-23 10:50:51 +0200
committerMagnus Ahltorp <map@kth.se>2014-09-23 10:50:51 +0200
commitf6d8e82e9c781b2cade1468460d7f84474200924 (patch)
treea57b577ccd0e67c1420d5accdb137702501ace2b
parentc13074ac63ff2b37e4a42cedcb3222678e84fd9b (diff)
Actually serialise TLS vectors according to specfix-tls-vector
-rw-r--r--src/plop.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/plop.erl b/src/plop.erl
index 0cb29f5..39ab2c0 100644
--- a/src/plop.erl
+++ b/src/plop.erl
@@ -372,6 +372,10 @@ timestamp(Timestamp) ->
_ -> Timestamp
end.
+serialise_tls_vector(Binary, LengthLen) ->
+ Length = byte_size(Binary),
+ <<Length:LengthLen/integer-unit:8, Binary/binary>>.
+
-spec serialise(plop_entry() | timestamped_entry() | mtl() |
spt() | spt_signed() | sth() | sth_signed() |
sig_and_hash_alg() | signature()) -> binary().
@@ -380,12 +384,14 @@ serialise(#plop_entry{
data = Data
}) ->
EntryType = entry_type(TypeAtom),
- <<EntryType:16, Data/binary>>;
+ DataVector = serialise_tls_vector(Data, 3),
+ <<EntryType:16, DataVector/binary>>;
serialise(#timestamped_entry{
timestamp = Timestamp,
entry = PlopEntry
}) ->
- list_to_binary([<<Timestamp:64>>, serialise(PlopEntry)]);
+ Extensions = <<>>,
+ list_to_binary([<<Timestamp:64>>, serialise(PlopEntry), serialise_tls_vector(Extensions, 2)]);
serialise(#spt{
version = Version,
logid = LogID,