函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\keys\trusted-keys\trusted_tpm2.c Create Date:2022-07-27 20:06:07
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:pm2_seal_trusted() - seal the payload of a trusted key*@chip: TPM chip to use*@payload: the key data in clear and encrypted form*@options: authentication values and other options* Return: < 0 on error and 0 on success.

函数原型:int tpm2_seal_trusted(struct tpm_chip *chip, struct trusted_key_payload *payload, struct trusted_key_options *options)

返回类型:int

参数:

类型参数名称
struct tpm_chip *chip
struct trusted_key_payload *payload
struct trusted_key_options *options
72 i小于ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(tpm2_hash_map)循环
73  如果hash恒等于crypto_id
74  hash等于tpm_id
75  退出
79  如果i恒等于ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(tpm2_hash_map)则返回:负EINVAL
82  rc等于tpm_buf_init( & buf, TPM2_ST_SESSIONS, TPM2_CC_CREATE)
83  如果rc则返回:rc
86  tpm_buf_append_u32( & buf, keyhandle)
87  pm_buf_append_auth() - append TPMS_AUTH_COMMAND to the buffer
94  tpm_buf_append_u16( & buf, 4 + Max TPM v1.2 PCR size + key_len + 1)
96  tpm_buf_append_u16( & buf, Max TPM v1.2 PCR size )
97  tpm_buf_append( & buf, blobauth, Max TPM v1.2 PCR size )
98  tpm_buf_append_u16( & buf, key_len + 1)
99  tpm_buf_append( & buf, key, key_len)
100  tpm_buf_append_u8( & buf, migratable)
103  tpm_buf_append_u16( & buf, 14 + policydigest_len)
104  tpm_buf_append_u16( & buf, TPM_ALG_KEYEDHASH)
105  tpm_buf_append_u16( & buf, hash)
108  如果policydigest_len
109  tpm_buf_append_u32( & buf, 0)
110  tpm_buf_append_u16( & buf, policydigest_len)
111  tpm_buf_append( & buf, policydigest, policydigest_len)
113  否则
114  tpm_buf_append_u32( & buf, TPM2_OA_USER_WITH_AUTH)
115  tpm_buf_append_u16( & buf, 0)
119  tpm_buf_append_u16( & buf, TPM_ALG_NULL)
120  tpm_buf_append_u16( & buf, 0)
123  tpm_buf_append_u16( & buf, 0)
126  tpm_buf_append_u32( & buf, 0)
128  如果flags按位与TPM_BUF_OVERFLOW
129  rc等于负E2BIG
130  转到:out
133  rc等于tpm_send(chip, data, tpm_buf_length( & buf))
134  如果rc则转到:out
137  blob_len等于be32_to_cpup((__be32 * ) & data[TPM_HEADER_SIZE])
138  如果blob_len大于MAX_BLOB_SIZE
139  rc等于负E2BIG
140  转到:out
142  如果tpm_buf_length( & buf)小于TPM_HEADER_SIZE加4加blob_len
143  rc等于负EFAULT
144  转到:out
147  memcpy(blob, & data[TPM_HEADER_SIZE + 4], blob_len)
148  blob_len等于blob_len
150  out :
151  tpm_buf_destroy( & buf)
153  如果rc大于0则
154  如果tpm2_rc_value(rc)恒等于 RC_FMT1 rc等于负EINVAL
156  否则rc等于负EPERM
160  返回:rc
调用者
名称描述
trusted_instantiaterusted_instantiate - create a new trusted key* Unseal an existing trusted blob or, for a new key, get a* random key, then seal and create a trusted key-type key,* adding it to the specified keyring.* On success, return 0. Otherwise return errno.