This commit is contained in:
iceman1001 2019-03-18 22:04:53 +01:00
parent 524ed17894
commit 4288e9db73
4 changed files with 22 additions and 6 deletions

View file

@ -322,6 +322,9 @@ static int ul_read(uint8_t page, uint8_t *response, uint16_t responseLength) {
static int ul_comp_write(uint8_t page, uint8_t *data, uint8_t datalen) {
if (data == NULL)
return -1;
uint8_t cmd[18];
memset(cmd, 0x00, sizeof(cmd));
datalen = (datalen > 16) ? 16 : datalen;
@ -330,7 +333,7 @@ static int ul_comp_write(uint8_t page, uint8_t *data, uint8_t datalen) {
cmd[1] = page;
memcpy(cmd + 2, data, datalen);
uint8_t response[1] = {0xff};
uint8_t response[1] = {0xFF};
ul_send_cmd_raw(cmd, 2 + datalen, response, sizeof(response));
// ACK
if (response[0] == 0x0a) return 0;
@ -948,7 +951,7 @@ int CmdHF14AMfUInfo(const char *Cmd) {
uint8_t pwd[4] = {0, 0, 0, 0};
uint8_t *key = pwd;
uint8_t pack[4] = {0, 0, 0, 0};
int len = 0;
int len;
char tempStr[50];
while (param_getchar(Cmd, cmdp) != 0x00 && !errors) {

View file

@ -26,7 +26,6 @@
#include "lfdemod.h"
#include "cmdhf14a.h" //for getTagInfo
#define T55x7_CONFIGURATION_BLOCK 0x00
#define T55x7_PAGE0 0x00
#define T55x7_PAGE1 0x01
@ -37,6 +36,7 @@
#define T55X7_DEFAULT_CONFIG_BLOCK 0x000880E8 // ASK, compat mode, data rate 32, manchester, STT, 7 data blocks
#define T55X7_RAW_CONFIG_BLOCK 0x000880E0 // ASK, compat mode, data rate 32, manchester, 7 data blocks
#define T55X7_EM_UNIQUE_CONFIG_BLOCK 0x00148040 // ASK, emulate em4x02/unique - compat mode, manchester, data rate 64, 2 data blocks
#define T55X7_EM_PAXTON_CONFIG_BLOCK 0x00148040 // ASK, emulate em4x02/paxton - compat mode, manchester, data rate 64, 2 data blocks
// FDXB requires data inversion and BiPhase 57 is simply BiPhase 50 inverted, so we can either do it using the modulation scheme or the inversion flag
// we've done both below to prove that it works either way, and the modulation value for BiPhase 50 in the Atmel data sheet of binary "10001" (17) is a typo,
// and it should actually be "10000" (16)
@ -53,6 +53,7 @@
#define T55X7_PRESCO_CONFIG_BLOCK 0x00088088 // ASK, data rate 32, Manchester, 5 data blocks, STT
#define T55X7_NEDAP_64_CONFIG_BLOCK 0x907f0042 // BiPhase, data rate 64, 3 data blocks
#define T55X7_NEDAP_128_CONFIG_BLOCK 0x907f0082 // BiPhase, data rate 64, 5 data blocks
#define T55X7_bin 0b0010
#define T5555_DEFAULT_CONFIG_BLOCK 0x6001F004 // data rate 64 , ask, manchester, 2 data blocks?

View file

@ -87,9 +87,7 @@ bool B(State state) {
bool x2 = state.b & 0x20;
bool x3 = state.b & 0x10;
bool x7 = state.b & 0x01;
return x1 ^ x2 ^ x3 ^ x7;
}

View file

@ -69,6 +69,13 @@ static int l_GetFromBigBuf(lua_State *L) {
startindex = luaL_checknumber(L, 1);
len = luaL_checknumber(L, 2);
}
if ( len == 0 ) {
//signal error by returning Nil, errorstring
lua_pushnil(L);
lua_pushstring(L, "You need to supply number of bytes larger than zero");
return 2; // two return values
}
uint8_t *data = calloc(len, sizeof(uint8_t));
if (!data) {
@ -118,6 +125,13 @@ static int l_GetFromFlashMem(lua_State *L) {
startindex = luaL_checknumber(L, 1);
len = luaL_checknumber(L, 2);
}
if ( len == 0 ) {
//signal error by returning Nil, errorstring
lua_pushnil(L);
lua_pushstring(L, "You need to supply number of bytes larger than zero");
return 2; // two return values
}
uint8_t *data = calloc(len, sizeof(uint8_t));
if (!data) {
@ -627,7 +641,7 @@ static int l_hardnested(lua_State *L) {
uint8_t key[6] = {0, 0, 0, 0, 0, 0};
uint8_t trgkey[6] = {0, 0, 0, 0, 0, 0};
for (int i = 0; i < 32; i += 2) {
for (int i = 0; i < 12; i += 2) {
sscanf(&p_key[i], "%02x", &tmp);
key[i / 2] = tmp & 0xFF;
if (haveTarget) {