diff --git a/src/crypto/crypto_dsa.cc b/src/crypto/crypto_dsa.cc index 6839283fbf4ca7..dce1f93f4c20d5 100644 --- a/src/crypto/crypto_dsa.cc +++ b/src/crypto/crypto_dsa.cc @@ -89,10 +89,7 @@ Maybe DsaKeyGenTraits::AdditionalConfig( params->params.modulus_bits = args[*offset].As()->Value(); params->params.divisor_bits = args[*offset + 1].As()->Value(); - if (params->params.divisor_bits < -1) { - THROW_ERR_OUT_OF_RANGE(env, "invalid value for divisor_bits"); - return Nothing(); - } + CHECK_GE(params->params.divisor_bits, -1); *offset += 2; diff --git a/test/parallel/test-crypto-keygen.js b/test/parallel/test-crypto-keygen.js index 1a77266b057041..df8c5d93a90342 100644 --- a/test/parallel/test-crypto-keygen.js +++ b/test/parallel/test-crypto-keygen.js @@ -1278,7 +1278,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); } // Test invalid divisor lengths. (out of range) - for (const divisorLength of [-6, -9, 2147483648]) { + for (const divisorLength of [-1, -6, -9, 2147483648]) { assert.throws(() => generateKeyPair('dsa', { modulusLength: 2048, divisorLength