diff options
author | Shelley Vohr <shelley.vohr@gmail.com> | 2021-02-09 21:52:46 +0300 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2021-02-28 16:39:52 +0300 |
commit | 01773ab614443998e215348a221cbd5fb3683db1 (patch) | |
tree | 6cd02285d1c7d914e3124b00d569e5ef06d83e88 /src | |
parent | 19d6eb929ce58ca9e54f1d016df85d8c4c7121d4 (diff) |
crypto: use BoringSSL compatible errors
PR-URL: https://github.com/nodejs/node/pull/37297
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/crypto/crypto_dh.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc index b40f06f4500..1c48f98656f 100644 --- a/src/crypto/crypto_dh.cc +++ b/src/crypto/crypto_dh.cc @@ -120,11 +120,13 @@ void DiffieHellman::MemoryInfo(MemoryTracker* tracker) const { bool DiffieHellman::Init(const char* p, int p_len, int g) { dh_.reset(DH_new()); if (p_len <= 0) { - BNerr(BN_F_BN_GENERATE_PRIME_EX, BN_R_BITS_TOO_SMALL); + ERR_put_error(ERR_LIB_BN, BN_F_BN_GENERATE_PRIME_EX, + BN_R_BITS_TOO_SMALL, __FILE__, __LINE__); return false; } if (g <= 1) { - DHerr(DH_F_DH_BUILTIN_GENPARAMS, DH_R_BAD_GENERATOR); + ERR_put_error(ERR_LIB_DH, DH_F_DH_BUILTIN_GENPARAMS, + DH_R_BAD_GENERATOR, __FILE__, __LINE__); return false; } BIGNUM* bn_p = @@ -142,18 +144,21 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) { bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) { dh_.reset(DH_new()); if (p_len <= 0) { - BNerr(BN_F_BN_GENERATE_PRIME_EX, BN_R_BITS_TOO_SMALL); + ERR_put_error(ERR_LIB_BN, BN_F_BN_GENERATE_PRIME_EX, + BN_R_BITS_TOO_SMALL, __FILE__, __LINE__); return false; } if (g_len <= 0) { - DHerr(DH_F_DH_BUILTIN_GENPARAMS, DH_R_BAD_GENERATOR); + ERR_put_error(ERR_LIB_DH, DH_F_DH_BUILTIN_GENPARAMS, + DH_R_BAD_GENERATOR, __FILE__, __LINE__); return false; } BIGNUM* bn_g = BN_bin2bn(reinterpret_cast<const unsigned char*>(g), g_len, nullptr); if (BN_is_zero(bn_g) || BN_is_one(bn_g)) { BN_free(bn_g); - DHerr(DH_F_DH_BUILTIN_GENPARAMS, DH_R_BAD_GENERATOR); + ERR_put_error(ERR_LIB_DH, DH_F_DH_BUILTIN_GENPARAMS, + DH_R_BAD_GENERATOR, __FILE__, __LINE__); return false; } BIGNUM* bn_p = |