Skip to content

Commit

Permalink
src: don't check failure with ERR_peek_error()
Browse files Browse the repository at this point in the history
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: nodejs#4221
PR-URL: nodejs#4731
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
  • Loading branch information
bnoordhuis authored and Michael Scovetta committed Apr 2, 2016
1 parent a9fde1d commit 701fbd2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3611,8 +3611,7 @@ bool Hash::HashInit(const char* hash_type) {
if (md_ == nullptr)
return false;
EVP_MD_CTX_init(&mdctx_);
EVP_DigestInit_ex(&mdctx_, md_, nullptr);
if (0 != ERR_peek_error()) {
if (EVP_DigestInit_ex(&mdctx_, md_, nullptr) <= 0) {
return false;
}
initialised_ = true;
Expand Down

0 comments on commit 701fbd2

Please sign in to comment.