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 committed Jan 18, 2016
1 parent 83d2b77 commit 761cf2b
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

3 comments on commit 761cf2b

@ncopa
Copy link
Contributor

@ncopa ncopa commented on 761cf2b Jan 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this commit be cherry-picked to v4.x for inclusion in 4.2.7? It fixes a regression introduced in 4.2.4

@bnoordhuis
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tagged the PR just now so it should be in the next LTS release.

@ncopa
Copy link
Contributor

@ncopa ncopa commented on 761cf2b Jan 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

Please sign in to comment.