Permalink
Browse files

src: remove unnecessary call to SSL_get_mode

SSL_set_mode() bit-ORs its argument into the current mode, its not
necessary for to do it ourself (though it doesn't cause harm).

See:
- https://www.openssl.org/docs/man1.1.0/ssl/SSL_set_mode.html
- https://github.com/nodejs/node/blob/0ce615c4af/deps/openssl/openssl/ssl/ssl_lib.c#L2176-L2177

PR-URL: #25711
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information...
sam-github authored and addaleax committed Jan 25, 2019
1 parent 7ba6650 commit 09a10858f790b2a1cc3c0480cf9d5c92a813a6b6
Showing with 1 addition and 2 deletions.
  1. +1 −2 src/tls_wrap.cc
@@ -110,8 +110,7 @@ void TLSWrap::InitSSL() {
SSL_set_verify(ssl_.get(), SSL_VERIFY_NONE, crypto::VerifyCallback);

#ifdef SSL_MODE_RELEASE_BUFFERS
long mode = SSL_get_mode(ssl_.get()); // NOLINT(runtime/int)
SSL_set_mode(ssl_.get(), mode | SSL_MODE_RELEASE_BUFFERS);
SSL_set_mode(ssl_.get(), SSL_MODE_RELEASE_BUFFERS);
#endif // SSL_MODE_RELEASE_BUFFERS

SSL_set_app_data(ssl_.get(), this);

0 comments on commit 09a1085

Please sign in to comment.