From b34ee8106923683ccb5128a5560a3b1dae105687 Mon Sep 17 00:00:00 2001 From: EKR Date: Thu, 15 Mar 2018 12:01:09 +0000 Subject: Bug 1446643 - Update to TLS 1.3 draft-26. r=mt - Update version number - Forbid negotiating < TLS 1.3 with supported_versions - Change to version number 0303 after HRR. Plus test - Update AAD. https://phabricator.services.mozilla.com/D753 --- cpputil/tls_parser.cc | 15 +++++++++++++++ cpputil/tls_parser.h | 1 + 2 files changed, 16 insertions(+) (limited to 'cpputil') diff --git a/cpputil/tls_parser.cc b/cpputil/tls_parser.cc index e4c06aa91..efedd7a65 100644 --- a/cpputil/tls_parser.cc +++ b/cpputil/tls_parser.cc @@ -46,6 +46,21 @@ bool TlsParser::Read(DataBuffer* val, size_t len) { return true; } +bool TlsParser::ReadFromMark(DataBuffer* val, size_t len, size_t mark) { + auto saved = offset_; + offset_ = mark; + + if (remaining() < len) { + offset_ = saved; + return false; + } + + val->Assign(ptr(), len); + + offset_ = saved; + return true; +} + bool TlsParser::ReadVariable(DataBuffer* val, size_t len_size) { uint32_t len; if (!Read(&len, len_size)) { diff --git a/cpputil/tls_parser.h b/cpputil/tls_parser.h index 436c11e76..56f562e07 100644 --- a/cpputil/tls_parser.h +++ b/cpputil/tls_parser.h @@ -123,6 +123,7 @@ class TlsParser { bool Read(uint32_t* val, size_t size); // Reads len bytes into dest buffer, overwriting it. bool Read(DataBuffer* dest, size_t len); + bool ReadFromMark(DataBuffer* val, size_t len, size_t mark); // Reads bytes into dest buffer, overwriting it. The number of bytes is // determined by reading from len_size bytes from the stream first. bool ReadVariable(DataBuffer* dest, size_t len_size); -- cgit v1.2.1