Skip to content

Commit

Permalink
src: fix dead code in RandomPrimeTraits
Browse files Browse the repository at this point in the history
PR-URL: #37083
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
tniessen authored and targos committed Feb 2, 2021
1 parent 3187845 commit 9c831c0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/crypto/crypto_random.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
}
Expand All @@ -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>();
}
Expand Down

0 comments on commit 9c831c0

Please sign in to comment.