mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -07:00
Update cmdhfmfdes.c
Desfire readdata patch
This commit is contained in:
parent
cfdef9e92e
commit
e0269bde74
1 changed files with 15 additions and 4 deletions
|
@ -1890,10 +1890,21 @@ static int handler_desfire_readdata(mfdes_data_t *data, MFDES_FILE_TYPE_T type,
|
|||
uint16_t sw = 0;
|
||||
uint32_t resplen = 0;
|
||||
|
||||
size_t plen = apdu.Lc;
|
||||
uint8_t *p = mifare_cryto_preprocess_data(tag, (uint8_t *)data, &plen, 0, MDCM_PLAIN | CMAC_COMMAND);
|
||||
apdu.Lc = (uint8_t)plen;
|
||||
apdu.data = p;
|
||||
// we need the CMD 0xBD <data> to calc the CMAC
|
||||
uint8_t tmp_data[8]; // Since the APDU is hardcoded to 7 bytes of payload 7+1 = 8 is enough.
|
||||
tmp_data[0] = 0xBD;
|
||||
memcpy (&tmp_data[1], data, 7);
|
||||
|
||||
// size_t plen = apdu.Lc;
|
||||
// uint8_t *p = mifare_cryto_preprocess_data(tag, (uint8_t *)data, &plen, 0, MDCM_PLAIN | CMAC_COMMAND);
|
||||
// apdu.Lc = (uint8_t)plen;
|
||||
// apdu.data = p;
|
||||
|
||||
size_t plen = 8;
|
||||
uint8_t *p = mifare_cryto_preprocess_data(tag, tmp_data, &plen, 0, MDCM_PLAIN | CMAC_COMMAND);
|
||||
// apdu data does not need the cmd, so use the original read command data.
|
||||
apdu.Lc = 7;
|
||||
apdu.data = (uint8_t *)data;
|
||||
|
||||
int res = send_desfire_cmd(&apdu, false, data->data, &resplen, &sw, 0, true);
|
||||
if (res != PM3_SUCCESS) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue