mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-23 15:47:42 +08:00
fix select command via iso channel (with wrapper)
This commit is contained in:
parent
fddf7cf6b8
commit
4bf3c43c7f
1 changed files with 23 additions and 8 deletions
|
@ -1586,7 +1586,7 @@ bool DesfireCheckAuthCmd(DesfireISOSelectWay way, uint32_t appID, uint8_t keyNum
|
||||||
if (res != PM3_SUCCESS)
|
if (res != PM3_SUCCESS)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uint8_t data[] = {keyNum, (checklrp) ? 0x01 : 0x00, 0x02};
|
uint8_t data[] = {keyNum, 0x01, (checklrp) ? 0x02 : 0x00};
|
||||||
uint8_t datalen = (authcmd == MFDES_AUTHENTICATE_EV2F) ? 2 : 1;
|
uint8_t datalen = (authcmd == MFDES_AUTHENTICATE_EV2F) ? 2 : 1;
|
||||||
if (checklrp)
|
if (checklrp)
|
||||||
datalen = 3;
|
datalen = 3;
|
||||||
|
@ -1606,9 +1606,11 @@ static bool DesfireCheckISOAuthCmd(DesfireISOSelectWay way, uint32_t appID, char
|
||||||
dctx.commMode = DCMPlain;
|
dctx.commMode = DCMPlain;
|
||||||
dctx.cmdSet = DCCISO;
|
dctx.cmdSet = DCCISO;
|
||||||
|
|
||||||
bool app_level = DesfireMFSelected(way, appID);
|
|
||||||
int res = DesfireSelect(&dctx, way, appID, dfname);
|
int res = DesfireSelect(&dctx, way, appID, dfname);
|
||||||
|
if (res != PM3_SUCCESS)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool app_level = !DesfireMFSelected(way, appID);
|
||||||
uint8_t rndlen = DesfireGetRndLenForKey(keytype);
|
uint8_t rndlen = DesfireGetRndLenForKey(keytype);
|
||||||
|
|
||||||
uint8_t piccrnd[64] = {0};
|
uint8_t piccrnd[64] = {0};
|
||||||
|
@ -2948,18 +2950,31 @@ int DesfireSelectEx(DesfireContext_t *ctx, bool fieldon, DesfireISOSelectWay way
|
||||||
size_t resplen = 0;
|
size_t resplen = 0;
|
||||||
|
|
||||||
if (way == ISWMF || (way == ISWDFName && dfname == NULL)) {
|
if (way == ISWMF || (way == ISWDFName && dfname == NULL)) {
|
||||||
return DesfireISOSelect(ctx, ISSMFDFEF, NULL, 0, resp, &resplen);
|
return DesfireISOSelectEx(ctx, fieldon, ISSMFDFEF, NULL, 0, resp, &resplen);
|
||||||
} else if (way == ISW6bAID) {
|
} else if (way == ISW6bAID) {
|
||||||
|
if (id == 0x000000 && fieldon)
|
||||||
|
return DesfireAnticollision(false);
|
||||||
|
|
||||||
|
DesfireCommandSet cmdset = ctx->cmdSet;
|
||||||
|
int res;
|
||||||
|
|
||||||
|
// if we try to select 6b AID via ISO channel - we can only switch the channel via the over channel because there is no equivalent command in the iso commands
|
||||||
|
if (ctx->cmdSet == DCCISO)
|
||||||
|
ctx->cmdSet = DCCNativeISO;
|
||||||
|
|
||||||
if (fieldon)
|
if (fieldon)
|
||||||
return DesfireSelectAIDHex(ctx, id, false, 0);
|
res = DesfireSelectAIDHex(ctx, id, false, 0);
|
||||||
else
|
else
|
||||||
return DesfireSelectAIDHexNoFieldOn(ctx, id);
|
res = DesfireSelectAIDHexNoFieldOn(ctx, id);
|
||||||
|
|
||||||
|
ctx->cmdSet = cmdset;
|
||||||
|
return res;
|
||||||
} else if (way == ISWIsoID) {
|
} else if (way == ISWIsoID) {
|
||||||
uint8_t data[2] = {0};
|
uint8_t data[2] = {0};
|
||||||
Uint2byteToMemBe(data, id);
|
Uint2byteToMemBe(data, id);
|
||||||
return DesfireISOSelectEx(ctx, fieldon, ISSMFDFEF, data, 2, resp, &resplen);
|
return DesfireISOSelectEx(ctx, fieldon, ISSMFDFEF, data, 2, resp, &resplen);
|
||||||
} else if (way == ISWDFName) {
|
} else if (way == ISWDFName) {
|
||||||
return DesfireISOSelect(ctx, ISSMFDFEF, NULL, 0, resp, &resplen);
|
return DesfireISOSelectEx(ctx, fieldon, ISSMFDFEF, NULL, 0, resp, &resplen);
|
||||||
}
|
}
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue