Skip to content

Commit e438577

Browse files
Grom-Vaarai
authored andcommitted
[SERVICES/STSAFEA] Fix query generic public key slot info
1 parent aaf266f commit e438577

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

services/stsafea/stsafea_asymmetric_key_slots.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,16 @@ stse_ReturnCode_t stsafea_query_generic_public_key_slot_info(
231231
if(*pPresence_flag == 1)
232232
{
233233
stse_ecc_key_type_t curve_id_index;
234+
PLAT_UI8 curve_id_total_length;
234235
*pKey_type = STSE_ECC_KT_INVALID;
236+
/*extract curve id length */
237+
curve_id_total_length = (*(eCurve_id.pData) << 8);
238+
curve_id_total_length += *(eCurve_id.pData+1) + STSAFEA_ECC_CURVE_ID_LENGTH_SIZE;
235239
/* Compare slot curve ID against each known curve ID to set the key type */
236240
for(curve_id_index=STSE_ECC_KT_NIST_P_256; curve_id_index<STSAFEA_ECC_NUMBER_OF_CURVES; curve_id_index++)
237241
{
238242
/* First check of the ID length to speed-up the loop */
239-
if(stsafea_ecc_info_table[curve_id_index].curve_id_total_length == eCurve_id.length)
243+
if(curve_id_total_length == stsafea_ecc_info_table[curve_id_index].curve_id_total_length)
240244
{
241245
int diff;
242246
diff = memcmp((PLAT_UI8*)&stsafea_ecc_info_table[curve_id_index].curve_id,

services/stsafea/stsafea_asymmetric_key_slots.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ typedef struct stsafea_generic_public_key_configuration_flags_t{
8585
PLAT_UI8 change_right : STSE_1BIT_LEN;
8686
PLAT_UI8 establish_symmetric_key : STSE_1BIT_LEN;
8787
PLAT_UI8 start_volatile_kek_session : STSE_1BIT_LEN;
88-
PLAT_UI8 filler : STSE_6BIT_LEN;
88+
PLAT_UI8 filler : STSE_5BIT_LEN;
8989
}stsafea_generic_public_key_configuration_flags_t;
9090

9191
/*!

0 commit comments

Comments
 (0)