gp.c: Properly check the SWs of the APDU when selecting AID
This commit is contained in:
parent
b6e08e008e
commit
9b4e00b24b
@ -42,14 +42,23 @@ static int
|
|||||||
gp_select_aid(struct sc_card *card, const struct sc_aid *aid)
|
gp_select_aid(struct sc_card *card, const struct sc_aid *aid)
|
||||||
{
|
{
|
||||||
struct sc_apdu apdu;
|
struct sc_apdu apdu;
|
||||||
|
int rv;
|
||||||
|
|
||||||
sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0xA4, 0x04, 0x0C);
|
sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0xA4, 0x04, 0x0C);
|
||||||
apdu.lc = aid->len;
|
apdu.lc = aid->len;
|
||||||
apdu.data = aid->value;
|
apdu.data = aid->value;
|
||||||
apdu.datalen = aid->len;
|
apdu.datalen = aid->len;
|
||||||
|
|
||||||
return sc_transmit_apdu(card, &apdu);
|
rv = sc_transmit_apdu(card, &apdu);
|
||||||
|
|
||||||
|
if (rv < 0)
|
||||||
|
return rv;
|
||||||
|
|
||||||
|
rv = sc_check_sw(card, apdu.sw1, apdu.sw2);
|
||||||
|
if (rv < 0)
|
||||||
|
return rv;
|
||||||
|
|
||||||
|
return apdu.resplen;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Select the Open Platform Card Manager */
|
/* Select the Open Platform Card Manager */
|
||||||
|
Loading…
Reference in New Issue
Block a user