tls: don't trigger SNICallback or OCSPRequest from the TLS lib stack · nodejs/node@1864175 · GitHub
Skip to content

Commit 1864175

Browse files
pimterrypanva
authored andcommitted
tls: don't trigger SNICallback or OCSPRequest from the TLS lib stack
Both events (backed by oncertcb) could potentially write to the socket synchronously, re-entering SSL mid-handshake and breaking the connection, so we defer them just like the new 'resumeSession' behaviour. Also fixes a small bug in the error path of EmitClientHello, which now bails out more aggressively instead of resuming handshakes in a V8 teardown scenario. Co-authored-by: Filip Skokan <panva.ip@gmail.com> Signed-off-by: Tim Perry <pimterry@gmail.com> PR-URL: #64827 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com>
1 parent 8f4ee7e commit 1864175

3 files changed

Lines changed: 96 additions & 25 deletions

File tree

src/crypto/crypto_tls.cc

Lines changed: 43 additions & 25 deletions

src/crypto/crypto_tls.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ class TLSWrap : public AsyncWrap,
115115
size_t session_id_len,
116116
bool has_ticket);
117117

118+
// Schedules 'oncertcb'. The handshake stays suspended until certCbDone().
119+
void ScheduleCertCb(std::string servername, bool ocsp);
120+
118121
// Implement MemoryRetainer:
119122
void MemoryInfo(MemoryTracker* tracker) const override;
120123
SET_MEMORY_INFO_NAME(TLSWrap)
@@ -149,6 +152,7 @@ class TLSWrap : public AsyncWrap,
149152
void WaitForCertCb(CertCb cb, void* arg);
150153
void EmitClientHello(const std::vector<unsigned char>& session_id,
151154
bool has_ticket);
155+
void EmitCertCb(const std::string& servername, bool ocsp);
152156

153157
TLSWrap(Environment* env,
154158
v8::Local<v8::Object> obj,
Lines changed: 49 additions & 0 deletions

0 commit comments

Comments
 (0)