- sm_transmit_apdu doesn't check SWs anymore
- not throwing error for sw=63XX in mse:set at git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@109 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -281,10 +281,10 @@ main (int argc, char **argv)
|
|||||||
goto err;
|
goto err;
|
||||||
printf("Established PACE channel with CAN.\n");
|
printf("Established PACE channel with CAN.\n");
|
||||||
|
|
||||||
i = pace_reset_retry_counter(&tmpctx, card, PACE_PIN, 0, NULL, 0);
|
/*i = pace_reset_retry_counter(&tmpctx, card, PACE_PIN, 0, NULL, 0);*/
|
||||||
if (i < 0)
|
/*if (i < 0)*/
|
||||||
goto err;
|
/*goto err;*/
|
||||||
printf("Resumed PIN.\n");
|
/*printf("Resumed PIN.\n");*/
|
||||||
|
|
||||||
i = pace_get_channel(&tmpctx, card,
|
i = pace_get_channel(&tmpctx, card,
|
||||||
PACE_PIN, pin, pin ? strlen(pin) : 0,
|
PACE_PIN, pin, pin ? strlen(pin) : 0,
|
||||||
|
|||||||
@@ -314,18 +314,11 @@ static int pace_mse_set_at(const struct sm_ctx *oldpacectx, sc_card_t *card,
|
|||||||
if (apdu.sw1 == 0x63) {
|
if (apdu.sw1 == 0x63) {
|
||||||
if ((apdu.sw2 & 0xc0) == 0xc0) {
|
if ((apdu.sw2 & 0xc0) == 0xc0) {
|
||||||
tries = apdu.sw2 & 0x0f;
|
tries = apdu.sw2 & 0x0f;
|
||||||
sc_error(card->ctx, "Verification failed (remaining tries: %d%s)\n",
|
|
||||||
tries, tries == 1? ", password must be resumed":
|
|
||||||
tries == 0? ", password must be unblocked": "");
|
|
||||||
if (tries > 1) {
|
|
||||||
/* this is only a warning... */
|
/* this is only a warning... */
|
||||||
|
sc_error(card->ctx, "Remaining tries: %d%s\n",
|
||||||
|
tries, tries == 1? ", (password must be resumed)":
|
||||||
|
tries == 0? ", (password must be unblocked)": "");
|
||||||
r = SC_SUCCESS;
|
r = SC_SUCCESS;
|
||||||
} else {
|
|
||||||
/* With less than 2 remaining tries an other type of secret
|
|
||||||
* must be used for the resume or unblock operation. */
|
|
||||||
r = SC_ERROR_SECURITY_STATUS_NOT_SATISFIED;
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
sc_error(card->ctx, "Unknown SWs; SW1=%02X, SW2=%02X\n",
|
sc_error(card->ctx, "Unknown SWs; SW1=%02X, SW2=%02X\n",
|
||||||
apdu.sw1, apdu.sw2);
|
apdu.sw1, apdu.sw2);
|
||||||
|
|||||||
@@ -566,8 +566,6 @@ int sm_transmit_apdu(const struct sm_ctx *sctx, sc_card_t *card,
|
|||||||
"Could not transmit SM APDU");
|
"Could not transmit SM APDU");
|
||||||
SC_TEST_RET(card->ctx, sm_decrypt(sctx, card, &sm_apdu, apdu),
|
SC_TEST_RET(card->ctx, sm_decrypt(sctx, card, &sm_apdu, apdu),
|
||||||
"Could not decrypt APDU");
|
"Could not decrypt APDU");
|
||||||
SC_TEST_RET(card->ctx, sc_check_sw(card, apdu->sw1, apdu->sw2),
|
|
||||||
"Card returned error");
|
|
||||||
|
|
||||||
SC_FUNC_RETURN(card->ctx, SC_LOG_TYPE_ERROR, SC_SUCCESS);
|
SC_FUNC_RETURN(card->ctx, SC_LOG_TYPE_ERROR, SC_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user