diff options
author | Tobias Nießen <tniessen@tnie.de> | 2020-01-21 01:14:13 +0300 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2020-01-23 22:06:14 +0300 |
commit | 8c313ceedfcc337f05022ffaabf2e42ef26d0cdf (patch) | |
tree | 2aa43221feabe33f6793f29d51d0e87a1fed1f0a /src/node_crypto.cc | |
parent | 085a5c7638d7783afd706889dbc2b57976d5061f (diff) |
crypto: assign and use ERR_CRYPTO_UNKNOWN_CIPHER
PR-URL: https://github.com/nodejs/node/pull/31437
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_crypto.cc')
-rw-r--r-- | src/node_crypto.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc index df823c48c18..606b63b7535 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -3531,7 +3531,7 @@ static NonCopyableMaybe<PrivateKeyEncodingConfig> GetPrivateKeyEncodingFromJs( args[*offset].As<String>()); result.cipher_ = EVP_get_cipherbyname(*cipher_name); if (result.cipher_ == nullptr) { - env->ThrowError("Unknown cipher"); + THROW_ERR_CRYPTO_UNKNOWN_CIPHER(env); return NonCopyableMaybe<PrivateKeyEncodingConfig>(); } needs_passphrase = true; @@ -4037,7 +4037,7 @@ void CipherBase::Init(const char* cipher_type, const EVP_CIPHER* const cipher = EVP_get_cipherbyname(cipher_type); if (cipher == nullptr) - return env()->ThrowError("Unknown cipher"); + return THROW_ERR_CRYPTO_UNKNOWN_CIPHER(env()); unsigned char key[EVP_MAX_KEY_LENGTH]; unsigned char iv[EVP_MAX_IV_LENGTH]; @@ -4101,7 +4101,7 @@ void CipherBase::InitIv(const char* cipher_type, const EVP_CIPHER* const cipher = EVP_get_cipherbyname(cipher_type); if (cipher == nullptr) { - return env()->ThrowError("Unknown cipher"); + return THROW_ERR_CRYPTO_UNKNOWN_CIPHER(env()); } const int expected_iv_len = EVP_CIPHER_iv_length(cipher); |