Fix selecting FIDO AID when MSG.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2022-12-22 19:32:02 +01:00
parent cd3ab0682c
commit 24522b9db8
No known key found for this signature in database
GPG key ID: C0095B7870A4CCD3

View file

@ -162,6 +162,8 @@ int driver_process_usb_nopacket_hid() {
return 0;
}
extern const uint8_t fido_aid[];
int driver_process_usb_packet_hid(uint16_t read) {
int apdu_sent = 0;
if (read >= 5) {
@ -278,7 +280,13 @@ int driver_process_usb_packet_hid(uint16_t read) {
}
else if (last_cmd == CTAPHID_MSG && (msg_packet.len == 0 || (msg_packet.len == msg_packet.current_len && msg_packet.len > 0))) {
current_app = apps[0].select_aid(&apps[0]);
if (current_app == NULL || memcmp(current_app->aid, fido_aid+1, MIN(current_app->aid[0], fido_aid[0])) != 0) {
for (int a = 0; a < num_apps; a++) {
if ((current_app = apps[a].select_aid(&apps[a], fido_aid+1, fido_aid[0]))) {
break;
}
}
}
if (thread_type != 1)
card_start(apdu_thread);
thread_type = 1;