1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-25 15:43:13 +03:00

Key update support: Add support for initiating periodic key updates for both client and server [4/x]

Summary:
Allow the server/client transport to initiate periodic key update. It's defaulted to being disabled.

The new logic for initiating and verifying a key update was handled correctly by the peer is consolidated in QuicTransportFunctions.

Reviewed By: mjoras

Differential Revision: D53109624

fbshipit-source-id: 0c3a944978fc0e0a84252da953dc116aa7c26379
This commit is contained in:
Joseph Beshay
2024-02-01 15:41:27 -08:00
committed by Facebook GitHub Bot
parent da3e5e3821
commit aeacf40ae8
14 changed files with 312 additions and 31 deletions

View File

@@ -372,18 +372,6 @@ void QuicClientTransport::processUdpPacketData(
"Invalid connection id", TransportErrorCode::PROTOCOL_VIOLATION);
}
if (conn_->readCodec->getCurrentOneRttReadPhase() !=
conn_->oneRttWritePhase) {
// Peer has initiated a key update.
updateOneRttWriteCipher(
*conn_,
clientConn_->clientHandshakeLayer->getNextOneRttWriteCipher(),
conn_->readCodec->getCurrentOneRttReadPhase());
conn_->readCodec->setNextOneRttReadCipher(
clientConn_->clientHandshakeLayer->getNextOneRttReadCipher());
}
// Add the packet to the AckState associated with the packet number space.
auto& ackState = getAckState(*conn_, pnSpace);
uint64_t distanceFromExpectedPacketNum =
@@ -419,6 +407,8 @@ void QuicClientTransport::processUdpPacketData(
// processing loop.
conn_->handshakeLayer->handshakeConfirmed();
}
maybeVerifyPendingKeyUpdate(
*conn_, outstandingPacket, regularPacket);
switch (packetFrame.type()) {
case QuicWriteFrame::Type::WriteAckFrame: {
const WriteAckFrame& frame = *packetFrame.asWriteAckFrame();
@@ -664,6 +654,8 @@ void QuicClientTransport::processUdpPacketData(
handshakeConfirmed(*conn_);
}
maybeHandleIncomingKeyUpdate(*conn_);
// Try reading bytes off of crypto, and performing a handshake.
auto cryptoData = readDataFromCryptoStream(
*getCryptoStream(*conn_->cryptoState, encryptionLevel));
@@ -923,6 +915,7 @@ void QuicClientTransport::writeData() {
// use.
SCOPE_EXIT {
conn_->pendingEvents.numProbePackets = {};
maybeInitiateKeyUpdate(*conn_);
};
if (conn_->initialWriteCipher) {
auto& initialCryptoStream =