fix few printf arg types

This commit is contained in:
Philippe Teuwen 2019-10-05 23:56:19 +02:00
parent b9424795ea
commit 4ae8a3d86b
49 changed files with 185 additions and 182 deletions

View file

@ -1522,7 +1522,7 @@ struct arg_dbl *arg_dbln(
addr = (size_t)(result + 1);
rem = addr % sizeof(double);
result->dval = (double *)(addr + sizeof(double) - rem);
ARG_TRACE(("addr=%p, dval=%p, sizeof(double)=%d rem=%d\n", addr, result->dval, (int)sizeof(double), (int)rem));
ARG_TRACE(("addr=%zu, dval=%p, sizeof(double)=%d rem=%d\n", addr, result->dval, (int)sizeof(double), (int)rem));
result->count = 0;
}

View file

@ -260,7 +260,7 @@ static int CmdAnalyseLCR(const char *Cmd) {
PrintAndLogEx(WARNING, "Invalid HEX value.");
return 1;
case 2:
PrintAndLogEx(WARNING, "Too many bytes. Max %d bytes", sizeof(data));
PrintAndLogEx(WARNING, "Too many bytes. Max %zu bytes", sizeof(data));
return 1;
case 3:
PrintAndLogEx(WARNING, "Hex must have even number of digits.");

View file

@ -553,7 +553,7 @@ int ASKDemod_ext(const char *Cmd, bool verbose, bool emSearch, uint8_t askType,
size_t BitLen = getFromGraphBuf(bits);
PrintAndLogEx(DEBUG, "DEBUG: (ASKDemod_ext) #samples from graphbuff: %d", BitLen);
PrintAndLogEx(DEBUG, "DEBUG: (ASKDemod_ext) #samples from graphbuff: %zu", BitLen);
if (BitLen < 255) {
free(bits);
@ -591,18 +591,18 @@ int ASKDemod_ext(const char *Cmd, bool verbose, bool emSearch, uint8_t askType,
int errCnt = askdemod_ext(bits, &BitLen, &clk, &invert, maxErr, askamp, askType, &startIdx);
if (errCnt < 0 || BitLen < 16) { //if fatal error (or -1)
PrintAndLogEx(DEBUG, "DEBUG: (ASKDemod_ext) No data found errors:%d, invert:%c, bitlen:%d, clock:%d", errCnt, (invert) ? 'Y' : 'N', BitLen, clk);
PrintAndLogEx(DEBUG, "DEBUG: (ASKDemod_ext) No data found errors:%d, invert:%c, bitlen:%zu, clock:%d", errCnt, (invert) ? 'Y' : 'N', BitLen, clk);
free(bits);
return PM3_ESOFT;
}
if (errCnt > maxErr) {
PrintAndLogEx(DEBUG, "DEBUG: (ASKDemod_ext) Too many errors found, errors:%d, bits:%d, clock:%d", errCnt, BitLen, clk);
PrintAndLogEx(DEBUG, "DEBUG: (ASKDemod_ext) Too many errors found, errors:%d, bits:%zu, clock:%d", errCnt, BitLen, clk);
free(bits);
return PM3_ESOFT;
}
if (verbose) PrintAndLogEx(DEBUG, "DEBUG: (ASKDemod_ext) Using clock:%d, invert:%d, bits found:%d, start index %d", clk, invert, BitLen, startIdx);
if (verbose) PrintAndLogEx(DEBUG, "DEBUG: (ASKDemod_ext) Using clock:%d, invert:%d, bits found:%zu, start index %d", clk, invert, BitLen, startIdx);
//output
setDemodBuff(bits, BitLen, 0);
@ -812,7 +812,7 @@ int AutoCorrelate(const int *in, int *out, size_t len, size_t window, bool SaveG
// sanity check
if (window > len) window = len;
if (verbose) PrintAndLogEx(INFO, "performing " _YELLOW_("%d")" correlations", GraphTraceLen - window);
if (verbose) PrintAndLogEx(INFO, "performing " _YELLOW_("%zu")" correlations", GraphTraceLen - window);
//test
double autocv = 0.0; // Autocovariance value
@ -870,7 +870,7 @@ int AutoCorrelate(const int *in, int *out, size_t len, size_t window, bool SaveG
distance = idx_1 - idx;
PrintAndLogEx(SUCCESS, "possible visible correlation %4d samples", distance);
} else if (verbose && (correlation > 1)) {
PrintAndLogEx(SUCCESS, "possible correlation %4d samples", correlation);
PrintAndLogEx(SUCCESS, "possible correlation %4zu samples", correlation);
} else {
PrintAndLogEx(FAILED, "no repeating pattern found, try increasing window size");
}
@ -912,7 +912,7 @@ static int CmdAutoCorr(const char *Cmd) {
case 'w':
window = param_get32ex(Cmd, cmdp + 1, 4000, 10);
if (window >= GraphTraceLen) {
PrintAndLogEx(WARNING, "window must be smaller than trace (%d samples)", GraphTraceLen);
PrintAndLogEx(WARNING, "window must be smaller than trace (%zu samples)", GraphTraceLen);
errors = true;
}
cmdp += 2;
@ -1222,17 +1222,17 @@ int PSKDemod(const char *Cmd, bool verbose) {
int startIdx = 0;
int errCnt = pskRawDemod_ext(bits, &bitlen, &clk, &invert, &startIdx);
if (errCnt > maxErr) {
if (g_debugMode || verbose) PrintAndLogEx(DEBUG, "DEBUG: (PSKdemod) Too many errors found, clk: %d, invert: %d, numbits: %d, errCnt: %d", clk, invert, bitlen, errCnt);
if (g_debugMode || verbose) PrintAndLogEx(DEBUG, "DEBUG: (PSKdemod) Too many errors found, clk: %d, invert: %d, numbits: %zu, errCnt: %d", clk, invert, bitlen, errCnt);
free(bits);
return PM3_ESOFT;
}
if (errCnt < 0 || bitlen < 16) { //throw away static - allow 1 and -1 (in case of threshold command first)
if (g_debugMode || verbose) PrintAndLogEx(DEBUG, "DEBUG: (PSKdemod) no data found, clk: %d, invert: %d, numbits: %d, errCnt: %d", clk, invert, bitlen, errCnt);
if (g_debugMode || verbose) PrintAndLogEx(DEBUG, "DEBUG: (PSKdemod) no data found, clk: %d, invert: %d, numbits: %zu, errCnt: %d", clk, invert, bitlen, errCnt);
free(bits);
return PM3_ESOFT;
}
if (verbose || g_debugMode) {
PrintAndLogEx(DEBUG, "DEBUG: (PSKdemod) Using Clock:%d, invert:%d, Bits Found:%d", clk, invert, bitlen);
PrintAndLogEx(DEBUG, "DEBUG: (PSKdemod) Using Clock:%d, invert:%d, Bits Found:%zu", clk, invert, bitlen);
if (errCnt > 0) {
PrintAndLogEx(DEBUG, "DEBUG: (PSKdemod) errors during Demoding (shown as 7 in bit stream): %d", errCnt);
}
@ -1264,7 +1264,7 @@ static int CmdIdteckDemod(const char *Cmd) {
else if (idx == -3)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: preamble not found");
else if (idx == -4)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: size not correct: %d", size);
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: size not correct: %zu", size);
else
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: idx: %d", idx);
@ -1283,7 +1283,7 @@ static int CmdIdteckDemod(const char *Cmd) {
else if (idx == -3)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: preamble not found");
else if (idx == -4)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: size not correct: %d", size);
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: size not correct: %zu", size);
else
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: idx: %d", idx);
@ -1346,17 +1346,17 @@ int NRZrawDemod(const char *Cmd, bool verbose) {
errCnt = nrzRawDemod(bits, &BitLen, &clk, &invert, &clkStartIdx);
if (errCnt > maxErr) {
PrintAndLogEx(DEBUG, "DEBUG: (NRZrawDemod) Too many errors found, clk: %d, invert: %d, numbits: %d, errCnt: %d", clk, invert, BitLen, errCnt);
PrintAndLogEx(DEBUG, "DEBUG: (NRZrawDemod) Too many errors found, clk: %d, invert: %d, numbits: %zu, errCnt: %d", clk, invert, BitLen, errCnt);
free(bits);
return PM3_ESOFT;
}
if (errCnt < 0 || BitLen < 16) { //throw away static - allow 1 and -1 (in case of threshold command first)
PrintAndLogEx(DEBUG, "DEBUG: (NRZrawDemod) no data found, clk: %d, invert: %d, numbits: %d, errCnt: %d", clk, invert, BitLen, errCnt);
PrintAndLogEx(DEBUG, "DEBUG: (NRZrawDemod) no data found, clk: %d, invert: %d, numbits: %zu, errCnt: %d", clk, invert, BitLen, errCnt);
free(bits);
return PM3_ESOFT;
}
if (verbose || g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: (NRZrawDemod) Tried NRZ Demod using Clock: %d - invert: %d - Bits Found: %d", clk, invert, BitLen);
if (verbose || g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: (NRZrawDemod) Tried NRZ Demod using Clock: %d - invert: %d - Bits Found: %zu", clk, invert, BitLen);
//prime demod buffer for output
setDemodBuff(bits, BitLen, 0);
setClockGrid(clk, clkStartIdx);
@ -1779,7 +1779,7 @@ static int CmdLoad(const char *Cmd) {
fclose(f);
PrintAndLogEx(SUCCESS, "loaded %d samples", GraphTraceLen);
PrintAndLogEx(SUCCESS, "loaded %zu samples", GraphTraceLen);
uint8_t bits[GraphTraceLen];
size_t size = getFromGraphBuf(bits);

View file

@ -266,7 +266,7 @@ static int CmdFlashMemLoad(const char *Cmd) {
conn.block_after_ACK = false;
free(data);
PrintAndLogEx(SUCCESS, "Wrote "_GREEN_("%u")"bytes to offset "_GREEN_("%u"), datalen, start_index);
PrintAndLogEx(SUCCESS, "Wrote "_GREEN_("%zu")"bytes to offset "_GREEN_("%u"), datalen, start_index);
return PM3_SUCCESS;
}
static int CmdFlashMemDump(const char *Cmd) {

View file

@ -413,7 +413,7 @@ static int CmdFlashMemSpiFFSLoad(const char *Cmd) {
conn.block_after_ACK = false;
free(data);
PrintAndLogEx(SUCCESS, "Wrote "_GREEN_("%u") "bytes to file "_GREEN_("%s"), datalen, destfilename);
PrintAndLogEx(SUCCESS, "Wrote "_GREEN_("%zu") "bytes to file "_GREEN_("%s"), datalen, destfilename);
// We want to unmount after these to set things back to normal but more than this
// unmouting ensure that SPIFFS CACHES are all flushed so our file is actually written on memory

View file

@ -553,7 +553,7 @@ int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leav
}
if (resp.oldarg[0] != 1 && resp.oldarg[0] != 2) {
PrintAndLogEx(ERR, "Card not in iso14443-4. res=%d.", resp.oldarg[0]);
PrintAndLogEx(ERR, "Card not in iso14443-4. res=" PRId64 ".", resp.oldarg[0]);
return 1;
}
@ -647,7 +647,7 @@ static int SelectCard14443_4(bool disconnect, iso14a_card_select_t *card) {
}
if (resp.oldarg[0] != 1 && resp.oldarg[0] != 2) {
PrintAndLogEx(ERR, "Card not in iso14443-4. res=%d.", resp.oldarg[0]);
PrintAndLogEx(ERR, "Card not in iso14443-4. res=%" PRId64 ".", resp.oldarg[0]);
return 1;
}
@ -1376,7 +1376,7 @@ int infoHF14A(bool verbose, bool do_nack_test) {
int16_t fsci = card.ats[1] & 0x0f;
PrintAndLogEx(NORMAL, " - T0 : TA1 is%s present, TB1 is%s present, "
"TC1 is%s present, FSCI is %d (FSC = %ld)",
"TC1 is%s present, FSCI is %d (FSC = %d)",
(ta1 ? "" : " NOT"),
(tb1 ? "" : " NOT"),
(tc1 ? "" : " NOT"),
@ -1408,7 +1408,7 @@ int infoHF14A(bool verbose, bool do_nack_test) {
if (tb1) {
uint32_t sfgi = card.ats[pos] & 0x0F;
uint32_t fwi = card.ats[pos] >> 4;
PrintAndLogEx(NORMAL, " - TB1 : SFGI = %d (SFGT = %s%ld/fc), FWI = %d (FWT = %ld/fc)",
PrintAndLogEx(NORMAL, " - TB1 : SFGI = %d (SFGT = %s%d/fc), FWI = %d (FWT = %d/fc)",
(sfgi),
sfgi ? "" : "(not needed) ",
sfgi ? (1 << 12) << sfgi : 0,

View file

@ -900,7 +900,7 @@ static int CmdHF14BDump(const char *Cmd) {
//select
if (WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
if (resp.oldarg[0]) {
PrintAndLogEx(INFO, "failed to select %d | %d", resp.oldarg[0], resp.oldarg[1]);
PrintAndLogEx(INFO, "failed to select %" PRId64 " | %" PRId64, resp.oldarg[0], resp.oldarg[1]);
goto out;
}
}

View file

@ -534,7 +534,7 @@ static int CmdHF15Demod(const char *Cmd) {
}
}
PrintAndLogEx(NORMAL, "SOF at %d, correlation %d", maxPos, max / (ARRAYLEN(FrameSOF) / skip));
PrintAndLogEx(NORMAL, "SOF at %d, correlation %zu", maxPos, max / (ARRAYLEN(FrameSOF) / skip));
i = maxPos + ARRAYLEN(FrameSOF) / skip;
int k = 0;
@ -1228,7 +1228,7 @@ static int CmdHF15Restore(const char *Cmd) {
cmdp++;
}
PrintAndLogEx(INFO, "Blocksize: %u", blocksize);
PrintAndLogEx(INFO, "Blocksize: %zu", blocksize);
if (!strlen(filename)) {
PrintAndLogEx(WARNING, "Please provide a filename");
@ -1259,7 +1259,7 @@ static int CmdHF15Restore(const char *Cmd) {
fclose(f);
return 0;
} else if (bytes_read != blocksize) {
PrintAndLogEx(ERR, "File reading error (%s), %u bytes read instead of %u bytes.", filename, bytes_read, blocksize);
PrintAndLogEx(ERR, "File reading error (%s), %zu bytes read instead of %zu bytes.", filename, bytes_read, blocksize);
fclose(f);
return 2;
}

View file

@ -50,7 +50,7 @@ static int CmdHFEPACollectPACENonces(const char *Cmd) {
// check if command failed
if (resp.oldarg[0] != 0) {
PrintAndLogEx(FAILED, "Error in step %d, Return code: %d", resp.oldarg[0], (int)resp.oldarg[1]);
PrintAndLogEx(FAILED, "Error in step %" PRId64 ", Return code: %" PRId64, resp.oldarg[0], (int)resp.oldarg[1]);
} else {
size_t nonce_length = resp.oldarg[1];
char *nonce = (char *) calloc(2 * nonce_length + 1, sizeof(uint8_t));
@ -58,7 +58,7 @@ static int CmdHFEPACollectPACENonces(const char *Cmd) {
sprintf(nonce + (2 * j), "%02X", resp.data.asBytes[j]);
}
// print nonce
PrintAndLogEx(NORMAL, "Length: %d, Nonce: %s", nonce_length, nonce);
PrintAndLogEx(NORMAL, "Length: %zu, Nonce: %s", nonce_length, nonce);
free(nonce);
}
if (i < n - 1) {

View file

@ -13,6 +13,7 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <inttypes.h>
#include "cmdparser.h" // command_t
#include "comms.h"
@ -391,7 +392,7 @@ static int CmdHFFelicaDumpLite(const char *Cmd) {
return 1;
}
uint64_t tracelen = resp.oldarg[1];
uint32_t tracelen = resp.oldarg[1];
if (tracelen == 0)
return 1;
@ -407,7 +408,7 @@ static int CmdHFFelicaDumpLite(const char *Cmd) {
return 0;
}
PrintAndLogEx(SUCCESS, "Recorded Activity (trace len = %d bytes)", tracelen);
PrintAndLogEx(SUCCESS, "Recorded Activity (trace len = %"PRIu64" bytes)", tracelen);
print_hex_break(trace, tracelen, 32);
printSep();

View file

@ -75,14 +75,14 @@ static int CmdHFFidoInfo(const char *cmd) {
if (!strncmp((char *)buf, "U2F_V2", 7)) {
if (!strncmp((char *)buf, "FIDO_2_0", 8)) {
PrintAndLogEx(INFO, "FIDO2 authenticator detected. Version: %.*s", len, buf);
PrintAndLogEx(INFO, "FIDO2 authenticator detected. Version: %.*s", (int)len, buf);
} else {
PrintAndLogEx(INFO, "FIDO authenticator detected (not standard U2F).");
PrintAndLogEx(INFO, "Non U2F authenticator version:");
dump_buffer((const unsigned char *)buf, len, NULL, 0);
}
} else {
PrintAndLogEx(INFO, "FIDO U2F authenticator detected. Version: %.*s", len, buf);
PrintAndLogEx(INFO, "FIDO U2F authenticator detected. Version: %.*s", (int)len, buf);
}
res = FIDO2GetInfo(buf, sizeof(buf), &len, &sw);
@ -274,7 +274,7 @@ static int CmdHFFidoRegister(const char *cmd) {
PrintAndLogEx(NORMAL, "");
if (APDULogging)
PrintAndLogEx(NORMAL, "---------------------------------------------------------------");
PrintAndLogEx(NORMAL, "data len: %d", len);
PrintAndLogEx(NORMAL, "data len: %zu", len);
if (verbose2) {
PrintAndLogEx(NORMAL, "--------------data----------------------");
dump_buffer((const unsigned char *)buf, len, NULL, 0);
@ -316,7 +316,7 @@ static int CmdHFFidoRegister(const char *cmd) {
// get hash
int hashp = 1 + 65 + 1 + keyHandleLen + derLen;
PrintAndLogEx(SUCCESS, "Hash[%d]: %s", len - hashp, sprint_hex(&buf[hashp], len - hashp));
PrintAndLogEx(SUCCESS, "Hash[%zu]: %s", len - hashp, sprint_hex(&buf[hashp], len - hashp));
// check ANSI X9.62 format ECDSA signature (on P-256)
uint8_t rval[300] = {0};
@ -543,7 +543,7 @@ static int CmdHFFidoAuthenticate(const char *cmd) {
PrintAndLogEx(SUCCESS, "User presence: %s", (buf[0] ? "verified" : "not verified"));
uint32_t cntr = (uint32_t)bytes_to_num(&buf[1], 4);
PrintAndLogEx(SUCCESS, "Counter: %d", cntr);
PrintAndLogEx(SUCCESS, "Hash[%d]: %s", len - 5, sprint_hex(&buf[5], len - 5));
PrintAndLogEx(SUCCESS, "Hash[%zu]: %s", len - 5, sprint_hex(&buf[5], len - 5));
// check ANSI X9.62 format ECDSA signature (on P-256)
uint8_t rval[300] = {0};
@ -736,7 +736,7 @@ static int CmdHFFido2MakeCredential(const char *cmd) {
return 0;
}
PrintAndLogEx(SUCCESS, "MakeCredential result (%d b) OK.", len);
PrintAndLogEx(SUCCESS, "MakeCredential result (%zu b) OK.", len);
if (showCBOR) {
PrintAndLogEx(SUCCESS, "CBOR make credential response:");
PrintAndLogEx(NORMAL, "---------------- CBOR ------------------");
@ -862,7 +862,7 @@ static int CmdHFFido2GetAssertion(const char *cmd) {
return 0;
}
PrintAndLogEx(SUCCESS, "GetAssertion result (%d b) OK.", len);
PrintAndLogEx(SUCCESS, "GetAssertion result (%zu b) OK.", len);
if (showCBOR) {
PrintAndLogEx(SUCCESS, "CBOR get assertion response:");
PrintAndLogEx(NORMAL, "---------------- CBOR ------------------");

View file

@ -1332,7 +1332,7 @@ static int CmdHFiClassReader_Dump(const char *Cmd) {
}
// save the dump to .bin file
PrintAndLogEx(SUCCESS, "saving dump file - %d blocks read", gotBytes / 8);
PrintAndLogEx(SUCCESS, "saving dump file - %zu blocks read", gotBytes / 8);
saveFile(filename, ".bin", tag_data, gotBytes);
saveFileEML(filename, tag_data, gotBytes, 8);
saveFileJSON(filename, jsfIclass, tag_data, gotBytes);
@ -2081,7 +2081,7 @@ static int loadKeys(char *filename) {
size_t bytes_read = fread(dump, 1, fsize, f);
fclose(f);
if (bytes_read > ICLASS_KEYS_MAX * 8) {
PrintAndLogEx(WARNING, "File is too long to load - bytes: %u", bytes_read);
PrintAndLogEx(WARNING, "File is too long to load - bytes: %zu", bytes_read);
free(dump);
return 0;
}
@ -2502,7 +2502,7 @@ static int CmdHFiClassLookUp(const char *Cmd) {
case 'p':
param_gethex_ex(Cmd, cmdp + 1, EPURSE, &len);
if (len >> 1 != sizeof(EPURSE)) {
PrintAndLogEx(WARNING, "Wrong EPURSE length, expected %d got [%d] ", sizeof(EPURSE), len >> 1);
PrintAndLogEx(WARNING, "Wrong EPURSE length, expected %zu got [%d] ", sizeof(EPURSE), len >> 1);
errors = true;
}
cmdp += 2;
@ -2652,7 +2652,7 @@ void PrintPreCalc(iclass_prekey_t *list, int itemcnt) {
for (int i = 0; i < itemcnt; i++) {
if (i < 10) {
PrintAndLogEx(NORMAL, "[%2d] | %016" PRIx64 " | %08" PRIx32, i, bytes_to_num(list[i].key, 8), bytes_to_num(list[i].mac, 4));
PrintAndLogEx(NORMAL, "[%2d] | %016" PRIx64 " | %08" PRIx64, i, bytes_to_num(list[i].key, 8), bytes_to_num(list[i].mac, 4));
} else if (i == 10) {
PrintAndLogEx(SUCCESS, "... skip printing the rest");
}

View file

@ -1036,7 +1036,7 @@ static int CmdLegicRestore(const char *Cmd) {
fseek(f, 0, SEEK_SET); // seek back to beginning of file
if (filesize != numofbytes) {
PrintAndLogEx(WARNING, "Fail, filesize and cardsize is not equal. [%u != %u]", filesize, numofbytes);
PrintAndLogEx(WARNING, "Fail, filesize and cardsize is not equal. [%zu != %u]", filesize, numofbytes);
free(data);
fclose(f);
return PM3_EFILE;
@ -1084,11 +1084,11 @@ static int CmdLegicRestore(const char *Cmd) {
uint8_t isOK = resp.oldarg[0] & 0xFF;
if (!isOK) {
PrintAndLogEx(WARNING, "Failed writing tag [msg = %u]", resp.oldarg[1] & 0xFF);
PrintAndLogEx(WARNING, "Failed writing tag [msg = %u]", (uint8_t)(resp.oldarg[1] & 0xFF));
free(data);
return PM3_ERFTRANS;
}
PrintAndLogEx(SUCCESS, "Wrote chunk [offset %d | len %d | total %d", i, len, i + len);
PrintAndLogEx(SUCCESS, "Wrote chunk [offset %zu | len %zu | total %zu", i, len, i + len);
}
free(data);
@ -1281,7 +1281,7 @@ static int CmdLegicWipe(const char *Cmd) {
uint8_t isOK = resp.oldarg[0] & 0xFF;
if (!isOK) {
PrintAndLogEx(WARNING, "Failed writing tag [msg = %u]", resp.oldarg[1] & 0xFF);
PrintAndLogEx(WARNING, "Failed writing tag [msg = %u]", (uint8_t)(resp.oldarg[1] & 0xFF));
free(data);
return PM3_ERFTRANS;
}

View file

@ -1296,7 +1296,7 @@ static int CmdHF14AMfNested(const char *Cmd) {
}
uint64_t t2 = msclock() - t1;
PrintAndLogEx(SUCCESS, "Time to check %d known keys: %.0f seconds\n", ARRAYLEN(g_mifare_default_keys), (float)t2 / 1000.0);
PrintAndLogEx(SUCCESS, "Time to check %zu known keys: %.0f seconds\n", ARRAYLEN(g_mifare_default_keys), (float)t2 / 1000.0);
PrintAndLogEx(SUCCESS, "enter nested attack");
// nested sectors

View file

@ -2496,7 +2496,7 @@ static int CmdHF14AMfUCSetPwd(const char *Cmd) {
if ((resp.oldarg[0] & 0xff) == 1) {
PrintAndLogEx(INFO, "Ultralight-C new password: %s", sprint_hex(pwd, 16));
} else {
PrintAndLogEx(WARNING, "Failed writing at block %d", resp.oldarg[1] & 0xff);
PrintAndLogEx(WARNING, "Failed writing at block %u", (uint8_t)(resp.oldarg[1] & 0xff));
return 1;
}
} else {

View file

@ -65,7 +65,7 @@ static int print_barcode(uint8_t *barcode, const size_t barcode_len, bool verbos
} else {
PrintAndLogEx(SUCCESS, " Checksum : "_YELLOW_("too few data for checksum")"- " _RED_("fail"));
}
PrintAndLogEx(SUCCESS, " Data len (bits) : "_YELLOW_("%i")"- %s", barcode_len * 8, (barcode_len == 16 || barcode_len == 32) ? _GREEN_("OK") : _YELLOW_("warning"));
PrintAndLogEx(SUCCESS, " Data len (bits) : "_YELLOW_("%zu")"- %s", barcode_len * 8, (barcode_len == 16 || barcode_len == 32) ? _GREEN_("OK") : _YELLOW_("warning"));
PrintAndLogEx(SUCCESS, " Raw data : "_YELLOW_("%s"), sprint_hex(barcode, barcode_len));
if (barcode_len < 4) // too few to go to next decoding stages
return PM3_ESOFT;

View file

@ -13,6 +13,7 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <inttypes.h>
#include "cmdparser.h" // command_t
#include "comms.h"
@ -71,7 +72,7 @@ static int topaz_send_cmd_raw(uint8_t *cmd, uint8_t len, uint8_t *response, uint
memcpy(response, resp.data.asBytes, *response_len);
}
} else {
if (verbose) PrintAndLogEx(WARNING, "Wrong response length (%d != %d)", *response_len, resp.oldarg[0]);
if (verbose) PrintAndLogEx(WARNING, "Wrong response length (%d != %" PRIu64 ")", *response_len, resp.oldarg[0]);
return PM3_ESOFT;
}
return PM3_SUCCESS;

View file

@ -651,7 +651,7 @@ int CmdLFSim(const char *Cmd) {
// convert to bitstream if necessary
ChkBitstream();
PrintAndLogEx(DEBUG, "DEBUG: Uploading %d bytes", GraphTraceLen);
PrintAndLogEx(DEBUG, "DEBUG: Uploading %zu bytes", GraphTraceLen);
struct pupload {
uint8_t flag;
@ -787,7 +787,7 @@ int CmdLFfskSim(const char *Cmd) {
size_t size = DemodBufferLen;
if (size > (PM3_CMD_DATA_SIZE - sizeof(lf_fsksim_t))) {
PrintAndLogEx(NORMAL, "DemodBuffer too long for current implementation - length: %d - max: %d", size, PM3_CMD_DATA_SIZE - sizeof(lf_fsksim_t));
PrintAndLogEx(NORMAL, "DemodBuffer too long for current implementation - length: %zu - max: %zu", size, PM3_CMD_DATA_SIZE - sizeof(lf_fsksim_t));
size = PM3_CMD_DATA_SIZE - sizeof(lf_fsksim_t);
}
@ -889,7 +889,7 @@ int CmdLFaskSim(const char *Cmd) {
size_t size = DemodBufferLen;
if (size > (PM3_CMD_DATA_SIZE - sizeof(lf_asksim_t))) {
PrintAndLogEx(NORMAL, "DemodBuffer too long for current implementation - length: %d - max: %d", size, PM3_CMD_DATA_SIZE - sizeof(lf_asksim_t));
PrintAndLogEx(NORMAL, "DemodBuffer too long for current implementation - length: %zu - max: %zu", size, PM3_CMD_DATA_SIZE - sizeof(lf_asksim_t));
size = PM3_CMD_DATA_SIZE - sizeof(lf_asksim_t);
}
@ -1009,7 +1009,7 @@ int CmdLFpskSim(const char *Cmd) {
}
size_t size = DemodBufferLen;
if (size > (PM3_CMD_DATA_SIZE - sizeof(lf_psksim_t))) {
PrintAndLogEx(NORMAL, "DemodBuffer too long for current implementation - length: %d - max: %d", size, PM3_CMD_DATA_SIZE - sizeof(lf_psksim_t));
PrintAndLogEx(NORMAL, "DemodBuffer too long for current implementation - length: %zu - max: %zu", size, PM3_CMD_DATA_SIZE - sizeof(lf_psksim_t));
size = PM3_CMD_DATA_SIZE - sizeof(lf_psksim_t);
}

View file

@ -324,7 +324,7 @@ static int CmdAWIDDemod(const char *Cmd) {
}
free(bits);
PrintAndLogEx(DEBUG, "DEBUG: AWID idx: %d, Len: %d Printing Demod Buffer:", idx, size);
PrintAndLogEx(DEBUG, "DEBUG: AWID idx: %d, Len: %zu Printing Demod Buffer:", idx, size);
if (g_debugMode)
printDemodBuff();

View file

@ -416,7 +416,7 @@ int AskEm410xDecode(bool verbose, uint32_t *hi, uint64_t *lo) {
setDemodBuff(DemodBuffer, (size == 40) ? 64 : 128, idx + 1);
setClockGrid(g_DemodClock, g_DemodStartIdx + ((idx + 1)*g_DemodClock));
PrintAndLogEx(DEBUG, "DEBUG: Em410x idx: %d, Len: %d, Printing Demod Buffer:", idx, size);
PrintAndLogEx(DEBUG, "DEBUG: Em410x idx: %zu, Len: %zu, Printing Demod Buffer:", idx, size);
if (g_debugMode)
printDemodBuff();
@ -1085,7 +1085,7 @@ static bool doPreambleSearch(size_t *startIdx) {
uint8_t preamble[EM_PREAMBLE_LEN] = {0, 0, 1, 0, 1, 0};
if (!preambleSearchEx(DemodBuffer, preamble, EM_PREAMBLE_LEN, &size, startIdx, true)) {
PrintAndLogEx(DEBUG, "DEBUG: Error - EM4305 preamble not found :: %d", *startIdx);
PrintAndLogEx(DEBUG, "DEBUG: Error - EM4305 preamble not found :: %zu", *startIdx);
return false;
}
return true;

View file

@ -245,7 +245,7 @@ static int CmdFdxDemod(const char *Cmd) {
PrintAndLogEx(SUCCESS, "CRC-16 0x%04X - 0x%04X [%s]", crc_16, calcCrc, (calcCrc == crc_16) ? _GREEN_("Ok") : _RED_("Fail"));
if (g_debugMode) {
PrintAndLogEx(DEBUG, "Start marker %d; Size %d", preambleIndex, size);
PrintAndLogEx(DEBUG, "Start marker %d; Size %zu", preambleIndex, size);
char *bin = sprint_bin_break(DemodBuffer, size, 16);
PrintAndLogEx(DEBUG, "DEBUG bin stream:\n%s", bin);
}

View file

@ -84,7 +84,7 @@ static int CmdGuardDemod(const char *Cmd) {
else if (preambleIndex == -2)
PrintAndLogEx(DEBUG, "DEBUG: Error - gProxII preamble not found");
else if (preambleIndex == -3)
PrintAndLogEx(DEBUG, "DEBUG: Error - gProxII size not correct: %d", size);
PrintAndLogEx(DEBUG, "DEBUG: Error - gProxII size not correct: %zu", size);
else if (preambleIndex == -5)
PrintAndLogEx(DEBUG, "DEBUG: Error - gProxII wrong spacerbits");
else
@ -103,14 +103,14 @@ static int CmdGuardDemod(const char *Cmd) {
// remove the 18 (90/5=18) parity bits (down to 72 bits (96-6-18=72))
size_t len = removeParity(bits_no_spacer, 0, 5, 3, 90); //source, startloc, paritylen, ptype, length_to_run
if (len != 72) {
PrintAndLogEx(DEBUG, "DEBUG: Error - gProxII spacer removal did not produce 72 bits: %u, start: %u", len, startIdx);
PrintAndLogEx(DEBUG, "DEBUG: Error - gProxII spacer removal did not produce 72 bits: %zu, start: %zu", len, startIdx);
return PM3_ESOFT;
}
// get key and then get all 8 bytes of payload decoded
xorKey = (uint8_t)bytebits_to_byteLSBF(bits_no_spacer, 8);
for (size_t idx = 0; idx < 8; idx++) {
ByteStream[idx] = ((uint8_t)bytebits_to_byteLSBF(bits_no_spacer + 8 + (idx * 8), 8)) ^ xorKey;
PrintAndLogEx(DEBUG, "DEBUG: gProxII byte %u after xor: %02x", (unsigned int)idx, ByteStream[idx]);
PrintAndLogEx(DEBUG, "DEBUG: gProxII byte %zu after xor: %02x", idx, ByteStream[idx]);
}
setDemodBuff(DemodBuffer, 96, preambleIndex);

View file

@ -123,7 +123,7 @@ static int sendTry(uint8_t format_idx, wiegand_card_t *card, uint32_t delay, boo
}
if (verbose)
PrintAndLogEx(INFO, "Trying FC: %u; CN: %u; Issue level: %u; OEM: %u", card->FacilityCode, card->CardNumber, card->IssueLevel, card->OEM);
PrintAndLogEx(INFO, "Trying FC: %u; CN: %"PRIu64"; Issue level: %u; OEM: %u", card->FacilityCode, card->CardNumber, card->IssueLevel, card->OEM);
lf_hidsim_t payload;
payload.hi2 = packed.Top;
@ -177,7 +177,7 @@ static int CmdHIDDemod(const char *Cmd) {
else if (idx == -4)
PrintAndLogEx(DEBUG, "DEBUG: Error - HID preamble not found");
else if (idx == -5)
PrintAndLogEx(DEBUG, "DEBUG: Error - HID error in Manchester data, size %d", size);
PrintAndLogEx(DEBUG, "DEBUG: Error - HID error in Manchester data, size %zu", size);
else
PrintAndLogEx(DEBUG, "DEBUG: Error - HID error demoding fsk %d", idx);

View file

@ -98,7 +98,7 @@ static int CmdIndalaDemod(const char *Cmd) {
else if (idx == -4)
PrintAndLogEx(DEBUG, "DEBUG: Error - Indala: preamble not found");
else if (idx == -5)
PrintAndLogEx(DEBUG, "DEBUG: Error - Indala: size not correct: %d", size);
PrintAndLogEx(DEBUG, "DEBUG: Error - Indala: size not correct: %zu", size);
else
PrintAndLogEx(DEBUG, "DEBUG: Error - Indala: error demoding psk idx: %d", idx);
return PM3_ESOFT;
@ -114,7 +114,7 @@ static int CmdIndalaDemod(const char *Cmd) {
if (DemodBufferLen == 64) {
PrintAndLogEx(
SUCCESS
, "Indala Found - bitlength %d, Raw %x%08x"
, "Indala Found - bitlength %zu, Raw %x%08x"
, DemodBufferLen
, uid1
, uid2
@ -161,7 +161,7 @@ static int CmdIndalaDemod(const char *Cmd) {
uint32_t uid7 = bytebits_to_byte(DemodBuffer + 192, 32);
PrintAndLogEx(
SUCCESS
, "Indala Found - bitlength %d, Raw 0x%x%08x%08x%08x%08x%08x%08x"
, "Indala Found - bitlength %zu, Raw 0x%x%08x%08x%08x%08x%08x%08x"
, DemodBufferLen
, uid1
, uid2
@ -237,7 +237,7 @@ static int CmdIndalaDemodAlt(const char *Cmd) {
}
if (rawbit > 0) {
PrintAndLogEx(INFO, "Recovered %d raw bits, expected: %d", rawbit, GraphTraceLen / 32);
PrintAndLogEx(INFO, "Recovered %d raw bits, expected: %zu", rawbit, GraphTraceLen / 32);
PrintAndLogEx(INFO, "worst metric (0=best..7=worst): %d at pos %d", worst, worstPos);
} else {
return PM3_ESOFT;
@ -629,7 +629,7 @@ out:
//PrintAndLogEx(INFO, "DEBUG: detectindala RES = %d | %d | %d", res, found_size, idx);
if (found_size != 224 && found_size != 64) {
PrintAndLogEx(INFO, "DEBUG: detectindala | %d", found_size);
PrintAndLogEx(INFO, "DEBUG: detectindala | %zu", found_size);
return -5;
}

View file

@ -109,7 +109,7 @@ static int CmdIOProxDemod(const char *Cmd) {
} else if (idx == -4) {
PrintAndLogEx(DEBUG, "DEBUG: Error - IO prox preamble not found");
} else if (idx == -5) {
PrintAndLogEx(DEBUG, "DEBUG: Error - IO size not correct, size %d", size);
PrintAndLogEx(DEBUG, "DEBUG: Error - IO size not correct, size %zu", size);
} else if (idx == -6) {
PrintAndLogEx(DEBUG, "DEBUG: Error - IO prox separator bits not found");
} else {
@ -123,7 +123,7 @@ static int CmdIOProxDemod(const char *Cmd) {
if (idx == 0) {
if (g_debugMode) {
PrintAndLogEx(DEBUG, "DEBUG: Error - IO prox data not found - FSK Bits: %d", size);
PrintAndLogEx(DEBUG, "DEBUG: Error - IO prox data not found - FSK Bits: %zu", size);
if (size > 92) PrintAndLogEx(DEBUG, "%s", sprint_bin_break(bits, 92, 16));
}
return PM3_ESOFT;
@ -176,7 +176,7 @@ static int CmdIOProxDemod(const char *Cmd) {
PrintAndLogEx(SUCCESS, "IO Prox XSF(%02d)%02x:%05d (%08x%08x) [crc %s]", version, facilitycode, number, code, code2, crcStr);
if (g_debugMode) {
PrintAndLogEx(DEBUG, "DEBUG: IO prox idx: %d, Len: %d, Printing demod buffer:", idx, size);
PrintAndLogEx(DEBUG, "DEBUG: IO prox idx: %d, Len: %zu, Printing demod buffer:", idx, size);
printDemodBuff();
}
return retval;

View file

@ -94,7 +94,7 @@ static int CmdJablotronDemod(const char *Cmd) {
else if (ans == -2)
PrintAndLogEx(DEBUG, "DEBUG: Error - Jablotron preamble not found");
else if (ans == -3)
PrintAndLogEx(DEBUG, "DEBUG: Error - Jablotron size not correct: %d", size);
PrintAndLogEx(DEBUG, "DEBUG: Error - Jablotron size not correct: %zu", size);
else if (ans == -5)
PrintAndLogEx(DEBUG, "DEBUG: Error - Jablotron checksum failed");
else

View file

@ -70,7 +70,7 @@ static int CmdKeriDemod(const char *Cmd) {
else if (idx == -2)
PrintAndLogEx(DEBUG, "DEBUG: Error - KERI: preamble not found");
else if (idx == -3)
PrintAndLogEx(DEBUG, "DEBUG: Error - KERI: Size not correct: 64 != %d", size);
PrintAndLogEx(DEBUG, "DEBUG: Error - KERI: Size not correct: 64 != %zu", size);
else
PrintAndLogEx(DEBUG, "DEBUG: Error - KERI: ans: %d", idx);
@ -154,7 +154,7 @@ static int CmdKeriClone(const char *Cmd) {
// 3 LSB is ONE
uint64_t data = ((uint64_t)internalid << 3) + 7;
PrintAndLogEx(INFO, "Preparing to clone KERI to T55x7 with Internal Id: %" PRIx64, internalid);
PrintAndLogEx(INFO, "Preparing to clone KERI to T55x7 with Internal Id: %" PRIx32, internalid);
blocks[1] = data >> 32;
blocks[2] = data & 0xFFFFFFFF;
@ -182,7 +182,7 @@ static int CmdKeriSim(const char *Cmd) {
bs[j++] = ((internalid >> i) & 1);
}
PrintAndLogEx(SUCCESS, "Simulating KERI - Internal Id: %u", internalid);
PrintAndLogEx(SUCCESS, "Simulating KERI - Internal Id: %" PRIu64, internalid);
lf_psksim_t *payload = calloc(1, sizeof(lf_psksim_t) + sizeof(bs));
payload->carrier = 2;

View file

@ -124,7 +124,7 @@ static int CmdLFNedapDemod(const char *Cmd) {
// sanity checks
if ((size != 128) && (size != 64)) {
PrintAndLogEx(DEBUG, "DEBUG: Error - NEDAP: Size not correct: %d", size);
PrintAndLogEx(DEBUG, "DEBUG: Error - NEDAP: Size not correct: %zu", size);
return PM3_ESOFT;
}

View file

@ -85,7 +85,7 @@ static int CmdNoralsyDemod(const char *Cmd) {
else if (ans == -2)
PrintAndLogEx(DEBUG, "DEBUG: Error - Noralsy: preamble not found");
else if (ans == -3)
PrintAndLogEx(DEBUG, "DEBUG: Error - Noralsy: Size not correct: %d", size);
PrintAndLogEx(DEBUG, "DEBUG: Error - Noralsy: Size not correct: %zu", size);
else
PrintAndLogEx(DEBUG, "DEBUG: Error - Noralsy: ans: %d", ans);
}

View file

@ -53,7 +53,7 @@ static int CmdPacDemod(const char *Cmd) {
else if (ans == -2)
PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: preamble not found");
else if (ans == -3)
PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: Size not correct: %d", size);
PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: Size not correct: %zu", size);
else
PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: ans: %d", ans);

View file

@ -86,7 +86,7 @@ static int CmdParadoxDemod(const char *Cmd) {
else if (idx == -4)
PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox preamble not found");
else if (idx == -5)
PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox error in Manchester data, size %d", size);
PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox error in Manchester data, size %zu", size);
else
PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox error demoding fsk %d", idx);
@ -117,7 +117,7 @@ static int CmdParadoxDemod(const char *Cmd) {
rawLo
);
PrintAndLogEx(DEBUG, "DEBUG: Paradox idx: %d, len: %d, Printing Demod Buffer:", idx, size);
PrintAndLogEx(DEBUG, "DEBUG: Paradox idx: %d, len: %zu, Printing Demod Buffer:", idx, size);
if (g_debugMode)
printDemodBuff();

View file

@ -72,7 +72,7 @@ static int CmdPrescoDemod(const char *Cmd) {
else if (ans == -2)
PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: preamble not found");
else if (ans == -3)
PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: Size not correct: %d", size);
PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: Size not correct: %zu", size);
else
PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: ans: %d", ans);
return PM3_ESOFT;

View file

@ -87,7 +87,7 @@ static int CmdPyramidDemod(const char *Cmd) {
else if (idx == -4)
PrintAndLogEx(DEBUG, "DEBUG: Error - Pyramid: preamble not found");
else if (idx == -5)
PrintAndLogEx(DEBUG, "DEBUG: Error - Pyramid: size not correct: %d", size);
PrintAndLogEx(DEBUG, "DEBUG: Error - Pyramid: size not correct: %zu", size);
else
PrintAndLogEx(DEBUG, "DEBUG: Error - Pyramid: error demoding fsk idx: %d", idx);
return PM3_ESOFT;
@ -137,7 +137,7 @@ static int CmdPyramidDemod(const char *Cmd) {
if (size == 0)
PrintAndLogEx(DEBUG, "DEBUG: Error - Pyramid: parity check failed - IDX: %d, hi3: %08X", idx, rawHi3);
else
PrintAndLogEx(DEBUG, "DEBUG: Error - Pyramid: at parity check - tag size does not match Pyramid format, SIZE: %d, IDX: %d, hi3: %08X", size, idx, rawHi3);
PrintAndLogEx(DEBUG, "DEBUG: Error - Pyramid: at parity check - tag size does not match Pyramid format, SIZE: %zu, IDX: %d, hi3: %08X", size, idx, rawHi3);
return PM3_ESOFT;
}

View file

@ -59,7 +59,7 @@ static int CmdSecurakeyDemod(const char *Cmd) {
else if (ans == -2)
PrintAndLogEx(DEBUG, "DEBUG: Error - Securakey: preamble not found");
else if (ans == -3)
PrintAndLogEx(DEBUG, "DEBUG: Error - Securakey: Size not correct: %d", size);
PrintAndLogEx(DEBUG, "DEBUG: Error - Securakey: Size not correct: %zu", size);
else
PrintAndLogEx(DEBUG, "DEBUG: Error - Securakey: ans: %d", ans);
return PM3_ESOFT;
@ -90,7 +90,7 @@ static int CmdSecurakeyDemod(const char *Cmd) {
// remove marker bits (0's every 9th digit after preamble) (pType = 3 (always 0s))
size = removeParity(bits_no_spacer, 0, 9, 3, 85);
if (size != 85 - 9) {
PrintAndLogEx(DEBUG, "DEBUG: Error removeParity: %d", size);
PrintAndLogEx(DEBUG, "DEBUG: Error removeParity: %zu", size);
return 0;
}

View file

@ -1257,7 +1257,7 @@ bool GetT55xxBlockData(uint32_t *blockdata) {
uint8_t idx = config.offset;
if (idx + 32 > DemodBufferLen) {
PrintAndLogEx(WARNING, "The configured offset %d is too big. Possible offset: %d)", idx, DemodBufferLen - 32);
PrintAndLogEx(WARNING, "The configured offset %d is too big. Possible offset: %zu)", idx, DemodBufferLen - 32);
return false;
}
@ -2624,12 +2624,12 @@ static int CmdT55xxChkPwds(const char *Cmd) {
}
if (resp.oldarg[0]) {
PrintAndLogEx(SUCCESS, "\nFound a candidate [ " _YELLOW_("%08X") " ]. Trying to validate", resp.oldarg[1]);
PrintAndLogEx(SUCCESS, "\nFound a candidate [ " _YELLOW_("%08"PRIX64) " ]. Trying to validate", resp.oldarg[1]);
if (AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, resp.oldarg[1], downlink_mode)) {
found = tryDetectModulation(downlink_mode, T55XX_PrintConfig);
if (found) {
PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08X") " ]", resp.oldarg[1]);
PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08"PRIX64) " ]", resp.oldarg[1]);
} else {
PrintAndLogEx(WARNING, "Check pwd failed");
@ -2672,7 +2672,7 @@ static int CmdT55xxChkPwds(const char *Cmd) {
curr_password = bytes_to_num(keyBlock + 4 * c, 4);
PrintAndLogEx(INFO, "Testing %08X", curr_password);
PrintAndLogEx(INFO, "Testing %08"PRIX64, curr_password);
for (dl_mode = downlink_mode; dl_mode <= 3; dl_mode++) {
if (!AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, curr_password, dl_mode)) {
@ -2681,7 +2681,7 @@ static int CmdT55xxChkPwds(const char *Cmd) {
found = tryDetectModulation(dl_mode, T55XX_PrintConfig);
if (found) {
PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08X") " ]", curr_password);
PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08"PRIX64) " ]", curr_password);
dl_mode = 4; // Exit other downlink mode checks
c = keycount; // Exit loop
}

View file

@ -53,7 +53,7 @@ static int CmdVerichipDemod(const char *Cmd) {
else if (ans == -2)
PrintAndLogEx(DEBUG, "DEBUG: Error - VERICHIP: preamble not found");
else if (ans == -3)
PrintAndLogEx(DEBUG, "DEBUG: Error - VERICHIP: Size not correct: %d", size);
PrintAndLogEx(DEBUG, "DEBUG: Error - VERICHIP: Size not correct: %zu", size);
else
PrintAndLogEx(DEBUG, "DEBUG: Error - VERICHIP: ans: %d", ans);

View file

@ -14,6 +14,7 @@
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <inttypes.h>
#include "commonutil.h" // ARRAYLEN
#include "common.h"
@ -119,7 +120,7 @@ static int CmdVisa2kDemod(const char *Cmd) {
else if (ans == -2)
PrintAndLogEx(DEBUG, "DEBUG: Error - Visa2k: preamble not found");
else if (ans == -3)
PrintAndLogEx(DEBUG, "DEBUG: Error - Visa2k: Size not correct: %d", size);
PrintAndLogEx(DEBUG, "DEBUG: Error - Visa2k: Size not correct: %zu", size);
else
PrintAndLogEx(DEBUG, "DEBUG: Error - Visa2k: ans: %d", ans);
@ -180,7 +181,7 @@ static int CmdVisa2kClone(const char *Cmd) {
blocks[2] = id;
blocks[3] = (visa_parity(id) << 4) | visa_chksum(id);
PrintAndLogEx(INFO, "Preparing to clone Visa2000 to T55x7 with CardId: %u", id);
PrintAndLogEx(INFO, "Preparing to clone Visa2000 to T55x7 with CardId: %"PRIu64, id);
print_blocks(blocks, ARRAYLEN(blocks));
return clone_t55xx_tag(blocks, ARRAYLEN(blocks));

View file

@ -311,7 +311,7 @@ static int PrintATR(uint8_t *atr, size_t atrlen) {
uint8_t calen = 2 + T1len + TD1len + TDilen + K;
if (atrlen != calen && atrlen != calen + 1) // may be CRC
PrintAndLogEx(WARNING, "Invalid ATR length. len: %d, T1len: %d, TD1len: %d, TDilen: %d, K: %d", atrlen, T1len, TD1len, TDilen, K);
PrintAndLogEx(WARNING, "Invalid ATR length. len: %zu, T1len: %d, TD1len: %d, TDilen: %d, K: %d", atrlen, T1len, TD1len, TDilen, K);
if (K > 0)
PrintAndLogEx(INFO, "\nHistorical bytes | len 0x%02d | format %02x", K, atr[2 + T1len + TD1len + TDilen]);
@ -443,7 +443,7 @@ static int CmdSmartRaw(const char *Cmd) {
PrintAndLogEx(WARNING, "Invalid HEX value.");
return 1;
case 2:
PrintAndLogEx(WARNING, "Too many bytes. Max %d bytes", sizeof(data));
PrintAndLogEx(WARNING, "Too many bytes. Max %zu bytes", sizeof(data));
return 1;
case 3:
PrintAndLogEx(WARNING, "Hex must have even number of digits.");

View file

@ -665,7 +665,7 @@ static int CmdTraceLoad(const char *Cmd) {
size_t bytes_read = fread(trace, 1, fsize, f);
traceLen = bytes_read;
fclose(f);
PrintAndLogEx(SUCCESS, "Recorded Activity (TraceLen = %d bytes) loaded from file %s", traceLen, filename);
PrintAndLogEx(SUCCESS, "Recorded Activity (TraceLen = %l bytes) loaded from file %s", traceLen, filename);
return 0;
}
@ -815,7 +815,7 @@ int CmdTraceList(const char *Cmd) {
}
}
PrintAndLogEx(SUCCESS, "Recorded Activity (TraceLen = %d bytes)", traceLen);
PrintAndLogEx(SUCCESS, "Recorded Activity (TraceLen = %l bytes)", traceLen);
PrintAndLogEx(INFO, "");
if (protocol == FELICA) {
printFelica(traceLen, trace);

View file

@ -278,13 +278,13 @@ static int usart_bt_testcomm(uint32_t baudrate, uint8_t parity) {
uint8_t data[PM3_CMD_DATA_SIZE] = {0x00};
size_t len = 0;
PrintAndLogEx(SUCCESS, "TX (%3u):%.*s at %u 8%c1", strlen(string), strlen(string), string, baudrate, parity);
PrintAndLogEx(SUCCESS, "TX (%3zu):%.*s at %u 8%c1", strlen(string), (int)strlen(string), string, baudrate, parity);
ret = usart_txrx((uint8_t *)string, strlen(string), data, &len, 1000); // such large timeout needed
if (ret == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "RX (%3u):%.*s", len, len, data);
PrintAndLogEx(SUCCESS, "RX (%3zu):%.*s", len, (int)len, data);
if (strcmp((char *)data, "hc01.comV2.0") == 0) {
PrintAndLogEx(SUCCESS, "Add-on " _GREEN_("found!"), len, len, data);
PrintAndLogEx(SUCCESS, "Add-on " _GREEN_("found!"));
return PM3_SUCCESS;
}
}
@ -365,11 +365,11 @@ static int CmdUsartBtFactory(const char *Cmd) {
memset(data, 0, sizeof(data));
string = "AT+NAMEPM3_RDV4.0";
PrintAndLogEx(SUCCESS, "TX (%3u):%.*s", strlen(string), strlen(string), string);
PrintAndLogEx(SUCCESS, "TX (%3zu):%.*s", strlen(string), (int)strlen(string), string);
int ret = usart_txrx((uint8_t *)string, strlen(string), data, &len, 1000);
if (ret == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "RX (%3u):%.*s", len, len, data);
PrintAndLogEx(SUCCESS, "RX (%3zu):%.*s", len, (int)len, data);
if (strcmp((char *)data, "OKsetname") == 0) {
PrintAndLogEx(SUCCESS, "Name set to " _GREEN_("PM3_RDV4.0"));
} else {
@ -383,11 +383,11 @@ static int CmdUsartBtFactory(const char *Cmd) {
memset(data, 0, sizeof(data));
len = 0;
string = "AT+ROLE=S";
PrintAndLogEx(SUCCESS, "TX (%3u):%.*s", strlen(string), strlen(string), string);
PrintAndLogEx(SUCCESS, "TX (%3zu):%.*s", strlen(string), (int)strlen(string), string);
ret = usart_txrx((uint8_t *)string, strlen(string), data, &len, 1000);
if (ret == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "RX (%3u):%.*s", len, len, data);
PrintAndLogEx(SUCCESS, "RX (%3zu):%.*s", len, (int)len, data);
if (strcmp((char *)data, "OK+ROLE:S") == 0) {
PrintAndLogEx(SUCCESS, "Role set to " _GREEN_("Slave"));
} else {
@ -401,11 +401,11 @@ static int CmdUsartBtFactory(const char *Cmd) {
memset(data, 0, sizeof(data));
len = 0;
string = "AT+PIN1234";
PrintAndLogEx(SUCCESS, "TX (%3u):%.*s", strlen(string), strlen(string), string);
PrintAndLogEx(SUCCESS, "TX (%3zu):%.*s", strlen(string), (int)strlen(string), string);
ret = usart_txrx((uint8_t *)string, strlen(string), data, &len, 1000);
if (ret == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "RX (%3u):%.*s", len, len, data);
PrintAndLogEx(SUCCESS, "RX (%3zu):%.*s", len, (int)len, data);
if (strcmp((char *)data, "OKsetPIN") == 0) {
PrintAndLogEx(SUCCESS, "PIN set to " _GREEN_("1234"));
} else {
@ -421,11 +421,11 @@ static int CmdUsartBtFactory(const char *Cmd) {
memset(data, 0, sizeof(data));
len = 0;
string = "AT+PN";
PrintAndLogEx(SUCCESS, "TX (%3u):%.*s", strlen(string), strlen(string), string);
PrintAndLogEx(SUCCESS, "TX (%3zu):%.*s", strlen(string), (int)strlen(string), string);
ret = usart_txrx((uint8_t *)string, strlen(string), data, &len, 1000);
if (ret == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "RX (%3u):%.*s", len, len, data);
PrintAndLogEx(SUCCESS, "RX (%3zu):%.*s", len, (int)len, data);
if (strcmp((char *)data, "OK None") == 0) {
PrintAndLogEx(SUCCESS, "Parity set to " _GREEN_("None"));
} else {
@ -441,11 +441,11 @@ static int CmdUsartBtFactory(const char *Cmd) {
memset(data, 0, sizeof(data));
len = 0;
string = BTADDON_BAUD_AT;
PrintAndLogEx(SUCCESS, "TX (%3u):%.*s", strlen(string), strlen(string), string);
PrintAndLogEx(SUCCESS, "TX (%3zu):%.*s", strlen(string), (int)strlen(string), string);
ret = usart_txrx((uint8_t *)string, strlen(string), data, &len, 1000);
if (ret == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "RX (%3u):%.*s", len, len, data);
PrintAndLogEx(SUCCESS, "RX (%3zu):%.*s", len, (int)len, data);
if (strcmp((char *)data, "OK" BTADDON_BAUD_NUM) == 0) {
PrintAndLogEx(SUCCESS, "Baudrate set to " _GREEN_(BTADDON_BAUD_NUM));
} else {
@ -514,7 +514,7 @@ static int CmdUsartBtPin(const char *Cmd) {
sprintf(string, "AT+PIN%s", pin);
uint8_t data[PM3_CMD_DATA_SIZE] = {0x00};
size_t len = 0;
// PrintAndLogEx(NORMAL, "TX (%3u):%.*s", strlen(string), strlen(string), string);
// PrintAndLogEx(NORMAL, "TX (%3zu):%.*s", strlen(string), (int)strlen(string), string);
int ret = usart_txrx((uint8_t *)string, strlen(string), data, &len, 600);
if (ret == PM3_ENODATA) {
PrintAndLogEx(FAILED, "No response from add-on, is it ON and blinking?");
@ -524,7 +524,7 @@ static int CmdUsartBtPin(const char *Cmd) {
PrintAndLogEx(FAILED, "Command failed, ret=%i", ret);
return ret;
}
// PrintAndLogEx(NORMAL, "RX (%3u):%.*s", len, len, data);
// PrintAndLogEx(NORMAL, "RX (%3zu):%.*s", len, (int)len, data);
if (strcmp((char *)data, "OKsetPIN") == 0) {
PrintAndLogEx(NORMAL, "PIN changed " _GREEN_("successfully"));
} else {
@ -688,11 +688,11 @@ static int CmdUsartTXRX(const char *Cmd) {
}
uint8_t data[PM3_CMD_DATA_SIZE] = {0x00};
size_t len = 0;
PrintAndLogEx(NORMAL, "TX (%3u):%.*s", strlen(string2), strlen(string2), string2);
PrintAndLogEx(NORMAL, "TX (%3zu):%.*s", strlen(string2), (int)strlen(string2), string2);
int ret = usart_txrx((uint8_t *)string2, strlen(string2), data, &len, waittime);
if (ret != PM3_SUCCESS)
return ret;
PrintAndLogEx(NORMAL, "RX (%3u):%.*s", len, len, data);
PrintAndLogEx(NORMAL, "RX (%3zu):%.*s", len, (int)len, data);
return PM3_SUCCESS;
}

View file

@ -123,7 +123,7 @@ static void SendCommandNG_internal(uint16_t cmd, uint8_t *data, size_t len, bool
return;
}
if (len > PM3_CMD_DATA_SIZE) {
PrintAndLogEx(WARNING, "Sending %d bytes of payload is too much, abort", len);
PrintAndLogEx(WARNING, "Sending %zu bytes of payload is too much, abort", len);
return;
}
@ -183,7 +183,7 @@ void SendCommandNG(uint16_t cmd, uint8_t *data, size_t len) {
void SendCommandMIX(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, void *data, size_t len) {
uint64_t arg[3] = {arg0, arg1, arg2};
if (len > PM3_CMD_DATA_SIZE_MIX) {
PrintAndLogEx(WARNING, "Sending %d bytes of payload is too much for MIX frames, abort", len);
PrintAndLogEx(WARNING, "Sending %zu bytes of payload is too much for MIX frames, abort", len);
return;
}
uint8_t cmddata[PM3_CMD_DATA_SIZE];
@ -434,7 +434,7 @@ __attribute__((force_align_arg_pointer))
res = uart_receive(sp, ((uint8_t *)&rx_old) + sizeof(PacketResponseNGPreamble), sizeof(PacketResponseOLD) - sizeof(PacketResponseNGPreamble), &rxlen);
if ((res != PM3_SUCCESS) || (rxlen != sizeof(PacketResponseOLD) - sizeof(PacketResponseNGPreamble))) {
PrintAndLogEx(WARNING, "Received packet OLD frame with payload too short? %d/%d", rxlen, sizeof(PacketResponseOLD) - sizeof(PacketResponseNGPreamble));
PrintAndLogEx(WARNING, "Received packet OLD frame with payload too short? %d/%zu", rxlen, sizeof(PacketResponseOLD) - sizeof(PacketResponseNGPreamble));
error = true;
}
if (!error) {
@ -464,7 +464,7 @@ __attribute__((force_align_arg_pointer))
}
} else {
if (rxlen > 0) {
PrintAndLogEx(WARNING, "Received packet frame preamble too short: %d/%d", rxlen, sizeof(PacketResponseNGPreamble));
PrintAndLogEx(WARNING, "Received packet frame preamble too short: %d/%zu", rxlen, sizeof(PacketResponseNGPreamble));
error = true;
}
if (res == PM3_ENOTTY) {

View file

@ -301,7 +301,7 @@ static int CmdEMVGPO(const char *Cmd) {
free(pdol_data_tlv);
return PM3_ESOFT;
}
PrintAndLogEx(INFO, "PDOL data[%d]: %s", pdol_data_tlv_data_len, sprint_hex(pdol_data_tlv_data, pdol_data_tlv_data_len));
PrintAndLogEx(INFO, "PDOL data[%zu]: %s", pdol_data_tlv_data_len, sprint_hex(pdol_data_tlv_data, pdol_data_tlv_data_len));
// exec
uint8_t buf[APDU_RES_LEN] = {0};
@ -477,7 +477,7 @@ static int CmdEMVAC(const char *Cmd) {
cdol_data_tlv = &data_tlv;
}
PrintAndLogEx(INFO, "CDOL data[%d]: %s", cdol_data_tlv->len, sprint_hex(cdol_data_tlv->value, cdol_data_tlv->len));
PrintAndLogEx(INFO, "CDOL data[%zu]: %s", cdol_data_tlv->len, sprint_hex(cdol_data_tlv->value, cdol_data_tlv->len));
// exec
uint8_t buf[APDU_RES_LEN] = {0};
@ -543,7 +543,7 @@ static int CmdEMVGenerateChallenge(const char *Cmd) {
PrintAndLogEx(SUCCESS, "Challenge: %s", sprint_hex(buf, len));
if (len != 4 && len != 8)
PrintAndLogEx(WARNING, "Length of challenge must be 4 or 8, but it %d", len);
PrintAndLogEx(WARNING, "Length of challenge must be 4 or 8, but it %zu", len);
return PM3_SUCCESS;
}
@ -624,7 +624,7 @@ static int CmdEMVInternalAuthenticate(const char *Cmd) {
ddol_data_tlv = &data_tlv;
}
PrintAndLogEx(INFO, "DDOL data[%d]: %s", ddol_data_tlv->len, sprint_hex(ddol_data_tlv->value, ddol_data_tlv->len));
PrintAndLogEx(INFO, "DDOL data[%zu]: %s", ddol_data_tlv->len, sprint_hex(ddol_data_tlv->value, ddol_data_tlv->len));
// exec
uint8_t buf[APDU_RES_LEN] = {0};
@ -693,7 +693,7 @@ static void ProcessGPOResponseFormat1(struct tlvdb *tlvRoot, uint8_t *buf, size_
}
if (len < 4 || (len - 4) % 4) {
PrintAndLogEx(ERR, "GPO response format 1 parsing error. length = %d", len);
PrintAndLogEx(ERR, "GPO response format 1 parsing error. length = %zu", len);
} else {
// AIP
struct tlvdb *f1AIP = tlvdb_fixed(0x82, 2, buf + 2);
@ -725,7 +725,7 @@ static void ProcessACResponseFormat1(struct tlvdb *tlvRoot, uint8_t *buf, size_t
uint8_t elmlen = len - 2; // wo 0x80XX
if (len < 4 + 2 || (elmlen - 2) % 4 || elmlen != buf[1]) {
PrintAndLogEx(ERR, "GPO response format1 parsing error. length=%d", len);
PrintAndLogEx(ERR, "GPO response format1 parsing error. length=%zu", len);
} else {
struct tlvdb *tlvElm = NULL;
if (decodeTLV)
@ -907,7 +907,7 @@ static int CmdEMVExec(const char *Cmd) {
PrintAndLogEx(ERR, "Error: can't create PDOL data.");
dreturn(PM3_ESOFT);
}
PrintAndLogEx(NORMAL, "PDOL data[%d]: %s", pdol_data_tlv_data_len, sprint_hex(pdol_data_tlv_data, pdol_data_tlv_data_len));
PrintAndLogEx(NORMAL, "PDOL data[%zu]: %s", pdol_data_tlv_data_len, sprint_hex(pdol_data_tlv_data, pdol_data_tlv_data_len));
PrintAndLogEx(NORMAL, "\n* GPO.");
res = EMVGPO(channel, true, pdol_data_tlv_data, pdol_data_tlv_data_len, buf, sizeof(buf), &len, &sw, tlvRoot);
@ -947,7 +947,7 @@ static int CmdEMVExec(const char *Cmd) {
while (AFL && AFL->len) {
if (AFL->len % 4) {
PrintAndLogEx(WARNING, "Warning: Wrong AFL length: %d", AFL->len);
PrintAndLogEx(WARNING, "Warning: Wrong AFL length: %zu", AFL->len);
break;
}
@ -1007,7 +1007,7 @@ static int CmdEMVExec(const char *Cmd) {
if (ODAiListLen) {
struct tlvdb *oda = tlvdb_fixed(0x21, ODAiListLen, ODAiList); // not a standard tag
tlvdb_add(tlvRoot, oda);
PrintAndLogEx(NORMAL, "* Input list for Offline Data Authentication added to TLV. len=%d \n", ODAiListLen);
PrintAndLogEx(NORMAL, "* Input list for Offline Data Authentication added to TLV. len=%zu \n", ODAiListLen);
}
// get AIP
@ -1058,7 +1058,7 @@ static int CmdEMVExec(const char *Cmd) {
if (IAD->len >= IAD->value[0] + 1) {
PrintAndLogEx(NORMAL, "\tKey index: 0x%02x", IAD->value[1]);
PrintAndLogEx(NORMAL, "\tCrypto ver: 0x%02x(%03d)", IAD->value[2], IAD->value[2]);
PrintAndLogEx(NORMAL, "\tCVR:", sprint_hex(&IAD->value[3], IAD->value[0] - 2));
PrintAndLogEx(NORMAL, "\tCVR: %s", sprint_hex(&IAD->value[3], IAD->value[0] - 2));
struct tlvdb *cvr = tlvdb_fixed(0x20, IAD->value[0] - 2, &IAD->value[3]);
TLVPrintFromTLVLev(cvr, 1);
}
@ -1085,7 +1085,7 @@ static int CmdEMVExec(const char *Cmd) {
dreturn(PM3_ERFTRANS);
}
if (len < 4) {
PrintAndLogEx(ERR, "Error GetChallenge. Wrong challenge length %d", len);
PrintAndLogEx(ERR, "Error GetChallenge. Wrong challenge length %zu", len);
dreturn(PM3_ESOFT);
}
@ -1104,7 +1104,7 @@ static int CmdEMVExec(const char *Cmd) {
dreturn(PM3_ESOFT);
}
PrintAndLogEx(NORMAL, "CDOL1 data[%d]: %s", cdol_data_tlv->len, sprint_hex(cdol_data_tlv->value, cdol_data_tlv->len));
PrintAndLogEx(NORMAL, "CDOL1 data[%zu]: %s", cdol_data_tlv->len, sprint_hex(cdol_data_tlv->value, cdol_data_tlv->len));
PrintAndLogEx(NORMAL, "* * AC1");
// EMVAC_TC + EMVAC_CDAREQ --- to get SDAD
@ -1151,7 +1151,7 @@ static int CmdEMVExec(const char *Cmd) {
break;
}
} else {
PrintAndLogEx(WARNING, "Warning: Wrong CID length %d", CID->len);
PrintAndLogEx(WARNING, "Warning: Wrong CID length %zu", CID->len);
}
} else {
PrintAndLogEx(WARNING, "Warning: CID(9F27) not found.");
@ -1194,7 +1194,7 @@ static int CmdEMVExec(const char *Cmd) {
dreturn(PM3_ESOFT);
}
PrintAndLogEx(NORMAL, "UDOL data[%d]: %s", udol_data_tlv->len, sprint_hex(udol_data_tlv->value, udol_data_tlv->len));
PrintAndLogEx(NORMAL, "UDOL data[%zu]: %s", udol_data_tlv->len, sprint_hex(udol_data_tlv->value, udol_data_tlv->len));
PrintAndLogEx(NORMAL, "\n* Mastercard compute cryptographic checksum(UDOL)");
@ -1228,7 +1228,7 @@ static int CmdEMVExec(const char *Cmd) {
dreturn(PM3_ESOFT);
}
PrintAndLogEx(NORMAL, "CDOL1 data[%d]: %s", cdol1_data_tlv->len, sprint_hex(cdol1_data_tlv->value, cdol1_data_tlv->len));
PrintAndLogEx(NORMAL, "CDOL1 data[%zu]: %s", cdol1_data_tlv->len, sprint_hex(cdol1_data_tlv->value, cdol1_data_tlv->len));
PrintAndLogEx(NORMAL, "* * AC1");
// EMVAC_TC + EMVAC_CDAREQ --- to get SDAD
@ -1260,7 +1260,7 @@ static int CmdEMVExec(const char *Cmd) {
PrintAndLogEx(NORMAL, "\n* * Issuer Application Data (IAD):");
uint8_t VDDlen = IAD->value[0]; // Visa discretionary data length
uint8_t IDDlen = 0; // Issuer discretionary data length
PrintAndLogEx(NORMAL, "IAD length: %d", IAD->len);
PrintAndLogEx(NORMAL, "IAD length: %zu", IAD->len);
PrintAndLogEx(NORMAL, "VDDlen: %d", VDDlen);
if (VDDlen < IAD->len - 1)
IDDlen = IAD->value[VDDlen + 1];
@ -1331,7 +1331,7 @@ static int CmdEMVExec(const char *Cmd) {
dreturn(PM3_ESOFT);
}
PrintAndLogEx(NORMAL, "CDOL2 data[%d]: %s", cdol2_data_tlv->len, sprint_hex(cdol2_data_tlv->value, cdol2_data_tlv->len));
PrintAndLogEx(NORMAL, "CDOL2 data[%zu]: %s", cdol2_data_tlv->len, sprint_hex(cdol2_data_tlv->value, cdol2_data_tlv->len));
//PrintAndLogEx(NORMAL, "* * AC2");
// here must be AC2, but we dont make external authenticate (
/* // AC2
@ -1590,7 +1590,7 @@ static int CmdEMVScan(const char *Cmd) {
DropFieldEx(channel);
return PM3_ESOFT;
}
PrintAndLogEx(INFO, "PDOL data[%d]: %s", pdol_data_tlv_data_len, sprint_hex(pdol_data_tlv_data, pdol_data_tlv_data_len));
PrintAndLogEx(INFO, "PDOL data[%zu]: %s", pdol_data_tlv_data_len, sprint_hex(pdol_data_tlv_data, pdol_data_tlv_data_len));
PrintAndLogEx(INFO, "-->GPO.");
res = EMVGPO(channel, true, pdol_data_tlv_data, pdol_data_tlv_data_len, buf, sizeof(buf), &len, &sw, tlvRoot);
@ -1622,7 +1622,7 @@ static int CmdEMVScan(const char *Cmd) {
while (AFL && AFL->len) {
if (AFL->len % 4) {
PrintAndLogEx(ERR, "Wrong AFL length: %d", AFL->len);
PrintAndLogEx(ERR, "Wrong AFL length: %zu", AFL->len);
break;
}
@ -1850,7 +1850,7 @@ static int CmdEMVRoca(const char *Cmd) {
free(pdol_data_tlv);
return PM3_ESOFT;
}
PrintAndLogEx(INFO, "PDOL data[%d]: %s", pdol_data_tlv_data_len, sprint_hex(pdol_data_tlv_data, pdol_data_tlv_data_len));
PrintAndLogEx(INFO, "PDOL data[%zu]: %s", pdol_data_tlv_data_len, sprint_hex(pdol_data_tlv_data, pdol_data_tlv_data_len));
PrintAndLogEx(INFO, "-->GPO.");
res = EMVGPO(channel, true, pdol_data_tlv_data, pdol_data_tlv_data_len, buf, sizeof(buf), &len, &sw, tlvRoot);
@ -1871,7 +1871,7 @@ static int CmdEMVRoca(const char *Cmd) {
while (AFL && AFL->len) {
if (AFL->len % 4) {
PrintAndLogEx(ERR, "Wrong AFL length: %d", AFL->len);
PrintAndLogEx(ERR, "Wrong AFL length: %zu", AFL->len);
break;
}

View file

@ -495,7 +495,7 @@ int EMVSearchPSE(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldO
if (tsfi) {
struct tlvdb *tsfitmp = tlvdb_find_path(tsfi, (tlv_tag_t[]) {0x70, 0x61, 0x00});
if (!tsfitmp) {
PrintAndLogEx(FAILED, "SFI 0x%02d doesn't have any records.", sfidatalen[ui]);
PrintAndLogEx(FAILED, "SFI 0x%02zu doesn't have any records.", sfidatalen[ui]);
continue;
}
res = EMVCheckAID(channel, decodeTLV, tsfitmp, tlv);
@ -863,7 +863,7 @@ int trDDA(EMVCommandChannel channel, bool decodeTLV, struct tlvdb *tlv) {
return 5;
}
PrintAndLogEx(NORMAL, "DDOL data[%d]: %s", ddol_data_tlv->len, sprint_hex(ddol_data_tlv->value, ddol_data_tlv->len));
PrintAndLogEx(NORMAL, "DDOL data[%zu]: %s", ddol_data_tlv->len, sprint_hex(ddol_data_tlv->value, ddol_data_tlv->len));
PrintAndLogEx(NORMAL, "\n* Internal Authenticate");
int res = EMVInternalAuthenticate(channel, true, (uint8_t *)ddol_data_tlv->value, ddol_data_tlv->len, buf, sizeof(buf), &len, &sw, NULL);
@ -879,7 +879,7 @@ int trDDA(EMVCommandChannel channel, bool decodeTLV, struct tlvdb *tlv) {
struct tlvdb *dda_db = NULL;
if (buf[0] == 0x80) {
if (len < 3) {
PrintAndLogEx(WARNING, "Warning: Internal Authenticate format1 parsing error. length=%d", len);
PrintAndLogEx(WARNING, "Warning: Internal Authenticate format1 parsing error. length=%zu", len);
} else {
// parse response 0x80
struct tlvdb *t80 = tlvdb_parse_multi(buf, len);

View file

@ -255,7 +255,7 @@ static bool HexToBuffer(const char *errormsg, const char *hexvalue, uint8_t *buf
}
if (buflen > maxbufferlen) {
PrintAndLogEx(ERR, "%s HEX length (%d) more than %d", errormsg, (bufferlen) ? *bufferlen : -1, maxbufferlen);
PrintAndLogEx(ERR, "%s HEX length (%zu) more than %zu", errormsg, (bufferlen) ? *bufferlen : -1, maxbufferlen);
return false;
}
@ -321,7 +321,7 @@ bool ParamLoadFromJson(struct tlvdb *tlv) {
return false;
}
PrintAndLogEx(SUCCESS, "Load params: json(%d) " _GREEN_("OK"), json_array_size(root));
PrintAndLogEx(SUCCESS, "Load params: json(%zu) " _GREEN_("OK"), json_array_size(root));
for (int i = 0; i < json_array_size(root); i++) {
json_t *data, *jtag, *jlength, *jvalue;
@ -382,7 +382,7 @@ bool ParamLoadFromJson(struct tlvdb *tlv) {
}
if (buflen != tlvLength) {
PrintAndLogEx(ERR, "Load params: data [%d] length of HEX must(%d) be identical to length in TLV param(%d)", i + 1, buflen, tlvLength);
PrintAndLogEx(ERR, "Load params: data [%d] length of HEX must(%zu) be identical to length in TLV param(%d)", i + 1, buflen, tlvLength);
json_decref(root);
return false;
}

View file

@ -206,7 +206,7 @@ int COSEGetECDSAKey(uint8_t *data, size_t datalen, bool verbose, uint8_t *public
res = CborGetBinStringValue(&map, &public_key[1], 32, &len);
cbor_check(res);
if (verbose)
PrintAndLogEx(SUCCESS, "x - coordinate [%d]: %s", len, sprint_hex(&public_key[1], 32));
PrintAndLogEx(SUCCESS, "x - coordinate [%zu]: %s", len, sprint_hex(&public_key[1], 32));
if (len != 32)
PrintAndLogEx(ERR, "ERROR: x - coordinate length must be 32.");
}
@ -217,7 +217,7 @@ int COSEGetECDSAKey(uint8_t *data, size_t datalen, bool verbose, uint8_t *public
res = CborGetBinStringValue(&map, &public_key[33], 32, &len);
cbor_check(res);
if (verbose)
PrintAndLogEx(SUCCESS, "y - coordinate [%d]: %s", len, sprint_hex(&public_key[33], 32));
PrintAndLogEx(SUCCESS, "y - coordinate [%zu]: %s", len, sprint_hex(&public_key[33], 32));
if (len != 32)
PrintAndLogEx(ERR, "ERROR: y - coordinate length must be 32.");
}
@ -229,7 +229,7 @@ int COSEGetECDSAKey(uint8_t *data, size_t datalen, bool verbose, uint8_t *public
res = CborGetBinStringValue(&map, private_key, sizeof(private_key), &len);
cbor_check(res);
if (verbose)
PrintAndLogEx(SUCCESS, "d - private key [%d]: %s", len, sprint_hex(private_key, len));
PrintAndLogEx(SUCCESS, "d - private key [%zu]: %s", len, sprint_hex(private_key, len));
}
if (verbose)

View file

@ -434,9 +434,9 @@ int FIDO2MakeCredentionalParseRes(json_t *root, uint8_t *data, size_t dataLen, b
memcpy(authData, ubuf, authDataLen);
if (verbose2) {
PrintAndLogEx(INFO, "authData[%d]: %s", n, sprint_hex_inrow(authData, authDataLen));
PrintAndLogEx(INFO, "authData[%zu]: %s", n, sprint_hex_inrow(authData, authDataLen));
} else {
PrintAndLogEx(INFO, "authData[%d]: %s...", n, sprint_hex(authData, MIN(authDataLen, 16)));
PrintAndLogEx(INFO, "authData[%zu]: %s...", n, sprint_hex(authData, MIN(authDataLen, 16)));
}
PrintAndLogEx(INFO, "RP ID Hash: %s", sprint_hex(ubuf, 32));
@ -530,9 +530,9 @@ int FIDO2MakeCredentionalParseRes(json_t *root, uint8_t *data, size_t dataLen, b
res = CborGetBinStringValue(&mapsmt, sign, sizeof(sign), &signLen);
cbor_check(res);
if (verbose2) {
PrintAndLogEx(INFO, "signature [%d]: %s", signLen, sprint_hex_inrow(sign, signLen));
PrintAndLogEx(INFO, "signature [%zu]: %s", signLen, sprint_hex_inrow(sign, signLen));
} else {
PrintAndLogEx(INFO, "signature [%d]: %s...", signLen, sprint_hex(sign, MIN(signLen, 16)));
PrintAndLogEx(INFO, "signature [%zu]: %s...", signLen, sprint_hex(sign, MIN(signLen, 16)));
}
}
@ -540,11 +540,11 @@ int FIDO2MakeCredentionalParseRes(json_t *root, uint8_t *data, size_t dataLen, b
res = CborGetArrayBinStringValue(&mapsmt, der, sizeof(der), &derLen);
cbor_check(res);
if (verbose2) {
PrintAndLogEx(NORMAL, "DER certificate[%d]:\n------------------DER-------------------", derLen);
PrintAndLogEx(NORMAL, "DER certificate[%zu]:\n------------------DER-------------------", derLen);
dump_buffer_simple((const unsigned char *)der, derLen, NULL);
PrintAndLogEx(NORMAL, "\n----------------DER---------------------");
} else {
PrintAndLogEx(NORMAL, "DER [%d]: %s...", derLen, sprint_hex(der, MIN(derLen, 16)));
PrintAndLogEx(NORMAL, "DER [%zu]: %s...", derLen, sprint_hex(der, MIN(derLen, 16)));
}
JsonSaveBufAsHexCompact(root, "$.AppData.DER", der, derLen);
}
@ -674,7 +674,7 @@ int FIDO2GetAssertionParseRes(json_t *root, uint8_t *data, size_t dataLen, bool
uint8_t cid[200] = {0};
res = CborGetBinStringValue(&mapint, cid, sizeof(cid), &n);
cbor_check(res);
PrintAndLogEx(SUCCESS, "credential id [%d]: %s", n, sprint_hex(cid, n));
PrintAndLogEx(SUCCESS, "credential id [%zu]: %s", n, sprint_hex(cid, n));
}
}
res = cbor_value_leave_container(&map, &mapint);
@ -693,9 +693,9 @@ int FIDO2GetAssertionParseRes(json_t *root, uint8_t *data, size_t dataLen, bool
memcpy(authData, ubuf, authDataLen);
if (verbose2) {
PrintAndLogEx(INFO, "authData[%d]: %s", n, sprint_hex_inrow(authData, authDataLen));
PrintAndLogEx(INFO, "authData[%zu]: %s", n, sprint_hex_inrow(authData, authDataLen));
} else {
PrintAndLogEx(INFO, "authData[%d]: %s...", n, sprint_hex(authData, MIN(authDataLen, 16)));
PrintAndLogEx(INFO, "authData[%zu]: %s...", n, sprint_hex(authData, MIN(authDataLen, 16)));
}
PrintAndLogEx(INFO, "RP ID Hash: %s", sprint_hex(ubuf, 32));
@ -749,7 +749,7 @@ int FIDO2GetAssertionParseRes(json_t *root, uint8_t *data, size_t dataLen, bool
uint8_t cid[200] = {0};
res = CborGetBinStringValue(&mapint, cid, sizeof(cid), &n);
cbor_check(res);
PrintAndLogEx(SUCCESS, "UserEntity id [%d]: %s", n, sprint_hex(cid, n));
PrintAndLogEx(SUCCESS, "UserEntity id [%zu]: %s", n, sprint_hex(cid, n));
// check
uint8_t idbuf[100] = {0};
@ -781,9 +781,9 @@ int FIDO2GetAssertionParseRes(json_t *root, uint8_t *data, size_t dataLen, bool
cbor_check(res);
if (verbose2) {
PrintAndLogEx(SUCCESS, "signature [%d]: %s", signLen, sprint_hex_inrow(sign, signLen));
PrintAndLogEx(SUCCESS, "signature [%zu]: %s", signLen, sprint_hex_inrow(sign, signLen));
} else {
PrintAndLogEx(SUCCESS, "signature [%d]: %s...", signLen, sprint_hex(sign, MIN(signLen, 16)));
PrintAndLogEx(SUCCESS, "signature [%zu]: %s...", signLen, sprint_hex(sign, MIN(signLen, 16)));
}
// get public key from json

View file

@ -153,7 +153,7 @@ int saveFile(const char *preferredName, const char *suffix, const void *data, si
fwrite(data, 1, datalen, f);
fflush(f);
fclose(f);
PrintAndLogEx(SUCCESS, "saved %u bytes to binary file " _YELLOW_("%s"), datalen, fileName);
PrintAndLogEx(SUCCESS, "saved %zu bytes to binary file " _YELLOW_("%s"), datalen, fileName);
free(fileName);
return PM3_SUCCESS;
}
@ -420,14 +420,14 @@ int loadFile(const char *preferredName, const char *suffix, void *data, size_t m
}
if (bytes_read > maxdatalen) {
PrintAndLogEx(WARNING, "Warning, bytes read exceed calling array limit. Max bytes is %d bytes", maxdatalen);
PrintAndLogEx(WARNING, "Warning, bytes read exceed calling array limit. Max bytes is %zu bytes", maxdatalen);
bytes_read = maxdatalen;
}
memcpy((data), dump, bytes_read);
free(dump);
PrintAndLogEx(SUCCESS, "loaded %d bytes from binary file " _YELLOW_("%s"), bytes_read, fileName);
PrintAndLogEx(SUCCESS, "loaded %zu bytes from binary file " _YELLOW_("%s"), bytes_read, fileName);
*datalen = bytes_read;
@ -483,7 +483,7 @@ int loadFile_safe(const char *preferredName, const char *suffix, void **pdata, s
*datalen = bytes_read;
PrintAndLogEx(SUCCESS, "loaded %d bytes from binary file " _YELLOW_("%s"), bytes_read, preferredName);
PrintAndLogEx(SUCCESS, "loaded %zu bytes from binary file " _YELLOW_("%s"), bytes_read, preferredName);
return retval;
}
@ -531,7 +531,7 @@ int loadFileEML(const char *preferredName, void *data, size_t *datalen) {
}
}
fclose(f);
PrintAndLogEx(SUCCESS, "loaded %d bytes from text file " _YELLOW_("%s"), counter, fileName);
PrintAndLogEx(SUCCESS, "loaded %zu bytes from text file " _YELLOW_("%s"), counter, fileName);
if (datalen)
*datalen = counter;

View file

@ -1005,7 +1005,7 @@ int detect_classic_prng(void) {
// check respA
if (respA.oldarg[0] != 4) {
PrintAndLogEx(ERR, "PRNG data error: Wrong length: %d", respA.oldarg[0]);
PrintAndLogEx(ERR, "PRNG data error: Wrong length: %"PRIu64, respA.oldarg[0]);
return PM3_ESOFT;
}

View file

@ -143,11 +143,11 @@ static int ndefPrintHeader(NDEFHeader_t *header) {
PrintAndLogEx(NORMAL, "\tID Len Present: %s", STRBOOL(header->IDLenPresent));
PrintAndLogEx(NORMAL, "\tType Name Format: [0x%02x] %s", header->TypeNameFormat, TypeNameFormat_s[header->TypeNameFormat]);
PrintAndLogEx(NORMAL, "\tHeader length : %d", header->len);
PrintAndLogEx(NORMAL, "\tType length : %d", header->TypeLen);
PrintAndLogEx(NORMAL, "\tPayload length : %d", header->PayloadLen);
PrintAndLogEx(NORMAL, "\tID length : %d", header->IDLen);
PrintAndLogEx(NORMAL, "\tRecord length : %d", header->RecLen);
PrintAndLogEx(NORMAL, "\tHeader length : %zu", header->len);
PrintAndLogEx(NORMAL, "\tType length : %zu", header->TypeLen);
PrintAndLogEx(NORMAL, "\tPayload length : %zu", header->PayloadLen);
PrintAndLogEx(NORMAL, "\tID length : %zu", header->IDLen);
PrintAndLogEx(NORMAL, "\tRecord length : %zu", header->RecLen);
return 0;
}
@ -171,7 +171,7 @@ static int ndefDecodeSig(uint8_t *sig, size_t siglen) {
// ecdsa 0x04
if (sigType == stECDSA) {
indx += 3;
PrintAndLogEx(NORMAL, "\tsignature [%d]: %s", intsiglen, sprint_hex_inrow(&sig[indx], intsiglen));
PrintAndLogEx(NORMAL, "\tsignature [%zu]: %s", intsiglen, sprint_hex_inrow(&sig[indx], intsiglen));
uint8_t rval[300] = {0};
uint8_t sval[300] = {0};
@ -186,7 +186,7 @@ static int ndefDecodeSig(uint8_t *sig, size_t siglen) {
if (sigURI) {
size_t intsigurilen = (sig[indx] << 8) + sig[indx + 1];
indx += 2;
PrintAndLogEx(NORMAL, "\tsignature uri [%d]: %.*s", intsigurilen, intsigurilen, &sig[indx]);
PrintAndLogEx(NORMAL, "\tsignature uri [%zu]: %.*s", intsigurilen, intsigurilen, &sig[indx]);
indx += intsigurilen;
}
@ -203,7 +203,7 @@ static int ndefDecodeSig(uint8_t *sig, size_t siglen) {
size_t intcertlen = (sig[indx + 1] << 8) + sig[indx + 2];
indx += 2;
PrintAndLogEx(NORMAL, "\tcertificate %d [%d]: %s", i + 1, intcertlen, sprint_hex_inrow(&sig[indx], intcertlen));
PrintAndLogEx(NORMAL, "\tcertificate %d [%zu]: %s", i + 1, intcertlen, sprint_hex_inrow(&sig[indx], intcertlen));
indx += intcertlen;
}
@ -211,7 +211,7 @@ static int ndefDecodeSig(uint8_t *sig, size_t siglen) {
if ((indx <= siglen) && certURI) {
size_t inturilen = (sig[indx] << 8) + sig[indx + 1];
indx += 2;
PrintAndLogEx(NORMAL, "\tcertificate uri [%d]: %.*s", inturilen, inturilen, &sig[indx]);
PrintAndLogEx(NORMAL, "\tcertificate uri [%zu]: %.*s", inturilen, inturilen, &sig[indx]);
}
return 0;
@ -222,17 +222,17 @@ static int ndefDecodePayload(NDEFHeader_t *ndef) {
switch (ndef->TypeNameFormat) {
case tnfWellKnownRecord:
PrintAndLogEx(INFO, "Well Known Record");
PrintAndLogEx(NORMAL, "\ttype: %.*s", ndef->TypeLen, ndef->Type);
PrintAndLogEx(NORMAL, "\ttype: %.*s", (int)ndef->TypeLen, ndef->Type);
if (!strncmp((char *)ndef->Type, "T", ndef->TypeLen)) {
PrintAndLogEx(NORMAL, "\ttext : %.*s", ndef->PayloadLen, ndef->Payload);
PrintAndLogEx(NORMAL, "\ttext : %.*s", (int)ndef->PayloadLen, ndef->Payload);
}
if (!strncmp((char *)ndef->Type, "U", ndef->TypeLen)) {
PrintAndLogEx(NORMAL
, "\turi : %s%.*s"
, (ndef->Payload[0] <= 0x23 ? URI_s[ndef->Payload[0]] : "[err]")
, ndef->PayloadLen - 1
, (int)(ndef->PayloadLen - 1)
, &ndef->Payload[1]
);
}
@ -244,8 +244,8 @@ static int ndefDecodePayload(NDEFHeader_t *ndef) {
break;
case tnfAbsoluteURIRecord:
PrintAndLogEx(INFO, "Absolute URI Record");
PrintAndLogEx(NORMAL, "\ttype: %.*s", ndef->TypeLen, ndef->Type);
PrintAndLogEx(NORMAL, "\tpayload: %.*s", ndef->PayloadLen, ndef->Payload);
PrintAndLogEx(NORMAL, "\ttype: %.*s", (int)ndef->TypeLen, ndef->Type);
PrintAndLogEx(NORMAL, "\tpayload: %.*s", (int)ndef->PayloadLen, ndef->Payload);
break;
case tnfEmptyRecord:
case tnfMIMEMediaRecord:
@ -302,7 +302,7 @@ static int ndefRecordsDecodeAndPrint(uint8_t *ndefRecord, size_t ndefRecordLen)
}
if (NDEFHeader.MessageEnd && len + NDEFHeader.RecLen != ndefRecordLen) {
PrintAndLogEx(ERR, "NDEF records have wrong length. Must be %d, calculated %d", ndefRecordLen, len + NDEFHeader.RecLen);
PrintAndLogEx(ERR, "NDEF records have wrong length. Must be %zu, calculated %zu", ndefRecordLen, len + NDEFHeader.RecLen);
return 1;
}