Skip to content

Commit

Permalink
Bug 1396487 - Record size limiting extension, r=ekr
Browse files Browse the repository at this point in the history
Summary: See draft-ietf-tls-record-limit for details.

Reviewers: ekr

Bug #: 1396487

Differential Revision: https://phabricator.services.mozilla.com/D23

--HG--
extra : rebase_source : 6ec3bafc76b0f1702772ddf54e9d67256fd73e7a
extra : amend_source : 4b77ad3d6d6d397cc5d18544ad94043b21cdb34a
  • Loading branch information
martinthomson committed Nov 24, 2017
1 parent a668594 commit 9a2290c
Show file tree
Hide file tree
Showing 21 changed files with 638 additions and 27 deletions.
1 change: 1 addition & 0 deletions gtests/ssl_gtest/manifest.mn
Expand Up @@ -36,6 +36,7 @@ CPPSRCS = \
ssl_loopback_unittest.cc \
ssl_misc_unittest.cc \
ssl_record_unittest.cc \
ssl_recordsize_unittest.cc \
ssl_resumption_unittest.cc \
ssl_renegotiation_unittest.cc \
ssl_skip_unittest.cc \
Expand Down
1 change: 1 addition & 0 deletions gtests/ssl_gtest/ssl_custext_unittest.cc
Expand Up @@ -68,6 +68,7 @@ static const uint16_t kManyExtensions[] = {
ssl_next_proto_nego_xtn,
ssl_renegotiation_info_xtn,
ssl_tls13_short_header_xtn,
ssl_record_size_limit_xtn,
1,
0xffff};
// The list here includes all extensions we expect to use (SSL_MAX_EXTENSIONS),
Expand Down
1 change: 1 addition & 0 deletions gtests/ssl_gtest/ssl_gtest.gyp
Expand Up @@ -37,6 +37,7 @@
'ssl_loopback_unittest.cc',
'ssl_misc_unittest.cc',
'ssl_record_unittest.cc',
'ssl_recordsize_unittest.cc',
'ssl_resumption_unittest.cc',
'ssl_renegotiation_unittest.cc',
'ssl_skip_unittest.cc',
Expand Down
13 changes: 4 additions & 9 deletions gtests/ssl_gtest/ssl_record_unittest.cc
Expand Up @@ -104,30 +104,25 @@ TEST_P(TlsPaddingTest, LastByteOfPadWrong) {
class RecordReplacer : public TlsRecordFilter {
public:
RecordReplacer(const std::shared_ptr<TlsAgent>& a, size_t size)
: TlsRecordFilter(a), enabled_(false), size_(size) {}
: TlsRecordFilter(a), size_(size) {
Disable();
}

PacketFilter::Action FilterRecord(const TlsRecordHeader& header,
const DataBuffer& data,
DataBuffer* changed) override {
if (!enabled_) {
return KEEP;
}

EXPECT_EQ(kTlsApplicationDataType, header.content_type());
changed->Allocate(size_);

for (size_t i = 0; i < size_; ++i) {
changed->data()[i] = i & 0xff;
}

enabled_ = false;
Disable();
return CHANGE;
}

void Enable() { enabled_ = true; }

private:
bool enabled_;
size_t size_;
};

Expand Down

0 comments on commit 9a2290c

Please sign in to comment.