diff --git a/quic/QuicConstants.h b/quic/QuicConstants.h index ed6434804..f7e57a1f8 100644 --- a/quic/QuicConstants.h +++ b/quic/QuicConstants.h @@ -35,6 +35,7 @@ using SystemClock = folly::chrono::SystemClock; namespace quic { +using ByteRange = folly::ByteRange; using BufHelpers = folly::IOBuf; // For stuff like BufHelpers::create, etc. using Buf = folly::IOBuf; // Used when we're not wrapping the buffer in an // std::unique_ptr diff --git a/quic/api/QuicSocketLite.h b/quic/api/QuicSocketLite.h index a8c26567a..c6c772c80 100644 --- a/quic/api/QuicSocketLite.h +++ b/quic/api/QuicSocketLite.h @@ -866,7 +866,7 @@ class QuicSocketLite { */ virtual Optional> getExportedKeyingMaterial( const std::string& label, - const Optional& context, + const Optional& context, uint16_t keyLength) const = 0; /** diff --git a/quic/api/test/MockQuicSocket.h b/quic/api/test/MockQuicSocket.h index 30b410a63..fa71dfc64 100644 --- a/quic/api/test/MockQuicSocket.h +++ b/quic/api/test/MockQuicSocket.h @@ -51,7 +51,7 @@ class MockQuicSocket : public QuicSocket { MOCK_METHOD( (Optional>), getExportedKeyingMaterial, - (const std::string&, const Optional&, uint16_t), + (const std::string&, const Optional&, uint16_t), (const)); MOCK_METHOD(std::shared_ptr, getEventBase, (), (const)); MOCK_METHOD( diff --git a/quic/api/test/QuicBatchWriterTest.cpp b/quic/api/test/QuicBatchWriterTest.cpp index 23114c7a9..c340042a4 100644 --- a/quic/api/test/QuicBatchWriterTest.cpp +++ b/quic/api/test/QuicBatchWriterTest.cpp @@ -281,7 +281,7 @@ TEST_F(QuicBatchWriterTest, TestBatchingSendmmsgInplaceIovecMatches) { size_t size = 0; for (auto& message : messages) { auto buf = folly::IOBuf::copyBuffer( - folly::ByteRange((unsigned char*)message.data(), message.size())); + ByteRange((unsigned char*)message.data(), message.size())); batchWriter->append( std::move(buf), message.size(), folly::SocketAddress(), nullptr); size += message.size(); @@ -306,7 +306,7 @@ TEST_F(QuicBatchWriterTest, TestBatchingSendmmsgInplaceIovecMatches) { folly::IOBufEqualTo eq; EXPECT_TRUE( eq(wrappedIovBuffer, - folly::IOBuf::copyBuffer(folly::ByteRange( + folly::IOBuf::copyBuffer(ByteRange( (unsigned char*)messages[i].data(), messages[i].size())))); } @@ -356,8 +356,8 @@ TEST_F(QuicBatchWriterTest, TestBatchingSendmmsgNewlyAllocatedIovecMatches) { for (auto& message : messages) { auto buf = std::make_unique(); for (size_t j = 0; j < message.size(); j++) { - auto partBuf = folly::IOBuf::copyBuffer(folly::ByteRange( - (unsigned char*)message[j].data(), message[j].size())); + auto partBuf = folly::IOBuf::copyBuffer( + ByteRange((unsigned char*)message[j].data(), message[j].size())); buf->appendToChain(std::move(partBuf)); } buffers.emplace_back(std::move(buf)); diff --git a/quic/api/test/QuicTransportBaseTest.cpp b/quic/api/test/QuicTransportBaseTest.cpp index e2c29694d..892fb9d7f 100644 --- a/quic/api/test/QuicTransportBaseTest.cpp +++ b/quic/api/test/QuicTransportBaseTest.cpp @@ -603,7 +603,7 @@ class TestQuicTransport Optional> getExportedKeyingMaterial( const std::string&, - const Optional&, + const Optional&, uint16_t) const override { return none; } diff --git a/quic/api/test/QuicTransportFunctionsTest.cpp b/quic/api/test/QuicTransportFunctionsTest.cpp index bd3cdc673..ae89d156d 100644 --- a/quic/api/test/QuicTransportFunctionsTest.cpp +++ b/quic/api/test/QuicTransportFunctionsTest.cpp @@ -293,15 +293,14 @@ TEST_F(QuicTransportFunctionsTest, TestUpdateConnection) { EXPECT_EQ(rt1.offset, 0); std::string expected = "hey w"; EXPECT_EQ( - folly::ByteRange((uint8_t*)expected.data(), expected.size()), + ByteRange((uint8_t*)expected.data(), expected.size()), rt1.data.getHead()->getRange()); EXPECT_EQ(stream2->retransmissionBuffer.size(), 1); auto& rt2 = *stream2->retransmissionBuffer.at(0); EXPECT_EQ(rt2.offset, 0); EXPECT_EQ( - folly::ByteRange(buf->buffer(), buf->length()), - rt2.data.getHead()->getRange()); + ByteRange(buf->buffer(), buf->length()), rt2.data.getHead()->getRange()); EXPECT_TRUE(rt2.eof); // Testing retransmission @@ -358,13 +357,13 @@ TEST_F(QuicTransportFunctionsTest, TestUpdateConnection) { auto& rt3 = *stream1->retransmissionBuffer.at(5); expected = "hats up"; EXPECT_EQ( - folly::ByteRange((uint8_t*)expected.data(), expected.size()), + ByteRange((uint8_t*)expected.data(), expected.size()), rt3.data.getHead()->getRange()); auto& rt4 = *stream1->retransmissionBuffer.at(0); expected = "hey w"; EXPECT_EQ( - folly::ByteRange((uint8_t*)expected.data(), expected.size()), + ByteRange((uint8_t*)expected.data(), expected.size()), rt4.data.getHead()->getRange()); // loss buffer should be split into 2. Part in retransmission buffer and @@ -374,7 +373,7 @@ TEST_F(QuicTransportFunctionsTest, TestUpdateConnection) { auto& rt5 = *stream2->retransmissionBuffer.at(0); expected = "hey wh"; EXPECT_EQ( - folly::ByteRange((uint8_t*)expected.data(), expected.size()), + ByteRange((uint8_t*)expected.data(), expected.size()), rt5.data.getHead()->getRange()); EXPECT_EQ(rt5.offset, 0); EXPECT_EQ(rt5.eof, 0); @@ -382,7 +381,7 @@ TEST_F(QuicTransportFunctionsTest, TestUpdateConnection) { auto& rt6 = stream2->lossBuffer.front(); expected = "ats up"; EXPECT_EQ( - folly::ByteRange((uint8_t*)expected.data(), expected.size()), + ByteRange((uint8_t*)expected.data(), expected.size()), rt6.data.getHead()->getRange()); EXPECT_EQ(rt6.offset, 6); EXPECT_EQ(rt6.eof, 1); @@ -494,8 +493,7 @@ TEST_F(QuicTransportFunctionsTest, TestUpdateConnectionPacketRetrans) { auto& rt = *stream1->retransmissionBuffer.at(0); EXPECT_EQ(rt.offset, 0); EXPECT_EQ( - folly::ByteRange(buf->data(), buf->length()), - rt.data.getHead()->getRange()); + ByteRange(buf->data(), buf->length()), rt.data.getHead()->getRange()); EXPECT_TRUE(rt.eof); stream1->lossBuffer.push_back(std::move(rt)); } @@ -504,8 +502,7 @@ TEST_F(QuicTransportFunctionsTest, TestUpdateConnectionPacketRetrans) { auto& rt = *stream2->retransmissionBuffer.at(0); EXPECT_EQ(rt.offset, 0); EXPECT_EQ( - folly::ByteRange(buf->data(), buf->length()), - rt.data.getHead()->getRange()); + ByteRange(buf->data(), buf->length()), rt.data.getHead()->getRange()); EXPECT_TRUE(rt.eof); stream2->lossBuffer.push_back(std::move(rt)); } @@ -670,8 +667,7 @@ TEST_F( auto& rt = *stream1->retransmissionBuffer.at(0); EXPECT_EQ(rt.offset, 0); EXPECT_EQ( - folly::ByteRange(buf->data(), buf->length()), - rt.data.getHead()->getRange()); + ByteRange(buf->data(), buf->length()), rt.data.getHead()->getRange()); EXPECT_TRUE(rt.eof); stream1->lossBuffer.push_back(std::move(rt)); } @@ -681,7 +677,7 @@ TEST_F( EXPECT_EQ(rt.offset, 0); auto expectedBuf = IOBuf::copyBuffer("hey w"); EXPECT_EQ( - folly::ByteRange(expectedBuf->data(), expectedBuf->length()), + ByteRange(expectedBuf->data(), expectedBuf->length()), rt.data.getHead()->getRange()); EXPECT_FALSE(rt.eof); stream2->lossBuffer.push_back(std::move(rt)); @@ -691,8 +687,7 @@ TEST_F( auto& rt = *stream3->retransmissionBuffer.at(0); EXPECT_EQ(rt.offset, 0); EXPECT_EQ( - folly::ByteRange(buf->data(), buf->length()), - rt.data.getHead()->getRange()); + ByteRange(buf->data(), buf->length()), rt.data.getHead()->getRange()); EXPECT_FALSE(rt.eof); stream3->lossBuffer.push_back(std::move(rt)); } diff --git a/quic/api/test/TestQuicTransport.h b/quic/api/test/TestQuicTransport.h index 25d92fa21..114e9c962 100644 --- a/quic/api/test/TestQuicTransport.h +++ b/quic/api/test/TestQuicTransport.h @@ -200,7 +200,7 @@ class TestQuicTransport Optional> getExportedKeyingMaterial( const std::string&, - const Optional&, + const Optional&, uint16_t) const override { return none; } diff --git a/quic/client/QuicClientTransportLite.h b/quic/client/QuicClientTransportLite.h index 02834b21f..437abac6b 100644 --- a/quic/client/QuicClientTransportLite.h +++ b/quic/client/QuicClientTransportLite.h @@ -113,7 +113,7 @@ class QuicClientTransportLite */ Optional> getExportedKeyingMaterial( const std::string& label, - const Optional& context, + const Optional& context, uint16_t keyLength) const override { return clientConn_->clientHandshakeLayer->getExportedKeyingMaterial( label, context, keyLength); diff --git a/quic/client/handshake/ClientHandshake.cpp b/quic/client/handshake/ClientHandshake.cpp index ad77bf161..c69863100 100644 --- a/quic/client/handshake/ClientHandshake.cpp +++ b/quic/client/handshake/ClientHandshake.cpp @@ -153,7 +153,7 @@ bool ClientHandshake::waitingForData() const { return waitForData_; } -void ClientHandshake::computeCiphers(CipherKind kind, folly::ByteRange secret) { +void ClientHandshake::computeCiphers(CipherKind kind, ByteRange secret) { std::unique_ptr aead = buildAead(kind, secret); std::unique_ptr packetNumberCipher = buildHeaderCipher(secret); diff --git a/quic/client/handshake/ClientHandshake.h b/quic/client/handshake/ClientHandshake.h index 325766e4a..950cc4444 100644 --- a/quic/client/handshake/ClientHandshake.h +++ b/quic/client/handshake/ClientHandshake.h @@ -145,7 +145,7 @@ class ClientHandshake : public Handshake { ZeroRttWrite, }; - void computeCiphers(CipherKind kind, folly::ByteRange secret); + void computeCiphers(CipherKind kind, ByteRange secret); /** * Various utilities for concrete implementations to use. @@ -176,7 +176,7 @@ class ClientHandshake : public Handshake { * Given secret_n, returns secret_n+1 to be used for generating the next Aead * on key updates. */ - virtual BufPtr getNextTrafficSecret(folly::ByteRange secret) const = 0; + virtual BufPtr getNextTrafficSecret(ByteRange secret) const = 0; BufPtr readTrafficSecret_; BufPtr writeTrafficSecret_; @@ -192,9 +192,9 @@ class ClientHandshake : public Handshake { virtual bool matchEarlyParameters() = 0; virtual std::unique_ptr buildAead( CipherKind kind, - folly::ByteRange secret) = 0; + ByteRange secret) = 0; virtual std::unique_ptr buildHeaderCipher( - folly::ByteRange secret) = 0; + ByteRange secret) = 0; // Represents the packet type that should be used to write the data currently // in the stream. diff --git a/quic/client/test/Mocks.h b/quic/client/test/Mocks.h index 457cfcb74..7a62bebea 100644 --- a/quic/client/test/Mocks.h +++ b/quic/client/test/Mocks.h @@ -62,7 +62,7 @@ class MockClientHandshake : public ClientHandshake { Optional>, getExportedKeyingMaterial, (const std::string& label, - const Optional& context, + const Optional& context, uint16_t keyLength), ()); MOCK_METHOD(Optional, getZeroRttRejected, ()); @@ -82,12 +82,12 @@ class MockClientHandshake : public ClientHandshake { MOCK_METHOD( std::unique_ptr, buildAead, - (ClientHandshake::CipherKind kind, folly::ByteRange secret)); + (ClientHandshake::CipherKind kind, ByteRange secret)); MOCK_METHOD( std::unique_ptr, buildHeaderCipher, - (folly::ByteRange secret)); - MOCK_METHOD(BufPtr, getNextTrafficSecret, (folly::ByteRange secret), (const)); + (ByteRange secret)); + MOCK_METHOD(BufPtr, getNextTrafficSecret, (ByteRange secret), (const)); MOCK_METHOD( const Optional&, getApplicationProtocol, diff --git a/quic/codec/Decode.cpp b/quic/codec/Decode.cpp index be8b7c122..c1859be7f 100644 --- a/quic/codec/Decode.cpp +++ b/quic/codec/Decode.cpp @@ -50,7 +50,7 @@ folly::Expected decodePaddingFrame( // Let's consume all the padding and return 1 padding frame for everything. static_assert( static_cast(FrameType::PADDING) == 0, "Padding value is 0"); - folly::ByteRange paddingBytes = cursor.peekBytes(); + ByteRange paddingBytes = cursor.peekBytes(); if (paddingBytes.size() == 0) { return PaddingFrame(); } @@ -1337,7 +1337,7 @@ size_t parsePacketNumberLength(uint8_t initialByte) { */ std::pair parsePacketNumber( uint8_t initialByte, - folly::ByteRange packetNumberRange, + ByteRange packetNumberRange, PacketNum expectedNextPacketNum) { size_t packetNumLen = parsePacketNumberLength(initialByte); uint32_t encodedPacketNum = 0; diff --git a/quic/codec/Decode.h b/quic/codec/Decode.h index 8d443d9d2..72cffccf9 100644 --- a/quic/codec/Decode.h +++ b/quic/codec/Decode.h @@ -242,7 +242,7 @@ size_t parsePacketNumberLength(uint8_t initialByte); */ std::pair parsePacketNumber( uint8_t initialByte, - folly::ByteRange packetNumberRange, + ByteRange packetNumberRange, PacketNum expectedNextPacketNum); // cursor: has to be point to the byte just past initialByte diff --git a/quic/codec/PacketNumberCipher.cpp b/quic/codec/PacketNumberCipher.cpp index 0932b2d8d..af29b0d80 100644 --- a/quic/codec/PacketNumberCipher.cpp +++ b/quic/codec/PacketNumberCipher.cpp @@ -14,7 +14,7 @@ namespace quic { void PacketNumberCipher::decipherHeader( - folly::ByteRange sample, + ByteRange sample, folly::MutableByteRange initialByte, folly::MutableByteRange packetNumberBytes, uint8_t initialByteMask, @@ -31,7 +31,7 @@ void PacketNumberCipher::decipherHeader( } void PacketNumberCipher::cipherHeader( - folly::ByteRange sample, + ByteRange sample, folly::MutableByteRange initialByte, folly::MutableByteRange packetNumberBytes, uint8_t initialByteMask, @@ -47,7 +47,7 @@ void PacketNumberCipher::cipherHeader( } void PacketNumberCipher::decryptLongHeader( - folly::ByteRange sample, + ByteRange sample, folly::MutableByteRange initialByte, folly::MutableByteRange packetNumberBytes) const { decipherHeader( @@ -59,7 +59,7 @@ void PacketNumberCipher::decryptLongHeader( } void PacketNumberCipher::decryptShortHeader( - folly::ByteRange sample, + ByteRange sample, folly::MutableByteRange initialByte, folly::MutableByteRange packetNumberBytes) const { decipherHeader( @@ -71,7 +71,7 @@ void PacketNumberCipher::decryptShortHeader( } void PacketNumberCipher::encryptLongHeader( - folly::ByteRange sample, + ByteRange sample, folly::MutableByteRange initialByte, folly::MutableByteRange packetNumberBytes) const { cipherHeader( @@ -83,7 +83,7 @@ void PacketNumberCipher::encryptLongHeader( } void PacketNumberCipher::encryptShortHeader( - folly::ByteRange sample, + ByteRange sample, folly::MutableByteRange initialByte, folly::MutableByteRange packetNumberBytes) const { cipherHeader( diff --git a/quic/codec/PacketNumberCipher.h b/quic/codec/PacketNumberCipher.h index f9ec1daee..65c8e36a9 100644 --- a/quic/codec/PacketNumberCipher.h +++ b/quic/codec/PacketNumberCipher.h @@ -20,9 +20,9 @@ class PacketNumberCipher { public: virtual ~PacketNumberCipher() = default; - virtual void setKey(folly::ByteRange key) = 0; + virtual void setKey(ByteRange key) = 0; - virtual HeaderProtectionMask mask(folly::ByteRange sample) const = 0; + virtual HeaderProtectionMask mask(ByteRange sample) const = 0; /** * Decrypts a long header from a sample. @@ -31,7 +31,7 @@ class PacketNumberCipher { * packetNumberBytes should be supplied with at least 4 bytes. */ virtual void decryptLongHeader( - folly::ByteRange sample, + ByteRange sample, folly::MutableByteRange initialByte, folly::MutableByteRange packetNumberBytes) const; @@ -42,7 +42,7 @@ class PacketNumberCipher { * packetNumberBytes should be supplied with at least 4 bytes. */ virtual void decryptShortHeader( - folly::ByteRange sample, + ByteRange sample, folly::MutableByteRange initialByte, folly::MutableByteRange packetNumberBytes) const; @@ -52,7 +52,7 @@ class PacketNumberCipher { * initialByte is the initial byte. */ virtual void encryptLongHeader( - folly::ByteRange sample, + ByteRange sample, folly::MutableByteRange initialByte, folly::MutableByteRange packetNumberBytes) const; @@ -62,7 +62,7 @@ class PacketNumberCipher { * initialByte is the initial byte. */ virtual void encryptShortHeader( - folly::ByteRange sample, + ByteRange sample, folly::MutableByteRange initialByte, folly::MutableByteRange packetNumberBytes) const; @@ -78,14 +78,14 @@ class PacketNumberCipher { protected: virtual void cipherHeader( - folly::ByteRange sample, + ByteRange sample, folly::MutableByteRange initialByte, folly::MutableByteRange packetNumberBytes, uint8_t initialByteMask, uint8_t packetNumLengthMask) const; virtual void decipherHeader( - folly::ByteRange sample, + ByteRange sample, folly::MutableByteRange initialByte, folly::MutableByteRange packetNumberBytes, uint8_t initialByteMask, diff --git a/quic/codec/QuicConnectionId.cpp b/quic/codec/QuicConnectionId.cpp index cb5940ab9..2c79d8a49 100644 --- a/quic/codec/QuicConnectionId.cpp +++ b/quic/codec/QuicConnectionId.cpp @@ -25,7 +25,7 @@ uint8_t ConnectionId::size() const { } std::string ConnectionId::hex() const { - return folly::hexlify(folly::ByteRange(connid.data(), connidLen)); + return folly::hexlify(ByteRange(connid.data(), connidLen)); } ConnectionId::ConnectionId(const std::vector& connidIn) { diff --git a/quic/codec/QuicReadCodec.cpp b/quic/codec/QuicReadCodec.cpp index 0ec3308db..886f1b616 100644 --- a/quic/codec/QuicReadCodec.cpp +++ b/quic/codec/QuicReadCodec.cpp @@ -290,8 +290,7 @@ CodecResult QuicReadCodec::tryParseShortHeaderPacket( folly::MutableByteRange initialByteRange(data->writableData(), 1); folly::MutableByteRange packetNumberByteRange( data->writableData() + packetNumberOffset, kMaxPacketNumEncodingSize); - folly::ByteRange sampleByteRange( - data->writableData() + sampleOffset, sample.size()); + ByteRange sampleByteRange(data->writableData() + sampleOffset, sample.size()); oneRttHeaderCipher_->decryptShortHeader( sampleByteRange, initialByteRange, packetNumberByteRange); @@ -447,8 +446,8 @@ CodecResult QuicReadCodec::parsePacket( } // Only allocate & copy the token if it matches the token we have if (cryptoEqual_( - folly::ByteRange(tokenSource, sizeof(StatelessResetToken)), - folly::ByteRange( + ByteRange(tokenSource, sizeof(StatelessResetToken)), + ByteRange( statelessResetToken_->data(), sizeof(StatelessResetToken)))) { token = StatelessResetToken(); memcpy(token->data(), tokenSource, token->size()); @@ -569,7 +568,7 @@ void QuicReadCodec::setStatelessResetToken( } void QuicReadCodec::setCryptoEqual( - std::function cryptoEqual) { + std::function cryptoEqual) { cryptoEqual_ = std::move(cryptoEqual); } diff --git a/quic/codec/QuicReadCodec.h b/quic/codec/QuicReadCodec.h index 2d7e68e18..0de16d8c7 100644 --- a/quic/codec/QuicReadCodec.h +++ b/quic/codec/QuicReadCodec.h @@ -166,8 +166,7 @@ class QuicReadCodec { void setClientConnectionId(ConnectionId connId); void setServerConnectionId(ConnectionId connId); void setStatelessResetToken(StatelessResetToken statelessResetToken); - void setCryptoEqual( - std::function cryptoEqual); + void setCryptoEqual(std::function cryptoEqual); const ConnectionId& getClientConnectionId() const; const ConnectionId& getServerConnectionId() const; @@ -237,7 +236,7 @@ class QuicReadCodec { std::unique_ptr handshakeHeaderCipher_; Optional statelessResetToken_; - std::function cryptoEqual_; + std::function cryptoEqual_; Optional handshakeDoneTime_; QuicTransportStatsCallback* statsCallback_{nullptr}; diff --git a/quic/common/ChainedByteRange.cpp b/quic/common/ChainedByteRange.cpp index 992baebd4..f44469d48 100644 --- a/quic/common/ChainedByteRange.cpp +++ b/quic/common/ChainedByteRange.cpp @@ -127,7 +127,7 @@ ChainedByteRangeHead ChainedByteRangeHead::splitAtMost(size_t len) { if (head_.length() > len) { // Just need to trim a little off the head. ret.head_.range_ = - folly::ByteRange(head_.range_.begin(), head_.range_.begin() + len); + ByteRange(head_.range_.begin(), head_.range_.begin() + len); ret.head_.next_ = nullptr; ret.tail_ = &ret.head_; head_.trimStart(len); @@ -184,9 +184,9 @@ ChainedByteRangeHead ChainedByteRangeHead::splitAtMost(size_t len) { */ ret.head_.range_ = head_.range_; head_.range_ = - folly::ByteRange(current->range_.begin() + len, current->range_.end()); - current->range_ = folly::ByteRange( - current->range_.begin(), current->range_.begin() + len); + ByteRange(current->range_.begin() + len, current->range_.end()); + current->range_ = + ByteRange(current->range_.begin(), current->range_.begin() + len); ret.head_.next_ = head_.next_; ret.tail_ = current; diff --git a/quic/common/ChainedByteRange.h b/quic/common/ChainedByteRange.h index ce17a9d95..be779c302 100644 --- a/quic/common/ChainedByteRange.h +++ b/quic/common/ChainedByteRange.h @@ -30,7 +30,7 @@ class ChainedByteRangeHead { public: ChainedByteRange() = default; - explicit ChainedByteRange(folly::ByteRange range) : range_(range) {} + explicit ChainedByteRange(ByteRange range) : range_(range) {} /** * Returns the length only of this ChainedByteRange @@ -47,7 +47,7 @@ class ChainedByteRangeHead { range_.advance(n); } - [[nodiscard]] folly::ByteRange getRange() const { + [[nodiscard]] ByteRange getRange() const { return range_; } @@ -56,7 +56,7 @@ class ChainedByteRangeHead { } private: - folly::ByteRange range_; + ByteRange range_; ChainedByteRange* next_{nullptr}; friend class ChainedByteRangeHead; }; diff --git a/quic/common/test/TestUtils.cpp b/quic/common/test/TestUtils.cpp index 71f15efa3..c761f11e9 100644 --- a/quic/common/test/TestUtils.cpp +++ b/quic/common/test/TestUtils.cpp @@ -778,7 +778,7 @@ FizzCryptoTestFactory::makePacketNumberCipher(fizz::CipherSuite) const { } std::unique_ptr -FizzCryptoTestFactory::makePacketNumberCipher(folly::ByteRange secret) const { +FizzCryptoTestFactory::makePacketNumberCipher(ByteRange secret) const { return _makePacketNumberCipher(secret); } @@ -789,7 +789,7 @@ void FizzCryptoTestFactory::setMockPacketNumberCipher( void FizzCryptoTestFactory::setDefault() { ON_CALL(*this, _makePacketNumberCipher(_)) - .WillByDefault(Invoke([&](folly::ByteRange secret) { + .WillByDefault(Invoke([&](ByteRange secret) { return FizzCryptoFactory::makePacketNumberCipher(secret); })); } diff --git a/quic/common/test/TestUtils.h b/quic/common/test/TestUtils.h index 774ebe407..0e4f9066d 100644 --- a/quic/common/test/TestUtils.h +++ b/quic/common/test/TestUtils.h @@ -354,11 +354,11 @@ class FizzCryptoTestFactory : public FizzCryptoFactory { MOCK_METHOD( std::unique_ptr, _makePacketNumberCipher, - (folly::ByteRange), + (ByteRange), (const)); std::unique_ptr makePacketNumberCipher( - folly::ByteRange secret) const override; + ByteRange secret) const override; void setMockPacketNumberCipher( std::unique_ptr packetNumberCipher); @@ -553,11 +553,11 @@ class FakeServerHandshake : public FizzServerHandshake { writeTrafficSecret_ = folly::IOBuf::copyBuffer(getRandSecret()); } - std::unique_ptr buildAead(folly::ByteRange /*secret*/) override { + std::unique_ptr buildAead(ByteRange /*secret*/) override { return createNoOpAead(); } - BufPtr getNextTrafficSecret(folly::ByteRange /*secret*/) const override { + BufPtr getNextTrafficSecret(ByteRange /*secret*/) const override { return folly::IOBuf::copyBuffer(getRandSecret()); } diff --git a/quic/fizz/client/handshake/FizzClientHandshake.cpp b/quic/fizz/client/handshake/FizzClientHandshake.cpp index 3ab20a75b..f745415b1 100644 --- a/quic/fizz/client/handshake/FizzClientHandshake.cpp +++ b/quic/fizz/client/handshake/FizzClientHandshake.cpp @@ -140,7 +140,7 @@ bool FizzClientHandshake::isTLSResumed() const { Optional> FizzClientHandshake::getExportedKeyingMaterial( const std::string& label, - const Optional& context, + const Optional& context, uint16_t keyLength) { const auto& ems = state_.exporterMasterSecret(); const auto cipherSuite = state_.cipher(); @@ -176,7 +176,7 @@ bool FizzClientHandshake::matchEarlyParameters() { std::unique_ptr FizzClientHandshake::buildAead( CipherKind kind, - folly::ByteRange secret) { + ByteRange secret) { bool isEarlyTraffic = kind == CipherKind::ZeroRttWrite; fizz::CipherSuite cipher = isEarlyTraffic ? state_.earlyDataParams()->cipher : *state_.cipher(); @@ -198,12 +198,11 @@ std::unique_ptr FizzClientHandshake::buildAead( } std::unique_ptr FizzClientHandshake::buildHeaderCipher( - folly::ByteRange secret) { + ByteRange secret) { return cryptoFactory_->makePacketNumberCipher(secret); } -BufPtr FizzClientHandshake::getNextTrafficSecret( - folly::ByteRange secret) const { +BufPtr FizzClientHandshake::getNextTrafficSecret(ByteRange secret) const { auto deriver = state_.context()->getFactory()->makeKeyDeriver(*state_.cipher()); auto nextSecret = deriver->expandLabel( diff --git a/quic/fizz/client/handshake/FizzClientHandshake.h b/quic/fizz/client/handshake/FizzClientHandshake.h index f1e05cf82..056ccdf03 100644 --- a/quic/fizz/client/handshake/FizzClientHandshake.h +++ b/quic/fizz/client/handshake/FizzClientHandshake.h @@ -41,7 +41,7 @@ class FizzClientHandshake : public ClientHandshake { Optional> getExportedKeyingMaterial( const std::string& label, - const Optional& context, + const Optional& context, uint16_t keyLength) override; const fizz::client::State& getState() const { @@ -75,11 +75,10 @@ class FizzClientHandshake : public ClientHandshake { EncryptionLevel getReadRecordLayerEncryptionLevel() override; void processSocketData(folly::IOBufQueue& queue) override; bool matchEarlyParameters() override; - std::unique_ptr buildAead(CipherKind kind, folly::ByteRange secret) - override; + std::unique_ptr buildAead(CipherKind kind, ByteRange secret) override; std::unique_ptr buildHeaderCipher( - folly::ByteRange secret) override; - BufPtr getNextTrafficSecret(folly::ByteRange secret) const override; + ByteRange secret) override; + BufPtr getNextTrafficSecret(ByteRange secret) const override; class ActionMoveVisitor; void processActions(fizz::client::Actions actions); diff --git a/quic/fizz/client/handshake/test/FizzClientHandshakeTest.cpp b/quic/fizz/client/handshake/test/FizzClientHandshakeTest.cpp index 57b2ef599..36ffaeac5 100644 --- a/quic/fizz/client/handshake/test/FizzClientHandshakeTest.cpp +++ b/quic/fizz/client/handshake/test/FizzClientHandshakeTest.cpp @@ -314,7 +314,7 @@ TEST_F(ClientHandshakeTest, TestGetExportedKeyingMaterial) { EXPECT_EQ(ekm->size(), 32); ekm = handshake->getExportedKeyingMaterial( - "EXPORTER-Some-Label", folly::ByteRange(), 32); + "EXPORTER-Some-Label", ByteRange(), 32); ASSERT_TRUE(ekm.has_value()); EXPECT_EQ(ekm->size(), 32); } diff --git a/quic/fizz/client/test/QuicClientTransportTestUtil.h b/quic/fizz/client/test/QuicClientTransportTestUtil.h index 011a9c66a..411a4fa91 100644 --- a/quic/fizz/client/test/QuicClientTransportTestUtil.h +++ b/quic/fizz/client/test/QuicClientTransportTestUtil.h @@ -329,7 +329,7 @@ class FakeOneRttHandshakeLayer : public FizzClientHandshake { return params_; } - BufPtr getNextTrafficSecret(folly::ByteRange /*secret*/) const override { + BufPtr getNextTrafficSecret(ByteRange /*secret*/) const override { return folly::IOBuf::copyBuffer(getRandSecret()); } @@ -382,12 +382,11 @@ class FakeOneRttHandshakeLayer : public FizzClientHandshake { throw std::runtime_error("matchEarlyParameters not implemented"); } - std::unique_ptr buildAead(CipherKind, folly::ByteRange) override { + std::unique_ptr buildAead(CipherKind, ByteRange) override { return createNoOpAead(); } - std::unique_ptr buildHeaderCipher( - folly::ByteRange) override { + std::unique_ptr buildHeaderCipher(ByteRange) override { throw std::runtime_error("buildHeaderCipher not implemented"); } }; @@ -405,7 +404,7 @@ class QuicClientTransportTestBase : public virtual testing::Test { folly::SocketAddress addr; Optional err; - TestReadData(folly::ByteRange dataIn, folly::SocketAddress addrIn) + TestReadData(ByteRange dataIn, folly::SocketAddress addrIn) : udpPacket(folly::IOBuf::copyBuffer(dataIn)), addr(std::move(addrIn)) {} @@ -799,7 +798,7 @@ class QuicClientTransportTestBase : public virtual testing::Test { void deliverDataWithoutErrorCheck( const folly::SocketAddress& addr, - folly::ByteRange data, + ByteRange data, bool writes = true) { ASSERT_TRUE(networkReadCallback); socketReads.emplace_back(data, addr); @@ -810,7 +809,7 @@ class QuicClientTransportTestBase : public virtual testing::Test { } void deliverDataWithoutErrorCheck( - folly::ByteRange data, + ByteRange data, bool writes = true, folly::SocketAddress* peer = nullptr) { deliverDataWithoutErrorCheck( @@ -831,7 +830,7 @@ class QuicClientTransportTestBase : public virtual testing::Test { void deliverData( const folly::SocketAddress& addr, - folly::ByteRange data, + ByteRange data, bool writes = true) { deliverDataWithoutErrorCheck(addr, data, writes); if (client->getConn().localConnectionError) { @@ -849,7 +848,7 @@ class QuicClientTransportTestBase : public virtual testing::Test { } void deliverData( - folly::ByteRange data, + ByteRange data, bool writes = true, folly::SocketAddress* peer = nullptr) { deliverData(peer == nullptr ? serverAddr : *peer, data, writes); diff --git a/quic/fizz/handshake/FizzCryptoFactory.cpp b/quic/fizz/handshake/FizzCryptoFactory.cpp index 4fddc56d6..8a4088e41 100644 --- a/quic/fizz/handshake/FizzCryptoFactory.cpp +++ b/quic/fizz/handshake/FizzCryptoFactory.cpp @@ -57,7 +57,7 @@ std::unique_ptr FizzCryptoFactory::makeInitialAead( } std::unique_ptr FizzCryptoFactory::makePacketNumberCipher( - folly::ByteRange baseSecret) const { + ByteRange baseSecret) const { auto pnCipher = makePacketNumberCipher(fizz::CipherSuite::TLS_AES_128_GCM_SHA256); auto deriver = @@ -80,7 +80,7 @@ std::unique_ptr FizzCryptoFactory::makePacketNumberCipher( } } -std::function +std::function FizzCryptoFactory::getCryptoEqualFunction() const { return fizz::CryptoUtils::equal; } diff --git a/quic/fizz/handshake/FizzCryptoFactory.h b/quic/fizz/handshake/FizzCryptoFactory.h index 479fd629b..3a10c49aa 100644 --- a/quic/fizz/handshake/FizzCryptoFactory.h +++ b/quic/fizz/handshake/FizzCryptoFactory.h @@ -27,12 +27,12 @@ class FizzCryptoFactory : public CryptoFactory { QuicVersion version) const override; std::unique_ptr makePacketNumberCipher( - folly::ByteRange baseSecret) const override; + ByteRange baseSecret) const override; virtual std::unique_ptr makePacketNumberCipher( fizz::CipherSuite cipher) const; - [[nodiscard]] std::function + [[nodiscard]] std::function getCryptoEqualFunction() const override; std::shared_ptr getFizzFactory() { diff --git a/quic/fizz/handshake/FizzPacketNumberCipher.cpp b/quic/fizz/handshake/FizzPacketNumberCipher.cpp index bce19f7c0..89e909d26 100644 --- a/quic/fizz/handshake/FizzPacketNumberCipher.cpp +++ b/quic/fizz/handshake/FizzPacketNumberCipher.cpp @@ -12,7 +12,7 @@ namespace quic { static void setKeyImpl( folly::ssl::EvpCipherCtxUniquePtr& context, const EVP_CIPHER* cipher, - folly::ByteRange key) { + ByteRange key) { DCHECK_EQ(key.size(), EVP_CIPHER_key_length(cipher)); context.reset(EVP_CIPHER_CTX_new()); if (context == nullptr) { @@ -26,7 +26,7 @@ static void setKeyImpl( static HeaderProtectionMask maskImpl( const folly::ssl::EvpCipherCtxUniquePtr& context, - folly::ByteRange sample) { + ByteRange sample) { HeaderProtectionMask outMask; CHECK_EQ(sample.size(), outMask.size()); int outLen = 0; @@ -42,12 +42,12 @@ static HeaderProtectionMask maskImpl( return outMask; } -void Aes128PacketNumberCipher::setKey(folly::ByteRange key) { +void Aes128PacketNumberCipher::setKey(ByteRange key) { pnKey_ = BufHelpers::copyBuffer(key); return setKeyImpl(encryptCtx_, EVP_aes_128_ecb(), key); } -void Aes256PacketNumberCipher::setKey(folly::ByteRange key) { +void Aes256PacketNumberCipher::setKey(ByteRange key) { pnKey_ = BufHelpers::copyBuffer(key); return setKeyImpl(encryptCtx_, EVP_aes_256_ecb(), key); } @@ -60,13 +60,11 @@ const BufPtr& Aes256PacketNumberCipher::getKey() const { return pnKey_; } -HeaderProtectionMask Aes128PacketNumberCipher::mask( - folly::ByteRange sample) const { +HeaderProtectionMask Aes128PacketNumberCipher::mask(ByteRange sample) const { return maskImpl(encryptCtx_, sample); } -HeaderProtectionMask Aes256PacketNumberCipher::mask( - folly::ByteRange sample) const { +HeaderProtectionMask Aes256PacketNumberCipher::mask(ByteRange sample) const { return maskImpl(encryptCtx_, sample); } diff --git a/quic/fizz/handshake/FizzPacketNumberCipher.h b/quic/fizz/handshake/FizzPacketNumberCipher.h index a7424a1df..df1be2f8d 100644 --- a/quic/fizz/handshake/FizzPacketNumberCipher.h +++ b/quic/fizz/handshake/FizzPacketNumberCipher.h @@ -17,11 +17,11 @@ class Aes128PacketNumberCipher : public PacketNumberCipher { public: ~Aes128PacketNumberCipher() override = default; - void setKey(folly::ByteRange key) override; + void setKey(ByteRange key) override; const BufPtr& getKey() const override; - HeaderProtectionMask mask(folly::ByteRange sample) const override; + HeaderProtectionMask mask(ByteRange sample) const override; size_t keyLength() const override; @@ -35,11 +35,11 @@ class Aes256PacketNumberCipher : public PacketNumberCipher { public: ~Aes256PacketNumberCipher() override = default; - void setKey(folly::ByteRange key) override; + void setKey(ByteRange key) override; const BufPtr& getKey() const override; - HeaderProtectionMask mask(folly::ByteRange sample) const override; + HeaderProtectionMask mask(ByteRange sample) const override; size_t keyLength() const override; diff --git a/quic/fizz/handshake/test/FizzCryptoFactoryTest.cpp b/quic/fizz/handshake/test/FizzCryptoFactoryTest.cpp index 9722e718c..b744c6594 100644 --- a/quic/fizz/handshake/test/FizzCryptoFactoryTest.cpp +++ b/quic/fizz/handshake/test/FizzCryptoFactoryTest.cpp @@ -49,7 +49,7 @@ class FizzCryptoFactoryTest : public Test { std::unique_ptr createMockPacketNumberCipher() { auto mockPacketNumberCipher = std::make_unique(); EXPECT_CALL(*mockPacketNumberCipher, setKey(_)) - .WillOnce(Invoke([&](folly::ByteRange key) { + .WillOnce(Invoke([&](ByteRange key) { packetCipherKey_ = folly::IOBuf::copyBuffer(key); })); EXPECT_CALL(*mockPacketNumberCipher, keyLength()) diff --git a/quic/fizz/server/handshake/FizzServerHandshake.cpp b/quic/fizz/server/handshake/FizzServerHandshake.cpp index 2cddeccd6..eb27720b2 100644 --- a/quic/fizz/server/handshake/FizzServerHandshake.cpp +++ b/quic/fizz/server/handshake/FizzServerHandshake.cpp @@ -87,7 +87,7 @@ void FizzServerHandshake::processSocketData(folly::IOBufQueue& queue) { machine_.processSocketData(state_, queue, fizz::Aead::AeadOptions())); } -std::unique_ptr FizzServerHandshake::buildAead(folly::ByteRange secret) { +std::unique_ptr FizzServerHandshake::buildAead(ByteRange secret) { return FizzAead::wrap(fizz::Protocol::deriveRecordAeadWithLabel( *state_.context()->getFactory(), *state_.keyScheduler(), @@ -98,12 +98,11 @@ std::unique_ptr FizzServerHandshake::buildAead(folly::ByteRange secret) { } std::unique_ptr FizzServerHandshake::buildHeaderCipher( - folly::ByteRange secret) { + ByteRange secret) { return cryptoFactory_->makePacketNumberCipher(secret); } -BufPtr FizzServerHandshake::getNextTrafficSecret( - folly::ByteRange secret) const { +BufPtr FizzServerHandshake::getNextTrafficSecret(ByteRange secret) const { auto deriver = state_.context()->getFactory()->makeKeyDeriver(*state_.cipher()); auto nextSecret = deriver->expandLabel( diff --git a/quic/fizz/server/handshake/FizzServerHandshake.h b/quic/fizz/server/handshake/FizzServerHandshake.h index 0fe2a80be..0a7cacef1 100644 --- a/quic/fizz/server/handshake/FizzServerHandshake.h +++ b/quic/fizz/server/handshake/FizzServerHandshake.h @@ -39,10 +39,10 @@ class FizzServerHandshake : public ServerHandshake { EncryptionLevel getReadRecordLayerEncryptionLevel() override; void processSocketData(folly::IOBufQueue& queue) override; - std::unique_ptr buildAead(folly::ByteRange secret) override; + std::unique_ptr buildAead(ByteRange secret) override; std::unique_ptr buildHeaderCipher( - folly::ByteRange secret) override; - BufPtr getNextTrafficSecret(folly::ByteRange secret) const override; + ByteRange secret) override; + BufPtr getNextTrafficSecret(ByteRange secret) const override; void processAccept() override; bool processPendingCryptoEvent() override; diff --git a/quic/handshake/CryptoFactory.h b/quic/handshake/CryptoFactory.h index 6ee46f8f0..dc8f2d004 100644 --- a/quic/handshake/CryptoFactory.h +++ b/quic/handshake/CryptoFactory.h @@ -62,9 +62,9 @@ class CryptoFactory { QuicVersion version) const = 0; virtual std::unique_ptr makePacketNumberCipher( - folly::ByteRange baseSecret) const = 0; + ByteRange baseSecret) const = 0; - [[nodiscard]] virtual std::function + [[nodiscard]] virtual std::function getCryptoEqualFunction() const = 0; virtual ~CryptoFactory() = default; diff --git a/quic/handshake/HandshakeLayer.h b/quic/handshake/HandshakeLayer.h index eceb63f95..1ee335d35 100644 --- a/quic/handshake/HandshakeLayer.h +++ b/quic/handshake/HandshakeLayer.h @@ -48,7 +48,7 @@ class Handshake { */ virtual Optional> getExportedKeyingMaterial( const std::string& label, - const Optional& context, + const Optional& context, uint16_t keyLength) = 0; virtual void handshakeConfirmed() { diff --git a/quic/handshake/test/Mocks.h b/quic/handshake/test/Mocks.h index e29a06def..633694513 100644 --- a/quic/handshake/test/Mocks.h +++ b/quic/handshake/test/Mocks.h @@ -23,8 +23,8 @@ class MockPacketNumberCipher : public PacketNumberCipher { public: virtual ~MockPacketNumberCipher() = default; - MOCK_METHOD(void, setKey, (folly::ByteRange key)); - MOCK_METHOD(HeaderProtectionMask, mask, (folly::ByteRange), (const)); + MOCK_METHOD(void, setKey, (ByteRange key)); + MOCK_METHOD(HeaderProtectionMask, mask, (ByteRange), (const)); MOCK_METHOD(size_t, keyLength, (), (const)); MOCK_METHOD(const BufPtr&, getKey, (), (const)); diff --git a/quic/logging/FileQLogger.cpp b/quic/logging/FileQLogger.cpp index c0219f267..d475f4925 100644 --- a/quic/logging/FileQLogger.cpp +++ b/quic/logging/FileQLogger.cpp @@ -87,7 +87,7 @@ void FileQLogger::writeToStream(folly::StringPiece message) { bool inputConsumed = false; while (!inputConsumed) { compressionBuffer_->clear(); - folly::ByteRange inputRange(message); + ByteRange inputRange(message); auto outputRange = folly::MutableByteRange( compressionBuffer_->writableData(), compressionBuffer_->capacity()); compressionCodec_->compressStream(inputRange, outputRange); @@ -148,7 +148,7 @@ void FileQLogger::finishStream() { bool ended = false; while (!ended) { compressionBuffer_->clear(); - folly::ByteRange inputRange(folly::StringPiece("")); + ByteRange inputRange(folly::StringPiece("")); auto outputRange = folly::MutableByteRange( compressionBuffer_->writableData(), compressionBuffer_->capacity()); ended = compressionCodec_->compressStream( diff --git a/quic/loss/test/QuicLossFunctionsTest.cpp b/quic/loss/test/QuicLossFunctionsTest.cpp index a9193dbc6..5ee76f424 100644 --- a/quic/loss/test/QuicLossFunctionsTest.cpp +++ b/quic/loss/test/QuicLossFunctionsTest.cpp @@ -544,8 +544,7 @@ TEST_F(QuicLossFunctionsTest, TestMarkPacketLoss) { auto& buffer = stream1->lossBuffer.front(); EXPECT_EQ(buffer.offset, 0); EXPECT_EQ( - folly::ByteRange(buf->data(), buf->length()), - buffer.data.getHead()->getRange()); + ByteRange(buf->data(), buf->length()), buffer.data.getHead()->getRange()); } bool areEqual(folly::IOBuf* ptr, ChainedByteRangeHead* rch) { @@ -721,13 +720,13 @@ TEST_F(QuicLossFunctionsTest, TestMarkPacketLossNoMerge) { auto& buffer1 = stream1->lossBuffer[0]; EXPECT_EQ(buffer1.offset, 0); EXPECT_EQ( - folly::ByteRange(buf1->data(), buf1->length()), + ByteRange(buf1->data(), buf1->length()), buffer1.data.getHead()->getRange()); auto& buffer3 = stream1->lossBuffer[1]; EXPECT_EQ(buffer3.offset, 40); EXPECT_EQ( - folly::ByteRange(buf3->data(), buf3->length()), + ByteRange(buf3->data(), buf3->length()), buffer3.data.getHead()->getRange()); } @@ -2557,7 +2556,7 @@ TEST_F(QuicLossFunctionsTest, LossVisitorDSRTest) { ASSERT_FALSE(retxIter->second->eof); auto expectedBuf = folly::IOBuf::copyBuffer("grape"); ASSERT_EQ( - folly::ByteRange(expectedBuf->buffer(), expectedBuf->length()), + ByteRange(expectedBuf->buffer(), expectedBuf->length()), retxIter->second->data.getHead()->getRange()); ASSERT_EQ(stream->currentWriteOffset, bufMetaStartingOffset); diff --git a/quic/server/QuicServerTransport.h b/quic/server/QuicServerTransport.h index ab02ce97d..935eb2bbf 100644 --- a/quic/server/QuicServerTransport.h +++ b/quic/server/QuicServerTransport.h @@ -181,7 +181,7 @@ class QuicServerTransport */ Optional> getExportedKeyingMaterial( const std::string& label, - const Optional& context, + const Optional& context, uint16_t keyLength) const override { return serverConn_->serverHandshakeLayer->getExportedKeyingMaterial( label, context, keyLength); diff --git a/quic/server/handshake/ServerHandshake.cpp b/quic/server/handshake/ServerHandshake.cpp index 6202b2fde..bf5bbceb2 100644 --- a/quic/server/handshake/ServerHandshake.cpp +++ b/quic/server/handshake/ServerHandshake.cpp @@ -207,7 +207,7 @@ const fizz::server::State& ServerHandshake::getState() const { Optional> ServerHandshake::getExportedKeyingMaterial( const std::string& label, - const Optional& context, + const Optional& context, uint16_t keyLength) { const auto cipherSuite = state_.cipher(); const auto& ems = state_.exporterMasterSecret(); @@ -521,7 +521,7 @@ void ServerHandshake::processActions( processPendingEvents(); } -void ServerHandshake::computeCiphers(CipherKind kind, folly::ByteRange secret) { +void ServerHandshake::computeCiphers(CipherKind kind, ByteRange secret) { std::unique_ptr aead = buildAead(secret); std::unique_ptr headerCipher = buildHeaderCipher(secret); switch (kind) { diff --git a/quic/server/handshake/ServerHandshake.h b/quic/server/handshake/ServerHandshake.h index 5e40d364a..2b942051f 100644 --- a/quic/server/handshake/ServerHandshake.h +++ b/quic/server/handshake/ServerHandshake.h @@ -207,7 +207,7 @@ class ServerHandshake : public Handshake { */ Optional> getExportedKeyingMaterial( const std::string& label, - const Optional& context, + const Optional& context, uint16_t keyLength) override; /** @@ -219,7 +219,7 @@ class ServerHandshake : public Handshake { * Given secret_n, returns secret_n+1 to be used for generating the next Aead * on key updates. */ - virtual BufPtr getNextTrafficSecret(folly::ByteRange secret) const = 0; + virtual BufPtr getNextTrafficSecret(ByteRange secret) const = 0; ~ServerHandshake() override = default; @@ -270,7 +270,7 @@ class ServerHandshake : public Handshake { ZeroRttRead, }; - void computeCiphers(CipherKind kind, folly::ByteRange secret); + void computeCiphers(CipherKind kind, ByteRange secret); fizz::server::State state_; fizz::server::ServerStateMachine machine_; @@ -321,9 +321,9 @@ class ServerHandshake : public Handshake { virtual EncryptionLevel getReadRecordLayerEncryptionLevel() = 0; virtual void processSocketData(folly::IOBufQueue& queue) = 0; - virtual std::unique_ptr buildAead(folly::ByteRange secret) = 0; + virtual std::unique_ptr buildAead(ByteRange secret) = 0; virtual std::unique_ptr buildHeaderCipher( - folly::ByteRange secret) = 0; + ByteRange secret) = 0; virtual void processAccept() = 0; /* diff --git a/quic/server/handshake/TokenGenerator.cpp b/quic/server/handshake/TokenGenerator.cpp index 8a443463d..d7acf8d64 100644 --- a/quic/server/handshake/TokenGenerator.cpp +++ b/quic/server/handshake/TokenGenerator.cpp @@ -20,7 +20,7 @@ const std::vector kCipherContexts = {"RetryToken_V2"}; namespace quic { TokenGenerator::TokenGenerator(TokenSecret secret) : cipher_(kCipherContexts) { - std::vector secrets; + std::vector secrets; secrets.emplace_back(folly::range(secret)); cipher_.setSecrets(secrets); } diff --git a/quic/server/handshake/test/ServerHandshakeTest.cpp b/quic/server/handshake/test/ServerHandshakeTest.cpp index 3927ebcfc..ecc590c01 100644 --- a/quic/server/handshake/test/ServerHandshakeTest.cpp +++ b/quic/server/handshake/test/ServerHandshakeTest.cpp @@ -402,7 +402,7 @@ TEST_F(ServerHandshakeTest, TestGetExportedKeyingMaterial) { EXPECT_EQ(ekm->size(), 32); ekm = handshake->getExportedKeyingMaterial( - "EXPORTER-Some-Label", folly::ByteRange(), 32); + "EXPORTER-Some-Label", ByteRange(), 32); ASSERT_TRUE(ekm.has_value()); EXPECT_EQ(ekm->size(), 32); }