From 9c831c0d8fffb84a7c1354c787645cd641d5b677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Tue, 26 Jan 2021 18:58:45 +0100 Subject: [PATCH] src: fix dead code in RandomPrimeTraits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/37083 Reviewed-By: Juan José Arboleda Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- src/crypto/crypto_random.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/crypto/crypto_random.cc b/src/crypto/crypto_random.cc index 01f32832b29843..e5722169486e3e 100644 --- a/src/crypto/crypto_random.cc +++ b/src/crypto/crypto_random.cc @@ -110,8 +110,7 @@ Maybe RandomPrimeTraits::AdditionalConfig( return Nothing(); } ArrayBufferOrViewContents 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(); } @@ -124,8 +123,7 @@ Maybe RandomPrimeTraits::AdditionalConfig( return Nothing(); } ArrayBufferOrViewContents 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(); }