mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-16 10:03:04 -07:00
make style
This commit is contained in:
parent
05b4b27823
commit
41f36ca20b
13 changed files with 89 additions and 89 deletions
|
@ -1140,24 +1140,24 @@ void SimulateIso14443aTag(int tagType, int flags, uint8_t *data) {
|
||||||
AddCrc14A(emdata, len);
|
AddCrc14A(emdata, len);
|
||||||
EmSendCmd(emdata, len + 2);
|
EmSendCmd(emdata, len + 2);
|
||||||
p_response = NULL;
|
p_response = NULL;
|
||||||
} else if ((receivedCmd[0] == MIFARE_ULC_WRITE || receivedCmd[0] == MIFARE_ULC_COMP_WRITE) && (tagType == 2 || tagType == 7)) { // Received a WRITE
|
} 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
|
// cmd + block + 4/16 bytes data + 2 bytes crc
|
||||||
if (len == 8 || len == 20) {
|
if (len == 8 || len == 20) {
|
||||||
bool isCrcCorrect = CheckCrc14A(receivedCmd, len);
|
bool isCrcCorrect = CheckCrc14A(receivedCmd, len);
|
||||||
if (isCrcCorrect) {
|
if (isCrcCorrect) {
|
||||||
int block = receivedCmd[1] + 12; // first 12 blocks of emu are [getversion answer - check tearing - pack - 0x00 - signature]
|
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);
|
emlSetMem_xt(&receivedCmd[2], block, 1, 4);
|
||||||
// send ACK
|
// send ACK
|
||||||
EmSend4bit(CARD_ACK);
|
EmSend4bit(CARD_ACK);
|
||||||
} else {
|
} else {
|
||||||
// send NACK 0x1 == crc/parity error
|
// send NACK 0x1 == crc/parity error
|
||||||
EmSend4bit(CARD_NACK_PA);
|
EmSend4bit(CARD_NACK_PA);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// send NACK 0x0 == invalid argument
|
// send NACK 0x0 == invalid argument
|
||||||
EmSend4bit(CARD_NACK_IV);
|
EmSend4bit(CARD_NACK_IV);
|
||||||
}
|
}
|
||||||
p_response = NULL;
|
p_response = NULL;
|
||||||
} else if (receivedCmd[0] == MIFARE_ULEV1_READSIG && tagType == 7) { // Received a READ SIGNATURE --
|
} 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]
|
// first 12 blocks of emu are [getversion answer - check tearing - pack - 0x00 - signature]
|
||||||
uint16_t start = 4 * 4;
|
uint16_t start = 4 * 4;
|
||||||
|
|
|
@ -547,7 +547,7 @@ int CmdT55xxDetect(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tryDetectModulation())
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -712,8 +712,8 @@ static int l_T55xx_readblock(lua_State *L) {
|
||||||
|
|
||||||
//Check number of arguments
|
//Check number of arguments
|
||||||
int n = lua_gettop(L);
|
int n = lua_gettop(L);
|
||||||
if ( n != 4 ) {
|
if (n != 4) {
|
||||||
return returnToLuaWithError(L, "Wrong number of arguments, got %d bytes, expected 4", n);
|
return returnToLuaWithError(L, "Wrong number of arguments, got %d bytes, expected 4", n);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t block, usepage1, override, password;
|
uint32_t block, usepage1, override, password;
|
||||||
|
@ -733,7 +733,7 @@ static int l_T55xx_readblock(lua_State *L) {
|
||||||
sscanf(p_override, "%x", &override);
|
sscanf(p_override, "%x", &override);
|
||||||
|
|
||||||
const char *p_pwd = luaL_checklstring(L, 4, &size);
|
const char *p_pwd = luaL_checklstring(L, 4, &size);
|
||||||
if ( size == 0 ) {
|
if (size == 0) {
|
||||||
usepwd = false;
|
usepwd = false;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -796,12 +796,12 @@ static int l_T55xx_detect(lua_State *L) {
|
||||||
const char *p_gb = luaL_checklstring(L, 2, &size);
|
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);
|
if (size != 1) return returnToLuaWithError(L, "Wrong size of useGB, got %d , expected 1", (int) size);
|
||||||
sscanf(p_gb, "%u", &gb);
|
sscanf(p_gb, "%u", &gb);
|
||||||
useGB = ( gb ) ? true : false;
|
useGB = (gb) ? true : false;
|
||||||
printf("p_gb size %zu | %c \n", size, useGB ? 'Y':'N');
|
printf("p_gb size %zu | %c \n", size, useGB ? 'Y' : 'N');
|
||||||
}
|
}
|
||||||
case 1: {
|
case 1: {
|
||||||
const char *p_pwd = luaL_checklstring(L, 1, &size);
|
const char *p_pwd = luaL_checklstring(L, 1, &size);
|
||||||
if ( size == 0 ) {
|
if (size == 0) {
|
||||||
usepwd = false;
|
usepwd = false;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -818,7 +818,7 @@ static int l_T55xx_detect(lua_State *L) {
|
||||||
if (!useGB) {
|
if (!useGB) {
|
||||||
|
|
||||||
isok = AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, usepwd, password);
|
isok = AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, usepwd, password);
|
||||||
if ( isok == false ) {
|
if (isok == false) {
|
||||||
// signal error by returning Nil, errorstring
|
// signal error by returning Nil, errorstring
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
lua_pushstring(L, "Failed to aquire LF signal data");
|
lua_pushstring(L, "Failed to aquire LF signal data");
|
||||||
|
@ -827,7 +827,7 @@ static int l_T55xx_detect(lua_State *L) {
|
||||||
}
|
}
|
||||||
|
|
||||||
isok = tryDetectModulation();
|
isok = tryDetectModulation();
|
||||||
if ( isok == false ) {
|
if (isok == false) {
|
||||||
// signal error by returning Nil, errorstring
|
// signal error by returning Nil, errorstring
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
lua_pushstring(L, "Could not detect modulation automatically. Try setting it manually with \'lf t55xx config\'");
|
lua_pushstring(L, "Could not detect modulation automatically. Try setting it manually with \'lf t55xx config\'");
|
||||||
|
|
|
@ -200,8 +200,8 @@ int FillBuffer(uint8_t *data, size_t maxDataLength, size_t *dataLength, ...);
|
||||||
|
|
||||||
bool CheckStringIsHEXValue(const char *value);
|
bool CheckStringIsHEXValue(const char *value);
|
||||||
void hex_to_buffer(const uint8_t *buf, const uint8_t *hex_data, const size_t hex_len,
|
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,
|
const size_t hex_max_len, const size_t min_str_len, const size_t spaces_between,
|
||||||
bool uppercase);
|
bool uppercase);
|
||||||
|
|
||||||
void print_hex(const uint8_t *data, const size_t len);
|
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);
|
void print_hex_break(const uint8_t *data, const size_t len, const uint8_t breaks);
|
||||||
|
|
14
common/crc.h
14
common/crc.h
|
@ -65,13 +65,13 @@ uint32_t CRC8Legic(uint8_t *buff, size_t size);
|
||||||
/* Static initialization of a crc structure */
|
/* Static initialization of a crc structure */
|
||||||
#define CRC_INITIALIZER(_order, _polynom, _initial_value, _final_xor) { \
|
#define CRC_INITIALIZER(_order, _polynom, _initial_value, _final_xor) { \
|
||||||
.state = ((_initial_value) & ((1L<<(_order))-1)), \
|
.state = ((_initial_value) & ((1L<<(_order))-1)), \
|
||||||
.order = (_order), \
|
.order = (_order), \
|
||||||
.polynom = (_polynom), \
|
.polynom = (_polynom), \
|
||||||
.initial_value = (_initial_value), \
|
.initial_value = (_initial_value), \
|
||||||
.final_xor = (_final_xor), \
|
.final_xor = (_final_xor), \
|
||||||
.mask = ((1L<<(_order))-1) \
|
.mask = ((1L<<(_order))-1) \
|
||||||
.refin = false, \
|
.refin = false, \
|
||||||
.refout = false \
|
.refout = false \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __CRC_H */
|
#endif /* __CRC_H */
|
||||||
|
|
|
@ -1911,7 +1911,7 @@ int pskRawDemod_ext(uint8_t *dest, size_t *size, int *clock, int *invert, int *s
|
||||||
if (waveLenCnt > fc) {
|
if (waveLenCnt > fc) {
|
||||||
//this wave is a phase shift
|
//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
|
, waveStart
|
||||||
, waveLenCnt
|
, waveLenCnt
|
||||||
, lastClkBit + *clock - tol
|
, lastClkBit + *clock - tol
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue