From d233a0d30f5c41ae0a2c1b69c57fb0d86259ffc1 Mon Sep 17 00:00:00 2001 From: Fei Li Date: Wed, 11 May 2022 14:01:34 +0800 Subject: [PATCH] hv: crypto: fix a minor build Werror The comparison "ctx->md_info == NULL" (if ctx is not NULL) will always evaluate as 'false' for the address of 'hmac_ctx' will never be NULL. This patch remove this unnecessary check. Tracked-On: #7453 Signed-off-by: Fei Li --- hypervisor/lib/crypto/mbedtls/md.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hypervisor/lib/crypto/mbedtls/md.c b/hypervisor/lib/crypto/mbedtls/md.c index 2fc9f640c..d65b378e1 100644 --- a/hypervisor/lib/crypto/mbedtls/md.c +++ b/hypervisor/lib/crypto/mbedtls/md.c @@ -83,7 +83,7 @@ int32_t mbedtls_md_hmac_starts(mbedtls_md_context_t *ctx, const uint8_t *key, si const uint8_t *temp_key = key; size_t i; - if ((ctx == NULL) || (ctx->md_info == NULL) || (ctx->hmac_ctx == NULL) || (temp_key == NULL)) { + if ((ctx == NULL) || (ctx->md_info == NULL) || (temp_key == NULL)) { ret = MBEDTLS_ERR_MD_BAD_INPUT_DATA; } @@ -131,7 +131,7 @@ int32_t mbedtls_md_hmac_update(mbedtls_md_context_t *ctx, const uint8_t *input, { int32_t ret; - if ((ctx == NULL) || (ctx->md_info == NULL) || (ctx->hmac_ctx == NULL)) { + if ((ctx == NULL) || (ctx->md_info == NULL)) { ret = MBEDTLS_ERR_MD_BAD_INPUT_DATA; } else { ret = ctx->md_info->update_func((void *) ctx->md_ctx, input, ilen); @@ -146,7 +146,7 @@ int32_t mbedtls_md_hmac_finish(mbedtls_md_context_t *ctx, uint8_t *output) uint8_t tmp[MBEDTLS_MD_MAX_SIZE]; uint8_t *opad; - if ((ctx == NULL) || (ctx->md_info == NULL) || (ctx->hmac_ctx == NULL)) { + if ((ctx == NULL) || (ctx->md_info == NULL)) { ret = MBEDTLS_ERR_MD_BAD_INPUT_DATA; }