From fb19ae86db7735b2597b5a486e914ed551dad42c Mon Sep 17 00:00:00 2001 From: Tianjia Zhang Date: Thu, 2 Jul 2020 22:16:13 +0800 Subject: [PATCH] ima-evm-utils: Fix mismatched type checking Even if imaevm_get_hash_algo() returns an error value of -1, it is forced to be converted to uint8_t type here, resulting in this error not being checked by the if condition. This patch fixes this error. Signed-off-by: Tianjia Zhang Signed-off-by: Mimi Zohar --- src/libimaevm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libimaevm.c b/src/libimaevm.c index 4bcce13..240334d 100644 --- a/src/libimaevm.c +++ b/src/libimaevm.c @@ -924,7 +924,7 @@ static int sign_hash_v2(const char *algo, const unsigned char *hash, hdr->version = (uint8_t) DIGSIG_VERSION_2; hdr->hash_algo = imaevm_get_hash_algo(algo); - if (hdr->hash_algo == -1) { + if (hdr->hash_algo == (uint8_t)-1) { log_err("sign_hash_v2: hash algo is unknown: %s\n", algo); return -1; }