From 578e3e56f25b855ca94806d4a02ed86ea67e1d99 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 18 Jan 2021 08:22:51 -0800 Subject: [PATCH 1/2] [Temporary for debugging] --- deps/openssl/openssl/crypto/init.c | 2 ++ deps/openssl/openssl/crypto/mem_sec.c | 1 + 2 files changed, 3 insertions(+) diff --git a/deps/openssl/openssl/crypto/init.c b/deps/openssl/openssl/crypto/init.c index 1b0d523beae0..68a69075619a 100644 --- a/deps/openssl/openssl/crypto/init.c +++ b/deps/openssl/openssl/crypto/init.c @@ -607,7 +607,9 @@ void OPENSSL_cleanup(void) obj_cleanup_int(); err_cleanup(); +printf("About to call CRYPTO_secure_malloc_done\n"); CRYPTO_secure_malloc_done(); +printf("Just called CRYPTO_secure_malloc_done\n"); base_inited = 0; } diff --git a/deps/openssl/openssl/crypto/mem_sec.c b/deps/openssl/openssl/crypto/mem_sec.c index b5f959ba15d5..44d75917dade 100644 --- a/deps/openssl/openssl/crypto/mem_sec.c +++ b/deps/openssl/openssl/crypto/mem_sec.c @@ -91,6 +91,7 @@ int CRYPTO_secure_malloc_init(size_t size, int minsize) int CRYPTO_secure_malloc_done(void) { #ifdef OPENSSL_SECURE_MEMORY +printf("!!! secure_mem_used %llu\n", secure_mem_used); if (secure_mem_used == 0) { sh_done(); secure_mem_initialized = 0; From 9699aadd3ac96588d0b815a1d4d78fdc7ae4abf2 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 18 Jan 2021 09:40:43 -0800 Subject: [PATCH 2/2] [Temporary for debugging] --- deps/openssl/openssl/crypto/init.c | 2 -- deps/openssl/openssl/crypto/mem_sec.c | 1 - test/parallel/test-crypto-secure-heap.js | 36 ++++++++++++------------ 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/deps/openssl/openssl/crypto/init.c b/deps/openssl/openssl/crypto/init.c index 68a69075619a..1b0d523beae0 100644 --- a/deps/openssl/openssl/crypto/init.c +++ b/deps/openssl/openssl/crypto/init.c @@ -607,9 +607,7 @@ void OPENSSL_cleanup(void) obj_cleanup_int(); err_cleanup(); -printf("About to call CRYPTO_secure_malloc_done\n"); CRYPTO_secure_malloc_done(); -printf("Just called CRYPTO_secure_malloc_done\n"); base_inited = 0; } diff --git a/deps/openssl/openssl/crypto/mem_sec.c b/deps/openssl/openssl/crypto/mem_sec.c index 44d75917dade..b5f959ba15d5 100644 --- a/deps/openssl/openssl/crypto/mem_sec.c +++ b/deps/openssl/openssl/crypto/mem_sec.c @@ -91,7 +91,6 @@ int CRYPTO_secure_malloc_init(size_t size, int minsize) int CRYPTO_secure_malloc_done(void) { #ifdef OPENSSL_SECURE_MEMORY -printf("!!! secure_mem_used %llu\n", secure_mem_used); if (secure_mem_used == 0) { sh_done(); secure_mem_initialized = 0; diff --git a/test/parallel/test-crypto-secure-heap.js b/test/parallel/test-crypto-secure-heap.js index f6bdc3a2d8a0..96d30e1d0420 100644 --- a/test/parallel/test-crypto-secure-heap.js +++ b/test/parallel/test-crypto-secure-heap.js @@ -7,26 +7,26 @@ if (!common.hasCrypto) if (common.isWindows) common.skip('Not supported on Windows'); -if (process.config.variables.asan) - common.skip('ASAN does not play well with secure heap allocations'); +// if (process.config.variables.asan) +// common.skip('ASAN does not play well with secure heap allocations'); const assert = require('assert'); const { fork } = require('child_process'); const fixtures = require('../common/fixtures'); const { - secureHeapUsed, + // secureHeapUsed, createDiffieHellman, } = require('crypto'); if (process.argv[2] === 'child') { - const a = secureHeapUsed(); + // const a = secureHeapUsed(); - assert(a); - assert.strictEqual(typeof a, 'object'); - assert.strictEqual(a.total, 65536); - assert.strictEqual(a.min, 4); - assert.strictEqual(a.used, 0); + // assert(a); + // assert.strictEqual(typeof a, 'object'); + // assert.strictEqual(a.total, 65536); + // assert.strictEqual(a.min, 4); + // assert.strictEqual(a.used, 0); { const dh1 = createDiffieHellman(common.hasFipsCrypto ? 1024 : 256); @@ -37,14 +37,14 @@ if (process.argv[2] === 'child') { dh1.computeSecret(key2, 'hex', 'base64'); dh2.computeSecret(key1, 'latin1', 'buffer'); - const b = secureHeapUsed(); - assert(b); - assert.strictEqual(typeof b, 'object'); - assert.strictEqual(b.total, 65536); - assert.strictEqual(b.min, 4); - // The amount used can vary on a number of factors - assert(b.used > 0); - assert(b.utilization > 0.0); + // const b = secureHeapUsed(); + // assert(b); + // assert.strictEqual(typeof b, 'object'); + // assert.strictEqual(b.total, 65536); + // assert.strictEqual(b.min, 4); + // // The amount used can vary on a number of factors + // assert(b.used > 0); + // assert(b.utilization > 0.0); } return; @@ -53,7 +53,7 @@ if (process.argv[2] === 'child') { const child = fork( process.argv[1], ['child'], - { execArgv: ['--secure-heap=65536', '--secure-heap-min=4'] }); + { /* execArgv: ['--secure-heap=65536', '--secure-heap-min=4'] */ }); child.on('exit', common.mustCall((code) => { assert.strictEqual(code, 0);