Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\integrity\ima\ima_api.c Create Date:2022-07-28 19:58:43
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:ma_store_template - store ima template measurements* Calculate the hash of a template entry, add the template entry* to an ordered list of measurement entries maintained inside the kernel,* and also update the aggregate integrity value (maintained inside

Proto:int ima_store_template(struct ima_template_entry *entry, int violation, struct inode *inode, const unsigned char *filename, int pcr)

Type:int

Parameter:

TypeParameterName
struct ima_template_entry *entry
intviolation
struct inode *inode
const unsigned char *filename
intpcr
95  op[] = "add_template_measure"
96  audit_cause[] = "hashing_error"
97  template_name = name
99  struct{struct ima_digest_data hdr;char digest[20];}hash
104  If Not violation Then
105  num_fields = num_fields
108  algo = HASH_ALGO_SHA1
109  result = ima_calc_field_array_hash( & template related data [0], template descriptor , num_fields, & hdr)
112  If result < 0 Then
116  Return result
118  memcpy( sha1 or md5 measurement hash , digest, length)
120  pcr = pcr
121  result = Add template entry to the measurement list and hash table, and* extend the pcr.* On systems which support carrying the IMA measurement list across* kexec, maintain the total memory size required for serializing the* binary_runtime_measurements.
122  Return result
Caller
NameDescribe
process_buffer_measurementprocess_buffer_measurement - Measure the buffer to ima log
ima_add_violationma_add_violation - add violation to measurement list.* Violations are flagged in the measurement list with zero hash values.* By extending the PCR with 0xFF's instead of with zeroes, the PCR* value is invalidated.
ima_store_measurementma_store_measurement - store file measurement* Create an "ima" template and then store the template by calling* ima_store_template
ima_add_boot_aggregateAdd the boot aggregate to the IMA measurement list and extend* the PCR register.* Calculate the boot aggregate, a SHA1 over tpm registers 0-7,* assuming a TPM chip exists, and zeroes if the TPM chip does not* exist