An app can be selected even if there is another selected previously.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2022-12-24 00:49:25 +01:00
parent 88b2978ae5
commit 7deaa990d3
No known key found for this signature in database
GPG key ID: C0095B7870A4CCD3

View file

@ -26,13 +26,12 @@ extern uint32_t timeout;
int process_apdu() {
led_set_blink(BLINK_PROCESSING);
if (!current_app)
{
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 ((current_app = apps[a].select_aid(&apps[a], apdu.data, apdu.nc))) {
return set_res_sw(0x90,0x00);
}
if (INS(apdu) == 0xA4 && P1(apdu) == 0x04 && (P2(apdu) == 0x00 || P2(apdu) == 0x4)) { //select by AID
if (current_app && current_app->unload)
current_app->unload();
for (int a = 0; a < num_apps; a++) {
if ((current_app = apps[a].select_aid(&apps[a], apdu.data, apdu.nc))) {
return set_res_sw(0x90,0x00);
}
}
return set_res_sw(0x6a, 0x82);