函数逻辑报告

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:56
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:se the AUTH2_COMMAND form of unseal, to authorize both key and blob

函数原型:static int tpm_unseal(struct tpm_buf *tb, uint32_t keyhandle, const unsigned char *keyauth, const unsigned char *blob, int bloblen, const unsigned char *blobauth, unsigned char *data, unsigned int *datalen)

返回类型:int

参数:

类型参数名称
struct tpm_buf *tb
uint32_tkeyhandle
const unsigned char *keyauth
const unsigned char *blob
intbloblen
const unsigned char *blobauth
unsigned char *data
unsigned int *datalen
584  authhandle1等于0
585  authhandle2等于0
586  cont等于0
591  ret等于Create an object independent authorisation protocol (oiap) session
592  如果ret小于0则
593  打印信息("trusted_key: oiap failed (%d)\n", ret)
594  返回:ret
596  ret等于Create an object independent authorisation protocol (oiap) session
597  如果ret小于0则
598  打印信息("trusted_key: oiap failed (%d)\n", ret)
599  返回:ret
602  ordinal等于htonl(TPM_ORD_UNSEAL)
603  ret等于tpm_get_random(chip, nonceodd, TPM_NONCE_SIZE)
604  如果ret不等于TPM_NONCE_SIZE
605  打印信息("trusted_key: tpm_get_random failed (%d)\n", ret)
606  返回:ret
608  ret等于alculate authorization info fields to send to TPM
611  如果ret小于0则返回:ret
613  ret等于alculate authorization info fields to send to TPM
616  如果ret小于0则返回:ret
620  tpm_buf_reset(tb, TPM_TAG_RQU_AUTH2_COMMAND, TPM_ORD_UNSEAL)
621  tpm_buf_append_u32(tb, keyhandle)
622  tpm_buf_append(tb, blob, bloblen)
623  tpm_buf_append_u32(tb, authhandle1)
624  tpm_buf_append(tb, nonceodd, TPM_NONCE_SIZE)
625  tpm_buf_append_u8(tb, cont)
626  tpm_buf_append(tb, authdata1, SHA1_DIGEST_SIZE)
627  tpm_buf_append_u32(tb, authhandle2)
628  tpm_buf_append(tb, nonceodd, TPM_NONCE_SIZE)
629  tpm_buf_append_u8(tb, cont)
630  tpm_buf_append(tb, authdata2, SHA1_DIGEST_SIZE)
632  ret等于For key specific tpm requests, we will generate and send our* own TPM command packets using the drivers send function.
633  如果ret小于0则
634  打印信息("trusted_key: authhmac failed (%d)\n", ret)
635  返回:ret
638  datalen等于LOAD32(data, TPM_DATA_OFFSET)
639  ret等于verify the AUTH2_COMMAND (unseal) result from TPM
645  如果ret小于0则
646  打印信息("trusted_key: TSS_checkhmac2 failed (%d)\n", ret)
647  返回:ret
649  memcpy(data, data + TPM_DATA_OFFSET + sizeof(uint32_t), * datalen)
650  返回:0
调用者
名称描述
key_unsealHave the TPM unseal(decrypt) the symmetric key