Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions src/crypto/crypto_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,27 +116,12 @@ MaybeLocal<Value> GetSSLOCSPResponse(
return ret;
}

bool SetTLSSession(
const SSLPointer& ssl,
const unsigned char* buf,
size_t length) {
SSLSessionPointer s(d2i_SSL_SESSION(nullptr, &buf, length));
return s == nullptr ? false : SetTLSSession(ssl, s);
}

bool SetTLSSession(
const SSLPointer& ssl,
const SSLSessionPointer& session) {
return session != nullptr && SSL_set_session(ssl.get(), session.get()) == 1;
}

SSLSessionPointer GetTLSSession(Local<Value> val) {
if (!val->IsArrayBufferView())
return SSLSessionPointer();
ArrayBufferViewContents<unsigned char> sbuf(val.As<ArrayBufferView>());
return GetTLSSession(sbuf.data(), sbuf.length());
}

SSLSessionPointer GetTLSSession(const unsigned char* buf, size_t length) {
return SSLSessionPointer(d2i_SSL_SESSION(nullptr, &buf, length));
}
Expand Down
7 changes: 0 additions & 7 deletions src/crypto/crypto_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,10 @@ v8::MaybeLocal<v8::Value> GetSSLOCSPResponse(
SSL* ssl,
v8::Local<v8::Value> default_value);

bool SetTLSSession(
const SSLPointer& ssl,
const unsigned char* buf,
size_t length);

bool SetTLSSession(
const SSLPointer& ssl,
const SSLSessionPointer& session);

SSLSessionPointer GetTLSSession(v8::Local<v8::Value> val);

SSLSessionPointer GetTLSSession(const unsigned char* buf, size_t length);

long VerifyPeerCertificate( // NOLINT(runtime/int)
Expand Down
6 changes: 3 additions & 3 deletions src/crypto/crypto_tls.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1667,10 +1667,10 @@ void TLSWrap::SetSession(const FunctionCallbackInfo<Value>& args) {
return THROW_ERR_MISSING_ARGS(env, "Session argument is mandatory");

THROW_AND_RETURN_IF_NOT_BUFFER(env, args[0], "Session");

SSLSessionPointer sess = GetTLSSession(args[0]);
ArrayBufferViewContents<unsigned char> sbuf(args[0]);
SSLSessionPointer sess = GetTLSSession(sbuf.data(), sbuf.length());
if (sess == nullptr)
return;
return; // TODO(tniessen): figure out error handling

if (!SetTLSSession(w->ssl_, sess))
return env->ThrowError("SSL_set_session error");
Expand Down