Lines Matching full:payload

31 static int tpm2_key_encode(struct trusted_key_payload *payload,  in tpm2_key_encode()  argument
84 work1 = payload->blob; in tpm2_key_encode()
85 work1 = asn1_encode_sequence(work1, work1 + sizeof(payload->blob), in tpm2_key_encode()
94 return work1 - payload->blob; in tpm2_key_encode()
109 static int tpm2_key_decode(struct trusted_key_payload *payload, in tpm2_key_decode() argument
119 ret = asn1_ber_decoder(&tpm2key_decoder, &ctx, payload->blob, in tpm2_key_decode()
120 payload->blob_len); in tpm2_key_decode()
232 * tpm2_seal_trusted() - seal the payload of a trusted key
235 * @payload: the key data in clear and encrypted form
241 struct trusted_key_payload *payload, in tpm2_seal_trusted() argument
296 tpm_buf_append_u16(&sized, payload->key_len); in tpm2_seal_trusted()
297 tpm_buf_append(&sized, payload->key, payload->key_len); in tpm2_seal_trusted()
308 flags |= payload->migratable ? 0 : (TPM2_OA_FIXED_TPM | TPM2_OA_FIXED_PARENT); in tpm2_seal_trusted()
350 blob_len = tpm2_key_encode(payload, options, &buf.data[offset], blob_len); in tpm2_seal_trusted()
365 payload->blob_len = blob_len; in tpm2_seal_trusted()
376 * @payload: the key data in clear and encrypted form
381 * -E2BIG on wrong payload size.
386 struct trusted_key_payload *payload, in tpm2_load_cmd() argument
398 rc = tpm2_key_decode(payload, options, &blob); in tpm2_load_cmd()
401 blob = payload->blob; in tpm2_load_cmd()
402 payload->old_format = 1; in tpm2_load_cmd()
410 if (payload->blob_len < 4) in tpm2_load_cmd()
416 if (private_len + 2 + 2 > (payload->blob_len)) in tpm2_load_cmd()
420 if (private_len + 2 + public_len + 2 > payload->blob_len) in tpm2_load_cmd()
429 payload->migratable = 0; in tpm2_load_cmd()
431 payload->migratable = 1; in tpm2_load_cmd()
434 if (blob_len > payload->blob_len) in tpm2_load_cmd()
467 if (blob != payload->blob) in tpm2_load_cmd()
481 * @payload: the key data in clear and encrypted form
490 struct trusted_key_payload *payload, in tpm2_unseal_cmd() argument
554 if (payload->old_format) { in tpm2_unseal_cmd()
556 memcpy(payload->key, data, data_len - 1); in tpm2_unseal_cmd()
557 payload->key_len = data_len - 1; in tpm2_unseal_cmd()
558 payload->migratable = data[data_len - 1]; in tpm2_unseal_cmd()
564 memcpy(payload->key, data, data_len); in tpm2_unseal_cmd()
565 payload->key_len = data_len; in tpm2_unseal_cmd()
575 * tpm2_unseal_trusted() - unseal the payload of a trusted key
578 * @payload: the key data in clear and encrypted form
584 struct trusted_key_payload *payload, in tpm2_unseal_trusted() argument
594 rc = tpm2_load_cmd(chip, payload, options, &blob_handle); in tpm2_unseal_trusted()
598 rc = tpm2_unseal_cmd(chip, payload, options, blob_handle); in tpm2_unseal_trusted()