Skip to content

Commit 4451019

Browse files
aglMylesBorins
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 <[email protected]> Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Shigeki Ohtsu <[email protected]>
1 parent e59697c commit 4451019

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/_tls_common.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ exports.createSecureContext = function createSecureContext(options, context) {
140140
}
141141
}
142142

143-
// Do not keep read/write buffers in free list
143+
// Do not keep read/write buffers in free list for OpenSSL < 1.1.0. (For
144+
// OpenSSL 1.1.0, buffers are malloced and freed without the use of a
145+
// freelist.)
144146
if (options.singleUse) {
145147
c.singleUse = true;
146148
c.context.setFreeListLength(0);

src/node_crypto.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,10 +1148,14 @@ void SecureContext::SetTicketKeys(const FunctionCallbackInfo<Value>& args) {
11481148

11491149

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

11541157
wrap->ctx_->freelist_max_len = args[0]->Int32Value();
1158+
#endif
11551159
}
11561160

11571161

0 commit comments

Comments
 (0)