less memory footprint

This commit is contained in:
iceman1001 2024-01-25 16:23:00 +01:00
commit 2288c7e72b
2 changed files with 9 additions and 7 deletions

View file

@ -2706,11 +2706,11 @@ OUT:
void MifareHasStaticEncryptedNonce(uint8_t block_no, uint8_t key_type, uint8_t *key) { void MifareHasStaticEncryptedNonce(uint8_t block_no, uint8_t key_type, uint8_t *key) {
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
LEDsoff();
clear_trace(); clear_trace();
set_tracing(true); set_tracing(true);
int retval = PM3_SUCCESS; int retval = PM3_SUCCESS;
uint8_t *uid = BigBuf_calloc(10);
uint64_t ui64key = bytes_to_num(key, 6); uint64_t ui64key = bytes_to_num(key, 6);
uint8_t data[1] = { NONCE_FAIL }; uint8_t data[1] = { NONCE_FAIL };
@ -2722,7 +2722,7 @@ void MifareHasStaticEncryptedNonce(uint8_t block_no, uint8_t key_type, uint8_t *
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN); iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
uint32_t cuid = 0; uint32_t cuid = 0;
if (!iso14443a_select_card(uid, NULL, &cuid, true, 0, true)) { if (iso14443a_select_card(NULL, NULL, &cuid, true, 0, true) == false) {
retval = PM3_ESOFT; retval = PM3_ESOFT;
goto OUT; goto OUT;
} }
@ -2745,14 +2745,16 @@ void MifareHasStaticEncryptedNonce(uint8_t block_no, uint8_t key_type, uint8_t *
goto OUT; goto OUT;
}; };
if (g_dbglevel >= DBG_INFO) if (g_dbglevel >= DBG_INFO) {
Dbprintf("nt: %x, nt encoded: %x", nt, ntenc); Dbprintf("nt: %x, nt encoded: %x", nt, ntenc);
}
if (oldntenc == 0) if (oldntenc == 0) {
oldntenc = ntenc; oldntenc = ntenc;
else if (ntenc == oldntenc) } else if (ntenc == oldntenc) {
enc_counter++; enc_counter++;
} }
}
if (enc_counter) { if (enc_counter) {
data[0] = NONCE_STATIC_ENC; data[0] = NONCE_STATIC_ENC;

View file

@ -75,7 +75,7 @@ static int CmdHelp(const char *Cmd);
// if key event, send break loop cmd to Pm3 // if key event, send break loop cmd to Pm3
int lfsim_wait_check(uint32_t cmd) { int lfsim_wait_check(uint32_t cmd) {
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(INFO, "Press " _GREEN_("pm3 button") " or press " _GREEN_("<Enter>") " to abort simulation"); PrintAndLogEx(INFO, "Press " _GREEN_("pm3 button") " or " _GREEN_("<Enter>") " to abort simulation");
for (;;) { for (;;) {
if (kbd_enter_pressed()) { if (kbd_enter_pressed()) {
@ -163,7 +163,7 @@ static int CmdLFTune(const char *Cmd) {
style = STYLE_VALUE; style = STYLE_VALUE;
PrintAndLogEx(INFO, "Measuring LF antenna at " _YELLOW_("%.2f") " kHz", LF_DIV2FREQ(divisor)); PrintAndLogEx(INFO, "Measuring LF antenna at " _YELLOW_("%.2f") " kHz", LF_DIV2FREQ(divisor));
PrintAndLogEx(INFO, "Press " _GREEN_("pm3 button") " or press " _GREEN_("<Enter>") " to exit"); PrintAndLogEx(INFO, "Press " _GREEN_("pm3 button") " or " _GREEN_("<Enter>") " to exit");
uint8_t params[] = {1, 0}; uint8_t params[] = {1, 0};
params[1] = divisor; params[1] = divisor;