Merge pull request from Arnie97/master

hf mf nested: transfer keys to the correct block in one sector mode.
This commit is contained in:
Iceman 2018-01-26 19:31:23 +01:00 committed by GitHub
commit 365627e2f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -683,9 +683,9 @@ int CmdHF14AMfNested(const char *Cmd)
if (transferToEml) {
uint8_t sectortrailer;
if (trgBlockNo < 32*4) { // 4 block sector
sectortrailer = (trgBlockNo & 0x03) + 3;
sectortrailer = (trgBlockNo & ~0x03) + 3;
} else { // 16 block sector
sectortrailer = (trgBlockNo & 0x0f) + 15;
sectortrailer = (trgBlockNo & ~0x0f) + 15;
}
mfEmlGetMem(keyBlock, sectortrailer, 1);
@ -1685,10 +1685,7 @@ int CmdHF14AMfESet(const char *Cmd)
}
// 1 - blocks count
UsbCommand c = {CMD_MIFARE_EML_MEMSET, {blockNo, 1, 0}};
memcpy(c.d.asBytes, memBlock, 16);
SendCommand(&c);
return 0;
return mfEmlSetMem(memBlock, blockNo, 1);
}