mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
src: remove unused md_ data members
The code assigned the result of EVP_get_digestbyname() to data members called md_ that were not used outside the initialization functions. PR-URL: https://github.com/nodejs/node/pull/7374 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit is contained in:
1 parent
2228a656b0
commit
25bc7fee34
2 files changed
+17
-23
No files matched your search
+17
-17
@@ -3585,17 +3585,17 @@ void Hmac::New(const FunctionCallbackInfo<Value>& args) {
|
||||
void Hmac::HmacInit(const char* hash_type, const char* key, int key_len) {
|
||||
HandleScope scope(env()->isolate());
|
||||
|
||||
CHECK_EQ(md_, nullptr);
|
||||
md_ = EVP_get_digestbyname(hash_type);
|
||||
if (md_ == nullptr) {
|
||||
CHECK_EQ(initialised_, false);
|
||||
const EVP_MD* md = EVP_get_digestbyname(hash_type);
|
||||
if (md == nullptr) {
|
||||
return env()->ThrowError("Unknown message digest");
|
||||
}
|
||||
HMAC_CTX_init(&ctx_);
|
||||
int result = 0;
|
||||
if (key_len == 0) {
|
||||
result = HMAC_Init(&ctx_, "", 0, md_);
|
||||
result = HMAC_Init(&ctx_, "", 0, md);
|
||||
} else {
|
||||
result = HMAC_Init(&ctx_, key, key_len, md_);
|
||||
result = HMAC_Init(&ctx_, key, key_len, md);
|
||||
}
|
||||
if (!result) {
|
||||
return ThrowCryptoError(env(), ERR_get_error());
|
||||
@@ -3730,12 +3730,12 @@ void Hash::New(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
|
||||
bool Hash::HashInit(const char* hash_type) {
|
||||
CHECK_EQ(md_, nullptr);
|
||||
md_ = EVP_get_digestbyname(hash_type);
|
||||
if (md_ == nullptr)
|
||||
CHECK_EQ(initialised_, false);
|
||||
const EVP_MD* md = EVP_get_digestbyname(hash_type);
|
||||
if (md == nullptr)
|
||||
return false;
|
||||
EVP_MD_CTX_init(&mdctx_);
|
||||
if (EVP_DigestInit_ex(&mdctx_, md_, nullptr) <= 0) {
|
||||
if (EVP_DigestInit_ex(&mdctx_, md, nullptr) <= 0) {
|
||||
return false;
|
||||
}
|
||||
initialised_ = true;
|
||||
@@ -3881,13 +3881,13 @@ void Sign::New(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
|
||||
SignBase::Error Sign::SignInit(const char* sign_type) {
|
||||
CHECK_EQ(md_, nullptr);
|
||||
md_ = EVP_get_digestbyname(sign_type);
|
||||
if (!md_)
|
||||
CHECK_EQ(initialised_, false);
|
||||
const EVP_MD* md = EVP_get_digestbyname(sign_type);
|
||||
if (md == nullptr)
|
||||
return kSignUnknownDigest;
|
||||
|
||||
EVP_MD_CTX_init(&mdctx_);
|
||||
if (!EVP_SignInit_ex(&mdctx_, md_, nullptr))
|
||||
if (!EVP_SignInit_ex(&mdctx_, md, nullptr))
|
||||
return kSignInit;
|
||||
initialised_ = true;
|
||||
|
||||
@@ -4087,13 +4087,13 @@ void Verify::New(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
|
||||
SignBase::Error Verify::VerifyInit(const char* verify_type) {
|
||||
CHECK_EQ(md_, nullptr);
|
||||
md_ = EVP_get_digestbyname(verify_type);
|
||||
if (md_ == nullptr)
|
||||
CHECK_EQ(initialised_, false);
|
||||
const EVP_MD* md = EVP_get_digestbyname(verify_type);
|
||||
if (md == nullptr)
|
||||
return kSignUnknownDigest;
|
||||
|
||||
EVP_MD_CTX_init(&mdctx_);
|
||||
if (!EVP_VerifyInit_ex(&mdctx_, md_, nullptr))
|
||||
if (!EVP_VerifyInit_ex(&mdctx_, md, nullptr))
|
||||
return kSignInit;
|
||||
initialised_ = true;
|
||||
|
||||
|
||||
@@ -500,14 +500,12 @@ class Hmac : public BaseObject {
|
||||
|
||||
Hmac(Environment* env, v8::Local<v8::Object> wrap)
|
||||
: BaseObject(env, wrap),
|
||||
md_(nullptr),
|
||||
initialised_(false) {
|
||||
MakeWeak<Hmac>(this);
|
||||
}
|
||||
|
||||
private:
|
||||
HMAC_CTX ctx_; /* coverity[member_decl] */
|
||||
const EVP_MD* md_; /* coverity[member_decl] */
|
||||
bool initialised_;
|
||||
};
|
||||
|
||||
@@ -531,14 +529,12 @@ class Hash : public BaseObject {
|
||||
|
||||
Hash(Environment* env, v8::Local<v8::Object> wrap)
|
||||
: BaseObject(env, wrap),
|
||||
md_(nullptr),
|
||||
initialised_(false) {
|
||||
MakeWeak<Hash>(this);
|
||||
}
|
||||
|
||||
private:
|
||||
EVP_MD_CTX mdctx_; /* coverity[member_decl] */
|
||||
const EVP_MD* md_; /* coverity[member_decl] */
|
||||
bool initialised_;
|
||||
bool finalized_;
|
||||
};
|
||||
@@ -557,7 +553,6 @@ class SignBase : public BaseObject {
|
||||
|
||||
SignBase(Environment* env, v8::Local<v8::Object> wrap)
|
||||
: BaseObject(env, wrap),
|
||||
md_(nullptr),
|
||||
initialised_(false) {
|
||||
}
|
||||
|
||||
@@ -571,7 +566,6 @@ class SignBase : public BaseObject {
|
||||
void CheckThrow(Error error);
|
||||
|
||||
EVP_MD_CTX mdctx_; /* coverity[member_decl] */
|
||||
const EVP_MD* md_; /* coverity[member_decl] */
|
||||
bool initialised_;
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user