Lines Matching refs:tpm

262 static int get_tpm_nv_size(struct udevice *tpm, uint32_t index, uint32_t *size)  in get_tpm_nv_size()  argument
269 err = tpm_get_capability(tpm, TPM_CAP_NV_INDEX, index, in get_tpm_nv_size()
298 static int find_key(struct udevice *tpm, const uint8_t auth[20], in find_key() argument
311 err = tpm_get_capability(tpm, TPM_CAP_HANDLE, TPM_RT_KEY, buf, in find_key()
323 err = tpm_get_pub_key_oiap(tpm, key_handles[i], auth, buf, in find_key()
342 static int read_common_data(struct udevice *tpm) in read_common_data() argument
349 if (get_tpm_nv_size(tpm, NV_COMMON_DATA_INDEX, &size) || in read_common_data()
352 err = tpm_nv_read_value(tpm, NV_COMMON_DATA_INDEX, in read_common_data()
486 static struct h_reg *access_hreg(struct udevice *tpm, uint8_t spec, in access_hreg() argument
504 hre_tpm_err = tpm_pcr_read(tpm, HREG_IDX(spec), in access_hreg()
510 read_common_data(tpm); in access_hreg()
586 static int hre_op_loadkey(struct udevice *tpm, struct h_reg *src_reg, in hre_op_loadkey() argument
595 if (find_key(tpm, src_reg->digest, dst_reg->digest, &parent_handle)) in hre_op_loadkey()
597 hre_tpm_err = tpm_load_key2_oiap(tpm, parent_handle, key, key_size, in hre_op_loadkey()
614 static const uint8_t *hre_execute_op(struct udevice *tpm, const uint8_t **ip, in hre_execute_op() argument
646 src_reg = access_hreg(tpm, src_spec, HREG_RD); in hre_execute_op()
649 dst_reg = access_hreg(tpm, dst_spec, in hre_execute_op()
706 if (hre_op_loadkey(tpm, src_reg, dst_reg, data, data_size)) in hre_execute_op()
714 hre_tpm_err = tpm_extend(tpm, HREG_IDX(dst_spec), in hre_execute_op()
738 static int hre_run_program(struct udevice *tpm, const uint8_t *code, in hre_run_program() argument
748 if (!hre_execute_op(tpm, &ip, &code_left)) in hre_run_program()
953 static int first_stage_actions(struct udevice *tpm) in first_stage_actions() argument
960 if (tpm_continue_self_test(tpm)) in first_stage_actions()
963 tpm_continue_self_test(tpm); in first_stage_actions()
967 if (hre_run_program(tpm, prg_stage1_prepare, in first_stage_actions()
973 if (hre_run_program(tpm, sd_prg->code, sd_prg->code_size)) in first_stage_actions()
994 struct udevice *tpm; in first_stage_init() local
998 ret = get_tpm(&tpm); in first_stage_init()
999 if (ret || tpm_init(tpm) || tpm_startup(tpm, TPM_ST_CLEAR)) in first_stage_init()
1001 ret = first_stage_actions(tpm); in first_stage_init()
1049 struct udevice *tpm; in second_stage_init() local
1054 ret = get_tpm(&tpm); in second_stage_init()
1055 if (ret || tpm_init(tpm)) in second_stage_init()
1057 err = tpm_startup(tpm, TPM_ST_CLEAR); in second_stage_init()
1062 if (!did_first_stage_run && first_stage_actions(tpm)) in second_stage_init()
1069 if (hre_run_program(tpm, prg_stage2_prepare, in second_stage_init()
1115 hre_run_program(tpm, prg_stage2_success, sizeof(prg_stage2_success)); in second_stage_init()
1120 hre_run_program(tpm, prg_stage_fail, sizeof(prg_stage_fail)); in second_stage_init()