hv: trusty: fix get_max_svn_index return type inconsistent

Function return type should consistent.

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
Li, Fei1 2018-11-27 19:30:59 +08:00 committed by lijinxia
parent c200c98405
commit 042c393526
1 changed files with 4 additions and 12 deletions

View File

@ -334,15 +334,10 @@ void switch_world(struct acrn_vcpu *vcpu, int next_world)
arch->cur_context = next_world;
}
static int32_t get_max_svn_index(void)
static inline uint32_t get_max_svn_index(void)
{
uint32_t i, max_svn_idx = 0U;
if ((g_key_info.num_seeds == 0U) ||
(g_key_info.num_seeds > BOOTLOADER_SEED_MAX_ENTRIES)) {
return -1;
}
for (i = 1U; i < g_key_info.num_seeds; i++) {
if (g_key_info.dseed_list[i].cse_svn >
g_key_info.dseed_list[i-1].cse_svn) {
@ -358,17 +353,14 @@ static bool derive_aek(uint8_t *attkb_key)
const int8_t salt[] = "Attestation Keybox Encryption Key";
const uint8_t *ikm;
uint32_t ikm_len;
int32_t max_svn_idx;
uint32_t max_svn_idx;
if (!attkb_key) {
if ((!attkb_key) || (g_key_info.num_seeds == 0U) ||
(g_key_info.num_seeds > BOOTLOADER_SEED_MAX_ENTRIES)) {
return false;
}
max_svn_idx = get_max_svn_index();
if (max_svn_idx < 0) {
return false;
}
ikm = g_key_info.dseed_list[max_svn_idx].seed;
/* only the low 32 bits of seed are valid */
ikm_len = 32;