@@ -3585,17 +3585,17 @@ void Hmac::New(const FunctionCallbackInfo<Value>& args) {
3585
3585
void Hmac::HmacInit (const char * hash_type, const char * key, int key_len) {
3586
3586
HandleScope scope (env ()->isolate ());
3587
3587
3588
- CHECK_EQ (md_, nullptr );
3589
- md_ = EVP_get_digestbyname (hash_type);
3590
- if (md_ == nullptr ) {
3588
+ CHECK_EQ (initialised_, false );
3589
+ const EVP_MD* md = EVP_get_digestbyname (hash_type);
3590
+ if (md == nullptr ) {
3591
3591
return env ()->ThrowError (" Unknown message digest" );
3592
3592
}
3593
3593
HMAC_CTX_init (&ctx_);
3594
3594
int result = 0 ;
3595
3595
if (key_len == 0 ) {
3596
- result = HMAC_Init (&ctx_, " " , 0 , md_ );
3596
+ result = HMAC_Init (&ctx_, " " , 0 , md );
3597
3597
} else {
3598
- result = HMAC_Init (&ctx_, key, key_len, md_ );
3598
+ result = HMAC_Init (&ctx_, key, key_len, md );
3599
3599
}
3600
3600
if (!result) {
3601
3601
return ThrowCryptoError (env (), ERR_get_error ());
@@ -3730,12 +3730,12 @@ void Hash::New(const FunctionCallbackInfo<Value>& args) {
3730
3730
3731
3731
3732
3732
bool Hash::HashInit (const char * hash_type) {
3733
- CHECK_EQ (md_, nullptr );
3734
- md_ = EVP_get_digestbyname (hash_type);
3735
- if (md_ == nullptr )
3733
+ CHECK_EQ (initialised_, false );
3734
+ const EVP_MD* md = EVP_get_digestbyname (hash_type);
3735
+ if (md == nullptr )
3736
3736
return false ;
3737
3737
EVP_MD_CTX_init (&mdctx_);
3738
- if (EVP_DigestInit_ex (&mdctx_, md_ , nullptr ) <= 0 ) {
3738
+ if (EVP_DigestInit_ex (&mdctx_, md , nullptr ) <= 0 ) {
3739
3739
return false ;
3740
3740
}
3741
3741
initialised_ = true ;
@@ -3881,13 +3881,13 @@ void Sign::New(const FunctionCallbackInfo<Value>& args) {
3881
3881
3882
3882
3883
3883
SignBase::Error Sign::SignInit (const char * sign_type) {
3884
- CHECK_EQ (md_, nullptr );
3885
- md_ = EVP_get_digestbyname (sign_type);
3886
- if (!md_ )
3884
+ CHECK_EQ (initialised_, false );
3885
+ const EVP_MD* md = EVP_get_digestbyname (sign_type);
3886
+ if (md == nullptr )
3887
3887
return kSignUnknownDigest ;
3888
3888
3889
3889
EVP_MD_CTX_init (&mdctx_);
3890
- if (!EVP_SignInit_ex (&mdctx_, md_ , nullptr ))
3890
+ if (!EVP_SignInit_ex (&mdctx_, md , nullptr ))
3891
3891
return kSignInit ;
3892
3892
initialised_ = true ;
3893
3893
@@ -4087,13 +4087,13 @@ void Verify::New(const FunctionCallbackInfo<Value>& args) {
4087
4087
4088
4088
4089
4089
SignBase::Error Verify::VerifyInit (const char * verify_type) {
4090
- CHECK_EQ (md_, nullptr );
4091
- md_ = EVP_get_digestbyname (verify_type);
4092
- if (md_ == nullptr )
4090
+ CHECK_EQ (initialised_, false );
4091
+ const EVP_MD* md = EVP_get_digestbyname (verify_type);
4092
+ if (md == nullptr )
4093
4093
return kSignUnknownDigest ;
4094
4094
4095
4095
EVP_MD_CTX_init (&mdctx_);
4096
- if (!EVP_VerifyInit_ex (&mdctx_, md_ , nullptr ))
4096
+ if (!EVP_VerifyInit_ex (&mdctx_, md , nullptr ))
4097
4097
return kSignInit ;
4098
4098
initialised_ = true ;
4099
4099
0 commit comments