Lines Matching refs:tb

30 static int tpm_loadkey2(struct tpm_buf *tb,  in tpm_loadkey2()  argument
46 ret = oiap(tb, &authhandle, enonce); in tpm_loadkey2()
67 tpm_buf_reset(tb, TPM_TAG_RQU_AUTH1_COMMAND, TPM_ORD_LOADKEY2); in tpm_loadkey2()
68 tpm_buf_append_u32(tb, keyhandle); in tpm_loadkey2()
69 tpm_buf_append(tb, keyblob, keybloblen); in tpm_loadkey2()
70 tpm_buf_append_u32(tb, authhandle); in tpm_loadkey2()
71 tpm_buf_append(tb, nonceodd, TPM_NONCE_SIZE); in tpm_loadkey2()
72 tpm_buf_append_u8(tb, cont); in tpm_loadkey2()
73 tpm_buf_append(tb, authdata, SHA1_DIGEST_SIZE); in tpm_loadkey2()
75 ret = trusted_tpm_send(tb->data, MAX_BUF_SIZE); in tpm_loadkey2()
81 ret = TSS_checkhmac1(tb->data, ordinal, nonceodd, keyauth, in tpm_loadkey2()
88 *newhandle = LOAD32(tb->data, TPM_DATA_OFFSET); in tpm_loadkey2()
95 static int tpm_flushspecific(struct tpm_buf *tb, uint32_t handle) in tpm_flushspecific() argument
97 tpm_buf_reset(tb, TPM_TAG_RQU_COMMAND, TPM_ORD_FLUSHSPECIFIC); in tpm_flushspecific()
98 tpm_buf_append_u32(tb, handle); in tpm_flushspecific()
99 tpm_buf_append_u32(tb, TPM_RT_KEY); in tpm_flushspecific()
101 return trusted_tpm_send(tb->data, MAX_BUF_SIZE); in tpm_flushspecific()
108 static int tpm_unbind(struct tpm_buf *tb, in tpm_unbind() argument
126 ret = oiap(tb, &authhandle, enonce); in tpm_unbind()
148 tpm_buf_reset(tb, TPM_TAG_RQU_AUTH1_COMMAND, TPM_ORD_UNBIND); in tpm_unbind()
149 tpm_buf_append_u32(tb, keyhandle); in tpm_unbind()
150 tpm_buf_append_u32(tb, bloblen); in tpm_unbind()
151 tpm_buf_append(tb, blob, bloblen); in tpm_unbind()
152 tpm_buf_append_u32(tb, authhandle); in tpm_unbind()
153 tpm_buf_append(tb, nonceodd, TPM_NONCE_SIZE); in tpm_unbind()
154 tpm_buf_append_u8(tb, cont); in tpm_unbind()
155 tpm_buf_append(tb, authdata, SHA1_DIGEST_SIZE); in tpm_unbind()
157 ret = trusted_tpm_send(tb->data, MAX_BUF_SIZE); in tpm_unbind()
163 datalen = LOAD32(tb->data, TPM_DATA_OFFSET); in tpm_unbind()
165 ret = TSS_checkhmac1(tb->data, ordinal, nonceodd, in tpm_unbind()
175 memcpy(out, tb->data + TPM_DATA_OFFSET + sizeof(uint32_t), in tpm_unbind()
191 static int tpm_sign(struct tpm_buf *tb, in tpm_sign() argument
209 ret = oiap(tb, &authhandle, enonce); in tpm_sign()
231 tpm_buf_reset(tb, TPM_TAG_RQU_AUTH1_COMMAND, TPM_ORD_SIGN); in tpm_sign()
232 tpm_buf_append_u32(tb, keyhandle); in tpm_sign()
233 tpm_buf_append_u32(tb, bloblen); in tpm_sign()
234 tpm_buf_append(tb, blob, bloblen); in tpm_sign()
235 tpm_buf_append_u32(tb, authhandle); in tpm_sign()
236 tpm_buf_append(tb, nonceodd, TPM_NONCE_SIZE); in tpm_sign()
237 tpm_buf_append_u8(tb, cont); in tpm_sign()
238 tpm_buf_append(tb, authdata, SHA1_DIGEST_SIZE); in tpm_sign()
240 ret = trusted_tpm_send(tb->data, MAX_BUF_SIZE); in tpm_sign()
246 datalen = LOAD32(tb->data, TPM_DATA_OFFSET); in tpm_sign()
248 ret = TSS_checkhmac1(tb->data, ordinal, nonceodd, in tpm_sign()
258 memcpy(out, tb->data + TPM_DATA_OFFSET + sizeof(uint32_t), in tpm_sign()
507 struct tpm_buf tb; in tpm_key_decrypt() local
521 r = tpm_buf_init(&tb, 0, 0); in tpm_key_decrypt()
528 r = tpm_loadkey2(&tb, SRKHANDLE, srkauth, in tpm_key_decrypt()
538 r = tpm_unbind(&tb, keyhandle, keyauth, in tpm_key_decrypt()
543 if (tpm_flushspecific(&tb, keyhandle) < 0) in tpm_key_decrypt()
547 tpm_buf_destroy(&tb); in tpm_key_decrypt()
631 struct tpm_buf tb; in tpm_key_sign() local
669 r = tpm_buf_init(&tb, 0, 0); in tpm_key_sign()
676 r = tpm_loadkey2(&tb, SRKHANDLE, srkauth, in tpm_key_sign()
686 r = tpm_sign(&tb, keyhandle, keyauth, in, in_len, out, params->out_len); in tpm_key_sign()
690 if (tpm_flushspecific(&tb, keyhandle) < 0) in tpm_key_sign()
694 tpm_buf_destroy(&tb); in tpm_key_sign()