This commit is contained in:
iceman1001 2021-04-08 11:08:39 +02:00
parent 27184d7f5b
commit 007b916643
21 changed files with 226 additions and 226 deletions

View file

@ -89,7 +89,7 @@ int rdv4_validate(rdv40_validation_t *mem) {
return PM3_EFAILED; return PM3_EFAILED;
} }
static int rdv4_sign_write(uint8_t *signature, uint8_t slen){ static int rdv4_sign_write(uint8_t *signature, uint8_t slen) {
// save to mem // save to mem
clearCommandBuffer(); clearCommandBuffer();
PacketResponseNG resp; PacketResponseNG resp;
@ -439,14 +439,14 @@ static int CmdFlashMemInfo(const char *Cmd) {
// shall_write = arg_get_lit(ctx, 5); // shall_write = arg_get_lit(ctx, 5);
CLIParserFree(ctx); CLIParserFree(ctx);
if (res || (dlen > 0 && dlen < sizeof(id)) ) { if (res || (dlen > 0 && dlen < sizeof(id))) {
PrintAndLogEx(FAILED, "Error parsing flash memory id, expect 8, got %d", dlen); PrintAndLogEx(FAILED, "Error parsing flash memory id, expect 8, got %d", dlen);
return PM3_EINVARG; return PM3_EINVARG;
} }
// set up PK key context now. // set up PK key context now.
mbedtls_pk_context pkctx; mbedtls_pk_context pkctx;
mbedtls_pk_init( &pkctx ); mbedtls_pk_init(&pkctx);
bool got_private = false; bool got_private = false;
// PEM // PEM
if (pemlen) { if (pemlen) {
@ -472,7 +472,7 @@ static int CmdFlashMemInfo(const char *Cmd) {
return PM3_EFILE; return PM3_EFILE;
} }
mbedtls_rsa_context *rsa = (mbedtls_rsa_context*)pkctx.pk_ctx; mbedtls_rsa_context *rsa = (mbedtls_rsa_context *)pkctx.pk_ctx;
if (rsa == NULL) { if (rsa == NULL) {
PrintAndLogEx(FAILED, "failed to allocate rsa context memory"); PrintAndLogEx(FAILED, "failed to allocate rsa context memory");
return PM3_EMALLOC; return PM3_EMALLOC;
@ -482,7 +482,7 @@ static int CmdFlashMemInfo(const char *Cmd) {
} else { } else {
// it not loaded, we need to setup the context manually // it not loaded, we need to setup the context manually
if (mbedtls_pk_setup( &pkctx, mbedtls_pk_info_from_type( (mbedtls_pk_type_t) MBEDTLS_PK_RSA ) ) != 0 ) { if (mbedtls_pk_setup(&pkctx, mbedtls_pk_info_from_type((mbedtls_pk_type_t) MBEDTLS_PK_RSA)) != 0) {
PrintAndLogEx(FAILED, "failed, mbedtls_pk_setup returned "); PrintAndLogEx(FAILED, "failed, mbedtls_pk_setup returned ");
return PM3_ESOFT; return PM3_ESOFT;
} }
@ -521,7 +521,7 @@ static int CmdFlashMemInfo(const char *Cmd) {
mbedtls_rsa_context *rsa = NULL; mbedtls_rsa_context *rsa = NULL;
if (got_private) { if (got_private) {
rsa = mbedtls_pk_rsa( pkctx ); rsa = mbedtls_pk_rsa(pkctx);
rsa->padding = MBEDTLS_RSA_PKCS_V15; rsa->padding = MBEDTLS_RSA_PKCS_V15;
rsa->hash_id = 0; rsa->hash_id = 0;
rsa->len = RRG_RSA_KEY_LEN; rsa->len = RRG_RSA_KEY_LEN;
@ -587,7 +587,7 @@ static int CmdFlashMemInfo(const char *Cmd) {
PrintAndLogEx(INFO, "--- " _CYAN_("Enter signing") " --------------------"); PrintAndLogEx(INFO, "--- " _CYAN_("Enter signing") " --------------------");
if (dlen == 8) { if (dlen == 8) {
mbedtls_sha1(id, sizeof(id), sha_hash); mbedtls_sha1(id, sizeof(id), sha_hash);
} }
PrintAndLogEx(INFO, "Signing....... %s", sprint_hex_inrow(sha_hash, sizeof(sha_hash))); PrintAndLogEx(INFO, "Signing....... %s", sprint_hex_inrow(sha_hash, sizeof(sha_hash)));

View file

@ -1171,7 +1171,7 @@ static int CmdHF15FindAfi(const char *Cmd) {
break; break;
} }
if (WaitForResponseTimeout(CMD_HF_ISO15693_FINDAFI, &resp, 2000)){ if (WaitForResponseTimeout(CMD_HF_ISO15693_FINDAFI, &resp, 2000)) {
if (resp.status == PM3_EOPABORTED) { if (resp.status == PM3_EOPABORTED) {
PrintAndLogEx(DEBUG, "Button pressed, user aborted"); PrintAndLogEx(DEBUG, "Button pressed, user aborted");
} }

View file

@ -247,9 +247,9 @@ static int CmdHFCryptoRFReader(const char *Cmd) {
static int CmdHFCryptoRFDump(const char *Cmd) { static int CmdHFCryptoRFDump(const char *Cmd) {
CLIParserContext *ctx; CLIParserContext *ctx;
CLIParserInit(&ctx, "hf cryptorf dump", CLIParserInit(&ctx, "hf cryptorf dump",
"Dump all memory from a CryptoRF tag (512/4096 bit size)", "Dump all memory from a CryptoRF tag (512/4096 bit size)",
"hf cryptorf dump\n" "hf cryptorf dump\n"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
@ -393,9 +393,9 @@ static int CmdHFCryptoRFELoad(const char *Cmd) {
CLIParserContext *ctx; CLIParserContext *ctx;
CLIParserInit(&ctx, "hf cryptorf eload", CLIParserInit(&ctx, "hf cryptorf eload",
"Loads CryptoRF tag dump into emulator memory on device", "Loads CryptoRF tag dump into emulator memory on device",
"hf cryptorf eload -f hf-cryptorf-0102030405-dump.bin\n" "hf cryptorf eload -f hf-cryptorf-0102030405-dump.bin\n"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
@ -455,11 +455,11 @@ static int CmdHFCryptoRFESave(const char *Cmd) {
CLIParserContext *ctx; CLIParserContext *ctx;
CLIParserInit(&ctx, "hf cryptorf esave", CLIParserInit(&ctx, "hf cryptorf esave",
"Save emulator memory to bin/eml/json file\n" "Save emulator memory to bin/eml/json file\n"
"if filename is not supplied, UID will be used.", "if filename is not supplied, UID will be used.",
"hf cryptorf esave\n" "hf cryptorf esave\n"
"hf cryptorf esave -f filename" "hf cryptorf esave -f filename"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
arg_str0("f", "file", "<filename>", "filename of dumpfile"), arg_str0("f", "file", "<filename>", "filename of dumpfile"),

View file

@ -1217,7 +1217,7 @@ static void emrtd_mrz_replace_pad(char *data, int datalen, char newchar) {
static void emrtd_print_optional_elements(char *mrz, int offset, int length, bool verify_check_digit) { static void emrtd_print_optional_elements(char *mrz, int offset, int length, bool verify_check_digit) {
int i = emrtd_mrz_determine_length(mrz, offset, length); int i = emrtd_mrz_determine_length(mrz, offset, length);
if (i == -1){ if (i == -1) {
return; return;
} }

View file

@ -1351,17 +1351,17 @@ static int CmdHFFelicaRequestSystemCode(const char *Cmd) {
static int CmdHFFelicaRequestService(const char *Cmd) { static int CmdHFFelicaRequestService(const char *Cmd) {
CLIParserContext *ctx; CLIParserContext *ctx;
CLIParserInit(&ctx, "hf felica rqservice", CLIParserInit(&ctx, "hf felica rqservice",
"Use this command to verify the existence of Area and Service, and to acquire Key Version:\n" "Use this command to verify the existence of Area and Service, and to acquire Key Version:\n"
" - When the specified Area or Service exists, the card returns Key Version.\n" " - When the specified Area or Service exists, the card returns Key Version.\n"
" - When the specified Area or Service does not exist, the card returns FFFFh as Key Version.\n" " - When the specified Area or Service does not exist, the card returns FFFFh as Key Version.\n"
"For Node Code List of a command packet, Area Code or Service Code of the target\n" "For Node Code List of a command packet, Area Code or Service Code of the target\n"
"of acquisition of Key Version shall be enumerated in Little Endian format.\n" "of acquisition of Key Version shall be enumerated in Little Endian format.\n"
"If Key Version of System is the target of acquisition, FFFFh shall be specified\n" "If Key Version of System is the target of acquisition, FFFFh shall be specified\n"
"in the command packet.", "in the command packet.",
"hf felcia rqservice --node 01 --code FFFF\n" "hf felcia rqservice --node 01 --code FFFF\n"
"hf felcia rqservice -a --code FFFF\n" "hf felcia rqservice -a --code FFFF\n"
"hf felica rqservice -i 011204126417E405 --node 01 --code FFFF" "hf felica rqservice -i 011204126417E405 --node 01 --code FFFF"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
@ -1383,41 +1383,41 @@ static int CmdHFFelicaRequestService(const char *Cmd) {
bool custom_IDm = false; bool custom_IDm = false;
uint16_t datalen = 13; // length (1) + CMD (1) + IDm(8) + Node Number (1) + Node Code List (2) uint16_t datalen = 13; // length (1) + CMD (1) + IDm(8) + Node Number (1) + Node Code List (2)
/* /*
case 'i': case 'i':
custom_IDm = true; custom_IDm = true;
if (!add_param(Cmd, paramCount, data, 2, 16)) { if (!add_param(Cmd, paramCount, data, 2, 16)) {
return PM3_EINVARG;
}
if (!all_nodes) {
// Node Number
if (param_getlength(Cmd, paramCount) == 2) {
if (param_gethex(Cmd, paramCount++, data + 10, 2) == 1) {
PrintAndLogEx(ERR, "Failed param key");
return PM3_EINVARG; return PM3_EINVARG;
} }
if (!all_nodes) {
// Node Number
if (param_getlength(Cmd, paramCount) == 2) {
if (param_gethex(Cmd, paramCount++, data + 10, 2) == 1) {
PrintAndLogEx(ERR, "Failed param key");
return PM3_EINVARG;
}
} else {
PrintAndLogEx(ERR, "Incorrect Node number length!");
return PM3_EINVARG;
}
}
if (param_getlength(Cmd, paramCount) == 4) {
if (param_gethex(Cmd, paramCount++, data + 11, 4) == 1) {
PrintAndLogEx(ERR, "Failed param key");
return PM3_EINVARG;
}
} else { } else {
PrintAndLogEx(ERR, "Incorrect Node number length!"); PrintAndLogEx(ERR, "Incorrect parameter length!");
return PM3_EINVARG; return PM3_EINVARG;
} }
} */
if (param_getlength(Cmd, paramCount) == 4) {
if (param_gethex(Cmd, paramCount++, data + 11, 4) == 1) {
PrintAndLogEx(ERR, "Failed param key");
return PM3_EINVARG;
}
} else {
PrintAndLogEx(ERR, "Incorrect parameter length!");
return PM3_EINVARG;
}
*/
uint8_t flags = FELICA_APPEND_CRC; uint8_t flags = FELICA_APPEND_CRC;
if (custom_IDm) { if (custom_IDm) {
@ -1458,11 +1458,11 @@ static int CmdHFFelicaNotImplementedYet(const char *Cmd) {
static int CmdHFFelicaSniff(const char *Cmd) { static int CmdHFFelicaSniff(const char *Cmd) {
CLIParserContext *ctx; CLIParserContext *ctx;
CLIParserInit(&ctx, "hf felica sniff", CLIParserInit(&ctx, "hf felica sniff",
"Collect data from the field and save into command buffer.\n" "Collect data from the field and save into command buffer.\n"
"Buffer accessible from `hf felica list`", "Buffer accessible from `hf felica list`",
"hf felica sniff\n" "hf felica sniff\n"
"hf felica sniff -s 10 -t 19" "hf felica sniff -s 10 -t 19"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
arg_u64_0("s", "samples", "<dec>", "samples to skip"), arg_u64_0("s", "samples", "<dec>", "samples to skip"),
@ -1480,20 +1480,20 @@ static int CmdHFFelicaSniff(const char *Cmd) {
payload.triggers = arg_get_u32_def(ctx, 2, 5000); payload.triggers = arg_get_u32_def(ctx, 2, 5000);
CLIParserFree(ctx); CLIParserFree(ctx);
if (payload.samples > 9999 ){ if (payload.samples > 9999) {
payload.samples = 9999; payload.samples = 9999;
PrintAndLogEx(INFO, "Too large samples to skip value, using max value 9999"); PrintAndLogEx(INFO, "Too large samples to skip value, using max value 9999");
return PM3_EINVARG; return PM3_EINVARG;
} }
if (payload.triggers > 9999 ){ if (payload.triggers > 9999) {
payload.triggers = 9999; payload.triggers = 9999;
PrintAndLogEx(INFO, "Too large trigger to skip value, using max value 9999"); PrintAndLogEx(INFO, "Too large trigger to skip value, using max value 9999");
return PM3_EINVARG; return PM3_EINVARG;
} }
PrintAndLogEx(INFO, "Sniff Felica, getting first %" PRIu32 " frames, skipping after %" PRIu32 " triggers", payload.samples, payload.triggers ); PrintAndLogEx(INFO, "Sniff Felica, getting first %" PRIu32 " frames, skipping after %" PRIu32 " triggers", payload.samples, payload.triggers);
PrintAndLogEx(INFO, "Press " _GREEN_("<Enter>") " or pm3-button to abort sniffing"); PrintAndLogEx(INFO, "Press " _GREEN_("<Enter>") " or pm3-button to abort sniffing");
clearCommandBuffer(); clearCommandBuffer();
SendCommandNG(CMD_HF_FELICA_SNIFF, (uint8_t *)&payload, sizeof(payload)); SendCommandNG(CMD_HF_FELICA_SNIFF, (uint8_t *)&payload, sizeof(payload));
@ -1524,9 +1524,9 @@ static int CmdHFFelicaSniff(const char *Cmd) {
static int CmdHFFelicaSimLite(const char *Cmd) { static int CmdHFFelicaSimLite(const char *Cmd) {
CLIParserContext *ctx; CLIParserContext *ctx;
CLIParserInit(&ctx, "hf felica litesim", CLIParserInit(&ctx, "hf felica litesim",
"Emulating ISO/18092 FeliCa Lite tag", "Emulating ISO/18092 FeliCa Lite tag",
"hf felica litesim -u 1122334455667788" "hf felica litesim -u 1122334455667788"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
arg_str1("u", "uid", "<hex>", "UID/NDEF2 8 hex bytes"), arg_str1("u", "uid", "<hex>", "UID/NDEF2 8 hex bytes"),
@ -1720,19 +1720,19 @@ static uint16_t PrintFliteBlock(uint16_t tracepos, uint8_t *trace, uint16_t trac
static int CmdHFFelicaDumpLite(const char *Cmd) { static int CmdHFFelicaDumpLite(const char *Cmd) {
/* /*
iceman 2021, iceman 2021,
Why does this command say it dumps a FeliCa lite card Why does this command say it dumps a FeliCa lite card
and then tries to print a trace?!? and then tries to print a trace?!?
Is this a trace list or a feclia dump cmd? Is this a trace list or a feclia dump cmd?
*/ */
CLIParserContext *ctx; CLIParserContext *ctx;
CLIParserInit(&ctx, "hf felica litedump", CLIParserInit(&ctx, "hf felica litedump",
"Dump ISO/18092 FeliCa Lite tag. It will timeout after 200sec", "Dump ISO/18092 FeliCa Lite tag. It will timeout after 200sec",
"hf felica litedump" "hf felica litedump"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
arg_param_end arg_param_end
@ -1817,9 +1817,9 @@ static int CmdHFFelicaCmdRaw(const char *Cmd) {
CLIParserContext *ctx; CLIParserContext *ctx;
CLIParserInit(&ctx, "hf felica raw ", CLIParserInit(&ctx, "hf felica raw ",
"Send raw hex data to tag", "Send raw hex data to tag",
"hf felica raw -s 20" "hf felica raw -s 20"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
@ -1837,7 +1837,7 @@ static int CmdHFFelicaCmdRaw(const char *Cmd) {
bool active = arg_get_lit(ctx, 1); bool active = arg_get_lit(ctx, 1);
bool crc = arg_get_lit(ctx, 2); bool crc = arg_get_lit(ctx, 2);
bool keep_field_on = arg_get_lit(ctx, 3); bool keep_field_on = arg_get_lit(ctx, 3);
uint16_t numbits = arg_get_u32_def(ctx, 4, 0) &0xFFFF; uint16_t numbits = arg_get_u32_def(ctx, 4, 0) & 0xFFFF;
bool reply = (arg_get_lit(ctx, 5) == false); bool reply = (arg_get_lit(ctx, 5) == false);
bool active_select = arg_get_lit(ctx, 6); bool active_select = arg_get_lit(ctx, 6);

View file

@ -134,7 +134,7 @@ uint8_t card_app2_limit[] = {
0xff, 0xff,
}; };
iclass_config_card_item_t iclass_config_types[14]= { iclass_config_card_item_t iclass_config_types[14] = {
{"", ""}, {"", ""},
{"", ""}, {"", ""},
{"", ""}, {"", ""},
@ -274,7 +274,7 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
return PM3_ENODATA; return PM3_ENODATA;
} }
uint8_t ffs[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; uint8_t ffs[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
if (Encrypt(ffs, ffs) == false) { if (Encrypt(ffs, ffs) == false) {
PrintAndLogEx(WARNING, "failed to encrypt FF"); PrintAndLogEx(WARNING, "failed to encrypt FF");
} }
@ -291,7 +291,7 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
memcpy(data + (0xD * 8), enckey1, sizeof(enckey1)); memcpy(data + (0xD * 8), enckey1, sizeof(enckey1));
// encrypted 0xFF // encrypted 0xFF
for (uint8_t i = 0xe; i < 0x14; i++) { for (uint8_t i = 0xe; i < 0x14; i++) {
memcpy(data + (i*8), ffs, sizeof(ffs)); memcpy(data + (i * 8), ffs, sizeof(ffs));
} }
// encrypted partial keyroll key 14 // encrypted partial keyroll key 14
@ -322,8 +322,8 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
} else { } else {
memcpy(data, &iclass_last_known_card, sizeof(picopass_hdr_t)); memcpy(data, &iclass_last_known_card, sizeof(picopass_hdr_t));
memcpy(data + (6*8), o->data, sizeof(o->data)); memcpy(data + (6 * 8), o->data, sizeof(o->data));
} }
// create filename // create filename
char filename[FILE_PATH_SIZE] = {0}; char filename[FILE_PATH_SIZE] = {0};
@ -3711,7 +3711,7 @@ static int CmdHFiClassAutopwn(const char *Cmd) {
} }
*/ */
static int CmdHFiClassConfigCard(const char * Cmd) { static int CmdHFiClassConfigCard(const char *Cmd) {
CLIParserContext *ctx; CLIParserContext *ctx;
CLIParserInit(&ctx, "hf iclass configcard", CLIParserInit(&ctx, "hf iclass configcard",

View file

@ -59,8 +59,8 @@ uint8_t iso14443A_CRC_check(bool isResponse, uint8_t *d, uint8_t n) {
if (n < 3) return 2; if (n < 3) return 2;
if (isResponse && (n < 6)) return 2; if (isResponse && (n < 6)) return 2;
if (d[1] == 0x50 && if (d[1] == 0x50 &&
d[0] >= ISO14443A_CMD_ANTICOLL_OR_SELECT && d[0] >= ISO14443A_CMD_ANTICOLL_OR_SELECT &&
d[0] <= ISO14443A_CMD_ANTICOLL_OR_SELECT_3) { d[0] <= ISO14443A_CMD_ANTICOLL_OR_SELECT_3) {
return 2; return 2;
} }
return check_crc(CRC_14443_A, d, n); return check_crc(CRC_14443_A, d, n);
@ -1338,7 +1338,7 @@ void annotateMifare(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, uint8
} }
static void mf_get_paritybinstr(char *s, uint32_t val, uint8_t par) { static void mf_get_paritybinstr(char *s, uint32_t val, uint8_t par) {
uint8_t foo[4] = {0,0,0,0}; uint8_t foo[4] = {0, 0, 0, 0};
num_to_bytes(val, sizeof(uint32_t), foo); num_to_bytes(val, sizeof(uint32_t), foo);
for (uint8_t i = 0; i < 4; i++) { for (uint8_t i = 0; i < 4; i++) {
if (oddparity8(foo[i]) != ((par >> (7 - (i & 0x0007))) & 0x01)) if (oddparity8(foo[i]) != ((par >> (7 - (i & 0x0007))) & 0x01))
@ -1444,25 +1444,25 @@ bool DecodeMifareData(uint8_t *cmd, uint8_t cmdsize, uint8_t *parity, bool isRes
//PrintAndLogEx(NORMAL, "hardnested not implemented. uid:%x nt:%x ar_enc:%x at_enc:%x\n", AuthData.uid, AuthData.nt, AuthData.ar_enc, AuthData.at_enc); //PrintAndLogEx(NORMAL, "hardnested not implemented. uid:%x nt:%x ar_enc:%x at_enc:%x\n", AuthData.uid, AuthData.nt, AuthData.ar_enc, AuthData.at_enc);
char snt[5] = {0,0,0,0,0}; char snt[5] = {0, 0, 0, 0, 0};
mf_get_paritybinstr(snt, AuthData.nt_enc, AuthData.nt_enc_par); mf_get_paritybinstr(snt, AuthData.nt_enc, AuthData.nt_enc_par);
char sar[5] = {0,0,0,0,0}; char sar[5] = {0, 0, 0, 0, 0};
mf_get_paritybinstr(sar, AuthData.ar_enc, AuthData.ar_enc_par); mf_get_paritybinstr(sar, AuthData.ar_enc, AuthData.ar_enc_par);
char sat[5] = {0,0,0,0,0}; char sat[5] = {0, 0, 0, 0, 0};
mf_get_paritybinstr(sat, AuthData.at_enc, AuthData.at_enc_par); mf_get_paritybinstr(sat, AuthData.at_enc, AuthData.at_enc_par);
PrintAndLogEx(NORMAL, "Nested authentication detected. "); PrintAndLogEx(NORMAL, "Nested authentication detected. ");
PrintAndLogEx(NORMAL, "tools/mf_nonce_brute/mf_nonce_brute %x %x %s %x %x %s %x %s %s\n" PrintAndLogEx(NORMAL, "tools/mf_nonce_brute/mf_nonce_brute %x %x %s %x %x %s %x %s %s\n"
, AuthData.uid , AuthData.uid
, AuthData.nt_enc , AuthData.nt_enc
, snt , snt
, AuthData.nr_enc , AuthData.nr_enc
, AuthData.ar_enc , AuthData.ar_enc
, sar , sar
, AuthData.at_enc , AuthData.at_enc
, sat , sat
, sprint_hex_inrow(cmd, cmdsize) , sprint_hex_inrow(cmd, cmdsize)
); );
MifareAuthState = masError; MifareAuthState = masError;

View file

@ -1251,7 +1251,7 @@ static int CmdHF14AMfRestore(const char *Cmd) {
if (use_keyfile_for_auth) { if (use_keyfile_for_auth) {
for (uint8_t kt=0; kt < 2; kt++) { for (uint8_t kt = 0; kt < 2; kt++) {
if (kt == 0) if (kt == 0)
memcpy(data, keyA[sectorNo], 6); memcpy(data, keyA[sectorNo], 6);
@ -5589,7 +5589,7 @@ static int CmdHF14AMfWipe(const char *Cmd) {
"New acc FF 07 80\n" "New acc FF 07 80\n"
"New GDB 69", "New GDB 69",
"hf mf wipe" "hf mf wipe"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
arg_str0("f", "file", "<fn>", "key filename"), arg_str0("f", "file", "<fn>", "key filename"),
@ -5652,12 +5652,12 @@ static int CmdHF14AMfWipe(const char *Cmd) {
} }
} }
uint8_t zeros[MFBLOCK_SIZE] = {0}; uint8_t zeros[MFBLOCK_SIZE] = {0};
memset(zeros, 0x00, sizeof(zeros)); memset(zeros, 0x00, sizeof(zeros));
uint8_t st[MFBLOCK_SIZE] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x80, 0x69, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; uint8_t st[MFBLOCK_SIZE] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x80, 0x69, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
// time to wipe card // time to wipe card
for (uint8_t s = 0; s < num_sectors; s++) { for (uint8_t s = 0; s < num_sectors; s++) {
for (uint8_t b = 0; b < NumBlocksPerSector(s); b++) { for (uint8_t b = 0; b < NumBlocksPerSector(s); b++) {

View file

@ -1075,7 +1075,7 @@ static mfu_identify_t mfu_ident_table[] = {
{NULL, NULL, 0, 0, NULL, NULL, NULL, NULL} {NULL, NULL, 0, 0, NULL, NULL, NULL, NULL}
}; };
static mfu_identify_t* mfu_match_fingerprint(uint8_t *version, uint8_t *data) { static mfu_identify_t *mfu_match_fingerprint(uint8_t *version, uint8_t *data) {
uint8_t i = 0; uint8_t i = 0;
do { do {
@ -1184,7 +1184,7 @@ static int mfu_fingerprint(void) {
uint8_t version[8] = {0}; uint8_t version[8] = {0};
uint8_t uid[7] = {0}; uint8_t uid[7] = {0};
if (mfu_get_version_uid(version, uid) == PM3_SUCCESS) { if (mfu_get_version_uid(version, uid) == PM3_SUCCESS) {
mfu_identify_t* item = mfu_match_fingerprint(version, data); mfu_identify_t *item = mfu_match_fingerprint(version, data);
if (item) { if (item) {
PrintAndLogEx(SUCCESS, "Found " _GREEN_("%s"), item->desc); PrintAndLogEx(SUCCESS, "Found " _GREEN_("%s"), item->desc);
@ -3280,30 +3280,30 @@ static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
if (memcmp(pre, post, sizeof(pre)) == 0) { if (memcmp(pre, post, sizeof(pre)) == 0) {
PrintAndLogEx(INFO, "Current : %02d (0x%02X) %s" PrintAndLogEx(INFO, "Current : %02d (0x%02X) %s"
, blockno , blockno
, blockno , blockno
, poststr , poststr
); );
} else { } else {
PrintAndLogEx(INFO, _CYAN_("Tear off occurred") " : %02d (0x%02X) %s => " _RED_("%s") PrintAndLogEx(INFO, _CYAN_("Tear off occurred") " : %02d (0x%02X) %s => " _RED_("%s")
, blockno , blockno
, blockno , blockno
, prestr , prestr
, poststr , poststr
); );
lock_on = true; lock_on = true;
if ((phase_begin_clear == -1) && (bitcount32(*(uint32_t*)pre) > bitcount32(*(uint32_t*)post))) if ((phase_begin_clear == -1) && (bitcount32(*(uint32_t *)pre) > bitcount32(*(uint32_t *)post)))
phase_begin_clear = current; phase_begin_clear = current;
if ((phase_begin_clear > -1) && (phase_end_clear == -1) && (bitcount32(*(uint32_t*)post) == 0)) if ((phase_begin_clear > -1) && (phase_end_clear == -1) && (bitcount32(*(uint32_t *)post) == 0))
phase_end_clear = current; phase_end_clear = current;
if ((current == start) && (phase_end_clear > -1)) if ((current == start) && (phase_end_clear > -1))
skip_phase1 = true; skip_phase1 = true;
// new write phase must be atleast 100us later.. // new write phase must be atleast 100us later..
if (((bitcount32(*(uint32_t*)pre) == 0) || (phase_end_clear > -1)) && (phase_begin_newwr == -1) && (bitcount32(*(uint32_t*)post) != 0) && (skip_phase1 || (current > (phase_end_clear + 100)))) if (((bitcount32(*(uint32_t *)pre) == 0) || (phase_end_clear > -1)) && (phase_begin_newwr == -1) && (bitcount32(*(uint32_t *)post) != 0) && (skip_phase1 || (current > (phase_end_clear + 100))))
phase_begin_newwr = current; phase_begin_newwr = current;
if ((phase_begin_newwr > -1) && (phase_end_newwr == -1) && (memcmp(post, teardata, sizeof(teardata)) == 0)) if ((phase_begin_newwr > -1) && (phase_end_newwr == -1) && (memcmp(post, teardata, sizeof(teardata)) == 0))
@ -3346,7 +3346,7 @@ static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
if ((phase_begin_clear > - 1) && (phase_begin_clear != start)) { if ((phase_begin_clear > - 1) && (phase_begin_clear != start)) {
PrintAndLogEx(INFO, "Erase phase start boundary around " _YELLOW_("%5d") " us", phase_begin_clear); PrintAndLogEx(INFO, "Erase phase start boundary around " _YELLOW_("%5d") " us", phase_begin_clear);
} }
if ((phase_end_clear > - 1) && (phase_end_clear != start)){ if ((phase_end_clear > - 1) && (phase_end_clear != start)) {
PrintAndLogEx(INFO, "Erase phase end boundary around " _YELLOW_("%5d") " us", phase_end_clear); PrintAndLogEx(INFO, "Erase phase end boundary around " _YELLOW_("%5d") " us", phase_end_clear);
} }
if (phase_begin_newwr > - 1) { if (phase_begin_newwr > - 1) {
@ -3889,7 +3889,7 @@ static int CmdHF14MfuNDEF(const char *Cmd) {
} }
} }
} }
char *mattel = strstr((char*)records, ".pid.mattel/"); char *mattel = strstr((char *)records, ".pid.mattel/");
if (mattel) { if (mattel) {
mattel += 12; mattel += 12;
while (mattel) { while (mattel) {

View file

@ -562,7 +562,7 @@ int CmdLFConfig(const char *Cmd) {
config.decimation = 8; config.decimation = 8;
} }
if (divisor> -1) { if (divisor > -1) {
config.divisor = divisor; config.divisor = divisor;
if (config.divisor < 19) { if (config.divisor < 19) {
PrintAndLogEx(ERR, "divisor must be between 19 and 255"); PrintAndLogEx(ERR, "divisor must be between 19 and 255");

View file

@ -470,7 +470,7 @@ int CmdEM4x50Chk(const char *Cmd) {
// upload to flash. // upload to flash.
datalen = MIN(bytes_remaining, keyblock); datalen = MIN(bytes_remaining, keyblock);
res = flashmem_spiffs_load((char*)destfn, keys, datalen); res = flashmem_spiffs_load((char *)destfn, keys, datalen);
if (res != PM3_SUCCESS) { if (res != PM3_SUCCESS) {
PrintAndLogEx(WARNING, "SPIFFS upload failed"); PrintAndLogEx(WARNING, "SPIFFS upload failed");
return res; return res;

View file

@ -388,7 +388,7 @@ static int CmdHIDClone(const char *Cmd) {
packed.Mid = mid; packed.Mid = mid;
packed.Bot = bot; packed.Bot = bot;
} else if (bin_len) { } else if (bin_len) {
int res = binstring_to_u96(&top, &mid, &bot, (const char*)bin); int res = binstring_to_u96(&top, &mid, &bot, (const char *)bin);
if (res != bin_len) { if (res != bin_len) {
PrintAndLogEx(ERR, "Binary string contains none <0|1> chars"); PrintAndLogEx(ERR, "Binary string contains none <0|1> chars");
return PM3_EINVARG; return PM3_EINVARG;

View file

@ -337,7 +337,7 @@ static int CmdLFHitagEload(const char *Cmd) {
memcpy(payload.data, dump, dumplen); memcpy(payload.data, dump, dumplen);
clearCommandBuffer(); clearCommandBuffer();
SendCommandNG(CMD_LF_HITAG_ELOAD, (uint8_t *)&payload, 2 + dumplen); SendCommandNG(CMD_LF_HITAG_ELOAD, (uint8_t *)&payload, 2 + dumplen);
} else { } else {
PrintAndLogEx(ERR, "error, wrong dump file size. got %zu", dumplen); PrintAndLogEx(ERR, "error, wrong dump file size. got %zu", dumplen);
} }
@ -368,7 +368,7 @@ static int CmdLFHitagSim(const char *Cmd) {
bool use_hts = arg_get_lit(ctx, 3); bool use_hts = arg_get_lit(ctx, 3);
CLIParserFree(ctx); CLIParserFree(ctx);
if ((use_ht1 + use_ht2 + use_hts) > 1 ) { if ((use_ht1 + use_ht2 + use_hts) > 1) {
PrintAndLogEx(ERR, "error, Only specify one Hitag type"); PrintAndLogEx(ERR, "error, Only specify one Hitag type");
return PM3_EINVARG; return PM3_EINVARG;
} }
@ -659,10 +659,10 @@ static int CmdLFHitagCheckChallenges(const char *Cmd) {
size_t datalen = 0; size_t datalen = 0;
int res = loadFile_safe(filename, ".cc", (void **)&data, &datalen); int res = loadFile_safe(filename, ".cc", (void **)&data, &datalen);
if (res == PM3_SUCCESS) { if (res == PM3_SUCCESS) {
if (datalen == (8 * 60) ) { if (datalen == (8 * 60)) {
SendCommandOLD(CMD_LF_HITAGS_TEST_TRACES, 1, 0, 0, data, datalen); SendCommandOLD(CMD_LF_HITAGS_TEST_TRACES, 1, 0, 0, data, datalen);
} else { } else {
PrintAndLogEx(ERR, "Error, file length mismatch. Expected %d, got %zu", 8*60, datalen); PrintAndLogEx(ERR, "Error, file length mismatch. Expected %d, got %zu", 8 * 60, datalen);
} }
} }
if (data) { if (data) {

View file

@ -458,9 +458,9 @@ static int CmdT55xxSetConfig(const char *Cmd) {
bool mods[12]; bool mods[12];
int verify_mods = 0; int verify_mods = 0;
while (idx - 1 < sizeof(mods)) { while (idx - 1 < sizeof(mods)) {
mods[idx - 1] = arg_get_lit(ctx, idx); mods[idx - 1] = arg_get_lit(ctx, idx);
verify_mods += mods[idx - 1]; verify_mods += mods[idx - 1];
idx++; idx++;
} }
// Not these flags are used to Toggle the values. // Not these flags are used to Toggle the values.
@ -516,7 +516,7 @@ static int CmdT55xxSetConfig(const char *Cmd) {
break; break;
} }
} }
if (i == 9){ if (i == 9) {
PrintAndLogEx(FAILED, "Error select a valid bitrate"); PrintAndLogEx(FAILED, "Error select a valid bitrate");
return PM3_EINVARG; return PM3_EINVARG;
} }
@ -557,7 +557,7 @@ static int CmdT55xxSetConfig(const char *Cmd) {
config.downlink_mode = downlink_mode; config.downlink_mode = downlink_mode;
// validate user specific modulation // validate user specific modulation
if (mods[0]){ if (mods[0]) {
config.modulation = DEMOD_FSK; config.modulation = DEMOD_FSK;
} else if (mods[1]) { } else if (mods[1]) {
config.modulation = DEMOD_FSK1; config.modulation = DEMOD_FSK1;
@ -643,10 +643,10 @@ static int CmdT55xxReadBlock(const char *Cmd) {
CLIParserContext *ctx; CLIParserContext *ctx;
CLIParserInit(&ctx, "lf t55xx read", CLIParserInit(&ctx, "lf t55xx read",
"Read T55xx block data. This commands defaults to page 0.\n\n" "Read T55xx block data. This commands defaults to page 0.\n\n"
_RED_(" * * * WARNING * * *") "\n" _RED_(" * * * WARNING * * *") "\n"
_CYAN_("Use of read with password on a tag not configured") "\n" _CYAN_("Use of read with password on a tag not configured") "\n"
_CYAN_("for a password can damage the tag") "\n" _CYAN_("for a password can damage the tag") "\n"
_RED_(" * * * * * * * * * *"), _RED_(" * * * * * * * * * *"),
"lf t55xx read -b 0 --> read data from block 0\n" "lf t55xx read -b 0 --> read data from block 0\n"
"lf t55xx read -b 0 --pwd 01020304 --> read data from block 0, pwd 01020304\n" "lf t55xx read -b 0 --pwd 01020304 --> read data from block 0, pwd 01020304\n"
"lf t55xx read -b 0 --pwd 01020304 -o --> read data from block 0, pwd 01020304, override\n" "lf t55xx read -b 0 --pwd 01020304 -o --> read data from block 0, pwd 01020304, override\n"
@ -1731,7 +1731,7 @@ static int CmdT55xxReadTrace(const char *Cmd) {
} }
} }
if (DemodBufferLen == 0){ if (DemodBufferLen == 0) {
return PM3_ESOFT; return PM3_ESOFT;
} }
@ -3058,9 +3058,9 @@ static int CmdT55xxChkPwds(const char *Cmd) {
} }
uint8_t downlink_mode = refFixedBit; // Password checks should always start with default/fixed bit unluess requested by user for specific mode uint8_t downlink_mode = refFixedBit; // Password checks should always start with default/fixed bit unluess requested by user for specific mode
// if (r0 || ra) // ra should start downlink mode ad fixed bit to loop through all modes correctly // if (r0 || ra) // ra should start downlink mode ad fixed bit to loop through all modes correctly
// downlink_mode = refFixedBit; // downlink_mode = refFixedBit;
// else // else
if (r1) if (r1)
downlink_mode = refLongLeading; downlink_mode = refLongLeading;
else if (r2) else if (r2)
@ -3265,7 +3265,7 @@ static int CmdT55xxBruteForce(const char *Cmd) {
} }
uint8_t downlink_mode = refFixedBit; // if no downlink mode suppliled use fixed bit/default as the is the most common uint8_t downlink_mode = refFixedBit; // if no downlink mode suppliled use fixed bit/default as the is the most common
// Since we dont know the password the config.downlink mode is of little value. // Since we dont know the password the config.downlink mode is of little value.
// if (r0 || ra) // if try all (ra) then start at fixed bit for correct try all // if (r0 || ra) // if try all (ra) then start at fixed bit for correct try all
// downlink_mode = refFixedBit; // downlink_mode = refFixedBit;
// else // else

View file

@ -280,9 +280,9 @@ static int CmdPref(const char *Cmd) {
static int CmdClear(const char *Cmd) { static int CmdClear(const char *Cmd) {
CLIParserContext *ctx; CLIParserContext *ctx;
CLIParserInit(&ctx, "clear", CLIParserInit(&ctx, "clear",
"Clear the Proxmark3 client terminal screen", "Clear the Proxmark3 client terminal screen",
"clear" "clear"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
arg_param_end arg_param_end
@ -296,7 +296,7 @@ static int CmdClear(const char *Cmd) {
static command_t CommandTable[] = { static command_t CommandTable[] = {
{"help", CmdHelp, AlwaysAvailable, "Use `" _YELLOW_("<command> help") "` for details of a command"}, {"help", CmdHelp, AlwaysAvailable, "Use `" _YELLOW_("<command> help") "` for details of a command"},
{"preferences", CmdPref, AlwaysAvailable, "{ Edit client/device preferences... }"}, {"preferences", CmdPref, AlwaysAvailable, "{ Edit client/device preferences... }"},
{"--------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("Technology") " -----------------------"}, {"--------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("Technology") " -----------------------"},
{"analyse", CmdAnalyse, AlwaysAvailable, "{ Analyse utils... }"}, {"analyse", CmdAnalyse, AlwaysAvailable, "{ Analyse utils... }"},
{"data", CmdData, AlwaysAvailable, "{ Plot window / data buffer manipulation... }"}, {"data", CmdData, AlwaysAvailable, "{ Plot window / data buffer manipulation... }"},

View file

@ -330,7 +330,7 @@ static int smart_responseEx(uint8_t *out, int maxoutlen, bool verbose) {
memcpy(payload->data, cmd_getresp, sizeof(cmd_getresp)); memcpy(payload->data, cmd_getresp, sizeof(cmd_getresp));
clearCommandBuffer(); clearCommandBuffer();
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + sizeof(cmd_getresp)); SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + sizeof(cmd_getresp));
free(payload); free(payload);
datalen = smart_wait(out, maxoutlen, verbose); datalen = smart_wait(out, maxoutlen, verbose);
@ -439,7 +439,7 @@ static int CmdSmartRaw(const char *Cmd) {
} }
clearCommandBuffer(); clearCommandBuffer();
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + dlen); SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + dlen);
if (reply == false) { if (reply == false) {
goto out; goto out;
@ -459,7 +459,7 @@ static int CmdSmartRaw(const char *Cmd) {
data[4] = buf[1]; data[4] = buf[1];
memcpy(payload->data, data, dlen); memcpy(payload->data, data, dlen);
clearCommandBuffer(); clearCommandBuffer();
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + dlen); SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + dlen);
len = smart_response(buf, PM3_CMD_DATA_SIZE); len = smart_response(buf, PM3_CMD_DATA_SIZE);
@ -858,7 +858,7 @@ static void smart_brute_prim(void) {
memcpy(payload->data, get_card_data + i, 5); memcpy(payload->data, get_card_data + i, 5);
clearCommandBuffer(); clearCommandBuffer();
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + 5); SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + 5);
free(payload); free(payload);
int len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false); int len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false);
@ -901,7 +901,7 @@ static int smart_brute_sfi(bool decodeTLV) {
memcpy(payload->data, READ_RECORD, sizeof(READ_RECORD)); memcpy(payload->data, READ_RECORD, sizeof(READ_RECORD));
clearCommandBuffer(); clearCommandBuffer();
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + sizeof(READ_RECORD)); SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + sizeof(READ_RECORD));
len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false); len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false);
@ -910,7 +910,7 @@ static int smart_brute_sfi(bool decodeTLV) {
memcpy(payload->data, READ_RECORD, sizeof(READ_RECORD)); memcpy(payload->data, READ_RECORD, sizeof(READ_RECORD));
clearCommandBuffer(); clearCommandBuffer();
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + sizeof(READ_RECORD)); SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + sizeof(READ_RECORD));
len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false); len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false);
READ_RECORD[4] = 0; READ_RECORD[4] = 0;
@ -952,7 +952,7 @@ static void smart_brute_options(bool decodeTLV) {
memcpy(payload->data, GET_PROCESSING_OPTIONS, sizeof(GET_PROCESSING_OPTIONS)); memcpy(payload->data, GET_PROCESSING_OPTIONS, sizeof(GET_PROCESSING_OPTIONS));
clearCommandBuffer(); clearCommandBuffer();
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + sizeof(GET_PROCESSING_OPTIONS)); SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + sizeof(GET_PROCESSING_OPTIONS));
free(payload); free(payload);
int len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false); int len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false);
@ -1054,7 +1054,7 @@ static int CmdSmartBruteforceSFI(const char *Cmd) {
memcpy(payload->data, cmddata, hexlen); memcpy(payload->data, cmddata, hexlen);
clearCommandBuffer(); clearCommandBuffer();
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + hexlen); SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + hexlen);
free(payload); free(payload);
int len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false); int len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false);
@ -1138,7 +1138,7 @@ int ExchangeAPDUSC(bool verbose, uint8_t *datain, int datainlen, bool activateCa
memcpy(payload->data, datain, datainlen); memcpy(payload->data, datain, datainlen);
clearCommandBuffer(); clearCommandBuffer();
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + datainlen); SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + datainlen);
int len = smart_responseEx(dataout, maxdataoutlen, verbose); int len = smart_responseEx(dataout, maxdataoutlen, verbose);
if (len < 0) { if (len < 0) {
@ -1155,7 +1155,7 @@ int ExchangeAPDUSC(bool verbose, uint8_t *datain, int datainlen, bool activateCa
datain[4] = dataout[len - 1]; datain[4] = dataout[len - 1];
memcpy(payload->data, datain, 5); memcpy(payload->data, datain, 5);
clearCommandBuffer(); clearCommandBuffer();
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + 5); SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + 5);
datain[4] = 0; datain[4] = 0;
len = smart_responseEx(dataout, maxdataoutlen, verbose); len = smart_responseEx(dataout, maxdataoutlen, verbose);
} }

View file

@ -695,7 +695,7 @@ int mfStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBl
mem[4] = (chunk & 0xFF); mem[4] = (chunk & 0xFF);
// upload to flash. // upload to flash.
res = flashmem_spiffs_load((char*)destfn, mem, 5 + (chunk * 6)); res = flashmem_spiffs_load((char *)destfn, mem, 5 + (chunk * 6));
if (res != PM3_SUCCESS) { if (res != PM3_SUCCESS) {
PrintAndLogEx(WARNING, "\nSPIFFS upload failed"); PrintAndLogEx(WARNING, "\nSPIFFS upload failed");
free(mem); free(mem);
@ -1226,7 +1226,7 @@ int detect_mfc_ev1_signature(uint8_t *signature) {
uint8_t sign[32] = {0}; uint8_t sign[32] = {0};
uint8_t key[] = {0x4b, 0x79, 0x1b, 0xea, 0x7b, 0xcc}; uint8_t key[] = {0x4b, 0x79, 0x1b, 0xea, 0x7b, 0xcc};
int res = mfReadBlock(69, 1, key, sign); int res = mfReadBlock(69, 1, key, sign);
if ( res == PM3_SUCCESS) { if (res == PM3_SUCCESS) {
res = mfReadBlock(70, 1, key, sign + 16); res = mfReadBlock(70, 1, key, sign + 16);
if (res == PM3_SUCCESS) { if (res == PM3_SUCCESS) {
memcpy(signature, sign, sizeof(sign)); memcpy(signature, sign, sizeof(sign));