mirror of
https://git.code.sf.net/p/linux-ima/ima-evm-utils
synced 2025-04-28 14:43:37 +02:00
Fix hash array size in verify_ima()
Now evmctl supports different hash algorithms and sha512 will produce 64 byte digest. verify_ima() still allocates only 20bytes to store hash. This does not work with larger hashes. Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
parent
16d40dbdf6
commit
b48f4f9c7e
12
src/evmctl.c
12
src/evmctl.c
@ -1213,13 +1213,13 @@ static int cmd_verify_evm(struct command *cmd)
|
||||
|
||||
static int verify_ima(const char *file, const char *key)
|
||||
{
|
||||
unsigned char hash[20];
|
||||
unsigned char hash[64];
|
||||
unsigned char sig[1024];
|
||||
int len;
|
||||
int len, hashlen;
|
||||
|
||||
len = calc_hash(file, hash);
|
||||
if (len <= 1)
|
||||
return len;
|
||||
hashlen = calc_hash(file, hash);
|
||||
if (hashlen <= 1)
|
||||
return hashlen;
|
||||
|
||||
if (xattr) {
|
||||
len = getxattr(file, "security.ima", sig, sizeof(sig));
|
||||
@ -1242,7 +1242,7 @@ static int verify_ima(const char *file, const char *key)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return verify_hash(hash, sizeof(hash), sig + 1, len - 1, key);
|
||||
return verify_hash(hash, hashlen, sig + 1, len - 1, key);
|
||||
}
|
||||
|
||||
static int cmd_verify_ima(struct command *cmd)
|
||||
|
Loading…
x
Reference in New Issue
Block a user