mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-04 03:58:08 +08:00
revert
This commit is contained in:
parent
7a730ec57b
commit
776eac5e5a
1 changed files with 19 additions and 15 deletions
|
@ -344,12 +344,14 @@ static int l_WaitForResponseTimeout(lua_State *L) {
|
|||
return returnToLuaWithError(L, "You need to supply at least command to wait for");
|
||||
|
||||
// extract first param. cmd byte to look for
|
||||
if (n >= 1)
|
||||
cmd = luaL_checkunsigned(L, 1);
|
||||
if (n >= 1) {
|
||||
cmd = (uint32_t)luaL_checkinteger(L, 1);
|
||||
}
|
||||
|
||||
// extract second param. timeout value
|
||||
if (n >= 2)
|
||||
ms_timeout = luaL_checkunsigned(L, 2);
|
||||
if (n >= 2) {
|
||||
ms_timeout = (size_t)luaL_checkinteger(L, 2);
|
||||
}
|
||||
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(cmd, &resp, ms_timeout) == false) {
|
||||
|
@ -647,7 +649,7 @@ static int l_crc8legic(lua_State *L) {
|
|||
size_t size;
|
||||
const char *p_hexstr = luaL_checklstring(L, 1, &size);
|
||||
uint16_t retval = CRC8Legic((uint8_t *)p_hexstr, size);
|
||||
lua_pushunsigned(L, retval);
|
||||
lua_pushinteger(L, retval);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -663,7 +665,7 @@ static int l_crc16legic(lua_State *L) {
|
|||
|
||||
init_table(CRC_LEGIC_16);
|
||||
uint16_t retval = crc16_legic((uint8_t *)p_hexstr, hexsize, uidcrc);
|
||||
lua_pushunsigned(L, retval);
|
||||
lua_pushinteger(L, retval);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -673,7 +675,7 @@ static int l_crc16(lua_State *L) {
|
|||
const char *p_str = luaL_checklstring(L, 1, &size);
|
||||
|
||||
uint16_t checksum = Crc16ex(CRC_CCITT, (uint8_t *) p_str, size);
|
||||
lua_pushunsigned(L, checksum);
|
||||
lua_pushinteger(L, checksum);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -739,9 +741,10 @@ static int l_reveng_models(lua_State *L) {
|
|||
#define NMODELS 106
|
||||
|
||||
int count = 0;
|
||||
uint8_t in_width = luaL_checkunsigned(L, 1);
|
||||
if (in_width > 89)
|
||||
uint8_t in_width = (uint8_t)luaL_checkinteger(L, 1);
|
||||
if (in_width > 89) {
|
||||
return returnToLuaWithError(L, "Width cannot exceed 89, got %d", in_width);
|
||||
}
|
||||
|
||||
uint8_t width[NMODELS];
|
||||
memset(width, 0, sizeof(width));
|
||||
|
@ -749,8 +752,9 @@ static int l_reveng_models(lua_State *L) {
|
|||
|
||||
width[0] = in_width;
|
||||
|
||||
if (!GetModels(models, &count, width))
|
||||
if (!GetModels(models, &count, width)) {
|
||||
return returnToLuaWithError(L, "didn't find any models");
|
||||
}
|
||||
|
||||
lua_newtable(L);
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
@ -920,8 +924,8 @@ static int l_keygen_algoB(lua_State *L) {
|
|||
uint32_t pwd = ul_ev1_pwdgenB(uid);
|
||||
uint16_t pack = ul_ev1_packgenB(uid);
|
||||
|
||||
lua_pushunsigned(L, pwd);
|
||||
lua_pushunsigned(L, pack);
|
||||
lua_pushinteger(L, pwd);
|
||||
lua_pushinteger(L, pack);
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
@ -953,8 +957,8 @@ static int l_keygen_algoD(lua_State *L) {
|
|||
uint32_t pwd = ul_ev1_pwdgenD(uid);
|
||||
uint16_t pack = ul_ev1_packgenD(uid);
|
||||
|
||||
lua_pushunsigned(L, pwd);
|
||||
lua_pushunsigned(L, pack);
|
||||
lua_pushinteger(L, pwd);
|
||||
lua_pushinteger(L, pack);
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
@ -1041,7 +1045,7 @@ static int l_T55xx_readblock(lua_State *L) {
|
|||
return returnToLuaWithError(L, "Failed to get actual data");
|
||||
}
|
||||
|
||||
lua_pushunsigned(L, blockData);
|
||||
lua_pushinteger(L, blockData);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue