Skip to content

Commit 9c53e40

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 7bceb4f commit 9c53e40

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
@@ -135,7 +135,9 @@ exports.createSecureContext = function createSecureContext(options, context) {
135135
}
136136
}
137137

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

src/node_crypto.cc

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

11501150

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

11551158
wrap->ctx_->freelist_max_len = args[0]->Int32Value();
1159+
#endif
11561160
}
11571161

11581162

0 commit comments

Comments
 (0)