| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 182e6b9 commit 76f0f1c
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1475,31 +1475,5 @@ | |||
| 1475 | 1475 | }, | |
| 1476 | 1476 | ] | |
| 1477 | 1477 | }], # end aix section | |
| 1478 | - # TODO(RaisinTen): Enable this to build on other platforms as well. | ||
| 1479 | - ['(OS=="mac" or (OS=="linux" and target_arch=="x64")) and \ | ||
| 1480 | - node_use_openssl=="true"', { | ||
| 1481 | - 'targets': [ | ||
| 1482 | - { | ||
| 1483 | - 'target_name': 'test_crypto_engine', | ||
| 1484 | - 'type': 'shared_library', | ||
| 1485 | - 'include_dirs': ['deps/openssl/openssl/include'], | ||
| 1486 | - 'sources': ['test/fixtures/test_crypto_engine.c'], | ||
| 1487 | - 'conditions': [ | ||
| 1488 | - ['OS=="mac"', { | ||
| 1489 | - 'dependencies': ['deps/openssl/openssl.gyp:openssl'], | ||
| 1490 | - 'xcode_settings': { | ||
| 1491 | - 'OTHER_CFLAGS': ['-Wno-deprecated-declarations'], | ||
| 1492 | - }, | ||
| 1493 | - }], | ||
| 1494 | - ['OS=="linux" and target_arch=="x64"', { | ||
| 1495 | - 'cflags': [ | ||
| 1496 | - '-Wno-deprecated-declarations', | ||
| 1497 | - '-fPIC', | ||
| 1498 | - ], | ||
| 1499 | - }], | ||
| 1500 | - ], | ||
| 1501 | - }, # test_crypto_engine | ||
| 1502 | - ], # end targets | ||
| 1503 | - }], # end node_use_openssl section | ||
| 1504 | 1478 | ], # end conditions block | |
| 1505 | 1479 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,37 @@ | |||
| 1 | + { | ||
| 2 | + 'targets': [ | ||
| 3 | + { | ||
| 4 | + 'target_name': 'testsetengine', | ||
| 5 | + 'type': 'none', | ||
| 6 | + 'includes': ['../common.gypi'], | ||
| 7 | + 'conditions': [ | ||
| 8 | + ['(OS=="mac" or OS=="linux") and ' | ||
| 9 | + 'node_use_openssl=="true" and ' | ||
| 10 | + 'node_shared=="false" and ' | ||
| 11 | + 'node_shared_openssl=="false"', { | ||
| 12 | + 'type': 'shared_library', | ||
| 13 | + 'sources': [ 'testsetengine.cc' ], | ||
| 14 | + 'product_extension': 'engine', | ||
| 15 | + 'include_dirs': ['../../../deps/openssl/openssl/include'], | ||
| 16 | + 'conditions': [ | ||
| 17 | + ['OS=="mac"', { | ||
| 18 | + 'xcode_settings': { | ||
| 19 | + 'OTHER_CFLAGS': ['-Wno-deprecated-declarations'], | ||
| 20 | + }, | ||
| 21 | + 'link_settings': { | ||
| 22 | + 'libraries': [ | ||
| 23 | + '../../../../out/<(PRODUCT_DIR)/<(openssl_product)' | ||
| 24 | + ] | ||
| 25 | + }, | ||
| 26 | + }], | ||
| 27 | + ['OS=="linux"', { | ||
| 28 | + 'cflags': [ | ||
| 29 | + '-Wno-deprecated-declarations', | ||
| 30 | + ], | ||
| 31 | + }], | ||
| 32 | + ], | ||
| 33 | + }], | ||
| 34 | + ], | ||
| 35 | + } | ||
| 36 | + ] | ||
| 37 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,60 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../../common'); | ||
| 3 | + | ||
| 4 | + // This tests crypto.setEngine(). | ||
| 5 | + | ||
| 6 | + if (!common.hasCrypto) | ||
| 7 | + common.skip('missing crypto'); | ||
| 8 | + | ||
| 9 | + const assert = require('assert'); | ||
| 10 | + const crypto = require('crypto'); | ||
| 11 | + const fs = require('fs'); | ||
| 12 | + const path = require('path'); | ||
| 13 | + | ||
| 14 | + | ||
| 15 | + assert.throws(() => crypto.setEngine(true), /ERR_INVALID_ARG_TYPE/); | ||
| 16 | + assert.throws(() => crypto.setEngine('/path/to/engine', 'notANumber'), | ||
| 17 | + /ERR_INVALID_ARG_TYPE/); | ||
| 18 | + | ||
| 19 | + { | ||
| 20 | + const invalidEngineName = 'xxx'; | ||
| 21 | + assert.throws(() => crypto.setEngine(invalidEngineName), | ||
| 22 | + /ERR_CRYPTO_ENGINE_UNKNOWN/); | ||
| 23 | + assert.throws(() => crypto.setEngine(invalidEngineName, | ||
| 24 | + crypto.constants.ENGINE_METHOD_RSA), | ||
| 25 | + /ERR_CRYPTO_ENGINE_UNKNOWN/); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + crypto.setEngine('dynamic'); | ||
| 29 | + crypto.setEngine('dynamic'); | ||
| 30 | + | ||
| 31 | + crypto.setEngine('dynamic', crypto.constants.ENGINE_METHOD_RSA); | ||
| 32 | + crypto.setEngine('dynamic', crypto.constants.ENGINE_METHOD_RSA); | ||
| 33 | + | ||
| 34 | + const engine = path.join(__dirname, | ||
| 35 | + `/build/${common.buildType}/testsetengine.engine`); | ||
| 36 | + | ||
| 37 | + if (!fs.existsSync(engine)) | ||
| 38 | + common.skip('no engine'); | ||
| 39 | + | ||
| 40 | + { | ||
| 41 | + const engineId = path.parse(engine).name; | ||
| 42 | + const execDir = path.parse(engine).dir; | ||
| 43 | + | ||
| 44 | + crypto.setEngine(engine); | ||
| 45 | + // OpenSSL 3.0.1 and 1.1.1m now throw errors if an engine is loaded again | ||
| 46 | + // with a duplicate absolute path. | ||
| 47 | + // TODO(richardlau): figure out why this fails on macOS but not Linux. | ||
| 48 | + // crypto.setEngine(engine); | ||
| 49 | + | ||
| 50 | + // crypto.setEngine(engine, crypto.constants.ENGINE_METHOD_RSA); | ||
| 51 | + // crypto.setEngine(engine, crypto.constants.ENGINE_METHOD_RSA); | ||
| 52 | + | ||
| 53 | + process.env.OPENSSL_ENGINES = execDir; | ||
| 54 | + | ||
| 55 | + crypto.setEngine(engineId); | ||
| 56 | + crypto.setEngine(engineId); | ||
| 57 | + | ||
| 58 | + crypto.setEngine(engineId, crypto.constants.ENGINE_METHOD_RSA); | ||
| 59 | + crypto.setEngine(engineId, crypto.constants.ENGINE_METHOD_RSA); | ||
| 60 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,44 @@ | |||
| 1 | + #include <openssl/engine.h> | ||
| 2 | + | ||
| 3 | + #ifndef ENGINE_CMD_BASE | ||
| 4 | + # error did not get engine.h | ||
| 5 | + #endif | ||
| 6 | + | ||
| 7 | + #define TEST_ENGINE_ID "testsetengine" | ||
| 8 | + #define TEST_ENGINE_NAME "dummy test engine" | ||
| 9 | + | ||
| 10 | + #ifdef _WIN32 | ||
| 11 | + # define DEFAULT_VISIBILITY __declspec(dllexport) | ||
| 12 | + #else | ||
| 13 | + # define DEFAULT_VISIBILITY __attribute__((visibility("default"))) | ||
| 14 | + #endif | ||
| 15 | + | ||
| 16 | + namespace { | ||
| 17 | + | ||
| 18 | + int EngineInit(ENGINE* engine) { | ||
| 19 | + return 1; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + int EngineFinish(ENGINE* engine) { | ||
| 23 | + return 1; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + int EngineDestroy(ENGINE* engine) { | ||
| 27 | + return 1; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + int bind_fn(ENGINE* engine, const char* id) { | ||
| 31 | + ENGINE_set_id(engine, TEST_ENGINE_ID); | ||
| 32 | + ENGINE_set_name(engine, TEST_ENGINE_NAME); | ||
| 33 | + ENGINE_set_init_function(engine, EngineInit); | ||
| 34 | + ENGINE_set_finish_function(engine, EngineFinish); | ||
| 35 | + ENGINE_set_destroy_function(engine, EngineDestroy); | ||
| 36 | + return 1; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + extern "C" { | ||
| 40 | + DEFAULT_VISIBILITY IMPLEMENT_DYNAMIC_CHECK_FN(); | ||
| 41 | + DEFAULT_VISIBILITY IMPLEMENT_DYNAMIC_BIND_FN(bind_fn); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + } // anonymous namespace | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,7 @@ if (typeof require === 'undefined') { | |||
| 5 | 5 | } | |
| 6 | 6 | ||
| 7 | 7 | const path = require('path'); | |
| 8 | - const { Worker, SHARE_ENV } = require('worker_threads'); | ||
| 8 | + const { Worker } = require('worker_threads'); | ||
| 9 | 9 | ||
| 10 | - new Worker(path.resolve(process.cwd(), process.argv[2]), { env: SHARE_ENV }) | ||
| 10 | + new Worker(path.resolve(process.cwd(), process.argv[2])) | ||
| 11 | 11 | .on('exit', (code) => process.exitCode = code); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments