mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
iso channel auth with des/2dea/3tdea/aes works
This commit is contained in:
parent
e4eff3c40f
commit
91f000ad33
1 changed files with 3 additions and 5 deletions
|
@ -1293,9 +1293,8 @@ static int DesfireAuthenticateISO(DesfireContext *dctx, DesfireSecureChannel sec
|
||||||
memcpy(&both[rndlen], piccrnd, rndlen);
|
memcpy(&both[rndlen], piccrnd, rndlen);
|
||||||
|
|
||||||
// encode
|
// encode
|
||||||
uint8_t IV[16] = {0};
|
DesfireClearIV(dctx);
|
||||||
if (aes_encode(IV, dctx->key, both, both, rndlen * 2))
|
DesfireCryptoEncDec(dctx, false, both, rndlen * 2, both, true); // error 303
|
||||||
return 303;
|
|
||||||
|
|
||||||
// external authenticate
|
// external authenticate
|
||||||
res = DesfireISOExternalAuth(dctx, true, dctx->keyNum, dctx->keyType, both);
|
res = DesfireISOExternalAuth(dctx, true, dctx->keyNum, dctx->keyType, both);
|
||||||
|
@ -1314,8 +1313,7 @@ static int DesfireAuthenticateISO(DesfireContext *dctx, DesfireSecureChannel sec
|
||||||
|
|
||||||
// decode rnddata
|
// decode rnddata
|
||||||
uint8_t piccrnd2[64] = {0};
|
uint8_t piccrnd2[64] = {0};
|
||||||
if (aes_decode(IV, dctx->key, rnddata, piccrnd2, rndlen * 2))
|
DesfireCryptoEncDec(dctx, false, rnddata, rndlen * 2, piccrnd2, false); // error 307
|
||||||
return 307;
|
|
||||||
|
|
||||||
// check
|
// check
|
||||||
if (memcmp(hostrnd2, &piccrnd2[rndlen], rndlen) != 0)
|
if (memcmp(hostrnd2, &piccrnd2[rndlen], rndlen) != 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue