函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:verify the AUTH1_COMMAND (Seal) result from TPM

函数原型:int TSS_checkhmac1(unsigned char *buffer, const uint32_t command, const unsigned char *ononce, const unsigned char *key, unsigned int keylen, ...)

返回类型:int

参数:

类型参数名称
unsigned char *buffer
const uint32_tcommand
const unsigned char *ononce
const unsigned char *key
unsigned intkeylen
198  如果非chip则返回:负ENODEV
201  bufsize等于LOAD32(buffer, TPM_SIZE_OFFSET)
202  tag等于LOAD16(buffer, 0)
203  ordinal等于command
204  result等于LOAD32N(buffer, TPM_RETURN_OFFSET)
205  如果tag恒等于TPM_TAG_RSP_COMMAND则返回:0
207  如果tag不等于TPM_TAG_RSP_AUTH1_COMMAND则返回:负EINVAL
209  authdata等于bufferbufsizeSHA1_DIGEST_SIZE
210  continueflag等于authdata减1
211  enonce等于continueflagTPM_NONCE_SIZE
213  sdesc等于init_sdesc(hashalg)
214  如果是错误
215  打印信息("trusted_key: can't alloc %s\n", hash_alg)
216  返回:错误
218  ret等于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
219  如果ret小于0则转到:out
221  ret等于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
223  如果ret小于0则转到:out
225  ret等于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
227  如果ret小于0则转到:out
229  va_start(argp, keylen)
230  循环
231  dlen等于va_arg(argp, unsignedint)
232  如果dlen恒等于0则退出
234  dpos等于va_arg(argp, unsignedint)
235  ret等于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
236  如果ret小于0则退出
239  va_end(argp)
240  如果非retret等于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
242  如果ret小于0则转到:out
245  ret等于TSS_rawhmac(testhmac, key, keylen, SHA1_DIGEST_SIZE, paramdigest, TPM_NONCE_SIZE, enonce, TPM_NONCE_SIZE, ononce, 1, continueflag, 0, 0)
248  如果ret小于0则转到:out
251  如果内存比较ret等于负EINVAL
253  out :
254  kzfree - like kfree but zero memory*@p: object to free memory of* The memory of the object @p points to is zeroed before freed.* If @p is %NULL, kzfree() does nothing.* Note: this function zeroes the whole allocated buffer which can be a good
255  返回:ret
调用者
名称描述
tpm_sealHave the TPM seal(encrypt) the trusted key, possibly based on* Platform Configuration Registers (PCRs). AUTH1 for sealing key.