Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a bridge to fizz::Aead #12

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions quic/api/QuicTransportFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -688,7 +688,7 @@ void writeCloseCommon(
QuicConnectionStateBase& connection,
PacketHeader&& header,
folly::Optional<std::pair<QuicErrorCode, std::string>> 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.
Expand Down Expand Up @@ -773,7 +773,7 @@ void writeLongClose(
const ConnectionId& dstConnId,
LongHeader::Types headerType,
folly::Optional<std::pair<QuicErrorCode, std::string>> closeDetails,
const fizz::Aead& aead,
const Aead& aead,
const PacketNumberCipher& headerCipher,
QuicVersion version) {
if (!connection.serverConnectionId) {
Expand Down Expand Up @@ -802,7 +802,7 @@ void writeShortClose(
QuicConnectionStateBase& connection,
const ConnectionId& connId,
folly::Optional<std::pair<QuicErrorCode, std::string>> closeDetails,
const fizz::Aead& aead,
const Aead& aead,
const PacketNumberCipher& headerCipher) {
auto header = ShortHeader(
ProtectionType::KeyPhaseZero,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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(
Expand Down
18 changes: 9 additions & 9 deletions quic/api/QuicTransportFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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,
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -154,7 +154,7 @@ void writeCloseCommon(
QuicConnectionStateBase& connection,
PacketHeader&& header,
folly::Optional<std::pair<QuicErrorCode, std::string>> closeDetails,
const fizz::Aead& aead,
const Aead& aead,
const PacketNumberCipher& headerCipher);

/**
Expand All @@ -168,7 +168,7 @@ void writeLongClose(
const ConnectionId& dstConnId,
LongHeader::Types headerType,
folly::Optional<std::pair<QuicErrorCode, std::string>> closeDetails,
const fizz::Aead& aead,
const Aead& aead,
const PacketNumberCipher& headerCipher,
QuicVersion);

Expand All @@ -181,7 +181,7 @@ void writeShortClose(
QuicConnectionStateBase& connection,
const ConnectionId& connId,
folly::Optional<std::pair<QuicErrorCode, std::string>> closeDetails,
const fizz::Aead& aead,
const Aead& aead,
const PacketNumberCipher& headerCipher);

/**
Expand Down Expand Up @@ -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);
Expand All @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion quic/api/test/QuicTransportBaseTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ class TestQuicTransport
}

QuicServerConnectionState* transportConn;
std::unique_ptr<fizz::Aead> aead;
std::unique_ptr<Aead> aead;
std::unique_ptr<PacketNumberCipher> headerCipher;
std::unique_ptr<ConnectionIdAlgo> connIdAlgo_;
bool transportClosed{false};
Expand Down
6 changes: 3 additions & 3 deletions quic/api/test/QuicTransportFunctionsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -171,7 +171,7 @@ class QuicTransportFunctionsTest : public Test {
return conn.version.value_or(*conn.originalVersion);
}

std::unique_ptr<fizz::Aead> aead;
std::unique_ptr<Aead> aead;
std::unique_ptr<PacketNumberCipher> headerCipher;
std::unique_ptr<MockQuicStats> transportInfoCb_;
};
Expand Down
2 changes: 1 addition & 1 deletion quic/api/test/QuicTransportTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class TestQuicTransport
drainTimeoutExpired();
}

std::unique_ptr<fizz::Aead> aead;
std::unique_ptr<Aead> aead;
std::unique_ptr<PacketNumberCipher> headerCipher;
bool closed{false};
};
Expand Down
10 changes: 5 additions & 5 deletions quic/client/handshake/ClientHandshake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,35 +90,35 @@ void ClientHandshake::doHandshake(
}
}

std::unique_ptr<fizz::Aead> ClientHandshake::getOneRttWriteCipher() {
std::unique_ptr<Aead> ClientHandshake::getOneRttWriteCipher() {
if (error_) {
error_.throw_exception();
}
return std::move(oneRttWriteCipher_);
}

std::unique_ptr<fizz::Aead> ClientHandshake::getOneRttReadCipher() {
std::unique_ptr<Aead> ClientHandshake::getOneRttReadCipher() {
if (error_) {
error_.throw_exception();
}
return std::move(oneRttReadCipher_);
}

std::unique_ptr<fizz::Aead> ClientHandshake::getZeroRttWriteCipher() {
std::unique_ptr<Aead> ClientHandshake::getZeroRttWriteCipher() {
if (error_) {
error_.throw_exception();
}
return std::move(zeroRttWriteCipher_);
}

std::unique_ptr<fizz::Aead> ClientHandshake::getHandshakeReadCipher() {
std::unique_ptr<Aead> ClientHandshake::getHandshakeReadCipher() {
if (error_) {
error_.throw_exception();
}
return std::move(handshakeReadCipher_);
}

std::unique_ptr<fizz::Aead> ClientHandshake::getHandshakeWriteCipher() {
std::unique_ptr<Aead> ClientHandshake::getHandshakeWriteCipher() {
if (error_) {
error_.throw_exception();
}
Expand Down
10 changes: 5 additions & 5 deletions quic/client/handshake/ClientHandshake.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<fizz::Aead> getOneRttWriteCipher();
std::unique_ptr<Aead> getOneRttWriteCipher();

/**
* An edge triggered API to get the oneRttReadCipher. Once you receive the
* read cipher subsequent calls will return null.
*/
std::unique_ptr<fizz::Aead> getOneRttReadCipher();
std::unique_ptr<Aead> 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<fizz::Aead> getZeroRttWriteCipher();
std::unique_ptr<Aead> getZeroRttWriteCipher();

/**
* An edge triggered API to get the handshakeReadCipher. Once you
* receive the handshake read cipher subsequent calls will return null.
*/
std::unique_ptr<fizz::Aead> getHandshakeReadCipher();
std::unique_ptr<Aead> getHandshakeReadCipher();

/**
* An edge triggered API to get the handshakeWriteCipher. Once you
* receive the handshake write cipher subsequent calls will return null.
*/
std::unique_ptr<fizz::Aead> getHandshakeWriteCipher();
std::unique_ptr<Aead> getHandshakeWriteCipher();

/**
* An edge triggered API to get the one rtt read header cpher. Once you
Expand Down
10 changes: 5 additions & 5 deletions quic/client/handshake/test/ClientHandshakeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,11 @@ class ClientHandshakeTest : public Test, public boost::static_visitor<> {
folly::IOBufQueue serverReadBuf{folly::IOBufQueue::cacheChainLength()};
std::unique_ptr<DelayedHolder, folly::DelayedDestruction::Destructor> dg;

std::unique_ptr<fizz::Aead> handshakeWriteCipher;
std::unique_ptr<fizz::Aead> handshakeReadCipher;
std::unique_ptr<fizz::Aead> oneRttWriteCipher;
std::unique_ptr<fizz::Aead> oneRttReadCipher;
std::unique_ptr<fizz::Aead> zeroRttWriteCipher;
std::unique_ptr<Aead> handshakeWriteCipher;
std::unique_ptr<Aead> handshakeReadCipher;
std::unique_ptr<Aead> oneRttWriteCipher;
std::unique_ptr<Aead> oneRttReadCipher;
std::unique_ptr<Aead> zeroRttWriteCipher;

folly::Optional<bool> zeroRttRejected;

Expand Down
6 changes: 3 additions & 3 deletions quic/client/test/QuicClientTransportTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ class QuicClientTransportTest : public Test {
bool handshakeCipher = false) {
QuicFizzFactory fizzFactory;
auto codec = std::make_unique<QuicReadCodec>(QuicNodeType::Server);
std::unique_ptr<fizz::Aead> handshakeReadCipher;
std::unique_ptr<Aead> handshakeReadCipher;
codec->setClientConnectionId(*originalConnId);
codec->setOneRttReadCipher(test::createNoOpAead());
codec->setOneRttHeaderCipher(test::createNoOpHeaderCipher());
Expand All @@ -1338,7 +1338,7 @@ class QuicClientTransportTest : public Test {
return codec;
}

const fizz::Aead& getInitialCipher() {
const Aead& getInitialCipher() {
return *client->getConn().readCodec->getInitialCipher();
}

Expand Down Expand Up @@ -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(
Expand Down
18 changes: 9 additions & 9 deletions quic/codec/QuicReadCodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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();
}

Expand All @@ -352,17 +352,17 @@ QuicReadCodec::getStatelessResetToken() const {
}

void QuicReadCodec::setInitialReadCipher(
std::unique_ptr<fizz::Aead> initialReadCipher) {
std::unique_ptr<Aead> initialReadCipher) {
initialReadCipher_ = std::move(initialReadCipher);
}

void QuicReadCodec::setOneRttReadCipher(
std::unique_ptr<fizz::Aead> oneRttReadCipher) {
std::unique_ptr<Aead> oneRttReadCipher) {
oneRttReadCipher_ = std::move(oneRttReadCipher);
}

void QuicReadCodec::setZeroRttReadCipher(
std::unique_ptr<fizz::Aead> zeroRttReadCipher) {
std::unique_ptr<Aead> zeroRttReadCipher) {
if (nodeType_ == QuicNodeType::Client) {
throw QuicTransportException(
"Invalid cipher", TransportErrorCode::INTERNAL_ERROR);
Expand All @@ -371,7 +371,7 @@ void QuicReadCodec::setZeroRttReadCipher(
}

void QuicReadCodec::setHandshakeReadCipher(
std::unique_ptr<fizz::Aead> handshakeReadCipher) {
std::unique_ptr<Aead> handshakeReadCipher) {
handshakeReadCipher_ = std::move(handshakeReadCipher);
}

Expand Down Expand Up @@ -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();
}

Expand Down
Loading