summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-11-19 20:06:50 +0100
committerAnna Henningsen <anna@addaleax.net>2019-11-30 01:14:45 +0100
commitef0b65f9b03ce29db2d9b8b5a5e5deb6d731d784 (patch)
treef7087477863f13c46f38a43e0f821587774e2483 /src
parent84a25eb7949a8ea887ddf8e23aa30f23a72fc5b1 (diff)
downloadandroid-node-v8-ef0b65f9b03ce29db2d9b8b5a5e5deb6d731d784.tar.gz
android-node-v8-ef0b65f9b03ce29db2d9b8b5a5e5deb6d731d784.tar.bz2
android-node-v8-ef0b65f9b03ce29db2d9b8b5a5e5deb6d731d784.zip
tls: add memory tracking support to SSLWrap
PR-URL: https://github.com/nodejs/node/pull/30548 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'src')
-rw-r--r--src/node_crypto.cc7
-rw-r--r--src/node_crypto.h2
-rw-r--r--src/tls_wrap.cc1
3 files changed, 10 insertions, 0 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index c4fa6e9020..8f80db5229 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -144,6 +144,7 @@ template void SSLWrap<TLSWrap>::AddMethods(Environment* env,
template void SSLWrap<TLSWrap>::ConfigureSecureContext(SecureContext* sc);
template void SSLWrap<TLSWrap>::SetSNIContext(SecureContext* sc);
template int SSLWrap<TLSWrap>::SetCACerts(SecureContext* sc);
+template void SSLWrap<TLSWrap>::MemoryInfo(MemoryTracker* tracker) const;
template SSL_SESSION* SSLWrap<TLSWrap>::GetSessionCallback(
SSL* s,
const unsigned char* key,
@@ -3074,6 +3075,12 @@ int SSLWrap<Base>::SetCACerts(SecureContext* sc) {
return 1;
}
+template <class Base>
+void SSLWrap<Base>::MemoryInfo(MemoryTracker* tracker) const {
+ tracker->TrackField("ocsp_response", ocsp_response_);
+ tracker->TrackField("sni_context", sni_context_);
+}
+
int VerifyCallback(int preverify_ok, X509_STORE_CTX* ctx) {
// From https://www.openssl.org/docs/man1.1.1/man3/SSL_verify_cb:
//
diff --git a/src/node_crypto.h b/src/node_crypto.h
index 56a9ad3104..d2bdd40ed2 100644
--- a/src/node_crypto.h
+++ b/src/node_crypto.h
@@ -222,6 +222,8 @@ class SSLWrap {
inline bool is_awaiting_new_session() const { return awaiting_new_session_; }
inline bool is_waiting_cert_cb() const { return cert_cb_ != nullptr; }
+ void MemoryInfo(MemoryTracker* tracker) const;
+
protected:
typedef void (*CertCb)(void* arg);
diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc
index 4ec6dda6df..626662c9a5 100644
--- a/src/tls_wrap.cc
+++ b/src/tls_wrap.cc
@@ -1089,6 +1089,7 @@ void TLSWrap::GetWriteQueueSize(const FunctionCallbackInfo<Value>& info) {
void TLSWrap::MemoryInfo(MemoryTracker* tracker) const {
+ SSLWrap<TLSWrap>::MemoryInfo(tracker);
tracker->TrackField("error", error_);
tracker->TrackFieldWithSize("pending_cleartext_input",
pending_cleartext_input_.size(),