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: #4221
PR-URL: #4731
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
  • Loading branch information
bnoordhuis authored and evanlucas committed Jan 18, 2016
1 parent 8104d9d commit 6988d2e
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 6988d2e

Please sign in to comment.