Skip to content

Commit 17d87d5

Browse files
committed
src: fix ValidateDSAParameters when fips is enabled
Currently, the following compilation errors are generated when configuring --openssl-is-fips: ../src/node_crypto.cc: In function ‘bool node::crypto::ValidateDSAParameters(EVP_PKEY*)’: ../src/node_crypto.cc:4886:55: error: ‘pkey’ was not declared in this scope if (FIPS_mode() && EVP_PKEY_DSA == EVP_PKEY_base_id(pkey.get())) { ^~~~ ../src/node_crypto.cc:4886:55: note: suggested alternative: ‘key’ if (FIPS_mode() && EVP_PKEY_DSA == EVP_PKEY_base_id(pkey.get())) { ^~~~ key ../src/node_crypto.cc:4898:35: error: expected ‘;’ before ‘}’ token (L == 3072 && N == 256) ^ ; } This commit fixes the errors, and after this compilation is successful. PR-URL: #29407 Reviewed-By: David Carlier <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 02c74e7 commit 17d87d5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/node_crypto.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4883,8 +4883,8 @@ static AllocatedBuffer Node_SignFinal(Environment* env,
48834883
static inline bool ValidateDSAParameters(EVP_PKEY* key) {
48844884
#ifdef NODE_FIPS_MODE
48854885
/* Validate DSA2 parameters from FIPS 186-4 */
4886-
if (FIPS_mode() && EVP_PKEY_DSA == EVP_PKEY_base_id(pkey.get())) {
4887-
DSA* dsa = EVP_PKEY_get0_DSA(pkey.get());
4886+
if (FIPS_mode() && EVP_PKEY_DSA == EVP_PKEY_base_id(key)) {
4887+
DSA* dsa = EVP_PKEY_get0_DSA(key);
48884888
const BIGNUM* p;
48894889
DSA_get0_pqg(dsa, &p, nullptr, nullptr);
48904890
size_t L = BN_num_bits(p);
@@ -4895,7 +4895,7 @@ static inline bool ValidateDSAParameters(EVP_PKEY* key) {
48954895
return (L == 1024 && N == 160) ||
48964896
(L == 2048 && N == 224) ||
48974897
(L == 2048 && N == 256) ||
4898-
(L == 3072 && N == 256)
4898+
(L == 3072 && N == 256);
48994899
}
49004900
#endif // NODE_FIPS_MODE
49014901

0 commit comments

Comments
 (0)