From 46a0ec7130a29b008d0582ab592933146fb4282b Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Thu, 27 Jul 2017 09:28:43 +0200 Subject: [PATCH] CHG: removed old TRUE/FALSE defines... some left still.. --- armsrc/appmain.c | 5 +++-- armsrc/legicrf.c | 22 +++++++++++----------- armsrc/lfops.c | 2 +- armsrc/mifarecmd.c | 10 ++++------ client/cmdanalyse.c | 12 ++++++------ client/cmddata.c | 18 +++++++++--------- client/cmdlf.c | 6 +++--- client/cmdlfawid.c | 2 +- client/cmdlfem4x.c | 4 ++-- client/cmdlffdx.c | 2 +- client/cmdlfguard.c | 2 +- client/cmdlfjablotron.c | 2 +- client/cmdlfnedap.c | 2 +- client/cmdlfnexwatch.c | 2 +- client/cmdlfnoralsy.c | 2 +- client/cmdlfpac.c | 2 +- client/cmdlfpresco.c | 2 +- client/cmdlfpyramid.c | 2 +- client/cmdlfsecurakey.c | 2 +- client/cmdlft55xx.c | 24 ++++++++++++------------ client/mifarehost.c | 8 ++++---- 21 files changed, 66 insertions(+), 67 deletions(-) diff --git a/armsrc/appmain.c b/armsrc/appmain.c index e6b86b25f..9db3af5af 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -1499,9 +1499,10 @@ void __attribute__((noreturn)) AppMain(void) for(;;) { if ( usb_poll_validate_length() ) { rx_len = usb_read(rx, sizeof(UsbCommand)); - - if (rx_len) + Dbprintf("ice recive len: %u", rx_len); + if (rx_len) { UsbPacketReceived(rx, rx_len); + } } WDT_HIT(); diff --git a/armsrc/legicrf.c b/armsrc/legicrf.c index aaf2e1108..dc4c8d4f6 100644 --- a/armsrc/legicrf.c +++ b/armsrc/legicrf.c @@ -218,7 +218,7 @@ void frame_sendAsReader(uint32_t data, uint8_t bits){ // log uint8_t cmdbytes[] = {bits, BYTEx(data,0), BYTEx(data,1), BYTEx(data,2), BYTEx(send,0), BYTEx(send,1), BYTEx(send,2)}; - LogTrace(cmdbytes, sizeof(cmdbytes), starttime, GET_TICKS, NULL, TRUE); + LogTrace(cmdbytes, sizeof(cmdbytes), starttime, GET_TICKS, NULL, true); } /* Receive a frame from the card in reader emulation mode, the FPGA and @@ -291,7 +291,7 @@ static void frame_receiveAsReader(struct legic_frame * const f, uint8_t bits) { // log uint8_t cmdbytes[] = {bits, BYTEx(data, 0), BYTEx(data, 1)}; - LogTrace(cmdbytes, sizeof(cmdbytes), starttime, GET_TICKS, NULL, FALSE); + LogTrace(cmdbytes, sizeof(cmdbytes), starttime, GET_TICKS, NULL, false); } // Setup pm3 as a Legic Reader @@ -460,7 +460,7 @@ OUT: ; legic_prng_forward(1); uint8_t cmdbytes[] = {1, isOK, BYTEx(steps, 0), BYTEx(steps, 1) }; - LogTrace(cmdbytes, sizeof(cmdbytes), start, GET_TICKS, NULL, FALSE); + LogTrace(cmdbytes, sizeof(cmdbytes), start, GET_TICKS, NULL, false); return isOK; } @@ -833,7 +833,7 @@ void LegicRfSimulate(int phase, int frame, int reqresp) cardmem = BigBuf_get_EM_addr(); clear_trace(); - set_tracing(TRUE); + set_tracing(true); crc_init(&legic_crc, 4, 0x19 >> 1, 0x5, 0); @@ -1163,7 +1163,7 @@ static struct { // break; // } - // return FALSE; + // return false; // } /* @@ -1362,7 +1362,7 @@ static RAMFUNC int HandleLegicSamplesDemod(int ci, int cq) if(s == 0x000) { // This is EOF (start, stop and all data bits == '0' - return TRUE; + return true; } } } @@ -1375,7 +1375,7 @@ static RAMFUNC int HandleLegicSamplesDemod(int ci, int cq) LED_C_OFF(); break; } - return FALSE; + return false; } */ /* @@ -1409,7 +1409,7 @@ static void DemodInit(uint8_t *data) { static void GetSamplesForLegicDemod(int n, bool quiet) { int max = 0; - bool gotFrame = FALSE; + bool gotFrame = false; int lastRxCounter = LEGIC_DMA_BUFFER_SIZE; int ci, cq, samples = 0; @@ -1478,7 +1478,7 @@ static void DemodInit(uint8_t *data) { //Tracing if (Demod.len > 0) { uint8_t parity[MAX_PARITY_SIZE] = {0x00}; - LogTrace(Demod.output, Demod.len, 0, 0, parity, FALSE); + LogTrace(Demod.output, Demod.len, 0, 0, parity, false); } } @@ -1583,7 +1583,7 @@ static void CodeLegicBitsAsReader(const uint8_t *cmd, uint8_t cmdlen, int bits) TransmitForLegic(); if (tracing) { uint8_t parity[1] = {0x00}; - LogTrace(cmd, cmdlen, 0, 0, parity, TRUE); + LogTrace(cmd, cmdlen, 0, 0, parity, true); } } @@ -1596,7 +1596,7 @@ void ice_legic_setup() { FpgaDownloadAndGo(FPGA_BITSTREAM_HF); BigBuf_free(); BigBuf_Clear_ext(false); clear_trace(); - set_tracing(TRUE); + set_tracing(true); DemodReset(); UartReset(); diff --git a/armsrc/lfops.c b/armsrc/lfops.c index 930279969..76e0147f0 100644 --- a/armsrc/lfops.c +++ b/armsrc/lfops.c @@ -1817,7 +1817,7 @@ void Cotag(uint32_t arg0) { switch(rawsignal) { case 0: doCotagAcquisition(50000); break; case 1: doCotagAcquisitionManchester(); break; - case 2: DoAcquisition_config(TRUE); break; + case 2: DoAcquisition_config(true); break; } // Turn the field off diff --git a/armsrc/mifarecmd.c b/armsrc/mifarecmd.c index ac274f56c..83d7aef55 100644 --- a/armsrc/mifarecmd.c +++ b/armsrc/mifarecmd.c @@ -14,7 +14,7 @@ //----------------------------------------------------------------------------- #include "mifarecmd.h" - +#include //----------------------------------------------------------------------------- // Select, Authenticate, Read a MIFARE tag. // read block @@ -957,8 +957,7 @@ void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain) { uint8_t keyType = (arg0 >> 8) & 0xFF; bool clearTrace = arg1 & 0xFF; uint8_t keyCount = arg2; - uint64_t ui64Key = 0; - + uint64_t key = 0; bool have_uid = false; uint8_t cascade_levels = 0; uint32_t timeout = 0; @@ -1012,9 +1011,8 @@ void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain) { } } - ui64Key = bytes_to_num(datain + i * 6, 6); - - if (mifare_classic_auth(pcs, cuid, blockNo, keyType, ui64Key, AUTH_FIRST)) { + key = bytes_to_num(datain + i * 6, 6); + if (mifare_classic_auth(pcs, cuid, blockNo, keyType, key, AUTH_FIRST)) { uint8_t dummy_answer = 0; ReaderTransmit(&dummy_answer, 1, NULL); diff --git a/client/cmdanalyse.c b/client/cmdanalyse.c index c1c9a5918..faf9469f1 100644 --- a/client/cmdanalyse.c +++ b/client/cmdanalyse.c @@ -8,7 +8,7 @@ // Analyse bytes commands //----------------------------------------------------------------------------- #include "cmdanalyse.h" -#include "nonce2key/nonce2key.h" +//#include "nonce2key/nonce2key.h" static int CmdHelp(const char *Cmd); @@ -438,12 +438,12 @@ uint64_t d2[] = {0x6e442129, 0x8f699195, 0x0000004, 0x00040f0f0305030e}; uid(3e172b29) nt(039b7bd2) ks(0c0e0f0505080800) nr(00000001) uid(3e172b29) nt(039b7bd2) ks(0e06090d03000b0f) nr(00000002) */ - uint64_t key = 0; - uint64_t d1[] = {0x3e172b29, 0x039b7bd2, 0x0000001, 0x0c0e0f0505080800}; - uint64_t d2[] = {0x3e172b29, 0x039b7bd2, 0x0000002, 0x0e06090d03000b0f}; + // uint64_t key = 0; + // uint64_t d1[] = {0x3e172b29, 0x039b7bd2, 0x0000001, 0x0c0e0f0505080800}; + // uint64_t d2[] = {0x3e172b29, 0x039b7bd2, 0x0000002, 0x0e06090d03000b0f}; - nonce2key_ex(0, 0 , d1[0], d1[1], d1[2], d1[3], &key); - nonce2key_ex(0, 0 , d2[0], d2[1], d2[2], d2[3], &key); + // nonce2key_ex(0, 0 , d1[0], d1[1], d1[2], d1[3], &key); + // nonce2key_ex(0, 0 , d2[0], d2[1], d2[2], d2[3], &key); return 0; } diff --git a/client/cmddata.c b/client/cmddata.c index a2757fbae..b899fc503 100644 --- a/client/cmddata.c +++ b/client/cmddata.c @@ -497,8 +497,8 @@ int AskEm410xDecode(bool verbose, uint32_t *hi, uint64_t *lo ) int AskEm410xDemod(const char *Cmd, uint32_t *hi, uint64_t *lo, bool verbose) { - bool st = TRUE; - if (!ASKDemod_ext(Cmd, FALSE, FALSE, 1, &st)) return 0; + bool st = true; + if (!ASKDemod_ext(Cmd, false, false, 1, &st)) return 0; return AskEm410xDecode(verbose, hi, lo); } @@ -751,7 +751,7 @@ int Cmdaskbiphdemod(const char *Cmd) char cmdp = param_getchar(Cmd, 0); if (strlen(Cmd) > 25 || cmdp == 'h' || cmdp == 'H') return usage_data_rawdemod_ab(); - return ASKbiphaseDemod(Cmd, TRUE); + return ASKbiphaseDemod(Cmd, true); } //by marshmellow @@ -761,7 +761,7 @@ int Cmdaskbiphdemod(const char *Cmd) //if successful it will push askraw data back to demod buffer ready for emulation int CmdG_Prox_II_Demod(const char *Cmd) { - if (!ASKbiphaseDemod(Cmd, FALSE)){ + if (!ASKbiphaseDemod(Cmd, false)){ if (g_debugMode) PrintAndLog("DEBUG: Error - gProxII ASKbiphaseDemod failed 1st try"); return 0; } @@ -802,7 +802,7 @@ int CmdG_Prox_II_Demod(const char *Cmd) uint32_t raw1 = bytebits_to_byte(DemodBuffer+ans,32); uint32_t raw2 = bytebits_to_byte(DemodBuffer+ans+32, 32); uint32_t raw3 = bytebits_to_byte(DemodBuffer+ans+64, 32); - bool unknown = FALSE; + bool unknown = false; switch(fmtLen) { case 36: FC = ((ByteStream[3] & 0x7F)<<7) | (ByteStream[4]>>1); @@ -813,7 +813,7 @@ int CmdG_Prox_II_Demod(const char *Cmd) Card = ((ByteStream[4]&0x7F)<<9) | (ByteStream[5]<<1) | (ByteStream[6]>>7); break; default : - unknown = TRUE; + unknown = true; break; } if ( !unknown) @@ -917,8 +917,8 @@ int CmdAutoCorr(const char *Cmd) PrintAndLog("window must be smaller than trace (%d samples)", GraphTraceLen); return 0; } - if (grph == 'g') updateGrph = TRUE; - return AutoCorrelate(window, updateGrph, TRUE); + if (grph == 'g') updateGrph = true; + return AutoCorrelate(window, updateGrph, true); } int CmdBitsamples(const char *Cmd) @@ -1164,7 +1164,7 @@ int CmdFSKrawdemod(const char *Cmd) char cmdp = param_getchar(Cmd, 0); if (strlen(Cmd) > 20 || cmdp == 'h' || cmdp == 'H') return usage_data_rawdemod_fs(); - return FSKrawDemod(Cmd, TRUE); + return FSKrawDemod(Cmd, true); } //by marshmellow (based on existing demod + holiman's refactor) diff --git a/client/cmdlf.c b/client/cmdlf.c index 67c9f9e8c..1338ff628 100644 --- a/client/cmdlf.c +++ b/client/cmdlf.c @@ -1195,7 +1195,7 @@ int CmdLFfind(const char *Cmd) { if (testRaw=='u' || testRaw=='U'){ //test unknown tag formats (raw mode) PrintAndLog("\nChecking for Unknown tags:\n"); - ans=AutoCorrelate(4000, FALSE, FALSE); + ans=AutoCorrelate(4000, false, false); if (ans > 0) { @@ -1232,8 +1232,8 @@ int CmdLFfind(const char *Cmd) { return 1; } } - bool st = TRUE; - ans=ASKDemod_ext("0 0 0",TRUE,FALSE,1,&st); + bool st = true; + ans=ASKDemod_ext("0 0 0",true,false,1,&st); if (ans>0) { PrintAndLog("\nUnknown ASK Modulated and Manchester encoded Tag Found!"); PrintAndLog("\nif it does not look right it could instead be ASK/Biphase - try 'data rawdemod ab'"); diff --git a/client/cmdlfawid.c b/client/cmdlfawid.c index ba9bf71e4..6a9d301de 100644 --- a/client/cmdlfawid.c +++ b/client/cmdlfawid.c @@ -127,7 +127,7 @@ int CmdAWIDDemodFSK(const char *Cmd) { int CmdAWIDRead(const char *Cmd) { CmdLFRead("s"); - getSamples("12000", TRUE); + getSamples("12000", true); return CmdFSKdemodAWID(Cmd); } diff --git a/client/cmdlfem4x.c b/client/cmdlfem4x.c index 8d023c06c..075b9d24c 100644 --- a/client/cmdlfem4x.c +++ b/client/cmdlfem4x.c @@ -218,7 +218,7 @@ int CmdEM410xWrite(const char *Cmd) bool EM_EndParityTest(uint8_t *BitStream, size_t size, uint8_t rows, uint8_t cols, uint8_t pType) { - if (rows*cols>size) return FALSE; + if (rows*cols>size) return false; uint8_t colP=0; //assume last col is a parity and do not test for (uint8_t colNum = 0; colNum < cols-1; colNum++) { @@ -232,7 +232,7 @@ bool EM_EndParityTest(uint8_t *BitStream, size_t size, uint8_t rows, uint8_t col bool EM_ByteParityTest(uint8_t *BitStream, size_t size, uint8_t rows, uint8_t cols, uint8_t pType) { - if (rows*cols>size) return FALSE; + if (rows*cols>size) return false; uint8_t rowP=0; //assume last row is a parity row and do not test for (uint8_t rowNum = 0; rowNum < rows-1; rowNum++) { diff --git a/client/cmdlffdx.c b/client/cmdlffdx.c index 6aa609f66..f6f725aa8 100644 --- a/client/cmdlffdx.c +++ b/client/cmdlffdx.c @@ -195,7 +195,7 @@ int CmdFdxDemod(const char *Cmd) { int CmdFdxRead(const char *Cmd) { CmdLFRead("s"); - getSamples("12000", TRUE); + getSamples("12000", true); return CmdFdxDemod(Cmd); } diff --git a/client/cmdlfguard.c b/client/cmdlfguard.c index 66cc396b0..4ce4edd14 100644 --- a/client/cmdlfguard.c +++ b/client/cmdlfguard.c @@ -138,7 +138,7 @@ int GetGuardBits(uint8_t fmtlen, uint32_t fc, uint32_t cn, uint8_t *guardBits) { int CmdGuardRead(const char *Cmd) { CmdLFRead("s"); - getSamples("12000", TRUE); + getSamples("12000", true); return CmdG_Prox_II_Demod(""); } diff --git a/client/cmdlfjablotron.c b/client/cmdlfjablotron.c index c96bf9adc..f8544020e 100644 --- a/client/cmdlfjablotron.c +++ b/client/cmdlfjablotron.c @@ -126,7 +126,7 @@ int CmdJablotronDemod(const char *Cmd) { int CmdJablotronRead(const char *Cmd) { CmdLFRead("s"); - getSamples("10000", TRUE); + getSamples("10000", true); return CmdJablotronDemod(Cmd); } diff --git a/client/cmdlfnedap.c b/client/cmdlfnedap.c index acf33b29c..f732659f9 100644 --- a/client/cmdlfnedap.c +++ b/client/cmdlfnedap.c @@ -203,7 +203,7 @@ lf t55xx wr b 4 d 4c0003ff int CmdLFNedapRead(const char *Cmd) { CmdLFRead("s"); - getSamples("12000", TRUE); + getSamples("12000", true); return CmdLFNedapDemod(""); } /* diff --git a/client/cmdlfnexwatch.c b/client/cmdlfnexwatch.c index 498f07da0..0097d1758 100644 --- a/client/cmdlfnexwatch.c +++ b/client/cmdlfnexwatch.c @@ -76,7 +76,7 @@ int CmdNexWatchRead(const char *Cmd) { //lf_read(true, 10000); CmdLFRead("s"); - getSamples("10000",TRUE); + getSamples("10000",true); // demod and output viking ID return CmdPSKNexWatch(Cmd); diff --git a/client/cmdlfnoralsy.c b/client/cmdlfnoralsy.c index c9b3f9c31..ed38e98b3 100644 --- a/client/cmdlfnoralsy.c +++ b/client/cmdlfnoralsy.c @@ -150,7 +150,7 @@ int CmdNoralsyDemod(const char *Cmd) { int CmdNoralsyRead(const char *Cmd) { CmdLFRead("s"); - getSamples("8000",TRUE); + getSamples("8000",true); return CmdNoralsyDemod(Cmd); } diff --git a/client/cmdlfpac.c b/client/cmdlfpac.c index ef3132a5b..f0b6c0626 100644 --- a/client/cmdlfpac.c +++ b/client/cmdlfpac.c @@ -79,7 +79,7 @@ int CmdPacDemod(const char *Cmd) { int CmdPacRead(const char *Cmd) { //lf_read(true, 4096*2 + 20); CmdLFRead("s"); - getSamples("8192",TRUE); + getSamples("8192",true); return CmdPacDemod(Cmd); } diff --git a/client/cmdlfpresco.c b/client/cmdlfpresco.c index fd397d65e..79192ef7b 100644 --- a/client/cmdlfpresco.c +++ b/client/cmdlfpresco.c @@ -159,7 +159,7 @@ int CmdPrescoRead(const char *Cmd) { // read lf silently CmdLFRead("s"); // get samples silently - getSamples("12000", TRUE); + getSamples("12000", true); // demod and output Presco ID return CmdPrescoDemod(Cmd); } diff --git a/client/cmdlfpyramid.c b/client/cmdlfpyramid.c index 7ef17f5e2..cc41455d3 100644 --- a/client/cmdlfpyramid.c +++ b/client/cmdlfpyramid.c @@ -75,7 +75,7 @@ int GetPyramidBits(uint32_t fc, uint32_t cn, uint8_t *pyramidBits) { int CmdPyramidRead(const char *Cmd) { CmdLFRead("s"); - getSamples("12000", TRUE); + getSamples("12000", true); return CmdFSKdemodPyramid(""); } diff --git a/client/cmdlfsecurakey.c b/client/cmdlfsecurakey.c index 59e339a9e..084eb6bce 100644 --- a/client/cmdlfsecurakey.c +++ b/client/cmdlfsecurakey.c @@ -125,7 +125,7 @@ int CmdSecurakeyDemod(const char *Cmd) { int CmdSecurakeyRead(const char *Cmd) { //lf_read(true, 8000); CmdLFRead("s"); - getSamples("8000",TRUE); + getSamples("8000",true); return CmdSecurakeyDemod(Cmd); } diff --git a/client/cmdlft55xx.c b/client/cmdlft55xx.c index fb96a1649..997fdad62 100644 --- a/client/cmdlft55xx.c +++ b/client/cmdlft55xx.c @@ -496,9 +496,9 @@ bool tryDetectModulation(){ int bitRate=0; uint8_t fc1 = 0, fc2 = 0, clk=0; - if (GetFskClock("", FALSE, FALSE)){ - fskClocks(&fc1, &fc2, &clk, FALSE); - if ( FSKrawDemod("0 0", FALSE) && test(DEMOD_FSK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)){ + if (GetFskClock("", false, false)){ + fskClocks(&fc1, &fc2, &clk, false); + if ( FSKrawDemod("0 0", false) && test(DEMOD_FSK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)){ tests[hits].modulation = DEMOD_FSK; if (fc1==8 && fc2 == 5) tests[hits].modulation = DEMOD_FSK1a; @@ -570,23 +570,23 @@ bool tryDetectModulation(){ } //undo trim from ask //save_restoreGB(0); - clk = GetNrzClock("", FALSE, FALSE); + clk = GetNrzClock("", false, false); if (clk>0) { - if ( NRZrawDemod("0 0 1", FALSE) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) { + if ( NRZrawDemod("0 0 1", false) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) { tests[hits].modulation = DEMOD_NRZ; tests[hits].bitrate = bitRate; - tests[hits].inverted = FALSE; + tests[hits].inverted = false; tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer); - tests[hits].ST = FALSE; + tests[hits].ST = false; ++hits; } - if ( NRZrawDemod("0 1 1", FALSE) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) { + if ( NRZrawDemod("0 1 1", false) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) { tests[hits].modulation = DEMOD_NRZ; tests[hits].bitrate = bitRate; - tests[hits].inverted = TRUE; + tests[hits].inverted = true; tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer); - tests[hits].ST = FALSE; + tests[hits].ST = false; ++hits; } } @@ -595,9 +595,9 @@ bool tryDetectModulation(){ // skip first 160 samples to allow antenna to settle in (psk gets inverted occasionally otherwise) save_restoreGB(1); CmdLtrim("160"); - clk = GetPskClock("", FALSE, FALSE); + clk = GetPskClock("", false, false); if (clk>0) { - if ( PSKDemod("0 0 6", FALSE) && test(DEMOD_PSK1, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) { + if ( PSKDemod("0 0 6", false) && test(DEMOD_PSK1, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) { tests[hits].modulation = DEMOD_PSK1; tests[hits].bitrate = bitRate; tests[hits].inverted = false; diff --git a/client/mifarehost.c b/client/mifarehost.c index c26fb0d27..8a5094a3c 100644 --- a/client/mifarehost.c +++ b/client/mifarehost.c @@ -290,14 +290,14 @@ int mfCSetUID(uint8_t *uid, uint8_t *atqa, uint8_t *sak, uint8_t *oldUID, uint8_ // UID memcpy(block0, uid, 4); // Mifare UID BCC - block0[4] = block0[0]^block0[1]^block0[2]^block0[3]; + block0[4] = block0[0] ^ block0[1] ^ block0[2] ^ block0[3]; // mifare classic SAK(byte 5) and ATQA(byte 6 and 7, reversed) if ( sak != NULL ) - block0[5]=sak[0]; + block0[5] = sak[0]; if ( atqa != NULL ) { - block0[6]=atqa[1]; - block0[7]=atqa[0]; + block0[6] = atqa[1]; + block0[7] = atqa[0]; } PrintAndLog("new block 0: %s", sprint_hex(block0,16));