mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -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
|
// can't test a model that has more crc digits than our data
|
||||||
if (crcChars >= dataLen)
|
if (crcChars >= dataLen)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
PrintAndLogEx(DEBUG
|
||||||
|
, "DEBUG: dataLen %d, crcChars %u, width[i] %u"
|
||||||
|
, dataLen
|
||||||
|
, crcChars
|
||||||
|
, width[i]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (crcChars == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
memset(result, 0, 30);
|
memset(result, 0, 30);
|
||||||
char *inCRC = calloc(crcChars + 1, sizeof(char));
|
char *inCRC = calloc(crcChars + 1, sizeof(char));
|
||||||
memcpy(inCRC, inHexStr + (dataLen - crcChars), crcChars);
|
memcpy(inCRC, inHexStr + (dataLen - crcChars), crcChars);
|
||||||
|
@ -421,7 +432,6 @@ static int CmdrevengSearch(const char *Cmd) {
|
||||||
char *outHex = calloc(dataLen - crcChars + 1, sizeof(char));
|
char *outHex = calloc(dataLen - crcChars + 1, sizeof(char));
|
||||||
memcpy(outHex, inHexStr, dataLen - crcChars);
|
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);
|
ans = RunModel(Models[i], outHex, false, 0, result);
|
||||||
if (ans) {
|
if (ans) {
|
||||||
// test for match
|
// test for match
|
||||||
|
|
|
@ -596,11 +596,15 @@ plast(const poly_t poly) {
|
||||||
unsigned long idx, size = SIZE(poly.length);
|
unsigned long idx, size = SIZE(poly.length);
|
||||||
bmp_t accu;
|
bmp_t accu;
|
||||||
unsigned int probe = BMP_SUB, ofs = 0;
|
unsigned int probe = BMP_SUB, ofs = 0;
|
||||||
|
|
||||||
if (!poly.length) return (0UL);
|
if (!poly.length) return (0UL);
|
||||||
idx = size - 1UL;
|
idx = size - 1UL;
|
||||||
while (idx && !(accu = poly.bitmap[idx])) --idx;
|
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);
|
if (!idx && !(accu = poly.bitmap[idx])) return (0UL);
|
||||||
|
|
||||||
/* now accu == poly.bitmap[idx] and contains last significant term */
|
/* now accu == poly.bitmap[idx] and contains last significant term */
|
||||||
while (probe) {
|
while (probe) {
|
||||||
#ifndef BMP_POF2
|
#ifndef BMP_POF2
|
||||||
|
@ -609,7 +613,6 @@ plast(const poly_t poly) {
|
||||||
if (accu << (ofs | probe)) ofs |= probe;
|
if (accu << (ofs | probe)) ofs |= probe;
|
||||||
probe >>= 1;
|
probe >>= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (idx * BMP_BIT + ofs + 1UL);
|
return (idx * BMP_BIT + ofs + 1UL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1074,20 +1077,34 @@ praloc(poly_t *poly, unsigned long length) {
|
||||||
if (oldsize != size)
|
if (oldsize != size)
|
||||||
/* reallocate if array pointer is null or array resized */
|
/* reallocate if array pointer is null or array resized */
|
||||||
poly->bitmap = (bmp_t *) realloc((void *)poly->bitmap, size * sizeof(bmp_t));
|
poly->bitmap = (bmp_t *) realloc((void *)poly->bitmap, size * sizeof(bmp_t));
|
||||||
|
|
||||||
if (poly->bitmap) {
|
if (poly->bitmap) {
|
||||||
|
|
||||||
|
if (poly->length == 24)
|
||||||
|
printf("ICE praloc - poly->length %lu\n", poly->length);
|
||||||
|
|
||||||
|
|
||||||
if (poly->length < length) {
|
if (poly->length < length) {
|
||||||
/* poly->length >= 0, length > 0, size > 0.
|
/* poly->length >= 0, length > 0, size > 0.
|
||||||
* poly expanded. clear old last word and all new words
|
* poly expanded. clear old last word and all new words
|
||||||
*/
|
*/
|
||||||
if (LOFS(poly->length))
|
if (LOFS(poly->length))
|
||||||
poly->bitmap[oldsize - 1UL] &= ~(~BMP_C(0) >> LOFS(poly->length));
|
poly->bitmap[oldsize - 1UL] &= ~(~BMP_C(0) >> LOFS(poly->length));
|
||||||
|
|
||||||
while (oldsize < size)
|
while (oldsize < size)
|
||||||
poly->bitmap[oldsize++] = BMP_C(0);
|
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->length >= length > 0.
|
||||||
* poly shrunk. clear new last word
|
* poly shrunk. clear new last word
|
||||||
*/
|
*/
|
||||||
poly->bitmap[size - 1UL] &= ~(~BMP_C(0) >> LOFS(length));
|
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;
|
poly->length = length;
|
||||||
} else
|
} else
|
||||||
uerror("cannot reallocate memory for poly");
|
uerror("cannot reallocate memory for poly");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue