summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/node_crypto.cc2
-rw-r--r--test/parallel/test-crypto-keygen.js4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index 3ddda9a774..5f135c2e0a 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -4864,8 +4864,10 @@ class RSAKeyPairGenerationConfig : public KeyPairGenerationConfig {
BignumPointer bn(BN_new());
CHECK_NOT_NULL(bn.get());
CHECK(BN_set_word(bn.get(), exponent_));
+ // EVP_CTX acceps ownership of bn on success.
if (EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx.get(), bn.get()) <= 0)
return false;
+ bn.release();
}
return true;
diff --git a/test/parallel/test-crypto-keygen.js b/test/parallel/test-crypto-keygen.js
index 0ffaa1c725..f164938d97 100644
--- a/test/parallel/test-crypto-keygen.js
+++ b/test/parallel/test-crypto-keygen.js
@@ -86,7 +86,7 @@ function convertDERToPEM(label, der) {
// To make the test faster, we will only test sync key generation once and
// with a relatively small key.
const ret = generateKeyPairSync('rsa', {
- publicExponent: 0x10001,
+ publicExponent: 3,
modulusLength: 512,
publicKeyEncoding: {
type: 'pkcs1',
@@ -144,7 +144,7 @@ function convertDERToPEM(label, der) {
// Now do the same with an encrypted private key.
generateKeyPair('rsa', {
- publicExponent: 0x10001,
+ publicExponent: 0x1001,
modulusLength: 512,
publicKeyEncoding: {
type: 'pkcs1',