CHG: 'hf list legic' doesn't print the parity now.

CHG: 'hf legic read' the device side timings is starting to look much better. HUGE Thanks to @will-rbnt for endless checks and logic analyser feedback. Without his effort this would not work. What does work? We can now use ANY IV in legic. The PM3 Master version is flawed, will only work with IV=0x55.

---still broke--- my crc implementation.. I know I'm about to look into it.
This commit is contained in:
iceman1001
2016-09-28 21:37:08 +02:00
parent 6a12ad0c86
commit d7e24e7c5f
4 changed files with 24 additions and 42 deletions

View File

@@ -664,7 +664,7 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
oddparity ^= (((frame[j] & 0xFF) >> k) & 0x01);
}
uint8_t parityBits = parityBytes[j>>3];
if (protocol != ISO_14443B && protocol != ISO_7816_4 && (isResponse || protocol == ISO_14443A) && (oddparity != ((parityBits >> (7-(j&0x0007))) & 0x01))) {
if (protocol != LEGIC && protocol != ISO_14443B && protocol != ISO_7816_4 && (isResponse || protocol == ISO_14443A) && (oddparity != ((parityBits >> (7-(j&0x0007))) & 0x01))) {
snprintf(line[j/16]+(( j % 16) * 4),110, "%02x! ", frame[j]);
} else {
snprintf(line[j/16]+(( j % 16) * 4),110, "%02x ", frame[j]);

View File

@@ -410,18 +410,8 @@ int CmdLegicRFRead(const char *Cmd) {
IV |= 0x01; // IV must be odd
PrintAndLog("LSB of IV must be SET");
}
PrintAndLog("Current IV: 0x%02x", IV);
PrintAndLog("Using IV: 0x%02x", IV);
// get some prng bytes from
uint8_t temp[32];
legic_prng_init(IV);
for ( uint8_t j = 0; j < sizeof(temp); ++j) {
temp[j] = legic_prng_get_bit(1);
legic_prng_forward(1);
//PrintAndLog("PRNG: %s", sprint_hex(temp, sizeof(temp)));
}
PrintAndLog("PRNG: %s", sprint_bin(temp, sizeof(temp)));
UsbCommand c = {CMD_READER_LEGIC_RF, {offset, len, IV}};
clearCommandBuffer();
SendCommand(&c);