mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-30 19:40:37 -07:00
style
This commit is contained in:
parent
ab6870c573
commit
9779868753
9 changed files with 86 additions and 59 deletions
|
@ -414,6 +414,17 @@ static int CmdrevengSearch(const char *Cmd) {
|
|||
// can't test a model that has more crc digits than our data
|
||||
if (crcChars >= dataLen)
|
||||
continue;
|
||||
|
||||
PrintAndLogEx(DEBUG
|
||||
, "DEBUG: dataLen %d, crcChars %u, width[i] %u"
|
||||
, dataLen
|
||||
, crcChars
|
||||
, width[i]
|
||||
);
|
||||
|
||||
if (crcChars == 0)
|
||||
continue;
|
||||
|
||||
memset(result, 0, 30);
|
||||
char *inCRC = calloc(crcChars + 1, sizeof(char));
|
||||
memcpy(inCRC, inHexStr + (dataLen - crcChars), crcChars);
|
||||
|
@ -421,7 +432,6 @@ static int CmdrevengSearch(const char *Cmd) {
|
|||
char *outHex = calloc(dataLen - crcChars + 1, sizeof(char));
|
||||
memcpy(outHex, inHexStr, dataLen - crcChars);
|
||||
|
||||
PrintAndLogEx(DEBUG, "DEBUG: dataLen: %d, crcChars: %d, Model: %s, CRC: %s, width: %d, outHex: %s", dataLen, crcChars, Models[i], inCRC, width[i], outHex);
|
||||
ans = RunModel(Models[i], outHex, false, 0, result);
|
||||
if (ans) {
|
||||
// test for match
|
||||
|
|
|
@ -310,7 +310,7 @@ static void lookupChipID(uint32_t iChipID, uint32_t mem_used) {
|
|||
static int CmdDetectReader(const char *Cmd) {
|
||||
uint16_t arg = 0;
|
||||
char c = tolower(Cmd[0]);
|
||||
switch ( c ) {
|
||||
switch (c) {
|
||||
case 'l':
|
||||
arg = 1;
|
||||
break;
|
||||
|
|
|
@ -241,10 +241,10 @@ static void memcpy_filtered(void *dest, const void *src, size_t n, bool filter)
|
|||
uint8_t *rsrc = (uint8_t *)src;
|
||||
uint16_t si = 0;
|
||||
for (uint16_t i = 0; i < n; i++) {
|
||||
if ( (rsrc[i] == '\x1b')
|
||||
if ((rsrc[i] == '\x1b')
|
||||
&& (i < n - 1)
|
||||
&& (rsrc[i + 1] >= 0x40)
|
||||
&& (rsrc[i + 1] <= 0x5F) ) { // entering ANSI sequence
|
||||
&& (rsrc[i + 1] <= 0x5F)) { // entering ANSI sequence
|
||||
|
||||
i++;
|
||||
if ((rsrc[i] == '[') && (i < n - 1)) { // entering CSI sequence
|
||||
|
|
|
@ -596,11 +596,15 @@ plast(const poly_t poly) {
|
|||
unsigned long idx, size = SIZE(poly.length);
|
||||
bmp_t accu;
|
||||
unsigned int probe = BMP_SUB, ofs = 0;
|
||||
|
||||
if (!poly.length) return (0UL);
|
||||
idx = size - 1UL;
|
||||
while (idx && !(accu = poly.bitmap[idx])) --idx;
|
||||
|
||||
if (poly.length == 24)
|
||||
printf("ICE plast B - poly.length %lu vs size %lu idx %lu bitmap %ld\n", poly.length, size, idx, poly.bitmap[idx]);
|
||||
|
||||
if (!idx && !(accu = poly.bitmap[idx])) return (0UL);
|
||||
|
||||
/* now accu == poly.bitmap[idx] and contains last significant term */
|
||||
while (probe) {
|
||||
#ifndef BMP_POF2
|
||||
|
@ -609,7 +613,6 @@ plast(const poly_t poly) {
|
|||
if (accu << (ofs | probe)) ofs |= probe;
|
||||
probe >>= 1;
|
||||
}
|
||||
|
||||
return (idx * BMP_BIT + ofs + 1UL);
|
||||
}
|
||||
|
||||
|
@ -1074,20 +1077,34 @@ praloc(poly_t *poly, unsigned long length) {
|
|||
if (oldsize != size)
|
||||
/* reallocate if array pointer is null or array resized */
|
||||
poly->bitmap = (bmp_t *) realloc((void *)poly->bitmap, size * sizeof(bmp_t));
|
||||
|
||||
if (poly->bitmap) {
|
||||
|
||||
if (poly->length == 24)
|
||||
printf("ICE praloc - poly->length %lu\n", poly->length);
|
||||
|
||||
|
||||
if (poly->length < length) {
|
||||
/* poly->length >= 0, length > 0, size > 0.
|
||||
* poly expanded. clear old last word and all new words
|
||||
*/
|
||||
if (LOFS(poly->length))
|
||||
poly->bitmap[oldsize - 1UL] &= ~(~BMP_C(0) >> LOFS(poly->length));
|
||||
|
||||
while (oldsize < size)
|
||||
poly->bitmap[oldsize++] = BMP_C(0);
|
||||
} else if (LOFS(length))
|
||||
|
||||
if (poly->length == 24) printf("ICE praloc MISS A\n");
|
||||
|
||||
} else if (LOFS(length)) {
|
||||
/* poly->length >= length > 0.
|
||||
* poly shrunk. clear new last word
|
||||
*/
|
||||
poly->bitmap[size - 1UL] &= ~(~BMP_C(0) >> LOFS(length));
|
||||
|
||||
if (poly->length == 24) printf("ICE praloc B size %lu, bm %lu \n", size, poly->bitmap[size - 1UL]);
|
||||
}
|
||||
|
||||
poly->length = length;
|
||||
} else
|
||||
uerror("cannot reallocate memory for poly");
|
||||
|
|
|
@ -100,8 +100,8 @@ static int l_SendCommandOLD(lua_State *L) {
|
|||
// data
|
||||
const char *p_data = luaL_checklstring(L, 5, &size);
|
||||
|
||||
if ( size ) {
|
||||
if ( size > 1024 )
|
||||
if (size) {
|
||||
if (size > 1024)
|
||||
size = 1024;
|
||||
|
||||
uint32_t tmp;
|
||||
|
@ -164,8 +164,8 @@ static int l_SendCommandMIX(lua_State *L) {
|
|||
|
||||
// data
|
||||
const char *p_data = luaL_checklstring(L, 5, &size);
|
||||
if ( size ) {
|
||||
if ( size > 1024 )
|
||||
if (size) {
|
||||
if (size > 1024)
|
||||
size = 1024;
|
||||
|
||||
uint32_t tmp;
|
||||
|
|
|
@ -804,7 +804,7 @@ int num_CPUs(void) {
|
|||
count = 1;
|
||||
return count;
|
||||
#elif defined(__APPLE__)
|
||||
/*
|
||||
/*
|
||||
TODO ICEMAN 2019, its commented out until someone finds a better solution
|
||||
#include "sys/sysctl.h"
|
||||
uint32_t logicalcores = 0;
|
||||
|
|
|
@ -593,7 +593,7 @@ bool I2C_WriteFW(uint8_t *data, uint8_t len, uint8_t msb, uint8_t lsb, uint8_t d
|
|||
}
|
||||
|
||||
void I2C_print_status(void) {
|
||||
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("Smart card module (ISO 7816)"));
|
||||
DbpStringEx(FLAG_LOG | FLAG_ANSI, _BLUE_("Smart card module (ISO 7816)"));
|
||||
uint8_t resp[] = {0, 0, 0, 0};
|
||||
I2C_Reset_EnterMainProgram();
|
||||
uint8_t len = I2C_BufferRead(resp, sizeof(resp), I2C_DEVICE_CMD_GETVERSION, I2C_DEVICE_ADDRESS_MAIN);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue