Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
quic: use const refs for QuicCID passing
Browse files Browse the repository at this point in the history
PR-URL: #205
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
jasnell authored and addaleax committed Dec 11, 2019
1 parent 43d8220 commit bef1b25
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/node_quic_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -963,8 +963,7 @@ void QuicSession::AddToSocket(QuicSocket* socket) {

switch (crypto_context_->Side()) {
case NGTCP2_CRYPTO_SIDE_SERVER: {
QuicCID rcid(rcid_);
socket->AssociateCID(rcid, scid);
socket->AssociateCID(QuicCID(rcid_), scid);

if (pscid_.datalen)
socket->AssociateCID(QuicCID(pscid_), scid);
Expand Down
12 changes: 12 additions & 0 deletions src/node_quic_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,23 @@ enum QuicSessionState : int {
IDX_QUIC_SESSION_STATE_COUNT
};

// The QuicCryptoContext class encapsulates all of the crypto/TLS
// handshake details on behalf of a QuicSession.
class QuicCryptoContext : public MemoryRetainer {
public:
SSL* operator*() { return ssl_.get(); }

uint64_t Cancel();

// Outgoing crypto data must be retained in memory until it is
// explicitly acknowledged.
void AcknowledgeCryptoData(ngtcp2_crypto_level level, size_t datalen);

// Enables openssl's TLS tracing mechanism
void EnableTrace();

// Returns the server's prepared OCSP response for transmission. This
// is not used by client QuicSession instances.
std::string GetOCSPResponse();

ngtcp2_crypto_level GetReadCryptoLevel();
Expand All @@ -184,6 +191,7 @@ class QuicCryptoContext : public MemoryRetainer {
return options_ & option;
}

// Emits a single keylog line to the JavaScript layer
void Keylog(const char* line);

int OnClientHello();
Expand All @@ -204,12 +212,15 @@ class QuicCryptoContext : public MemoryRetainer {

int OnTLSStatus();

// Receives and processes TLS handshake details
int Receive(
ngtcp2_crypto_level crypto_level,
uint64_t offset,
const uint8_t* data,
size_t datalen);

// Resumes the TLS handshake following a client hello or
// OCSP callback
void ResumeHandshake();

void SetOption(uint32_t option, bool on = true) {
Expand All @@ -235,6 +246,7 @@ class QuicCryptoContext : public MemoryRetainer {
size_t datalen);

bool InitiateKeyUpdate();

bool KeyUpdate(
uint8_t* rx_key,
uint8_t* rx_iv,
Expand Down

0 comments on commit bef1b25

Please sign in to comment.