From c41ed59dbcf63e7679abf69cfa01cde484fcd2a7 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sun, 17 Jan 2016 17:18:37 +0100 Subject: [PATCH] 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: https://github.com/nodejs/node/issues/4221 PR-URL: https://github.com/nodejs/node/pull/4731 Reviewed-By: Colin Ihrig Reviewed-By: Fedor Indutny --- src/node_crypto.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 7911ce9e612816..eec1eb9e63a5ec 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -3440,8 +3440,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;