mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-19 11:33:51 +08:00
fix mad2 crc8 check
This commit is contained in:
parent
979aa678ad
commit
3a98c9fcd3
1 changed files with 10 additions and 1 deletions
|
@ -109,13 +109,19 @@ static const char *GetAIDDescription(uint16_t AID) {
|
|||
|
||||
int madCRCCheck(uint8_t *sector, bool verbose, int MADver) {
|
||||
if (MADver == 1) {
|
||||
uint8_t crc = CRC8Mad(§or[16 + 1], 31);
|
||||
uint8_t crc = CRC8Mad(§or[16 + 1], 15 + 16);
|
||||
if (crc != sector[16]) {
|
||||
if (verbose)
|
||||
PrintAndLogEx(ERR, "Wrong MAD%d CRC. Calculated: 0x%02x, from card: 0x%02x", MADver, crc, sector[16]);
|
||||
return 3;
|
||||
};
|
||||
} else {
|
||||
uint8_t crc = CRC8Mad(§or[1], 15 + 16 + 16);
|
||||
if (crc != sector[0]) {
|
||||
if (verbose)
|
||||
PrintAndLogEx(ERR, "Wrong MAD%d CRC. Calculated: 0x%02x, from card: 0x%02x", MADver, crc, sector[16]);
|
||||
return 3;
|
||||
};
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -191,6 +197,9 @@ int MAD2DecodeAndPrint(uint8_t *sector, bool verbose) {
|
|||
if (res)
|
||||
return res;
|
||||
|
||||
if (verbose)
|
||||
PrintAndLogEx(NORMAL, "CRC8-MAD OK.");
|
||||
|
||||
uint8_t InfoByte = sector[1] & 0x3f;
|
||||
PrintAndLogEx(NORMAL, "MAD2 Card publisher sector: 0x%02x", InfoByte);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue