select_app now invokes U2F or FIDO depending on the message.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2024-08-20 14:29:11 +02:00
parent c1571c02f8
commit 38f0e2cc3a
4 changed files with 32 additions and 29 deletions

View File

@@ -53,22 +53,8 @@ int process_apdu() {
}
}
if (INS(apdu) == 0xA4 && P1(apdu) == 0x04 && (P2(apdu) == 0x00 || P2(apdu) == 0x4)) { //select by AID
for (int a = 0; a < num_apps; a++) {
if (!memcmp(apps[a].aid + 1, apdu.data, MIN(apdu.nc, apps[a].aid[0]))) {
if (current_app) {
if (current_app->aid && !memcmp(current_app->aid + 1, apdu.data, apdu.nc)) {
current_app->select_aid(current_app);
return SW_OK();
}
if (current_app->unload) {
current_app->unload();
}
}
current_app = &apps[a];
if (current_app->select_aid(current_app) == CCID_OK) {
return SW_OK();
}
}
if (select_app(apdu.data, apdu.nc) == CCID_OK) {
return SW_OK();
}
return SW_FILE_NOT_FOUND();
}