diff --git a/src/crypto/crypto_dsa.cc b/src/crypto/crypto_dsa.cc index c7894baf00ee9c..862c091b05f588 100644 --- a/src/crypto/crypto_dsa.cc +++ b/src/crypto/crypto_dsa.cc @@ -12,6 +12,17 @@ #include +// EVP_PKEY_CTX_set_dsa_paramgen_q_bits was added in OpenSSL 1.1.1e. +#if OPENSSL_VERSION_NUMBER < 0x1010105fL +#define EVP_PKEY_CTX_set_dsa_paramgen_q_bits(ctx, qbits) \ + EVP_PKEY_CTX_ctrl((ctx), \ + EVP_PKEY_DSA, \ + EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS, \ + (qbits), \ + nullptr) +#endif + namespace node { using v8::FunctionCallbackInfo; @@ -39,13 +50,8 @@ EVPKeyCtxPointer DsaKeyGenTraits::Setup(DsaKeyPairGenConfig* params) { } if (params->params.divisor_bits != -1) { - if (EVP_PKEY_CTX_ctrl( - param_ctx.get(), - EVP_PKEY_DSA, - EVP_PKEY_OP_PARAMGEN, - EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS, - params->params.divisor_bits, - nullptr) <= 0) { + if (EVP_PKEY_CTX_set_dsa_paramgen_q_bits( + param_ctx.get(), params->params.divisor_bits) <= 0) { return EVPKeyCtxPointer(); } }