mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
evm: check hash algorithm passed to init_desc()
This patch prevents memory access beyond the evm_tfm array by checking the
validity of the index (hash algorithm) passed to init_desc(). The hash
algorithm can be arbitrarily set if the security.ima xattr type is not
EVM_XATTR_HMAC.
Fixes: 5feeb61183 ("evm: Allow non-SHA1 digital signatures")
Signed-off-by: Roberto Sassu <[email protected]>
Cc: [email protected]
Signed-off-by: Mimi Zohar <[email protected]>
This commit is contained in:
parent
f40019475b
commit
221be106d7
1 changed files with 3 additions and 0 deletions
|
|
@ -89,6 +89,9 @@ static struct shash_desc *init_desc(char type, uint8_t hash_algo)
|
|||
tfm = &hmac_tfm;
|
||||
algo = evm_hmac;
|
||||
} else {
|
||||
if (hash_algo >= HASH_ALGO__LAST)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
tfm = &evm_tfm[hash_algo];
|
||||
algo = hash_algo_name[hash_algo];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue