test: do not load absolute path crypto engines twice

Newer versions of OpenSSL now throws an error if an engine is loaded
twice by its absolute path (a second load by its id appears to be okay).

PR-URL: https://github.com/nodejs/node/pull/41177
Refs: https://github.com/quictls/openssl/pull/69
Refs: https://mta.openssl.org/pipermail/openssl-announce/2021-December/000212.html
Reviewed-By: Danielle Adams <adamzdanielle@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
This commit is contained in:
Richard Lau authored and Danielle Adams committed 2021-12-17 08:15:46 -05:00
1 parent 8fcb71a5ab
commit da8baf4bbb
1 file changed
+6 -3
+6 -3
View File
@@ -44,10 +44,13 @@ crypto.setEngine('dynamic', crypto.constants.ENGINE_METHOD_RSA);
fs.accessSync(enginePath);
crypto.setEngine(enginePath);
crypto.setEngine(enginePath);
// OpenSSL 3.0.1 and 1.1.1m now throw errors if an engine is loaded again
// with a duplicate absolute path.
// TODO(richardlau): figure out why this fails on macOS but not Linux.
// crypto.setEngine(enginePath);
crypto.setEngine(enginePath, crypto.constants.ENGINE_METHOD_RSA);
crypto.setEngine(enginePath, crypto.constants.ENGINE_METHOD_RSA);
// crypto.setEngine(enginePath, crypto.constants.ENGINE_METHOD_RSA);
// crypto.setEngine(enginePath, crypto.constants.ENGINE_METHOD_RSA);
process.env.OPENSSL_ENGINES = execDir;