Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Calculate the hash of template data

Proto:static int ima_calc_field_array_hash_tfm(struct ima_field_data *field_data, struct ima_template_desc *td, int num_fields, struct ima_digest_data *hash, struct crypto_shash *tfm)

Type:int

Parameter:

TypeParameterName
struct ima_field_data *field_data
struct ima_template_desc *td
intnum_fields
struct ima_digest_data *hash
struct crypto_shash *tfm
472  SHASH_DESC_ON_STACK(shash, tfm)
475  tfm = tfm
477  length = rypto_shash_digestsize() - obtain message digest size*@tfm: cipher handle* The size for the message digest created by the message digest cipher* referenced with the cipher handle is returned.* Return: digest size of cipher
479  rc = rypto_shash_init() - (re)initialize message digest*@desc: operational state handle that is already filled* The call (re-)initializes the message digest referenced by the* operational state handle. Any potentially existing state created by
480  If rc != 0 Then Return rc
483  When i < num_fields cycle
484  u8 buffer[256] = {0}
485  data_to_hash = data
486  datalen = len
487  datalen_to_hash = If Not ima_canonical_fmt Then datalen Else cpu_to_le32(datalen)
490  If strcmp(name, IMA_TEMPLATE_IMA_NAME) != 0 Then
494  If rc Then Break
496  Else if strcmp(field_id, "n") == 0 Then
501  rc = rypto_shash_update() - add data to message digest for processing*@desc: operational state handle that is already initialized*@data: input data to be added to the message digest*@len: length of the input data
502  If rc Then Break
506  If Not rc Then rc = rypto_shash_final() - calculate message digest*@desc: operational state handle that is already filled with data*@out: output buffer filled with the message digest* Finalize the message digest operation and create the message digest
509  Return rc
Caller
NameDescribe
ima_calc_field_array_hash