Fix dkek status report when device is initialized without dkek.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2022-08-12 01:00:27 +02:00
parent 5506b46c9d
commit 2666573050

View File

@@ -780,7 +780,6 @@ static int cmd_initialize() {
}
}
}
//At least, the first DKEK shall exist
file_t *tf_kd = search_by_fid(EF_KEY_DOMAIN, NULL, SPECIFY_EF);
if (!tf_kd)
return SW_EXEC_ERROR();
@@ -801,6 +800,11 @@ static int cmd_initialize() {
return SW_EXEC_ERROR();
}
}
else {
uint16_t d = 0x0000;
if (flash_write_data_to_file(tf_kd, (const uint8_t *)&d, sizeof(d)) != CCID_OK)
return SW_EXEC_ERROR();
}
if (kds) {
uint8_t t[MAX_KEY_DOMAINS*2], k = MIN(*kds,MAX_KEY_DOMAINS);
memset(t, 0xff, 2*k);