Skip to content

Commit

Permalink
crypto: use SSL_SESSION_get_id
Browse files Browse the repository at this point in the history
This accessor exists in OpenSSL 1.0.2, so it may be used already. This
is cherry-picked from PR #8491.

PR-URL: #15348
Reviewed-By: Ben Noordhuis <[email protected]>
  • Loading branch information
davidben authored and MylesBorins committed Oct 3, 2017
1 parent ed8c89a commit 93d5ead
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 93d5ead

Please sign in to comment.