Skip to content

Commit

Permalink
crypto: remove unused SSLWrap handle methods
Browse files Browse the repository at this point in the history
One was not used at all, and the other was only used in a test, which I
converted to use the more standard `ShutdownWrap` API.

PR-URL: #22216
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
maclover7 authored and targos committed Aug 12, 2018
1 parent ab1e5d1 commit 9327a58
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 23 deletions.
21 changes: 0 additions & 21 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1375,13 +1375,11 @@ void SSLWrap<Base>::AddMethods(Environment* env, Local<FunctionTemplate> t) {
env->SetProtoMethod(t, "setSession", SetSession);
env->SetProtoMethod(t, "loadSession", LoadSession);
env->SetProtoMethodNoSideEffect(t, "isSessionReused", IsSessionReused);
env->SetProtoMethodNoSideEffect(t, "isInitFinished", IsInitFinished);
env->SetProtoMethodNoSideEffect(t, "verifyError", VerifyError);
env->SetProtoMethodNoSideEffect(t, "getCurrentCipher", GetCurrentCipher);
env->SetProtoMethod(t, "endParser", EndParser);
env->SetProtoMethod(t, "certCbDone", CertCbDone);
env->SetProtoMethod(t, "renegotiate", Renegotiate);
env->SetProtoMethod(t, "shutdownSSL", Shutdown);
env->SetProtoMethodNoSideEffect(t, "getTLSTicket", GetTLSTicket);
env->SetProtoMethod(t, "newSessionDone", NewSessionDone);
env->SetProtoMethod(t, "setOCSPResponse", SetOCSPResponse);
Expand Down Expand Up @@ -1987,16 +1985,6 @@ void SSLWrap<Base>::Renegotiate(const FunctionCallbackInfo<Value>& args) {
}


template <class Base>
void SSLWrap<Base>::Shutdown(const FunctionCallbackInfo<Value>& args) {
Base* w;
ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder());

int rv = SSL_shutdown(w->ssl_.get());
args.GetReturnValue().Set(rv);
}


template <class Base>
void SSLWrap<Base>::GetTLSTicket(const FunctionCallbackInfo<Value>& args) {
Base* w;
Expand Down Expand Up @@ -2130,15 +2118,6 @@ void SSLWrap<Base>::SetMaxSendFragment(
#endif // SSL_set_max_send_fragment


template <class Base>
void SSLWrap<Base>::IsInitFinished(const FunctionCallbackInfo<Value>& args) {
Base* w;
ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder());
bool yes = SSL_is_init_finished(w->ssl_.get());
args.GetReturnValue().Set(yes);
}


template <class Base>
void SSLWrap<Base>::VerifyError(const FunctionCallbackInfo<Value>& args) {
Base* w;
Expand Down
7 changes: 5 additions & 2 deletions test/parallel/test-tls-close-notify.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@ if (!common.hasCrypto)

const tls = require('tls');
const fixtures = require('../common/fixtures');
const { ShutdownWrap } = process.binding('stream_wrap');

const server = tls.createServer({
key: fixtures.readKey('agent1-key.pem'),
cert: fixtures.readKey('agent1-cert.pem')
}, function(c) {
// Send close-notify without shutting down TCP socket
if (c._handle.shutdownSSL() !== 1)
c._handle.shutdownSSL();
const req = new ShutdownWrap();
req.oncomplete = common.mustCall(() => {});
req.handle = c._handle;
c._handle.shutdown(req);
}).listen(0, common.mustCall(function() {
const c = tls.connect(this.address().port, {
rejectUnauthorized: false
Expand Down

0 comments on commit 9327a58

Please sign in to comment.