Skip to content

Commit c41ed59

Browse files
bnoordhuisMyles Borins
authored and
Myles Borins
committed
src: don't check failure with ERR_peek_error()
It's possible there is already an existing error on OpenSSL's error stack that is unrelated to the EVP_DigestInit_ex() operation we just executed. Fixes: #4221 PR-URL: #4731 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
1 parent 188cff3 commit c41ed59

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/node_crypto.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -3440,8 +3440,7 @@ bool Hash::HashInit(const char* hash_type) {
34403440
if (md_ == nullptr)
34413441
return false;
34423442
EVP_MD_CTX_init(&mdctx_);
3443-
EVP_DigestInit_ex(&mdctx_, md_, nullptr);
3444-
if (0 != ERR_peek_error()) {
3443+
if (EVP_DigestInit_ex(&mdctx_, md_, nullptr) <= 0) {
34453444
return false;
34463445
}
34473446
initialised_ = true;

0 commit comments

Comments
 (0)