Fix return metadata for PIN/PUK.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2024-08-13 17:05:35 +02:00
parent 209cd389e5
commit c28852d0ea
No known key found for this signature in database
GPG Key ID: C0095B7870A4CCD3

View File

@ -529,8 +529,13 @@ static int cmd_get_metadata() {
return SW_REFERENCE_NOT_FOUND();
}
uint8_t retries = *(file_get_data(pw_status) + 3 + (key_ref & 0xf));
if (!(pw_status = search_by_fid(EF_PW_RETRIES, NULL, SPECIFY_EF))) {
return SW_REFERENCE_NOT_FOUND();
}
uint8_t total = *(file_get_data(pw_status) + (key_ref & 0xf));
res_APDU[res_APDU_size++] = 0x6;
res_APDU[res_APDU_size++] = 1;
res_APDU[res_APDU_size++] = 2;
res_APDU[res_APDU_size++] = total;
res_APDU[res_APDU_size++] = retries;
}
}