Lines Matching refs:payload

31 static int tpm2_key_encode(struct trusted_key_payload *payload,  in tpm2_key_encode()  argument
79 work1 = payload->blob; in tpm2_key_encode()
80 work1 = asn1_encode_sequence(work1, work1 + sizeof(payload->blob), in tpm2_key_encode()
85 return work1 - payload->blob; in tpm2_key_encode()
96 static int tpm2_key_decode(struct trusted_key_payload *payload, in tpm2_key_decode() argument
106 ret = asn1_ber_decoder(&tpm2key_decoder, &ctx, payload->blob, in tpm2_key_decode()
107 payload->blob_len); in tpm2_key_decode()
228 struct trusted_key_payload *payload, in tpm2_seal_trusted() argument
269 tpm_buf_append_u16(&buf, 4 + options->blobauth_len + payload->key_len); in tpm2_seal_trusted()
275 tpm_buf_append_u16(&buf, payload->key_len); in tpm2_seal_trusted()
276 tpm_buf_append(&buf, payload->key, payload->key_len); in tpm2_seal_trusted()
286 flags |= payload->migratable ? 0 : (TPM2_OA_FIXED_TPM | in tpm2_seal_trusted()
325 blob_len = tpm2_key_encode(payload, options, in tpm2_seal_trusted()
341 payload->blob_len = blob_len; in tpm2_seal_trusted()
361 struct trusted_key_payload *payload, in tpm2_load_cmd() argument
373 rc = tpm2_key_decode(payload, options, &blob); in tpm2_load_cmd()
376 blob = payload->blob; in tpm2_load_cmd()
377 payload->old_format = 1; in tpm2_load_cmd()
385 if (payload->blob_len < 4) in tpm2_load_cmd()
391 if (private_len + 2 + 2 > (payload->blob_len)) in tpm2_load_cmd()
395 if (private_len + 2 + public_len + 2 > payload->blob_len) in tpm2_load_cmd()
404 payload->migratable = 0; in tpm2_load_cmd()
406 payload->migratable = 1; in tpm2_load_cmd()
409 if (blob_len > payload->blob_len) in tpm2_load_cmd()
436 if (blob != payload->blob) in tpm2_load_cmd()
459 struct trusted_key_payload *payload, in tpm2_unseal_cmd() argument
499 if (payload->old_format) { in tpm2_unseal_cmd()
501 memcpy(payload->key, data, data_len - 1); in tpm2_unseal_cmd()
502 payload->key_len = data_len - 1; in tpm2_unseal_cmd()
503 payload->migratable = data[data_len - 1]; in tpm2_unseal_cmd()
509 memcpy(payload->key, data, data_len); in tpm2_unseal_cmd()
510 payload->key_len = data_len; in tpm2_unseal_cmd()
529 struct trusted_key_payload *payload, in tpm2_unseal_trusted() argument
539 rc = tpm2_load_cmd(chip, payload, options, &blob_handle); in tpm2_unseal_trusted()
543 rc = tpm2_unseal_cmd(chip, payload, options, blob_handle); in tpm2_unseal_trusted()