diff --git a/quic/api/QuicTransportFunctions.cpp b/quic/api/QuicTransportFunctions.cpp index c9a78a768..25ab3198f 100644 --- a/quic/api/QuicTransportFunctions.cpp +++ b/quic/api/QuicTransportFunctions.cpp @@ -453,7 +453,7 @@ uint64_t writeQuicDataToSocket( QuicConnectionStateBase& connection, const ConnectionId& srcConnId, const ConnectionId& dstConnId, - const fizz::Aead& aead, + const Aead& aead, const PacketNumberCipher& headerCipher, QuicVersion version, uint64_t packetLimit) { @@ -527,7 +527,7 @@ uint64_t writeCryptoAndAckDataToSocket( const ConnectionId& srcConnId, const ConnectionId& dstConnId, LongHeader::Types packetType, - fizz::Aead& cleartextCipher, + Aead& cleartextCipher, const PacketNumberCipher& headerCipher, QuicVersion version, uint64_t packetLimit, @@ -572,7 +572,7 @@ uint64_t writeQuicDataExceptCryptoStreamToSocket( QuicConnectionStateBase& connection, const ConnectionId& srcConnId, const ConnectionId& dstConnId, - const fizz::Aead& aead, + const Aead& aead, const PacketNumberCipher& headerCipher, QuicVersion version, uint64_t packetLimit) { @@ -640,7 +640,7 @@ uint64_t writeZeroRttDataToSocket( QuicConnectionStateBase& connection, const ConnectionId& srcConnId, const ConnectionId& dstConnId, - const fizz::Aead& aead, + const Aead& aead, const PacketNumberCipher& headerCipher, QuicVersion version, uint64_t packetLimit) { @@ -688,7 +688,7 @@ void writeCloseCommon( QuicConnectionStateBase& connection, PacketHeader&& header, folly::Optional> closeDetails, - const fizz::Aead& aead, + const Aead& aead, const PacketNumberCipher& headerCipher) { // close is special, we're going to bypass all the packet sent logic for all // packets we send with a connection close frame. @@ -773,7 +773,7 @@ void writeLongClose( const ConnectionId& dstConnId, LongHeader::Types headerType, folly::Optional> closeDetails, - const fizz::Aead& aead, + const Aead& aead, const PacketNumberCipher& headerCipher, QuicVersion version) { if (!connection.serverConnectionId) { @@ -802,7 +802,7 @@ void writeShortClose( QuicConnectionStateBase& connection, const ConnectionId& connId, folly::Optional> closeDetails, - const fizz::Aead& aead, + const Aead& aead, const PacketNumberCipher& headerCipher) { auto header = ShortHeader( ProtectionType::KeyPhaseZero, @@ -858,7 +858,7 @@ uint64_t writeConnectionDataToSocket( QuicPacketScheduler& scheduler, const WritableBytesFunc& writableBytesFunc, uint64_t packetLimit, - const fizz::Aead& aead, + const Aead& aead, const PacketNumberCipher& headerCipher, QuicVersion version, Buf token) { @@ -961,7 +961,7 @@ uint64_t writeProbingDataToSocket( PacketNumberSpace pnSpace, FrameScheduler scheduler, uint8_t probesToSend, - const fizz::Aead& aead, + const Aead& aead, const PacketNumberCipher& headerCipher, QuicVersion version) { CloningScheduler cloningScheduler( diff --git a/quic/api/QuicTransportFunctions.h b/quic/api/QuicTransportFunctions.h index c6ca5b3bd..0125eb38b 100644 --- a/quic/api/QuicTransportFunctions.h +++ b/quic/api/QuicTransportFunctions.h @@ -39,7 +39,7 @@ uint64_t writeQuicDataToSocket( QuicConnectionStateBase& connection, const ConnectionId& srcConnId, const ConnectionId& dstConnId, - const fizz::Aead& aead, + const Aead& aead, const PacketNumberCipher& headerCipher, QuicVersion version, uint64_t packetLimit); @@ -55,7 +55,7 @@ uint64_t writeCryptoAndAckDataToSocket( const ConnectionId& srcConnId, const ConnectionId& dstConnId, LongHeader::Types packetType, - fizz::Aead& cleartextCipher, + Aead& cleartextCipher, const PacketNumberCipher& headerCipher, QuicVersion version, uint64_t packetLimit, @@ -71,7 +71,7 @@ uint64_t writeQuicDataExceptCryptoStreamToSocket( QuicConnectionStateBase& connection, const ConnectionId& srcConnId, const ConnectionId& dstConnId, - const fizz::Aead& aead, + const Aead& aead, const PacketNumberCipher& headerCipher, QuicVersion version, uint64_t packetLimit); @@ -85,7 +85,7 @@ uint64_t writeZeroRttDataToSocket( QuicConnectionStateBase& connection, const ConnectionId& srcConnId, const ConnectionId& dstConnId, - const fizz::Aead& aead, + const Aead& aead, const PacketNumberCipher& headerCipher, QuicVersion version, uint64_t packetLimit); @@ -154,7 +154,7 @@ void writeCloseCommon( QuicConnectionStateBase& connection, PacketHeader&& header, folly::Optional> closeDetails, - const fizz::Aead& aead, + const Aead& aead, const PacketNumberCipher& headerCipher); /** @@ -168,7 +168,7 @@ void writeLongClose( const ConnectionId& dstConnId, LongHeader::Types headerType, folly::Optional> closeDetails, - const fizz::Aead& aead, + const Aead& aead, const PacketNumberCipher& headerCipher, QuicVersion); @@ -181,7 +181,7 @@ void writeShortClose( QuicConnectionStateBase& connection, const ConnectionId& connId, folly::Optional> closeDetails, - const fizz::Aead& aead, + const Aead& aead, const PacketNumberCipher& headerCipher); /** @@ -213,7 +213,7 @@ uint64_t writeConnectionDataToSocket( QuicPacketScheduler& scheduler, const WritableBytesFunc& writableBytesFunc, uint64_t packetLimit, - const fizz::Aead& aead, + const Aead& aead, const PacketNumberCipher& headerCipher, QuicVersion version, Buf token = nullptr); @@ -227,7 +227,7 @@ uint64_t writeProbingDataToSocket( PacketNumberSpace pnSpace, FrameScheduler scheduler, uint8_t probesToSend, - const fizz::Aead& aead, + const Aead& aead, const PacketNumberCipher& headerCipher, QuicVersion version); diff --git a/quic/api/test/QuicTransportBaseTest.cpp b/quic/api/test/QuicTransportBaseTest.cpp index 79feb06a9..8eeca7b85 100644 --- a/quic/api/test/QuicTransportBaseTest.cpp +++ b/quic/api/test/QuicTransportBaseTest.cpp @@ -332,7 +332,7 @@ class TestQuicTransport } QuicServerConnectionState* transportConn; - std::unique_ptr aead; + std::unique_ptr aead; std::unique_ptr headerCipher; std::unique_ptr connIdAlgo_; bool transportClosed{false}; diff --git a/quic/api/test/QuicTransportFunctionsTest.cpp b/quic/api/test/QuicTransportFunctionsTest.cpp index cc832cc49..4c61a2866 100644 --- a/quic/api/test/QuicTransportFunctionsTest.cpp +++ b/quic/api/test/QuicTransportFunctionsTest.cpp @@ -28,7 +28,7 @@ uint64_t writeProbingDataToSocketForTest( folly::AsyncUDPSocket& sock, QuicConnectionStateBase& conn, uint8_t probesToSend, - const fizz::Aead& aead, + const Aead& aead, const PacketNumberCipher& headerCipher, QuicVersion version) { FrameScheduler scheduler = std::move(FrameScheduler::Builder( @@ -57,7 +57,7 @@ void writeCryptoDataProbesToSocketForTest( folly::AsyncUDPSocket& sock, QuicConnectionStateBase& conn, uint8_t probesToSend, - const fizz::Aead& aead, + const Aead& aead, const PacketNumberCipher& headerCipher, QuicVersion version, LongHeader::Types type = LongHeader::Types::Initial) { @@ -171,7 +171,7 @@ class QuicTransportFunctionsTest : public Test { return conn.version.value_or(*conn.originalVersion); } - std::unique_ptr aead; + std::unique_ptr aead; std::unique_ptr headerCipher; std::unique_ptr transportInfoCb_; }; diff --git a/quic/api/test/QuicTransportTest.cpp b/quic/api/test/QuicTransportTest.cpp index 31a666b8f..cd652d91e 100644 --- a/quic/api/test/QuicTransportTest.cpp +++ b/quic/api/test/QuicTransportTest.cpp @@ -138,7 +138,7 @@ class TestQuicTransport drainTimeoutExpired(); } - std::unique_ptr aead; + std::unique_ptr aead; std::unique_ptr headerCipher; bool closed{false}; }; diff --git a/quic/client/handshake/ClientHandshake.cpp b/quic/client/handshake/ClientHandshake.cpp index e958ccc9f..a0871d1cf 100644 --- a/quic/client/handshake/ClientHandshake.cpp +++ b/quic/client/handshake/ClientHandshake.cpp @@ -90,35 +90,35 @@ void ClientHandshake::doHandshake( } } -std::unique_ptr ClientHandshake::getOneRttWriteCipher() { +std::unique_ptr ClientHandshake::getOneRttWriteCipher() { if (error_) { error_.throw_exception(); } return std::move(oneRttWriteCipher_); } -std::unique_ptr ClientHandshake::getOneRttReadCipher() { +std::unique_ptr ClientHandshake::getOneRttReadCipher() { if (error_) { error_.throw_exception(); } return std::move(oneRttReadCipher_); } -std::unique_ptr ClientHandshake::getZeroRttWriteCipher() { +std::unique_ptr ClientHandshake::getZeroRttWriteCipher() { if (error_) { error_.throw_exception(); } return std::move(zeroRttWriteCipher_); } -std::unique_ptr ClientHandshake::getHandshakeReadCipher() { +std::unique_ptr ClientHandshake::getHandshakeReadCipher() { if (error_) { error_.throw_exception(); } return std::move(handshakeReadCipher_); } -std::unique_ptr ClientHandshake::getHandshakeWriteCipher() { +std::unique_ptr ClientHandshake::getHandshakeWriteCipher() { if (error_) { error_.throw_exception(); } diff --git a/quic/client/handshake/ClientHandshake.h b/quic/client/handshake/ClientHandshake.h index e38100433..18f45b485 100644 --- a/quic/client/handshake/ClientHandshake.h +++ b/quic/client/handshake/ClientHandshake.h @@ -65,31 +65,31 @@ class ClientHandshake : public Handshake { * An edge triggered API to get the oneRttWriteCipher. Once you receive the * write cipher subsequent calls will return null. */ - std::unique_ptr getOneRttWriteCipher(); + std::unique_ptr getOneRttWriteCipher(); /** * An edge triggered API to get the oneRttReadCipher. Once you receive the * read cipher subsequent calls will return null. */ - std::unique_ptr getOneRttReadCipher(); + std::unique_ptr getOneRttReadCipher(); /** * An edge triggered API to get the zeroRttWriteCipher. Once you receive the * zero rtt write cipher subsequent calls will return null. */ - std::unique_ptr getZeroRttWriteCipher(); + std::unique_ptr getZeroRttWriteCipher(); /** * An edge triggered API to get the handshakeReadCipher. Once you * receive the handshake read cipher subsequent calls will return null. */ - std::unique_ptr getHandshakeReadCipher(); + std::unique_ptr getHandshakeReadCipher(); /** * An edge triggered API to get the handshakeWriteCipher. Once you * receive the handshake write cipher subsequent calls will return null. */ - std::unique_ptr getHandshakeWriteCipher(); + std::unique_ptr getHandshakeWriteCipher(); /** * An edge triggered API to get the one rtt read header cpher. Once you diff --git a/quic/client/handshake/test/ClientHandshakeTest.cpp b/quic/client/handshake/test/ClientHandshakeTest.cpp index 997540b1d..be0964b9d 100644 --- a/quic/client/handshake/test/ClientHandshakeTest.cpp +++ b/quic/client/handshake/test/ClientHandshakeTest.cpp @@ -244,11 +244,11 @@ class ClientHandshakeTest : public Test, public boost::static_visitor<> { folly::IOBufQueue serverReadBuf{folly::IOBufQueue::cacheChainLength()}; std::unique_ptr dg; - std::unique_ptr handshakeWriteCipher; - std::unique_ptr handshakeReadCipher; - std::unique_ptr oneRttWriteCipher; - std::unique_ptr oneRttReadCipher; - std::unique_ptr zeroRttWriteCipher; + std::unique_ptr handshakeWriteCipher; + std::unique_ptr handshakeReadCipher; + std::unique_ptr oneRttWriteCipher; + std::unique_ptr oneRttReadCipher; + std::unique_ptr zeroRttWriteCipher; folly::Optional zeroRttRejected; diff --git a/quic/client/test/QuicClientTransportTest.cpp b/quic/client/test/QuicClientTransportTest.cpp index f111a938c..345df2557 100644 --- a/quic/client/test/QuicClientTransportTest.cpp +++ b/quic/client/test/QuicClientTransportTest.cpp @@ -1321,7 +1321,7 @@ class QuicClientTransportTest : public Test { bool handshakeCipher = false) { QuicFizzFactory fizzFactory; auto codec = std::make_unique(QuicNodeType::Server); - std::unique_ptr handshakeReadCipher; + std::unique_ptr handshakeReadCipher; codec->setClientConnectionId(*originalConnId); codec->setOneRttReadCipher(test::createNoOpAead()); codec->setOneRttHeaderCipher(test::createNoOpHeaderCipher()); @@ -1338,7 +1338,7 @@ class QuicClientTransportTest : public Test { return codec; } - const fizz::Aead& getInitialCipher() { + const Aead& getInitialCipher() { return *client->getConn().readCodec->getInitialCipher(); } @@ -3441,7 +3441,7 @@ Buf getHandshakePacketWithFrame( QuicWriteFrame frame, ConnectionId srcConnId, ConnectionId destConnId, - const fizz::Aead& serverWriteCipher, + const Aead& serverWriteCipher, const PacketNumberCipher& headerCipher) { PacketNum packetNum = folly::Random::rand32(); LongHeader header( diff --git a/quic/codec/QuicReadCodec.cpp b/quic/codec/QuicReadCodec.cpp index c0e08b822..0b2d31ca7 100644 --- a/quic/codec/QuicReadCodec.cpp +++ b/quic/codec/QuicReadCodec.cpp @@ -104,7 +104,7 @@ CodecResult QuicReadCodec::parseLongHeaderPacket( } cursor.pull(sample.data(), sample.size()); const PacketNumberCipher* headerCipher{nullptr}; - const fizz::Aead* cipher{nullptr}; + const Aead* cipher{nullptr}; auto protectionType = longHeader.getProtectionType(); switch (protectionType) { case ProtectionType::Initial: @@ -334,15 +334,15 @@ CodecResult QuicReadCodec::parsePacket( return decodeRegularPacket(std::move(*shortHeader), params_, packetCursor); } -const fizz::Aead* QuicReadCodec::getOneRttReadCipher() const { +const Aead* QuicReadCodec::getOneRttReadCipher() const { return oneRttReadCipher_.get(); } -const fizz::Aead* QuicReadCodec::getZeroRttReadCipher() const { +const Aead* QuicReadCodec::getZeroRttReadCipher() const { return zeroRttReadCipher_.get(); } -const fizz::Aead* QuicReadCodec::getHandshakeReadCipher() const { +const Aead* QuicReadCodec::getHandshakeReadCipher() const { return handshakeReadCipher_.get(); } @@ -352,17 +352,17 @@ QuicReadCodec::getStatelessResetToken() const { } void QuicReadCodec::setInitialReadCipher( - std::unique_ptr initialReadCipher) { + std::unique_ptr initialReadCipher) { initialReadCipher_ = std::move(initialReadCipher); } void QuicReadCodec::setOneRttReadCipher( - std::unique_ptr oneRttReadCipher) { + std::unique_ptr oneRttReadCipher) { oneRttReadCipher_ = std::move(oneRttReadCipher); } void QuicReadCodec::setZeroRttReadCipher( - std::unique_ptr zeroRttReadCipher) { + std::unique_ptr zeroRttReadCipher) { if (nodeType_ == QuicNodeType::Client) { throw QuicTransportException( "Invalid cipher", TransportErrorCode::INTERNAL_ERROR); @@ -371,7 +371,7 @@ void QuicReadCodec::setZeroRttReadCipher( } void QuicReadCodec::setHandshakeReadCipher( - std::unique_ptr handshakeReadCipher) { + std::unique_ptr handshakeReadCipher) { handshakeReadCipher_ = std::move(handshakeReadCipher); } @@ -412,7 +412,7 @@ void QuicReadCodec::setStatelessResetToken( statelessResetToken_ = std::move(statelessResetToken); } -const fizz::Aead* QuicReadCodec::getInitialCipher() const { +const Aead* QuicReadCodec::getInitialCipher() const { return initialReadCipher_.get(); } diff --git a/quic/codec/QuicReadCodec.h b/quic/codec/QuicReadCodec.h index be4336285..39d239dee 100644 --- a/quic/codec/QuicReadCodec.h +++ b/quic/codec/QuicReadCodec.h @@ -56,11 +56,11 @@ class QuicReadCodec { folly::IOBufQueue& queue, const AckStates& ackStates); - const fizz::Aead* getOneRttReadCipher() const; - const fizz::Aead* getZeroRttReadCipher() const; - const fizz::Aead* getHandshakeReadCipher() const; + const Aead* getOneRttReadCipher() const; + const Aead* getZeroRttReadCipher() const; + const Aead* getHandshakeReadCipher() const; - const fizz::Aead* getInitialCipher() const; + const Aead* getInitialCipher() const; const PacketNumberCipher* getInitialHeaderCipher() const; const PacketNumberCipher* getOneRttHeaderCipher() const; @@ -69,10 +69,10 @@ class QuicReadCodec { const folly::Optional& getStatelessResetToken() const; - void setInitialReadCipher(std::unique_ptr initialReadCipher); - void setOneRttReadCipher(std::unique_ptr oneRttReadCipher); - void setZeroRttReadCipher(std::unique_ptr zeroRttReadCipher); - void setHandshakeReadCipher(std::unique_ptr handshakeReadCipher); + void setInitialReadCipher(std::unique_ptr initialReadCipher); + void setOneRttReadCipher(std::unique_ptr oneRttReadCipher); + void setZeroRttReadCipher(std::unique_ptr zeroRttReadCipher); + void setHandshakeReadCipher(std::unique_ptr handshakeReadCipher); void setInitialHeaderCipher( std::unique_ptr initialHeaderCipher); @@ -110,11 +110,11 @@ class QuicReadCodec { folly::Optional serverConnectionId_; // Cipher used to decrypt handshake packets. - std::unique_ptr initialReadCipher_; + std::unique_ptr initialReadCipher_; - std::unique_ptr oneRttReadCipher_; - std::unique_ptr zeroRttReadCipher_; - std::unique_ptr handshakeReadCipher_; + std::unique_ptr oneRttReadCipher_; + std::unique_ptr zeroRttReadCipher_; + std::unique_ptr handshakeReadCipher_; std::unique_ptr initialHeaderCipher_; std::unique_ptr oneRttHeaderCipher_; diff --git a/quic/codec/test/QuicPacketBuilderTest.cpp b/quic/codec/test/QuicPacketBuilderTest.cpp index bf87b85d7..ee2df340d 100644 --- a/quic/codec/test/QuicPacketBuilderTest.cpp +++ b/quic/codec/test/QuicPacketBuilderTest.cpp @@ -31,7 +31,7 @@ std::vector versionList( Buf packetToBuf( RegularQuicPacketBuilder::Packet& packet, - fizz::Aead* aead = nullptr) { + Aead* aead = nullptr) { auto buf = folly::IOBuf::create(0); // This doesnt matter. PacketNum num = 10; @@ -62,8 +62,8 @@ constexpr size_t kVersionNegotiationHeaderSize = std::unique_ptr makeCodec( ConnectionId clientConnId, QuicNodeType nodeType, - std::unique_ptr zeroRttCipher = nullptr, - std::unique_ptr oneRttCipher = nullptr) { + std::unique_ptr zeroRttCipher = nullptr, + std::unique_ptr oneRttCipher = nullptr) { QuicFizzFactory fizzFactory; auto codec = std::make_unique(nodeType); if (nodeType != QuicNodeType::Client) { diff --git a/quic/codec/test/QuicReadCodecTest.cpp b/quic/codec/test/QuicReadCodecTest.cpp index 5f49911e6..07744a486 100644 --- a/quic/codec/test/QuicReadCodecTest.cpp +++ b/quic/codec/test/QuicReadCodecTest.cpp @@ -40,8 +40,8 @@ std::unique_ptr makeUnencryptedCodec() { std::unique_ptr makeEncryptedCodec( ConnectionId clientConnId, - std::unique_ptr oneRttAead, - std::unique_ptr zeroRttAead = nullptr, + std::unique_ptr oneRttAead, + std::unique_ptr zeroRttAead = nullptr, std::unique_ptr sourceToken = nullptr) { QuicFizzFactory fizzFactory; auto codec = std::make_unique(QuicNodeType::Server); diff --git a/quic/common/test/TestUtils.cpp b/quic/common/test/TestUtils.cpp index dd40caef0..68a34fbd4 100644 --- a/quic/common/test/TestUtils.cpp +++ b/quic/common/test/TestUtils.cpp @@ -106,7 +106,7 @@ RegularQuicPacketBuilder::Packet createAckPacket( PacketNum pn, IntervalSet& acks, PacketNumberSpace pnSpace, - const fizz::Aead* aead) { + const Aead* aead) { // This function sends ACK to dstConn auto srcConnId = (dstConn.nodeType == QuicNodeType::Client ? *dstConn.serverConnectionId @@ -360,7 +360,7 @@ RegularQuicPacketBuilder::Packet createInitialCryptoPacket( PacketNum packetNum, QuicVersion version, folly::IOBuf& data, - const fizz::Aead& aead, + const Aead& aead, PacketNum largestAcked, uint64_t offset) { LongHeader header( @@ -379,7 +379,7 @@ RegularQuicPacketBuilder::Packet createCryptoPacket( QuicVersion version, ProtectionType protectionType, folly::IOBuf& data, - const fizz::Aead& aead, + const Aead& aead, PacketNum largestAcked, uint64_t offset, uint64_t packetSizeLimit) { @@ -431,7 +431,7 @@ Buf packetToBuf(const RegularQuicPacketBuilder::Packet& packet) { Buf packetToBufCleartext( const RegularQuicPacketBuilder::Packet& packet, - const fizz::Aead& cleartextCipher, + const Aead& cleartextCipher, const PacketNumberCipher& headerCipher, PacketNum packetNum) { VLOG(10) << __func__ << " packet header: " diff --git a/quic/common/test/TestUtils.h b/quic/common/test/TestUtils.h index f2db021b8..c3b78ae95 100644 --- a/quic/common/test/TestUtils.h +++ b/quic/common/test/TestUtils.h @@ -58,7 +58,7 @@ RegularQuicPacketBuilder::Packet createAckPacket( PacketNum pn, IntervalSet& acks, PacketNumberSpace pnSpace, - const fizz::Aead* aead = nullptr); + const Aead* aead = nullptr); PacketNum rstStreamAndSendPacket( QuicServerConnectionState& conn, @@ -90,7 +90,7 @@ RegularQuicPacketBuilder::Packet createInitialCryptoPacket( PacketNum packetNum, QuicVersion version, folly::IOBuf& data, - const fizz::Aead& aead, + const Aead& aead, PacketNum largestAcked, uint64_t offset = 0); @@ -101,7 +101,7 @@ RegularQuicPacketBuilder::Packet createCryptoPacket( QuicVersion version, ProtectionType protectionType, folly::IOBuf& data, - const fizz::Aead& aead, + const Aead& aead, PacketNum largestAcked, uint64_t offset = 0, uint64_t packetSizeLimit = kDefaultUDPSendPacketLen); @@ -110,7 +110,7 @@ Buf packetToBuf(const RegularQuicPacketBuilder::Packet& packet); Buf packetToBufCleartext( const RegularQuicPacketBuilder::Packet& packet, - const fizz::Aead& cleartextCipher, + const Aead& cleartextCipher, const PacketNumberCipher& headerCipher, PacketNum packetNum); diff --git a/quic/handshake/FizzBridge.h b/quic/handshake/FizzBridge.h new file mode 100644 index 000000000..1ff0f8fcd --- /dev/null +++ b/quic/handshake/FizzBridge.h @@ -0,0 +1,15 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + +#pragma once + +#include + +namespace quic { +using Aead = fizz::Aead; +} diff --git a/quic/handshake/HandshakeLayer.cpp b/quic/handshake/HandshakeLayer.cpp index 55d1ab512..30d8baa11 100644 --- a/quic/handshake/HandshakeLayer.cpp +++ b/quic/handshake/HandshakeLayer.cpp @@ -45,7 +45,7 @@ Buf makeClientInitialTrafficSecret( factory, kClientInitialLabel, clientDestinationConnId); } -std::unique_ptr makeInitialAead( +std::unique_ptr makeInitialAead( fizz::Factory* factory, folly::StringPiece label, const ConnectionId& clientDestinationConnId) { @@ -70,13 +70,13 @@ std::unique_ptr makeInitialAead( return aead; } -std::unique_ptr getClientInitialCipher( +std::unique_ptr getClientInitialCipher( fizz::Factory* factory, const ConnectionId& clientDestinationConnId) { return makeInitialAead(factory, kClientInitialLabel, clientDestinationConnId); } -std::unique_ptr getServerInitialCipher( +std::unique_ptr getServerInitialCipher( fizz::Factory* factory, const ConnectionId& clientDestinationConnId) { return makeInitialAead(factory, kServerInitialLabel, clientDestinationConnId); diff --git a/quic/handshake/HandshakeLayer.h b/quic/handshake/HandshakeLayer.h index 3bd0d5c88..e498c58b6 100644 --- a/quic/handshake/HandshakeLayer.h +++ b/quic/handshake/HandshakeLayer.h @@ -8,7 +8,6 @@ #pragma once -#include #include #include #include @@ -18,6 +17,7 @@ #include #include #include +#include #include namespace fizz { @@ -45,16 +45,16 @@ constexpr folly::StringPiece kQuicDraft17Salt = constexpr folly::StringPiece kClientInitialLabel = "client in"; constexpr folly::StringPiece kServerInitialLabel = "server in"; -std::unique_ptr makeInitialAead( +std::unique_ptr makeInitialAead( fizz::Factory* factory, folly::StringPiece label, const ConnectionId& clientDestinationConnId); -std::unique_ptr getClientInitialCipher( +std::unique_ptr getClientInitialCipher( fizz::Factory* factory, const ConnectionId& clientDestinationConnId); -std::unique_ptr getServerInitialCipher( +std::unique_ptr getServerInitialCipher( fizz::Factory* factory, const ConnectionId& clientDestinationConnId); diff --git a/quic/handshake/test/HandshakeLayerTest.cpp b/quic/handshake/test/HandshakeLayerTest.cpp index 5ca627526..3e3210bdd 100644 --- a/quic/handshake/test/HandshakeLayerTest.cpp +++ b/quic/handshake/test/HandshakeLayerTest.cpp @@ -9,7 +9,6 @@ #include #include -#include #include #include #include @@ -36,7 +35,7 @@ class QuicTestFizzFactory : public QuicFizzFactory { return std::move(packetNumberCipher_); } - void setMockAead(std::unique_ptr aead) { + void setMockAead(std::unique_ptr aead) { aead_ = std::move(aead); } diff --git a/quic/loss/test/QuicLossFunctionsTest.cpp b/quic/loss/test/QuicLossFunctionsTest.cpp index 8c9172f6b..a29c3627e 100644 --- a/quic/loss/test/QuicLossFunctionsTest.cpp +++ b/quic/loss/test/QuicLossFunctionsTest.cpp @@ -112,7 +112,7 @@ class QuicLossFunctionsTest : public TestWithParam { } EventBase evb; - std::unique_ptr aead; + std::unique_ptr aead; std::unique_ptr headerCipher; MockLossTimeout timeout; std::unique_ptr transportInfoCb_; diff --git a/quic/server/handshake/ServerHandshake.cpp b/quic/server/handshake/ServerHandshake.cpp index bdcab639a..0bbc9b300 100644 --- a/quic/server/handshake/ServerHandshake.cpp +++ b/quic/server/handshake/ServerHandshake.cpp @@ -88,35 +88,35 @@ void ServerHandshake::writeNewSessionTicket(const AppToken& appToken) { } } -std::unique_ptr ServerHandshake::getHandshakeWriteCipher() { +std::unique_ptr ServerHandshake::getHandshakeWriteCipher() { if (error_) { throw QuicTransportException(error_->first, error_->second); } return std::move(handshakeWriteCipher_); } -std::unique_ptr ServerHandshake::getHandshakeReadCipher() { +std::unique_ptr ServerHandshake::getHandshakeReadCipher() { if (error_) { throw QuicTransportException(error_->first, error_->second); } return std::move(handshakeReadCipher_); } -std::unique_ptr ServerHandshake::getOneRttWriteCipher() { +std::unique_ptr ServerHandshake::getOneRttWriteCipher() { if (error_) { throw QuicTransportException(error_->first, error_->second); } return std::move(oneRttWriteCipher_); } -std::unique_ptr ServerHandshake::getOneRttReadCipher() { +std::unique_ptr ServerHandshake::getOneRttReadCipher() { if (error_) { throw QuicTransportException(error_->first, error_->second); } return std::move(oneRttReadCipher_); } -std::unique_ptr ServerHandshake::getZeroRttReadCipher() { +std::unique_ptr ServerHandshake::getZeroRttReadCipher() { if (error_) { throw QuicTransportException(error_->first, error_->second); } diff --git a/quic/server/handshake/ServerHandshake.h b/quic/server/handshake/ServerHandshake.h index 891352247..388df8962 100644 --- a/quic/server/handshake/ServerHandshake.h +++ b/quic/server/handshake/ServerHandshake.h @@ -105,31 +105,31 @@ class ServerHandshake : public Handshake { * An edge triggered API to get the handshakeWriteCipher. Once you receive the * write cipher subsequent calls will return null. */ - std::unique_ptr getHandshakeWriteCipher(); + std::unique_ptr getHandshakeWriteCipher(); /** * An edge triggered API to get the handshakeReadCipher. Once you receive the * write cipher subsequent calls will return null. */ - std::unique_ptr getHandshakeReadCipher(); + std::unique_ptr getHandshakeReadCipher(); /** * An edge triggered API to get the oneRttWriteCipher. Once you receive the * write cipher subsequent calls will return null. */ - std::unique_ptr getOneRttWriteCipher(); + std::unique_ptr getOneRttWriteCipher(); /** * An edge triggered API to get the oneRttReadCipher. Once you receive the * read cipher subsequent calls will return null. */ - std::unique_ptr getOneRttReadCipher(); + std::unique_ptr getOneRttReadCipher(); /** * An edge triggered API to get the zeroRttReadCipher. Once you receive the * zero rtt read cipher subsequent calls will return null. */ - std::unique_ptr getZeroRttReadCipher(); + std::unique_ptr getZeroRttReadCipher(); /** * An edge triggered API to get the one rtt read header cpher. Once you diff --git a/quic/server/handshake/test/ServerHandshakeTest.cpp b/quic/server/handshake/test/ServerHandshakeTest.cpp index dc58133fc..0aa9d06c5 100644 --- a/quic/server/handshake/test/ServerHandshakeTest.cpp +++ b/quic/server/handshake/test/ServerHandshakeTest.cpp @@ -324,11 +324,11 @@ class ServerHandshakeTest : public Test { std::vector clientWrites; MockServerHandshakeCallback serverCallback; - std::unique_ptr oneRttWriteCipher; - std::unique_ptr oneRttReadCipher; - std::unique_ptr zeroRttReadCipher; - std::unique_ptr handshakeWriteCipher; - std::unique_ptr handshakeReadCipher; + std::unique_ptr oneRttWriteCipher; + std::unique_ptr oneRttReadCipher; + std::unique_ptr zeroRttReadCipher; + std::unique_ptr handshakeWriteCipher; + std::unique_ptr handshakeReadCipher; std::exception_ptr ex; std::string hostname; diff --git a/quic/server/test/QuicServerTransportTest.cpp b/quic/server/test/QuicServerTransportTest.cpp index daa672434..dba196d50 100644 --- a/quic/server/test/QuicServerTransportTest.cpp +++ b/quic/server/test/QuicServerTransportTest.cpp @@ -314,7 +314,7 @@ class QuicServerTransportTest : public Test { fakeHandshake = new FakeServerHandshake(server->getNonConstConn()); } - std::unique_ptr getInitialCipher() { + std::unique_ptr getInitialCipher() { QuicFizzFactory fizzFactory; return getClientInitialCipher( &fizzFactory, *initialDestinationConnectionId); @@ -2889,7 +2889,7 @@ TEST_F(QuicUnencryptedServerTransportTest, TestGarbageData) { Buf getHandshakePacketWithFrame( QuicWriteFrame frame, ConnectionId connId, - fizz::Aead& clientWriteCipher, + Aead& clientWriteCipher, PacketNumberCipher& headerCipher) { PacketNum clientPacketNum = folly::Random::rand32(); LongHeader header( diff --git a/quic/state/StateData.h b/quic/state/StateData.h index a61e670d1..9afa21530 100644 --- a/quic/state/StateData.h +++ b/quic/state/StateData.h @@ -415,17 +415,17 @@ struct QuicConnectionStateBase { std::unique_ptr oneRttWriteHeaderCipher; // Write cipher for 1-RTT data - std::unique_ptr oneRttWriteCipher; + std::unique_ptr oneRttWriteCipher; // Write cipher for packets with initial keys. - std::unique_ptr initialWriteCipher; + std::unique_ptr initialWriteCipher; // Write cipher for packets with handshake keys. - std::unique_ptr handshakeWriteCipher; + std::unique_ptr handshakeWriteCipher; // Write cipher for 0-RTT data // TODO: move this back into the client state - std::unique_ptr zeroRttWriteCipher; + std::unique_ptr zeroRttWriteCipher; // Time at which the connection started. TimePoint connectionTime;