1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-10 21:22:20 +03:00

Extend CryptoFactory with makePacketNumberCipher (#40)

Summary:
The CryptoFactory is extended with makePacketNumberCipher . In order to support that feature, FizzCryptoFactory now explicitly takes a QuicFizzFactory as argument instead of a generic fizz::Factory, which is the only type that is used in practice anyways.

The cypher argument was removed because:
1/ Only one cypher is used at all. Fizz also supports ChaCha20, but using it in mvfst will throw an exception.
2/ it seems like the factory should know what cypher it is dealing with.

If a choice of cypher needs to be supported going forward, it can be done by adding state to FizzCryptoFactory.
Pull Request resolved: https://github.com/facebookincubator/mvfst/pull/40

Reviewed By: mjoras

Differential Revision: D16785274

Pulled By: yangchi

fbshipit-source-id: a1c490e34c5ddd107e8e068d8b127c1ed00a59ec
This commit is contained in:
Amaury Séchet
2019-08-16 08:50:35 -07:00
committed by Facebook Github Bot
parent 8a927b4655
commit cbd77a3603
20 changed files with 162 additions and 213 deletions

View File

@@ -51,8 +51,8 @@ std::unique_ptr<QuicReadCodec> makeEncryptedCodec(
codec->setClientConnectionId(clientConnId);
codec->setInitialReadCipher(
cryptoFactory.getClientInitialCipher(clientConnId, QuicVersion::MVFST));
codec->setInitialHeaderCipher(makeClientInitialHeaderCipher(
&fizzFactory, clientConnId, QuicVersion::MVFST));
codec->setInitialHeaderCipher(cryptoFactory.makeClientInitialHeaderCipher(
clientConnId, QuicVersion::MVFST));
codec->setZeroRttReadCipher(std::move(zeroRttAead));
codec->setZeroRttHeaderCipher(test::createNoOpHeaderCipher());
codec->setOneRttReadCipher(std::move(oneRttAead));
@@ -463,7 +463,7 @@ TEST_F(QuicReadCodecTest, TestInitialPacket) {
uint64_t offset = 0;
auto aead = cryptoFactory.getClientInitialCipher(connId, QuicVersion::MVFST);
auto headerCipher =
makeClientInitialHeaderCipher(&fizzFactory, connId, QuicVersion::MVFST);
cryptoFactory.makeClientInitialHeaderCipher(connId, QuicVersion::MVFST);
auto packet = createInitialCryptoPacket(
getTestConnectionId(),
connId,
@@ -501,7 +501,7 @@ TEST_F(QuicReadCodecTest, TestHandshakeDone) {
uint64_t offset = 0;
auto aead = cryptoFactory.getClientInitialCipher(connId, QuicVersion::MVFST);
auto headerCipher =
makeClientInitialHeaderCipher(&fizzFactory, connId, QuicVersion::MVFST);
cryptoFactory.makeClientInitialHeaderCipher(connId, QuicVersion::MVFST);
auto packet = createInitialCryptoPacket(
getTestConnectionId(),
connId,