summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Nießen <tniessen@tnie.de>2021-01-26 18:58:45 +0100
committerMichaël Zasso <targos@protonmail.com>2021-02-02 10:47:41 +0100
commit9c831c0d8fffb84a7c1354c787645cd641d5b677 (patch)
treef6054580a65f0e4b24883ec749171c79a6bf318b
parent3187845980956e88185edf377b3990fd50271d66 (diff)
downloadnode-new-9c831c0d8fffb84a7c1354c787645cd641d5b677.tar.gz
src: fix dead code in RandomPrimeTraits
PR-URL: https://github.com/nodejs/node/pull/37083 Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
-rw-r--r--src/crypto/crypto_random.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/crypto/crypto_random.cc b/src/crypto/crypto_random.cc
index 01f32832b2..e572216948 100644
--- a/src/crypto/crypto_random.cc
+++ b/src/crypto/crypto_random.cc
@@ -110,8 +110,7 @@ Maybe<bool> RandomPrimeTraits::AdditionalConfig(
return Nothing<bool>();
}
ArrayBufferOrViewContents<unsigned char> add(args[offset + 2]);
- BN_bin2bn(add.data(), add.size(), params->add.get());
- if (!params->add) {
+ if (BN_bin2bn(add.data(), add.size(), params->add.get()) == nullptr) {
THROW_ERR_INVALID_ARG_VALUE(env, "invalid options.add");
return Nothing<bool>();
}
@@ -124,8 +123,7 @@ Maybe<bool> RandomPrimeTraits::AdditionalConfig(
return Nothing<bool>();
}
ArrayBufferOrViewContents<unsigned char> rem(args[offset + 3]);
- BN_bin2bn(rem.data(), rem.size(), params->rem.get());
- if (!params->rem) {
+ if (BN_bin2bn(rem.data(), rem.size(), params->rem.get()) == nullptr) {
THROW_ERR_INVALID_ARG_VALUE(env, "invalid options.rem");
return Nothing<bool>();
}