From f6d8e82e9c781b2cade1468460d7f84474200924 Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Tue, 23 Sep 2014 10:50:51 +0200 Subject: Actually serialise TLS vectors according to spec --- src/plop.erl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/plop.erl') 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), + <>. + -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), - <>; + DataVector = serialise_tls_vector(Data, 3), + <>; serialise(#timestamped_entry{ timestamp = Timestamp, entry = PlopEntry }) -> - list_to_binary([<>, serialise(PlopEntry)]); + Extensions = <<>>, + list_to_binary([<>, serialise(PlopEntry), serialise_tls_vector(Extensions, 2)]); serialise(#spt{ version = Version, logid = LogID, -- cgit v1.1