Skip to content

Commit e0afd56

Browse files
authored
test: move crypto related common utilities in common/crypto
nodejs/node#56714
1 parent 3ff7799 commit e0afd56

3 files changed

Lines changed: 90 additions & 99 deletions

File tree

‎patches/node/fix_crypto_tests_to_run_with_bssl.patch‎

Lines changed: 46 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ before it's acceptable to upstream, as this patch comments out a couple
1111
of tests that upstream probably cares about.
1212

1313
diff --git a/test/common/index.js b/test/common/index.js
14-
index d1eaf6e69f603b0a7037e44be6ef185283972090..e3f26d32dbad2e4ccb47dea028dbf1a855525cfb 100644
14+
index 92c7294e6f6298f511b5a289e1e0e3a4be68cc77..63a350c5ed912a785b042a238c064c98ed423af4 100644
1515
--- a/test/common/index.js
1616
+++ b/test/common/index.js
17-
@@ -65,6 +65,8 @@ const opensslVersionNumber = (major = 0, minor = 0, patch = 0) => {
18-
return (major << 28) | (minor << 20) | (patch << 4);
19-
};
17+
@@ -56,6 +56,8 @@ const hasCrypto = Boolean(process.versions.openssl) &&
18+
19+
const hasQuic = hasCrypto && !!process.config.variables.openssl_quic;
2020

2121
+const openSSLIsBoringSSL = process.versions.openssl === '0.0.0';
2222
+
23-
let OPENSSL_VERSION_NUMBER;
24-
const hasOpenSSL = (major = 0, minor = 0, patch = 0) => {
25-
if (!hasCrypto) return false;
26-
@@ -1008,6 +1010,7 @@ const common = {
23+
function parseTestFlags(filename = process.argv[1]) {
24+
// The copyright notice is relatively big and the flags could come afterwards.
25+
const bytesToRead = 1500;
26+
@@ -889,6 +891,7 @@ const common = {
2727
mustNotMutateObjectDeep,
2828
mustSucceed,
2929
nodeProcessAborted,
@@ -139,12 +139,12 @@ index 476ca64b4425b5b8b0fa2dc8352ee6f03d563813..2250a8f24a875d6af198426891870b45
139139
}
140140
}
141141
diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js
142-
index 9ebe14011eed223994e0901bc22dcc582b4b0739..e78f90eb76380916ce7098fb517c83a954edb053 100644
142+
index d7ffbe5eca92734aa2380f482c7f9bfe7e2a36c7..d8e09f4b2186c2a0688f6c08943b3cd7b522632c 100644
143143
--- a/test/parallel/test-crypto-dh.js
144144
+++ b/test/parallel/test-crypto-dh.js
145-
@@ -55,18 +55,17 @@ const crypto = require('crypto');
145+
@@ -60,18 +60,17 @@ const {
146146
let wrongBlockLength;
147-
if (common.hasOpenSSL3) {
147+
if (hasOpenSSL3) {
148148
wrongBlockLength = {
149149
- message: 'error:1C80006B:Provider routines::wrong final block length',
150150
- code: 'ERR_OSSL_WRONG_FINAL_BLOCK_LENGTH',
@@ -169,9 +169,9 @@ index 9ebe14011eed223994e0901bc22dcc582b4b0739..e78f90eb76380916ce7098fb517c83a9
169169
};
170170
}
171171

172-
@@ -93,17 +92,23 @@ const crypto = require('crypto');
172+
@@ -98,15 +97,21 @@ const {
173173
dh3.computeSecret('');
174-
}, { message: common.hasOpenSSL3 && !hasOpenSSL3WithNewErrorMessage ?
174+
}, { message: hasOpenSSL3 && !hasOpenSSL3WithNewErrorMessage ?
175175
'Unspecified validation error' :
176176
- 'Supplied key is too small' });
177177
+ 'Supplied key is invalid' });
@@ -182,20 +182,18 @@ index 9ebe14011eed223994e0901bc22dcc582b4b0739..e78f90eb76380916ce7098fb517c83a9
182182
{
183183
const g = 0;
184184
- crypto.createDiffieHellman('abcdef', g);
185+
- crypto.createDiffieHellman('abcdef', 'hex', g);
185186
+ assert.throws(() => crypto.createDiffieHellman('abcdef', g), {
186187
+ code: /ERR_CRYPTO_OPERATION_FAILED/,
187188
+ name: 'Error'
188189
+ });
189-
crypto.createDiffieHellman('abcdef', 'hex', g);
190-
}
191-
192-
{
193-
- crypto.createDiffieHellman('abcdef', Buffer.from([2])); // OK
194190
+ assert.throws(() => crypto.createDiffieHellman('abcdef', Buffer.from([2])), {
195191
+ code: /ERR_CRYPTO_OPERATION_FAILED/,
196192
+ name: 'Error'
197193
+ });
198194
}
195+
196+
{
199197
diff --git a/test/parallel/test-crypto-getcipherinfo.js b/test/parallel/test-crypto-getcipherinfo.js
200198
index 64b79fc36ccf4d38f763fcd8c1930473c82cefd7..1c6717ebd46497384b9b13174b65894ca89e7f2d 100644
201199
--- a/test/parallel/test-crypto-getcipherinfo.js
@@ -237,38 +235,32 @@ index d22281abbd5c3cab3aaa3ac494301fa6b4a8a968..5f0c6a4aed2e868a1a1049212edf2187
237235
s.pipe(h).on('data', common.mustCall(function(c) {
238236
assert.strictEqual(c, expect);
239237
diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js
240-
index 83218c105a4596e0ae0381136f176bb8d759899e..afb3c8c592d2a8e2a053fd44f455af06c592a85e 100644
238+
index 61145aee0727fbe0b9781acdb3eeb641e7010729..fd7d4bd7d3f86caa30ffd03ea880eeac023bbcbb 100644
241239
--- a/test/parallel/test-crypto-hash.js
242240
+++ b/test/parallel/test-crypto-hash.js
243-
@@ -182,6 +182,7 @@ assert.throws(
241+
@@ -183,7 +183,7 @@ assert.throws(
242+
}
244243

245244
// Test XOF hash functions and the outputLength option.
246-
{
247-
+ /*
248-
// Default outputLengths.
249-
assert.strictEqual(crypto.createHash('shake128').digest('hex'),
250-
'7f9c2ba4e88f827d616045507605853e');
251-
@@ -236,6 +237,7 @@ assert.throws(
252-
assert.strictEqual(superLongHash.length, 2 * 1024 * 1024);
253-
assert.ok(superLongHash.endsWith('193414035ddba77bf7bba97981e656ec'));
254-
assert.ok(superLongHash.startsWith('a2a28dbc49cfd6e5d6ceea3d03e77748'));
255-
+ */
256-
257-
// Non-XOF hash functions should accept valid outputLength options as well.
258-
assert.strictEqual(crypto.createHash('sha224', { outputLength: 28 })
245+
-{
246+
+if (!common.openSSLIsBoringSSL) {
247+
// Default outputLengths. Since OpenSSL 3.4 an outputLength is mandatory
248+
if (!hasOpenSSL(3, 4)) {
249+
assert.strictEqual(crypto.createHash('shake128').digest('hex'),
250+
259251
diff --git a/test/parallel/test-crypto-hkdf.js b/test/parallel/test-crypto-hkdf.js
260-
index ff3abdf291efcd076b36e755de4147b0aad0b345..d29854cf0c0ce89f84c912def672e7c4e11427a3 100644
252+
index 3f7e61e9b2ebc0ca7c367d7c229afe9ab87762b8..36bd78105d153b75b42e4736f11d80a257916607 100644
261253
--- a/test/parallel/test-crypto-hkdf.js
262254
+++ b/test/parallel/test-crypto-hkdf.js
263-
@@ -124,8 +124,6 @@ const algorithms = [
255+
@@ -125,7 +125,7 @@ const algorithms = [
264256
['sha256', '', 'salt', '', 10],
265257
['sha512', 'secret', 'salt', '', 15],
266258
];
267-
-if (!common.hasOpenSSL3)
268-
- algorithms.push(['whirlpool', 'secret', '', 'info', 20]);
259+
-if (!hasOpenSSL3)
260+
+if (!hasOpenSSL3 && !common.openSSLIsBoringSSL)
261+
algorithms.push(['whirlpool', 'secret', '', 'info', 20]);
269262

270263
algorithms.forEach(([ hash, secret, salt, info, length ]) => {
271-
{
272264
diff --git a/test/parallel/test-crypto-padding.js b/test/parallel/test-crypto-padding.js
273265
index f1f14b472997e76bb4100edb1c6cf4fc24d1074d..5057e3f9bc5bb78aceffa5e79530f8ceed84e6f7 100644
274266
--- a/test/parallel/test-crypto-padding.js
@@ -302,10 +294,10 @@ index f1f14b472997e76bb4100edb1c6cf4fc24d1074d..5057e3f9bc5bb78aceffa5e79530f8ce
302294

303295
// No-pad encrypted string should return the same:
304296
diff --git a/test/parallel/test-crypto-rsa-dsa.js b/test/parallel/test-crypto-rsa-dsa.js
305-
index 5f4fafdfffbf726b7cb39c472baa3df25c9794cf..d52376da2cddd90adcdf8a9b7dcd03e348d9f2b4 100644
297+
index dcd5045daaf58c60e27c1e2f7941033302241339..6ac75565792b92a97c622baba73f821d754b8d01 100644
306298
--- a/test/parallel/test-crypto-rsa-dsa.js
307299
+++ b/test/parallel/test-crypto-rsa-dsa.js
308-
@@ -28,12 +28,11 @@ const dsaPkcs8KeyPem = fixtures.readKey('dsa_private_pkcs8.pem');
300+
@@ -29,12 +29,11 @@ const dsaPkcs8KeyPem = fixtures.readKey('dsa_private_pkcs8.pem');
309301
const ec = new TextEncoder();
310302

311303
const openssl1DecryptError = {
@@ -322,34 +314,25 @@ index 5f4fafdfffbf726b7cb39c472baa3df25c9794cf..d52376da2cddd90adcdf8a9b7dcd03e3
322314
+ library: /digital envelope routines|Cipher functions/,
323315
};
324316

325-
const decryptError = common.hasOpenSSL3 ?
326-
@@ -222,7 +221,8 @@ function test_rsa(padding, encryptOaepHash, decryptOaepHash) {
317+
const decryptError = hasOpenSSL3 ?
318+
@@ -223,7 +222,7 @@ function test_rsa(padding, encryptOaepHash, decryptOaepHash) {
327319
}, bufferToEncrypt);
328320

329321

330322
- if (padding === constants.RSA_PKCS1_PADDING) {
331-
+ // BoringSSL does not support RSA_PKCS1_PADDING.
332-
+ if (false) {
323+
+ if (!common.openSSLIsBoringSSL) {
333324
if (!process.config.variables.node_shared_openssl) {
334325
assert.throws(() => {
335326
crypto.privateDecrypt({
336-
@@ -466,10 +466,10 @@ assert.throws(() => {
337-
assert.strictEqual(verify2.verify(publicKey, signature, 'hex'), true);
338-
}
339-
340-
-
327+
@@ -471,7 +470,7 @@ assert.throws(() => {
341328
//
342329
// Test DSA signing and verification
343330
//
331+
-{
344332
+if (!common.openSSLIsBoringSSL) {
345-
{
346333
const input = 'I AM THE WALRUS';
347334

348-
@@ -541,3 +541,4 @@ const input = 'I AM THE WALRUS';
349-
350-
assert.strictEqual(verify.verify(dsaPubPem, signature, 'hex'), true);
351-
}
352-
+}
335+
// DSA signatures vary across runs so there is no static string to verify
353336
diff --git a/test/parallel/test-crypto-scrypt.js b/test/parallel/test-crypto-scrypt.js
354337
index 338a19b0e88ad6f08d2f6b6a5d38b9980996ce11..a4ee215575d072450ba66c558ddca88bfb23d85f 100644
355338
--- a/test/parallel/test-crypto-scrypt.js
@@ -364,10 +347,10 @@ index 338a19b0e88ad6f08d2f6b6a5d38b9980996ce11..a4ee215575d072450ba66c558ddca88b
364347
};
365348
assert.throws(() => crypto.scrypt('pass', 'salt', 1, options, () => {}),
366349
diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js
367-
index 8a263ec3350f5540591ac02e70fa2f552b9ac477..dcc4c2ec816d28f1b27df1c358cfce66f1a3a03b 100644
350+
index 0589d60736e377f24dc8550f87a6b7624173fc44..daa6a3d6f62ecfcd4580b3eb54b6f6bb916e93ad 100644
368351
--- a/test/parallel/test-crypto-sign-verify.js
369352
+++ b/test/parallel/test-crypto-sign-verify.js
370-
@@ -29,7 +29,7 @@ const keySize = 2048;
353+
@@ -33,7 +33,7 @@ const keySize = 2048;
371354
}
372355

373356
// Test handling of exceptional conditions
@@ -376,25 +359,25 @@ index 8a263ec3350f5540591ac02e70fa2f552b9ac477..dcc4c2ec816d28f1b27df1c358cfce66
376359
const library = {
377360
configurable: true,
378361
set() {
379-
@@ -341,15 +341,17 @@ assert.throws(
362+
@@ -345,15 +345,15 @@ assert.throws(
380363
padding: crypto.constants.RSA_PKCS1_OAEP_PADDING
381364
});
382-
}, common.hasOpenSSL3 ? {
365+
}, hasOpenSSL3 ? {
383366
- code: 'ERR_OSSL_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE',
384367
- message: /illegal or unsupported padding mode/,
385368
+ code: /^ERR_OSSL_(RSA|EVP)_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE$/,
386369
+ message: /illegal or unsupported padding mode|ILLEGAL_OR_UNSUPPORTED_PADDING_MODE/,
387370
} : {
388371
- code: 'ERR_OSSL_RSA_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE',
389372
- message: /illegal or unsupported padding mode/,
373+
- opensslErrorStack: [
390374
+ code: /^ERR_OSSL_(RSA|EVP)_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE$/,
391375
+ message: /illegal or unsupported padding mode|ILLEGAL_OR_UNSUPPORTED_PADDING_MODE/,
392-
+ /*
393-
opensslErrorStack: [
376+
+ /*opensslErrorStack: [
394377
'error:06089093:digital envelope routines:EVP_PKEY_CTX_ctrl:' +
395378
'command not supported',
396-
],
397-
+ */
379+
- ],
380+
+ ],*/
398381
});
399382
}
400383

‎patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch‎

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Upstreams:
1717
- https://github.com/nodejs/node/pull/39136
1818

1919
diff --git a/deps/ncrypto/ncrypto.cc b/deps/ncrypto/ncrypto.cc
20-
index ac2d771555126a4f43b8c3a3fd299d40019e6622..769fe636ef2b5d02ecc9ff753e64d93ea5075700 100644
20+
index ce2e7b384eb1987ddb081f79884fb8cb62ade60b..e969816ed20229ff2d52e55a018b5bb3d78525e2 100644
2121
--- a/deps/ncrypto/ncrypto.cc
2222
+++ b/deps/ncrypto/ncrypto.cc
2323
@@ -11,9 +11,6 @@
@@ -30,7 +30,7 @@ index ac2d771555126a4f43b8c3a3fd299d40019e6622..769fe636ef2b5d02ecc9ff753e64d93e
3030

3131
namespace ncrypto {
3232
namespace {
33-
@@ -708,7 +705,7 @@ bool SafeX509SubjectAltNamePrint(const BIOPointer& out, X509_EXTENSION* ext) {
33+
@@ -789,7 +786,7 @@ bool SafeX509SubjectAltNamePrint(const BIOPointer& out, X509_EXTENSION* ext) {
3434

3535
bool ok = true;
3636

@@ -39,7 +39,7 @@ index ac2d771555126a4f43b8c3a3fd299d40019e6622..769fe636ef2b5d02ecc9ff753e64d93e
3939
GENERAL_NAME* gen = sk_GENERAL_NAME_value(names, i);
4040

4141
if (i != 0) BIO_write(out.get(), ", ", 2);
42-
@@ -732,7 +729,7 @@ bool SafeX509InfoAccessPrint(const BIOPointer& out, X509_EXTENSION* ext) {
42+
@@ -813,7 +810,7 @@ bool SafeX509InfoAccessPrint(const BIOPointer& out, X509_EXTENSION* ext) {
4343

4444
bool ok = true;
4545

@@ -48,7 +48,7 @@ index ac2d771555126a4f43b8c3a3fd299d40019e6622..769fe636ef2b5d02ecc9ff753e64d93e
4848
ACCESS_DESCRIPTION* desc = sk_ACCESS_DESCRIPTION_value(descs, i);
4949

5050
if (i != 0) BIO_write(out.get(), "\n", 1);
51-
@@ -874,13 +871,17 @@ BIOPointer X509View::getValidTo() const {
51+
@@ -955,13 +952,17 @@ BIOPointer X509View::getValidTo() const {
5252

5353
int64_t X509View::getValidToTime() const {
5454
struct tm tp;
@@ -67,7 +67,7 @@ index ac2d771555126a4f43b8c3a3fd299d40019e6622..769fe636ef2b5d02ecc9ff753e64d93e
6767
return PortableTimeGM(&tp);
6868
}
6969

70-
@@ -1085,7 +1086,11 @@ BIOPointer BIOPointer::NewMem() {
70+
@@ -1236,7 +1237,11 @@ BIOPointer BIOPointer::NewMem() {
7171
}
7272

7373
BIOPointer BIOPointer::NewSecMem() {
@@ -80,7 +80,7 @@ index ac2d771555126a4f43b8c3a3fd299d40019e6622..769fe636ef2b5d02ecc9ff753e64d93e
8080
}
8181

8282
BIOPointer BIOPointer::New(const BIO_METHOD* method) {
83-
@@ -1149,8 +1154,10 @@ BignumPointer DHPointer::FindGroup(const std::string_view name,
83+
@@ -1306,8 +1311,10 @@ BignumPointer DHPointer::FindGroup(const std::string_view name,
8484
#define V(n, p) \
8585
if (EqualNoCase(name, n)) return BignumPointer(p(nullptr));
8686
if (option != FindGroupOption::NO_SMALL_PRIMES) {
@@ -91,7 +91,7 @@ index ac2d771555126a4f43b8c3a3fd299d40019e6622..769fe636ef2b5d02ecc9ff753e64d93e
9191
V("modp5", BN_get_rfc3526_prime_1536);
9292
}
9393
V("modp14", BN_get_rfc3526_prime_2048);
94-
@@ -1223,11 +1230,13 @@ DHPointer::CheckPublicKeyResult DHPointer::checkPublicKey(
94+
@@ -1383,11 +1390,13 @@ DHPointer::CheckPublicKeyResult DHPointer::checkPublicKey(
9595
int codes = 0;
9696
if (DH_check_pub_key(dh_.get(), pub_key.get(), &codes) != 1)
9797
return DHPointer::CheckPublicKeyResult::CHECK_FAILED;
@@ -106,33 +106,41 @@ index ac2d771555126a4f43b8c3a3fd299d40019e6622..769fe636ef2b5d02ecc9ff753e64d93e
106106
return DHPointer::CheckPublicKeyResult::INVALID;
107107
}
108108
return CheckPublicKeyResult::NONE;
109-
diff --git a/deps/ncrypto/ncrypto.h b/deps/ncrypto/ncrypto.h
110-
index fffa75ec718facc61cebf48f33ddc3909b9b9413..19757016a4f50e2f656a76bf60cb87e601845afe 100644
111-
--- a/deps/ncrypto/ncrypto.h
112-
+++ b/deps/ncrypto/ncrypto.h
113-
@@ -516,17 +516,21 @@ class DHPointer final {
114-
UNABLE_TO_CHECK_GENERATOR = DH_UNABLE_TO_CHECK_GENERATOR,
115-
NOT_SUITABLE_GENERATOR = DH_NOT_SUITABLE_GENERATOR,
116-
Q_NOT_PRIME = DH_CHECK_Q_NOT_PRIME,
109+
@@ -2330,7 +2339,7 @@ const std::string_view SSLPointer::getClientHelloAlpn() const {
110+
const unsigned char* buf;
111+
size_t len;
112+
size_t rem;
113+
-
117114
+#ifndef OPENSSL_IS_BORINGSSL
118-
INVALID_Q = DH_CHECK_INVALID_Q_VALUE,
119-
INVALID_J = DH_CHECK_INVALID_J_VALUE,
115+
if (!SSL_client_hello_get0_ext(
116+
get(),
117+
TLSEXT_TYPE_application_layer_protocol_negotiation,
118+
@@ -2343,6 +2352,8 @@ const std::string_view SSLPointer::getClientHelloAlpn() const {
119+
len = (buf[0] << 8) | buf[1];
120+
if (len + 2 != rem) return {};
121+
return reinterpret_cast<const char*>(buf + 3);
120122
+#endif
121-
CHECK_FAILED = 512,
122-
};
123-
CheckResult check();
123+
+ return nullptr;
124+
}
124125

125-
enum class CheckPublicKeyResult {
126-
NONE,
126+
const std::string_view SSLPointer::getClientHelloServerName() const {
127+
@@ -2350,7 +2361,7 @@ const std::string_view SSLPointer::getClientHelloServerName() const {
128+
const unsigned char* buf;
129+
size_t len;
130+
size_t rem;
131+
-
127132
+#ifndef OPENSSL_IS_BORINGSSL
128-
TOO_SMALL = DH_R_CHECK_PUBKEY_TOO_SMALL,
129-
TOO_LARGE = DH_R_CHECK_PUBKEY_TOO_LARGE,
130-
- INVALID = DH_R_CHECK_PUBKEY_INVALID,
133+
if (!SSL_client_hello_get0_ext(get(), TLSEXT_TYPE_server_name, &buf, &rem) ||
134+
rem <= 2) {
135+
return {};
136+
@@ -2366,6 +2377,7 @@ const std::string_view SSLPointer::getClientHelloServerName() const {
137+
len = (*(buf + 3) << 8) | *(buf + 4);
138+
if (len + 2 > rem) return {};
139+
return reinterpret_cast<const char*>(buf + 5);
131140
+#endif
132-
+ INVALID = DH_R_INVALID_PUBKEY,
133-
CHECK_FAILED = 512,
134-
};
135-
// Check to see if the given public key is suitable for this DH instance.
141+
}
142+
143+
std::optional<const std::string_view> SSLPointer::GetServerName(
136144
diff --git a/node.gni b/node.gni
137145
index 245a43920c7baf000ba63192a84a4c3fd219be7d..56a554175b805c1703f13d62041f8c80d6e94dd9 100644
138146
--- a/node.gni

‎patches/node/support_v8_sandboxed_pointers.patch‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ index ad323fc800a33c010b0504a4aa55c107498dee26..fc9b056d2f7e25109100fbde5f3ab0ae
2626
void* ret;
2727
if (zero_fill_field_ || per_process::cli_options->zero_fill_all_buffers)
2828
diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc
29-
index f973941b3b9ea954f35f2ea135f8ee3d77b98958..743c63ff7e3f526829919a8f2de7ebd625a93fbc 100644
29+
index 5387d9625a28bb7d11f7f0f05a5f07d1fee2c216..1b3b8c7b70073926f8dbf02759c2e1af5d938679 100644
3030
--- a/src/crypto/crypto_dh.cc
3131
+++ b/src/crypto/crypto_dh.cc
32-
@@ -51,6 +51,25 @@ void DiffieHellman::MemoryInfo(MemoryTracker* tracker) const {
32+
@@ -55,13 +55,32 @@ void DiffieHellman::MemoryInfo(MemoryTracker* tracker) const {
33+
3334
namespace {
34-
MaybeLocal<Value> DataPointerToBuffer(Environment* env,
35-
ncrypto::DataPointer&& data) {
35+
MaybeLocal<Value> DataPointerToBuffer(Environment* env, DataPointer&& data) {
3636
+#if defined(V8_ENABLE_SANDBOX)
3737
+ std::unique_ptr<v8::BackingStore> backing;
3838
+ if (data.size() > 0) {
@@ -55,14 +55,14 @@ index f973941b3b9ea954f35f2ea135f8ee3d77b98958..743c63ff7e3f526829919a8f2de7ebd6
5555
auto backing = ArrayBuffer::NewBackingStore(
5656
data.get(),
5757
data.size(),
58-
@@ -59,6 +78,7 @@ MaybeLocal<Value> DataPointerToBuffer(Environment* env,
59-
},
58+
[](void* data, size_t len, void* ptr) { DataPointer free_me(data, len); },
6059
nullptr);
6160
data.release();
61+
-
6262
+#endif
63-
6463
auto ab = ArrayBuffer::New(env->isolate(), std::move(backing));
6564
return Buffer::New(env, ab, 0, ab->ByteLength()).FromMaybe(Local<Value>());
65+
}
6666
diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc
6767
index 8a6a36a3c31532ed585c287ba8cee14026d315b4..3d449b5853f359d63e1b88671a857bf9152ff6af 100644
6868
--- a/src/crypto/crypto_util.cc

0 commit comments

Comments
 (0)