Skip to content

Commit

Permalink
src: remove duplicate HMAC_Init calls
Browse files Browse the repository at this point in the history
PR-URL: #7374
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
bnoordhuis authored and Fishrock123 committed Jul 5, 2016
1 parent 25bc7fe commit b7e661b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b7e661b

Please sign in to comment.