From b7e661b12c8f78981a7de4cf4177a37cc5b3c68b Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 22 Jun 2016 14:07:56 +0200 Subject: [PATCH] src: remove duplicate HMAC_Init calls PR-URL: https://github.com/nodejs/node/pull/7374 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Michael Dawson --- src/node_crypto.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index d7dcd6936c4352..eda62489a76107 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -3591,13 +3591,10 @@ void Hmac::HmacInit(const char* hash_type, const char* key, int key_len) { return env()->ThrowError("Unknown message digest"); } HMAC_CTX_init(&ctx_); - int result = 0; if (key_len == 0) { - result = HMAC_Init(&ctx_, "", 0, md); - } else { - result = HMAC_Init(&ctx_, key, key_len, md); + key = ""; } - if (!result) { + if (!HMAC_Init(&ctx_, key, key_len, md)) { return ThrowCryptoError(env(), ERR_get_error()); } initialised_ = true;