diff --git a/wolfcrypt/src/port/kcapi/kcapi_hmac.c b/wolfcrypt/src/port/kcapi/kcapi_hmac.c index 5d4538d3a..4e96839fc 100644 --- a/wolfcrypt/src/port/kcapi/kcapi_hmac.c +++ b/wolfcrypt/src/port/kcapi/kcapi_hmac.c @@ -102,7 +102,7 @@ int wc_HmacSetKey(Hmac* hmac, int type, const byte* key, word32 length) const char* ciphername = NULL; if ((hmac == NULL || (key == NULL && length != 0))) { - ret = BAD_FUNC_ARG; + return BAD_FUNC_ARG; } #ifdef HAVE_FIPS @@ -183,7 +183,7 @@ int wc_HmacSetKey(Hmac* hmac, int type, const byte* key, word32 length) hmac->macType = type; } - if (ret == 0 && hmac->handle == NULL) { + if (hmac->handle != NULL) { kcapi_md_destroy(hmac->handle); hmac->handle = NULL; }