- the previous patch was bad; fixed it

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1516 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
okir 2003-10-14 09:02:51 +00:00
parent 12a4ef75ef
commit c323d0a082
1 changed files with 9 additions and 4 deletions

View File

@ -547,7 +547,7 @@ gpk_select(struct sc_card *card, u8 kind,
{ {
struct gpk_private_data *priv = DRVDATA(card); struct gpk_private_data *priv = DRVDATA(card);
struct sc_apdu apdu; struct sc_apdu apdu;
u8 resbuf[SC_MAX_APDU_BUFFER_SIZE]; u8 resbuf[256];
int r; int r;
/* If we're about to select a DF, invalidate secure messaging keys */ /* If we're about to select a DF, invalidate secure messaging keys */
@ -559,15 +559,20 @@ gpk_select(struct sc_card *card, u8 kind,
/* do the apdu thing */ /* do the apdu thing */
memset(&apdu, 0, sizeof(apdu)); memset(&apdu, 0, sizeof(apdu));
apdu.cla = 0x00; apdu.cla = 0x00;
apdu.cse = SC_APDU_CASE_4_SHORT; apdu.cse = SC_APDU_CASE_3_SHORT;
apdu.ins = 0xA4; apdu.ins = 0xA4;
apdu.p1 = kind; apdu.p1 = kind;
apdu.p2 = 0; apdu.p2 = 0;
apdu.data = buf; apdu.data = buf;
apdu.datalen = buflen; apdu.datalen = buflen;
apdu.lc = apdu.datalen; apdu.lc = apdu.datalen;
if (file) {
apdu.cse = SC_APDU_CASE_4_SHORT;
apdu.resp = resbuf; apdu.resp = resbuf;
apdu.resplen = file? sizeof(resbuf) : 0; apdu.resplen = sizeof(resbuf);
apdu.le = sizeof(resbuf);
}
r = sc_transmit_apdu(card, &apdu); r = sc_transmit_apdu(card, &apdu);
SC_TEST_RET(card->ctx, r, "APDU transmit failed"); SC_TEST_RET(card->ctx, r, "APDU transmit failed");