Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e0fbba0

Browse filesBrowse files
davidbendanielleadams
authored andcommitted
crypto: use EVP_PKEY_CTX_set_dsa_paramgen_q_bits when available
This matches the formulation described in the documentation: https://www.openssl.org/docs/man3.0/man3/EVP_PKEY_CTX_set_dsa_paramgen_q_bits.html It is also, starting OpenSSL 3.0, more type-safe because the wrapper macros were finally converted to real functions. In OpenSSL 3.0, it is also no longer quite a wrapper over EVP_PKEY_CTX_ctrl, so using this name saves some extra OSSL_PARAM <-> EVP_PKEY_CTRL conversions. Alas, it was only backported to OpenSSL 1.1.1e, so I've left a temporary compatibility define until you all decide to drop pre-1.1.1e releases of 1.1.1. PR-URL: #44561 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 117f068 commit e0fbba0
Copy full SHA for e0fbba0

File tree

Expand file treeCollapse file tree

1 file changed

+13
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-7
lines changed
Open diff view settings
Collapse file

‎src/crypto/crypto_dsa.cc‎

Copy file name to clipboardExpand all lines: src/crypto/crypto_dsa.cc
+13-7Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@
1212

1313
#include <cstdio>
1414

15+
// EVP_PKEY_CTX_set_dsa_paramgen_q_bits was added in OpenSSL 1.1.1e.
16+
#if OPENSSL_VERSION_NUMBER < 0x1010105fL
17+
#define EVP_PKEY_CTX_set_dsa_paramgen_q_bits(ctx, qbits) \
18+
EVP_PKEY_CTX_ctrl((ctx), \
19+
EVP_PKEY_DSA, \
20+
EVP_PKEY_OP_PARAMGEN, \
21+
EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS, \
22+
(qbits), \
23+
nullptr)
24+
#endif
25+
1526
namespace node {
1627

1728
using v8::FunctionCallbackInfo;
@@ -39,13 +50,8 @@ EVPKeyCtxPointer DsaKeyGenTraits::Setup(DsaKeyPairGenConfig* params) {
3950
}
4051

4152
if (params->params.divisor_bits != -1) {
42-
if (EVP_PKEY_CTX_ctrl(
43-
param_ctx.get(),
44-
EVP_PKEY_DSA,
45-
EVP_PKEY_OP_PARAMGEN,
46-
EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS,
47-
params->params.divisor_bits,
48-
nullptr) <= 0) {
53+
if (EVP_PKEY_CTX_set_dsa_paramgen_q_bits(
54+
param_ctx.get(), params->params.divisor_bits) <= 0) {
4955
return EVPKeyCtxPointer();
5056
}
5157
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.