make style

This commit is contained in:
Philippe Teuwen 2019-04-06 19:09:01 +02:00
parent 05b4b27823
commit 41f36ca20b
13 changed files with 89 additions and 89 deletions

View file

@ -1140,24 +1140,24 @@ void SimulateIso14443aTag(int tagType, int flags, uint8_t *data) {
AddCrc14A(emdata, len);
EmSendCmd(emdata, len + 2);
p_response = NULL;
} else if ((receivedCmd[0] == MIFARE_ULC_WRITE || receivedCmd[0] == MIFARE_ULC_COMP_WRITE) && (tagType == 2 || tagType == 7)) { // Received a WRITE
// cmd + block + 4/16 bytes data + 2 bytes crc
if (len == 8 || len == 20) {
bool isCrcCorrect = CheckCrc14A(receivedCmd, len);
if (isCrcCorrect) {
int block = receivedCmd[1] + 12; // first 12 blocks of emu are [getversion answer - check tearing - pack - 0x00 - signature]
emlSetMem_xt(&receivedCmd[2], block, 1, 4);
// send ACK
EmSend4bit(CARD_ACK);
} else {
// send NACK 0x1 == crc/parity error
EmSend4bit(CARD_NACK_PA);
}
} else {
// send NACK 0x0 == invalid argument
EmSend4bit(CARD_NACK_IV);
}
p_response = NULL;
} else if ((receivedCmd[0] == MIFARE_ULC_WRITE || receivedCmd[0] == MIFARE_ULC_COMP_WRITE) && (tagType == 2 || tagType == 7)) { // Received a WRITE
// cmd + block + 4/16 bytes data + 2 bytes crc
if (len == 8 || len == 20) {
bool isCrcCorrect = CheckCrc14A(receivedCmd, len);
if (isCrcCorrect) {
int block = receivedCmd[1] + 12; // first 12 blocks of emu are [getversion answer - check tearing - pack - 0x00 - signature]
emlSetMem_xt(&receivedCmd[2], block, 1, 4);
// send ACK
EmSend4bit(CARD_ACK);
} else {
// send NACK 0x1 == crc/parity error
EmSend4bit(CARD_NACK_PA);
}
} else {
// send NACK 0x0 == invalid argument
EmSend4bit(CARD_NACK_IV);
}
p_response = NULL;
} else if (receivedCmd[0] == MIFARE_ULEV1_READSIG && tagType == 7) { // Received a READ SIGNATURE --
// first 12 blocks of emu are [getversion answer - check tearing - pack - 0x00 - signature]
uint16_t start = 4 * 4;

View file

@ -547,7 +547,7 @@ int CmdT55xxDetect(const char *Cmd) {
}
if (!tryDetectModulation())
PrintAndLogEx(WARNING, "Could not detect modulation automatically. Try setting it manually with " _YELLOW_("\'lf t55xx config\'") );
PrintAndLogEx(WARNING, "Could not detect modulation automatically. Try setting it manually with " _YELLOW_("\'lf t55xx config\'"));
return 0;
}

View file

@ -712,8 +712,8 @@ static int l_T55xx_readblock(lua_State *L) {
//Check number of arguments
int n = lua_gettop(L);
if ( n != 4 ) {
return returnToLuaWithError(L, "Wrong number of arguments, got %d bytes, expected 4", n);
if (n != 4) {
return returnToLuaWithError(L, "Wrong number of arguments, got %d bytes, expected 4", n);
}
uint32_t block, usepage1, override, password;
@ -733,7 +733,7 @@ static int l_T55xx_readblock(lua_State *L) {
sscanf(p_override, "%x", &override);
const char *p_pwd = luaL_checklstring(L, 4, &size);
if ( size == 0 ) {
if (size == 0) {
usepwd = false;
} else {
@ -796,12 +796,12 @@ static int l_T55xx_detect(lua_State *L) {
const char *p_gb = luaL_checklstring(L, 2, &size);
if (size != 1) return returnToLuaWithError(L, "Wrong size of useGB, got %d , expected 1", (int) size);
sscanf(p_gb, "%u", &gb);
useGB = ( gb ) ? true : false;
printf("p_gb size %zu | %c \n", size, useGB ? 'Y':'N');
useGB = (gb) ? true : false;
printf("p_gb size %zu | %c \n", size, useGB ? 'Y' : 'N');
}
case 1: {
const char *p_pwd = luaL_checklstring(L, 1, &size);
if ( size == 0 ) {
if (size == 0) {
usepwd = false;
} else {
@ -818,7 +818,7 @@ static int l_T55xx_detect(lua_State *L) {
if (!useGB) {
isok = AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, usepwd, password);
if ( isok == false ) {
if (isok == false) {
// signal error by returning Nil, errorstring
lua_pushnil(L);
lua_pushstring(L, "Failed to aquire LF signal data");
@ -827,7 +827,7 @@ static int l_T55xx_detect(lua_State *L) {
}
isok = tryDetectModulation();
if ( isok == false ) {
if (isok == false) {
// signal error by returning Nil, errorstring
lua_pushnil(L);
lua_pushstring(L, "Could not detect modulation automatically. Try setting it manually with \'lf t55xx config\'");

View file

@ -200,8 +200,8 @@ int FillBuffer(uint8_t *data, size_t maxDataLength, size_t *dataLength, ...);
bool CheckStringIsHEXValue(const char *value);
void hex_to_buffer(const uint8_t *buf, const uint8_t *hex_data, const size_t hex_len,
const size_t hex_max_len, const size_t min_str_len, const size_t spaces_between,
bool uppercase);
const size_t hex_max_len, const size_t min_str_len, const size_t spaces_between,
bool uppercase);
void print_hex(const uint8_t *data, const size_t len);
void print_hex_break(const uint8_t *data, const size_t len, const uint8_t breaks);

View file

@ -65,13 +65,13 @@ uint32_t CRC8Legic(uint8_t *buff, size_t size);
/* Static initialization of a crc structure */
#define CRC_INITIALIZER(_order, _polynom, _initial_value, _final_xor) { \
.state = ((_initial_value) & ((1L<<(_order))-1)), \
.order = (_order), \
.polynom = (_polynom), \
.initial_value = (_initial_value), \
.final_xor = (_final_xor), \
.mask = ((1L<<(_order))-1) \
.refin = false, \
.refout = false \
.order = (_order), \
.polynom = (_polynom), \
.initial_value = (_initial_value), \
.final_xor = (_final_xor), \
.mask = ((1L<<(_order))-1) \
.refin = false, \
.refout = false \
}
#endif /* __CRC_H */

View file

@ -1911,7 +1911,7 @@ int pskRawDemod_ext(uint8_t *dest, size_t *size, int *clock, int *invert, int *s
if (waveLenCnt > fc) {
//this wave is a phase shift
/*
prnt("DEBUG: phase shift at: %d, len: %d, nextClk: %d, i: %d, fc: %d"
prnt("DEBUG: phase shift at: %d, len: %d, nextClk: %d, i: %d, fc: %d"
, waveStart
, waveLenCnt
, lastClkBit + *clock - tol