diff options
author | Magnus Ahltorp <map@kth.se> | 2014-09-23 10:50:51 +0200 |
---|---|---|
committer | Magnus Ahltorp <map@kth.se> | 2014-09-23 10:50:51 +0200 |
commit | f6d8e82e9c781b2cade1468460d7f84474200924 (patch) | |
tree | a57b577ccd0e67c1420d5accdb137702501ace2b /src | |
parent | c13074ac63ff2b37e4a42cedcb3222678e84fd9b (diff) |
Actually serialise TLS vectors according to specfix-tls-vector
Diffstat (limited to 'src')
-rw-r--r-- | src/plop.erl | 10 |
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, |