Browse Source

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 <info@bnoordhuis.nl>
canary-base
David Benjamin 7 years ago
committed by Ruben Bridgewater
parent
commit
c51e0e97cc
No known key found for this signature in database GPG Key ID: F07496B3EB3C1762
  1. 7
      src/node_crypto.cc

7
src/node_crypto.cc

@ -1424,10 +1424,13 @@ int SSLWrap<Base>::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<Object> session = Buffer::Copy(
env,
reinterpret_cast<char*>(sess->session_id),
sess->session_id_length).ToLocalChecked();
reinterpret_cast<const char*>(session_id),
session_id_length).ToLocalChecked();
Local<Value> argv[] = { session, buff };
w->new_session_wait_ = true;
w->MakeCallback(env->onnewsession_string(), arraysize(argv), argv);

Loading…
Cancel
Save