Skip to content

Commit a57e2f2

Browse files
aglshigeki
authored andcommitted
crypto: freelist_max_len is gone in OpenSSL 1.1.0
The freelist_max_len member of SSL* (and the freelist itself) has been removed in OpenSSL 1.1.0. Thus this change will be necessary at some point but, for now, it makes it a little easier to build with 1.1.0 without breaking anything for previous versions of OpenSSL. PR-URL: #10859 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Shigeki Ohtsu <ohtsu@ohtsu.org>
1 parent 6b6123c commit a57e2f2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/_tls_common.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ exports.createSecureContext = function createSecureContext(options, context) {
134134
}
135135
}
136136

137-
// Do not keep read/write buffers in free list
137+
// Do not keep read/write buffers in free list for OpenSSL < 1.1.0. (For
138+
// OpenSSL 1.1.0, buffers are malloced and freed without the use of a
139+
// freelist.)
138140
if (options.singleUse) {
139141
c.singleUse = true;
140142
c.context.setFreeListLength(0);

src/node_crypto.cc

+4
Original file line numberDiff line numberDiff line change
@@ -1147,10 +1147,14 @@ void SecureContext::SetTicketKeys(const FunctionCallbackInfo<Value>& args) {
11471147

11481148

11491149
void SecureContext::SetFreeListLength(const FunctionCallbackInfo<Value>& args) {
1150+
#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(OPENSSL_IS_BORINGSSL)
1151+
// |freelist_max_len| was removed in OpenSSL 1.1.0. In that version OpenSSL
1152+
// mallocs and frees buffers directly, without the use of a freelist.
11501153
SecureContext* wrap;
11511154
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder());
11521155

11531156
wrap->ctx_->freelist_max_len = args[0]->Int32Value();
1157+
#endif
11541158
}
11551159

11561160

0 commit comments

Comments
 (0)