summaryrefslogtreecommitdiff
path: root/test/parallel/test-crypto-fips.js
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2017-10-23 22:44:52 -0700
committerJames M Snell <jasnell@gmail.com>2017-10-27 08:13:01 -0700
commitee76f3153b51c60c74e7e4b0882a99f3a3745294 (patch)
tree50dd105ac937cdbb4dbfd64676a304e3093fa147 /test/parallel/test-crypto-fips.js
parenta0f7ae6c4110cca75793964dc9dbbf457071dad8 (diff)
downloadandroid-node-v8-ee76f3153b51c60c74e7e4b0882a99f3a3745294.tar.gz
android-node-v8-ee76f3153b51c60c74e7e4b0882a99f3a3745294.tar.bz2
android-node-v8-ee76f3153b51c60c74e7e4b0882a99f3a3745294.zip
crypto: migrate setFipsCrypto to internal/errors
With the exception of ThrowCryptoError, use internal/errors to report fips unavailable or forced PR-URL: https://github.com/nodejs/node/pull/16428 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/parallel/test-crypto-fips.js')
-rw-r--r--test/parallel/test-crypto-fips.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/parallel/test-crypto-fips.js b/test/parallel/test-crypto-fips.js
index 755c6e20c2..faf5ab9588 100644
--- a/test/parallel/test-crypto-fips.js
+++ b/test/parallel/test-crypto-fips.js
@@ -10,7 +10,12 @@ const fixtures = require('../common/fixtures');
const FIPS_ENABLED = 1;
const FIPS_DISABLED = 0;
-const FIPS_ERROR_STRING = 'Error: Cannot set FIPS mode';
+const FIPS_ERROR_STRING =
+ 'Error [ERR_CRYPTO_FIPS_UNAVAILABLE]: Cannot set FIPS mode in a ' +
+ 'non-FIPS build.';
+const FIPS_ERROR_STRING2 =
+ 'Error [ERR_CRYPTO_FIPS_FORCED]: Cannot set FIPS mode, it was forced with ' +
+ '--force-fips at startup.';
const OPTION_ERROR_STRING = 'bad option';
const CNF_FIPS_ON = fixtures.path('openssl_fips_enabled.cnf');
@@ -208,7 +213,7 @@ testHelper(
testHelper(
'stderr',
['--force-fips'],
- compiledWithFips() ? FIPS_ERROR_STRING : OPTION_ERROR_STRING,
+ compiledWithFips() ? FIPS_ERROR_STRING2 : OPTION_ERROR_STRING,
'require("crypto").fips = false',
process.env);
@@ -225,7 +230,7 @@ testHelper(
testHelper(
'stderr',
['--force-fips', '--enable-fips'],
- compiledWithFips() ? FIPS_ERROR_STRING : OPTION_ERROR_STRING,
+ compiledWithFips() ? FIPS_ERROR_STRING2 : OPTION_ERROR_STRING,
'require("crypto").fips = false',
process.env);
@@ -233,6 +238,6 @@ testHelper(
testHelper(
'stderr',
['--enable-fips', '--force-fips'],
- compiledWithFips() ? FIPS_ERROR_STRING : OPTION_ERROR_STRING,
+ compiledWithFips() ? FIPS_ERROR_STRING2 : OPTION_ERROR_STRING,
'require("crypto").fips = false',
process.env);