proxygen
|
#include <KeyScheduler.h>
Classes | |
struct | AppTrafficSecret |
struct | EarlySecret |
struct | HandshakeSecret |
struct | MasterSecret |
Public Member Functions | |
KeyScheduler (std::unique_ptr< KeyDerivation > deriver) | |
virtual | ~KeyScheduler ()=default |
virtual void | deriveEarlySecret (folly::ByteRange psk) |
virtual void | deriveHandshakeSecret () |
virtual void | deriveHandshakeSecret (folly::ByteRange ecdhe) |
virtual void | deriveMasterSecret () |
virtual void | deriveAppTrafficSecrets (folly::ByteRange transcript) |
virtual void | clearMasterSecret () |
virtual uint32_t | clientKeyUpdate () |
virtual uint32_t | serverKeyUpdate () |
virtual std::vector< uint8_t > | getSecret (EarlySecrets s, folly::ByteRange transcript) const |
virtual std::vector< uint8_t > | getSecret (HandshakeSecrets s, folly::ByteRange transcript) const |
virtual std::vector< uint8_t > | getSecret (MasterSecrets s, folly::ByteRange transcript) const |
virtual std::vector< uint8_t > | getSecret (AppTrafficSecrets s) const |
virtual TrafficKey | getTrafficKey (folly::ByteRange trafficSecret, size_t keyLength, size_t ivLength) const |
virtual Buf | getResumptionSecret (folly::ByteRange resumptionMasterSecret, folly::ByteRange ticketNonce) const |
Private Attributes | |
folly::Optional< boost::variant< EarlySecret, HandshakeSecret, MasterSecret > > | secret_ |
folly::Optional< AppTrafficSecret > | appTrafficSecret_ |
std::unique_ptr< KeyDerivation > | deriver_ |
Keeps track of the TLS 1.3 key derivation schedule.
Definition at line 33 of file KeyScheduler.h.
|
inlineexplicit |
Definition at line 35 of file KeyScheduler.h.
|
virtualdefault |
|
virtual |
Clears the master secret. Must be in master secret state.
Definition at line 85 of file KeyScheduler.cpp.
References folly::none.
Referenced by fizz::sm::generateTicket(), and fizz::sm::handleCertMsg().
|
virtual |
Performs a key update on the client traffic key. Traffic secrets must be derived.
Definition at line 90 of file KeyScheduler.cpp.
References appTrafficSecret_, folly::IOBuf::create(), deriver_, kTrafficKeyUpdate, and folly::range().
Referenced by fizz::sm::generateTicket(), and fizz::sm::getMaxEarlyDataSize().
|
virtual |
Derives the app traffic secrets given the handshake context. Must be in master secret state. Note that this does not clear the master secret.
Definition at line 75 of file KeyScheduler.cpp.
References appTrafficSecret_, fizz::KeyScheduler::AppTrafficSecret::client, deriver_, kClientAppTraffic, kServerAppTraffic, folly::gen::move, folly::range(), and fizz::KeyScheduler::AppTrafficSecret::server.
Referenced by fizz::sm::handleCertMsg().
|
virtual |
Derives the early secret. Must be in uninitialized state.
Definition at line 32 of file KeyScheduler.cpp.
References deriver_, folly::range(), and secret_.
Referenced by fizz::sm::encodeAndAddBinders().
|
virtual |
Derives the master secert. Must be in early secret state.
Definition at line 41 of file KeyScheduler.cpp.
References deriver_, kDerivedSecret, and folly::range().
Referenced by fizz::sm::doKex().
|
virtual |
Derives the master secret with a DH secret. Must be in uninitialized or early secret state.
Definition at line 50 of file KeyScheduler.cpp.
References deriver_, kDerivedSecret, folly::range(), and secret_.
|
virtual |
Derives the master secert. Must be in handshake secret state.
Definition at line 64 of file KeyScheduler.cpp.
References deriver_, kDerivedSecret, and folly::range().
Referenced by fizz::sm::handleCertMsg().
|
virtual |
Derive a resumption secret with a particular ticket nonce. Does not require being in master secret state.
Definition at line 204 of file KeyScheduler.cpp.
References deriver_, kResumption, and folly::IOBuf::wrapBuffer().
Referenced by fizz::sm::generateTicket(), and fizz::sm::getMaxEarlyDataSize().
|
virtual |
Retreive a secret from the scheduler. Must be in the appropriate state.
Reimplemented in fizz::LoggingKeyScheduler.
Definition at line 114 of file KeyScheduler.cpp.
References fizz::ClientEarlyTraffic, deriver_, fizz::EarlyExporter, fizz::ExternalPskBinder, kClientEarlyTraffic, kEarlyExporter, kExternalPskBinder, kResumptionPskBinder, fizz::test::label, folly::range(), and fizz::ResumptionPskBinder.
Referenced by fizz::sm::encodeAndAddBinders(), fizz::sm::generateTicket(), fizz::sm::getMaxEarlyDataSize(), fizz::LoggingKeyScheduler::getSecret(), and fizz::sm::handleCertMsg().
|
virtual |
Reimplemented in fizz::LoggingKeyScheduler.
Definition at line 140 of file KeyScheduler.cpp.
References fizz::ClientHandshakeTraffic, deriver_, kClientHandshakeTraffic, kServerHandshakeTraffic, fizz::test::label, folly::range(), and fizz::ServerHandshakeTraffic.
|
virtual |
Definition at line 160 of file KeyScheduler.cpp.
References deriver_, fizz::ExporterMaster, kExporterMaster, kResumptionMaster, fizz::test::label, folly::range(), and fizz::ResumptionMaster.
|
virtual |
Reimplemented in fizz::LoggingKeyScheduler.
Definition at line 180 of file KeyScheduler.cpp.
References appTrafficSecret_, fizz::ClientAppTraffic, and fizz::ServerAppTraffic.
|
virtual |
Derive a traffic key and iv from a traffic secret.
Definition at line 192 of file KeyScheduler.cpp.
References folly::IOBuf::create(), deriver_, fizz::TrafficKey::iv, fizz::TrafficKey::key, kTrafficIv, and kTrafficKey.
Referenced by fizz::Protocol::setAead().
|
virtual |
Performs a key update on the server traffic key. Traffic secrets must be derived.
Definition at line 102 of file KeyScheduler.cpp.
References appTrafficSecret_, folly::IOBuf::create(), deriver_, kTrafficKeyUpdate, and folly::range().
Referenced by fizz::sm::generateTicket(), and fizz::sm::getMaxEarlyDataSize().
|
private |
Definition at line 132 of file KeyScheduler.h.
Referenced by clientKeyUpdate(), deriveAppTrafficSecrets(), getSecret(), and serverKeyUpdate().
|
private |
Definition at line 134 of file KeyScheduler.h.
Referenced by clientKeyUpdate(), deriveAppTrafficSecrets(), deriveEarlySecret(), deriveHandshakeSecret(), deriveMasterSecret(), getResumptionSecret(), getSecret(), getTrafficKey(), and serverKeyUpdate().
|
private |
Definition at line 131 of file KeyScheduler.h.
Referenced by deriveEarlySecret(), and deriveHandshakeSecret().