Skip to content

Commit 6988d2e

Browse files
bnoordhuisevanlucas
authored andcommitted
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 <cjihrig@gmail.com> Reviewed-By: Fedor Indutny <fedor@indutny.com>
1 parent 8104d9d commit 6988d2e

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
@@ -3611,8 +3611,7 @@ bool Hash::HashInit(const char* hash_type) {
36113611
if (md_ == nullptr)
36123612
return false;
36133613
EVP_MD_CTX_init(&mdctx_);
3614-
EVP_DigestInit_ex(&mdctx_, md_, nullptr);
3615-
if (0 != ERR_peek_error()) {
3614+
if (EVP_DigestInit_ex(&mdctx_, md_, nullptr) <= 0) {
36163615
return false;
36173616
}
36183617
initialised_ = true;

0 commit comments

Comments
 (0)