mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-20 12:42:54 +00:00
HV: trusty: Get rpmb_key from OSloader when init trusty
Extend struct trusty_boot_param to hold rpmb_key. Copy rpmb_key from trusty_boot_param when initialize trusty. Signed-off-by: Qi Yadong <yadong.qi@intel.com> Reviewed-by: Zhu Bing <bing.zhu@intel.com> Reviewed-by: Wang Kai <kai.z.wang@intel.com>
This commit is contained in:
parent
260e84769d
commit
3e2d1fba6b
@ -7,7 +7,8 @@
|
|||||||
#include <hypervisor.h>
|
#include <hypervisor.h>
|
||||||
#include <hkdf.h>
|
#include <hkdf.h>
|
||||||
|
|
||||||
#define TRUSTY_VERSION 1
|
#define TRUSTY_VERSION 1U
|
||||||
|
#define TRUSTY_VERSION_2 2U
|
||||||
|
|
||||||
struct trusty_mem {
|
struct trusty_mem {
|
||||||
/* The first page of trusty memory is reserved for key_info and
|
/* The first page of trusty memory is reserved for key_info and
|
||||||
@ -425,14 +426,20 @@ bool initialize_trusty(struct vcpu *vcpu, uint64_t param)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME: Temporarily comments out the size check since need to extend
|
||||||
|
* the interface, need to add back after the integration done.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
if (sizeof(struct trusty_boot_param) !=
|
if (sizeof(struct trusty_boot_param) !=
|
||||||
boot_param.size_of_this_struct) {
|
boot_param.size_of_this_struct) {
|
||||||
pr_err("%s: sizeof(struct trusty_boot_param) mismatch!\n",
|
pr_err("%s: sizeof(struct trusty_boot_param) mismatch!\n",
|
||||||
__func__);
|
__func__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (boot_param.version != TRUSTY_VERSION) {
|
if ((boot_param.version != TRUSTY_VERSION) &&
|
||||||
|
(boot_param.version != TRUSTY_VERSION_2)) {
|
||||||
pr_err("%s: version of(trusty_boot_param) mismatch!\n",
|
pr_err("%s: version of(trusty_boot_param) mismatch!\n",
|
||||||
__func__);
|
__func__);
|
||||||
return false;
|
return false;
|
||||||
@ -461,6 +468,14 @@ bool initialize_trusty(struct vcpu *vcpu, uint64_t param)
|
|||||||
/* save Normal World context */
|
/* save Normal World context */
|
||||||
save_world_ctx(&vcpu->arch_vcpu.contexts[NORMAL_WORLD]);
|
save_world_ctx(&vcpu->arch_vcpu.contexts[NORMAL_WORLD]);
|
||||||
|
|
||||||
|
if (boot_param.version == TRUSTY_VERSION_2) {
|
||||||
|
/* copy rpmb_key from OSloader */
|
||||||
|
memcpy_s(&g_key_info.rpmb_key[0][0], 64U,
|
||||||
|
&boot_param.rpmb_key[0], 64U);
|
||||||
|
memset(&boot_param.rpmb_key[0], 0U, 64U);
|
||||||
|
/* OSloader must clear the rpmb_key after switched back */
|
||||||
|
}
|
||||||
|
|
||||||
/* init secure world environment */
|
/* init secure world environment */
|
||||||
if (init_secure_world_env(vcpu,
|
if (init_secure_world_env(vcpu,
|
||||||
trusty_entry_gpa - trusty_base_gpa + TRUSTY_EPT_REBASE_GPA,
|
trusty_entry_gpa - trusty_base_gpa + TRUSTY_EPT_REBASE_GPA,
|
||||||
|
@ -256,6 +256,12 @@ struct trusty_boot_param {
|
|||||||
|
|
||||||
/** trusty runtime memory size */
|
/** trusty runtime memory size */
|
||||||
uint32_t mem_size;
|
uint32_t mem_size;
|
||||||
|
|
||||||
|
/** padding */
|
||||||
|
uint32_t padding;
|
||||||
|
|
||||||
|
/** rpmb key */
|
||||||
|
uint8_t rpmb_key[64];
|
||||||
} __aligned(8);
|
} __aligned(8);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user