From 93d5ead37aed1f05efacba98c1e77835009918ff Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Mon, 11 Sep 2017 17:23:39 -0400 Subject: [PATCH] crypto: use SSL_SESSION_get_id This accessor exists in OpenSSL 1.0.2, so it may be used already. This is cherry-picked from PR #8491. PR-URL: https://github.com/nodejs/node/pull/15348 Reviewed-By: Ben Noordhuis --- src/node_crypto.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 7dfb3523e36956..9006f3e12c664b 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -1424,10 +1424,13 @@ int SSLWrap::NewSessionCallback(SSL* s, SSL_SESSION* sess) { memset(serialized, 0, size); i2d_SSL_SESSION(sess, &serialized); + unsigned int session_id_length; + const unsigned char* session_id = SSL_SESSION_get_id(sess, + &session_id_length); Local session = Buffer::Copy( env, - reinterpret_cast(sess->session_id), - sess->session_id_length).ToLocalChecked(); + reinterpret_cast(session_id), + session_id_length).ToLocalChecked(); Local argv[] = { session, buff }; w->new_session_wait_ = true; w->MakeCallback(env->onnewsession_string(), arraysize(argv), argv);