fix: using the right sized param, helps..

This commit is contained in:
iceman1001 2020-04-04 07:03:30 +02:00
commit 945bbe6311

View file

@ -170,22 +170,26 @@ static int usage_legic_wipe(void) {
return PM3_SUCCESS;
}
static bool legic_xor(uint8_t *data, uint8_t cardsize) {
bool ret = true;
static bool legic_xor(uint8_t *data, uint16_t cardsize) {
if (cardsize <= 22) {
PrintAndLogEx(INFO, "No obsfuscation such small dump");
return false;
}
uint8_t crc = data[4];
uint32_t calc_crc = CRC8Legic(data, 4);
if (crc != calc_crc) {
PrintAndLogEx(INFO, "Crc mismatch, obsfuscation not possible");
ret = false;
} else if (cardsize <= 22) {
PrintAndLogEx(INFO, "No obsfuscation such small dump");
} else {
for(uint16_t i = 22; i < cardsize - 22; i++) {
data[i] ^= crc;
}
PrintAndLogEx(SUCCESS, "Obsfuscation done");
return false;
}
return ret;
for(uint16_t i = 22; i < cardsize - 22; i++) {
data[i] ^= crc;
}
PrintAndLogEx(SUCCESS, "Obsfuscation done");
return true;
}
/*