]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
ima: Switch to dynamically allocated buffer for template digests
authorRoberto Sassu <roberto.sassu@huawei.com>
Wed, 25 Mar 2020 10:47:09 +0000 (11:47 +0100)
committerMimi Zohar <zohar@linux.ibm.com>
Mon, 20 Apr 2020 02:03:39 +0000 (22:03 -0400)
commitaa724fe18a8a8285d0071c3bfc932efb090d142d
tree87fc69a1f17ebe723ebb9a16ff82ae4432e43379
parent7ca79645a1f8837c3850b881a2c0b43cfba5dc36
ima: Switch to dynamically allocated buffer for template digests

This patch dynamically allocates the array of tpm_digest structures in
ima_alloc_init_template() and ima_restore_template_data(). The size of the
array is equal to the number of PCR banks plus ima_extra_slots, to make
room for SHA1 and the IMA default hash algorithm, when PCR banks with those
algorithms are not allocated.

Calculating the SHA1 digest is mandatory, as SHA1 still remains the default
hash algorithm for the measurement list. When IMA will support the Crypto
Agile format, remaining digests will be also provided.

The position in the measurement entry array of the SHA1 digest is stored in
the ima_sha1_idx global variable and is determined at IMA initialization
time.

Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
security/integrity/ima/ima.h
security/integrity/ima/ima_api.c
security/integrity/ima/ima_crypto.c
security/integrity/ima/ima_fs.c
security/integrity/ima/ima_queue.c
security/integrity/ima/ima_template.c