CHG: Syntax suger

This commit is contained in:
iceman1001 2016-01-25 20:19:15 +01:00
commit 65c2d21d05
3 changed files with 15 additions and 20 deletions

View file

@ -354,9 +354,11 @@ int legic_read_byte(int byte_index, int cmd_sz) {
frame_receive_rwd(&current_frame, 12, 1); frame_receive_rwd(&current_frame, 12, 1);
byte = current_frame.data & 0xff; byte = current_frame.data & 0xff;
if( LegicCRC(byte_index, byte, cmd_sz) != (current_frame.data >> 8) ) { if( LegicCRC(byte_index, byte, cmd_sz) != (current_frame.data >> 8) ) {
Dbprintf("!!! crc mismatch: expected %x but got %x !!!", Dbprintf("!!! crc mismatch: expected %x but got %x !!!",
LegicCRC(byte_index, current_frame.data & 0xff, cmd_sz), current_frame.data >> 8); LegicCRC(byte_index, current_frame.data & 0xff, cmd_sz),
current_frame.data >> 8);
return -1; return -1;
} }
@ -372,9 +374,8 @@ int legic_read_byte(int byte_index, int cmd_sz) {
*/ */
int legic_write_byte(int byte, int addr, int addr_sz) { int legic_write_byte(int byte, int addr, int addr_sz) {
//do not write UID, CRC, DCF //do not write UID, CRC, DCF
if(addr <= 0x06) { if(addr <= 0x06)
return 0; return 0;
}
//== send write command ============================== //== send write command ==============================
crc_clear(&legic_crc); crc_clear(&legic_crc);

View file

@ -996,32 +996,26 @@ void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
set_tracing(TRUE); set_tracing(TRUE);
for (i = 0; i < keyCount; i++) { for (i = 0; i < keyCount; ++i) {
if(mifare_classic_halt(pcs, cuid)) { if (mifare_classic_halt(pcs, cuid))
if (MF_DBGLEVEL >= 1) Dbprintf("ChkKeys: Halt error"); if (MF_DBGLEVEL >= 1) Dbprintf("ChkKeys: Halt error");
}
if (!iso14443a_select_card(uid, NULL, &cuid, true, 0)) { if (!iso14443a_select_card(uid, NULL, &cuid, true, 0)) {
if (OLD_MF_DBGLEVEL >= 1) Dbprintf("ChkKeys: Can't select card"); if (OLD_MF_DBGLEVEL >= 1) Dbprintf("ChkKeys: Can't select card");
break; break;
}; }
ui64Key = bytes_to_num(datain + i * 6, 6); ui64Key = bytes_to_num(datain + i * 6, 6);
if(mifare_classic_auth(pcs, cuid, blockNo, keyType, ui64Key, AUTH_FIRST)) { if (mifare_classic_auth(pcs, cuid, blockNo, keyType, ui64Key, AUTH_FIRST))
continue; continue;
};
isOK = 1; isOK = 1;
break; break;
} }
// ----------------------------- crypto1 destroy
crypto1_destroy(pcs); crypto1_destroy(pcs);
LED_B_ON(); LED_B_ON();
cmd_send(CMD_ACK,isOK,0,0,datain + i * 6,6); cmd_send(CMD_ACK,isOK,0,0,datain + i * 6,6);
LED_B_OFF();
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
LEDsoff(); LEDsoff();
set_tracing(FALSE); set_tracing(FALSE);

View file

@ -13,11 +13,11 @@
static int sniffState = SNF_INIT; static int sniffState = SNF_INIT;
static uint8_t sniffUIDType; static uint8_t sniffUIDType;
static uint8_t sniffUID[8] = {0x00}; static uint8_t sniffUID[8];
static uint8_t sniffATQA[2] = {0x00}; static uint8_t sniffATQA[2];
static uint8_t sniffSAK; static uint8_t sniffSAK;
static uint8_t sniffBuf[16] = {0x00}; static uint8_t sniffBuf[16];
static uint32_t timerData = 0; static uint32_t timerData;
bool MfSniffInit(void){ bool MfSniffInit(void){