mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-22 14:23:50 -07:00
clear security state when card returns error
This commit is contained in:
parent
9cfa638e4d
commit
a206dcc9b2
1 changed files with 11 additions and 3 deletions
|
@ -70,10 +70,17 @@ static int CIPURSEExchangeEx(bool ActivateField, bool LeaveFieldON, sAPDU apdu,
|
||||||
if (*ResultLen < 2) {
|
if (*ResultLen < 2) {
|
||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t rlen = 0;
|
size_t rlen = 0;
|
||||||
CipurseCAPDURespDecode(&cipurseContext, Result, *ResultLen, securedata, &rlen, &isw);
|
if (*ResultLen == 2) {
|
||||||
memcpy(Result, securedata, rlen);
|
CipurseCClearContext(&cipurseContext);
|
||||||
|
|
||||||
|
isw = Result[0] * 0x0100 + Result[1];
|
||||||
|
} else {
|
||||||
|
CipurseCAPDURespDecode(&cipurseContext, Result, *ResultLen, securedata, &rlen, &isw);
|
||||||
|
memcpy(Result, securedata, rlen);
|
||||||
|
}
|
||||||
|
|
||||||
if (ResultLen != NULL)
|
if (ResultLen != NULL)
|
||||||
*ResultLen = rlen;
|
*ResultLen = rlen;
|
||||||
|
|
||||||
|
@ -171,6 +178,7 @@ bool CIPURSEChannelAuthenticate(uint8_t keyIndex, uint8_t *key, bool verbose) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
PrintAndLogEx(INFO, "Authentication " _GREEN_("OK"));
|
PrintAndLogEx(INFO, "Authentication " _GREEN_("OK"));
|
||||||
|
|
||||||
|
//CipurseCChannelSetSecurityLevels(&cpc, CPSEncrypted, CPSEncrypted);
|
||||||
CipurseCChannelSetSecurityLevels(&cpc, CPSMACed, CPSMACed);
|
CipurseCChannelSetSecurityLevels(&cpc, CPSMACed, CPSMACed);
|
||||||
//CipurseCChannelSetSecurityLevels(&cpc, CPSPlain, CPSPlain);
|
//CipurseCChannelSetSecurityLevels(&cpc, CPSPlain, CPSPlain);
|
||||||
memcpy(&cipurseContext, &cpc, sizeof(CipurseContext));
|
memcpy(&cipurseContext, &cpc, sizeof(CipurseContext));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue