| Function report | 
| Source Code: security\keys\trusted-keys\trusted_tpm1.c | Create Date:2022-07-28 18:30:19 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:verify the AUTH2_COMMAND (unseal) result from TPM
Proto:static int TSS_checkhmac2(unsigned char *buffer, const uint32_t command, const unsigned char *ononce, const unsigned char *key1, unsigned int keylen1, const unsigned char *key2, unsigned int keylen2, ...)
Type:int
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| unsigned char * | buffer | |
| const uint32_t | command | |
| const unsigned char * | ononce | |
| const unsigned char * | key1 | |
| unsigned int | keylen1 | |
| const unsigned char * | key2 | |
| unsigned int | keylen2 | 
| 289 | bufsize = LOAD32(buffer, TPM_SIZE_OFFSET) | 
| 292 | result = LOAD32N(buffer, TPM_RETURN_OFFSET) | 
| 294 | If tag == TPM_TAG_RSP_COMMAND Then Return 0 | 
| 296 | If tag != TPM_TAG_RSP_AUTH2_COMMAND Then Return -EINVAL | 
| 298 | authdata1 = buffer + bufsize - SHA1_DIGEST_SIZE + 1 + SHA1_DIGEST_SIZE + SHA1_DIGEST_SIZE | 
| 300 | authdata2 = buffer + bufsize - SHA1_DIGEST_SIZE | 
| 301 | continueflag1 = authdata1 - 1 | 
| 302 | continueflag2 = authdata2 - 1 | 
| 303 | enonce1 = continueflag1 - TPM_NONCE_SIZE | 
| 304 | enonce2 = continueflag2 - TPM_NONCE_SIZE | 
| 306 | sdesc = init_sdesc(hashalg) | 
| 324 | cycle | 
| 326 | If dlen == 0 Then Break | 
| 330 | If ret < 0 Then Break | 
| 339 | ret = TSS_rawhmac(testhmac1, key1, keylen1, SHA1_DIGEST_SIZE, paramdigest, TPM_NONCE_SIZE, enonce1, TPM_NONCE_SIZE, ononce, 1, continueflag1, 0, 0) | 
| 344 | If memcmp(testhmac1, authdata1, SHA1_DIGEST_SIZE) Then | 
| 348 | ret = TSS_rawhmac(testhmac2, key2, keylen2, SHA1_DIGEST_SIZE, paramdigest, TPM_NONCE_SIZE, enonce2, TPM_NONCE_SIZE, ononce, 1, continueflag2, 0, 0) | 
| 355 | out : | 
| 357 | Return ret | 
| Name | Describe | 
|---|---|
| tpm_unseal | se the AUTH2_COMMAND form of unseal, to authorize both key and blob | 
| Source code conversion tool public plug-in interface | X | 
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |