Fix CONFIG_TOUCH status report.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2025-03-23 22:44:35 +01:00
parent 23b60beb2e
commit 4e4c28a479

View File

@@ -350,11 +350,24 @@ uint16_t otp_status(bool is_otp) {
res_APDU[res_APDU_size++] = PICO_FIDO_VERSION_MINOR; res_APDU[res_APDU_size++] = PICO_FIDO_VERSION_MINOR;
res_APDU[res_APDU_size++] = 0; res_APDU[res_APDU_size++] = 0;
res_APDU[res_APDU_size++] = config_seq; res_APDU[res_APDU_size++] = config_seq;
res_APDU[res_APDU_size++] = (CONFIG2_TOUCH | CONFIG1_TOUCH) | uint8_t opts = 0;
(file_has_data(search_dynamic_file(EF_OTP_SLOT1)) ? CONFIG1_VALID : file_t *ef = search_dynamic_file(EF_OTP_SLOT1);
0x00) | if (file_has_data(ef)) {
(file_has_data(search_dynamic_file(EF_OTP_SLOT2)) ? CONFIG2_VALID : opts |= CONFIG1_VALID;
0x00); otp_config_t *otp_config = (otp_config_t *) file_get_data(ef);
if (!(otp_config->tkt_flags & CHAL_RESP) || otp_config->cfg_flags & CHAL_BTN_TRIG) {
opts |= CONFIG1_TOUCH;
}
}
ef = search_dynamic_file(EF_OTP_SLOT2);
if (file_has_data(ef)) {
opts |= CONFIG2_VALID;
otp_config_t *otp_config = (otp_config_t *) file_get_data(ef);
if (!(otp_config->tkt_flags & CHAL_RESP) || otp_config->cfg_flags & CHAL_BTN_TRIG) {
opts |= CONFIG2_TOUCH;
}
}
res_APDU[res_APDU_size++] = opts;
res_APDU[res_APDU_size++] = 0; res_APDU[res_APDU_size++] = 0;
res_APDU[res_APDU_size++] = status_byte; res_APDU[res_APDU_size++] = status_byte;
if (is_otp) { if (is_otp) {
@@ -638,6 +651,7 @@ uint16_t otp_hid_get_report_cb(uint8_t itf,
else { else {
res_APDU = buffer; res_APDU = buffer;
otp_status(true); otp_status(true);
DEBUG_DATA(buffer, 8);
} }
return reqlen; return reqlen;