From 5d34efc6e663a3f51937a6b6f84c36f4a2fda3c4 Mon Sep 17 00:00:00 2001 From: tharexde Date: Wed, 11 Nov 2020 22:36:24 +0100 Subject: [PATCH] =?UTF-8?q?Relocated=20write=20requests=20of=20function=20?= =?UTF-8?q?=E2=80=9E4x50=5Fwipe"=20from=20device=20to=20client?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- armsrc/appmain.c | 4 --- armsrc/em4x50.c | 62 ----------------------------------------------- armsrc/em4x50.h | 1 - include/pm3_cmd.h | 1 - 4 files changed, 68 deletions(-) diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 1fb2d2658..f06f30278 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -1107,10 +1107,6 @@ static void PacketReceived(PacketCommandNG *packet) { em4x50_read((em4x50_data_t *)packet->data.asBytes); break; } - case CMD_LF_EM4X50_WIPE: { - em4x50_wipe((uint32_t *)packet->data.asBytes); - break; - } case CMD_LF_EM4X50_BRUTE: { em4x50_brute((em4x50_data_t *)packet->data.asBytes); break; diff --git a/armsrc/em4x50.c b/armsrc/em4x50.c index 4c443dbc5..f2a0ce972 100644 --- a/armsrc/em4x50.c +++ b/armsrc/em4x50.c @@ -1111,68 +1111,6 @@ void em4x50_writepwd(em4x50_data_t *etd) { reply_ng(CMD_LF_EM4X50_WRITEPWD, res, 0, 0); } -void em4x50_wipe(uint32_t *password) { - - // set all data of EM4x50 tag to 0x0 including password - - bool bsuccess = false; - uint32_t addresses = 0x00001E01; // from fwr = 1 to lwr = 31 (0x1E) - uint32_t words[EM4X50_NO_WORDS] = {0x0}; - uint32_t zero = 0x0; - - em4x50_setup_read(); - - // set gHigh and gLow - if (get_signalproperties() && find_em4x50_tag()) { - - // login first - if (login(*password)) { - - // write 0x0 to each address but ignore addresses - // 0 -> password, 32 -> serial, 33 -> uid - for (int i = 1; i <= 33; i++) - write(zero, i); - - // to verify result -> reset EM4x50 - if (reset()) { - - // login not necessary because protected word has been set to 0 - // -> no read protected words - // -> selective read can be called immediately - if (selective_read(addresses, words)) { - - // check if everything is zero - bsuccess = true; - for (int i = 1; i <= 33; i++) - bsuccess &= (words[i] == 0); - - } - - if (bsuccess) { - - // so far everything is fine - // last task: reset password - if (login(*password)) { - - int res = write_password(*password, zero); - if (res == PM3_ETEAROFF) { - lf_finalize(); - return; - } - bsuccess = (res == PM3_SUCCESS); - } - // verify by login with new password - if (bsuccess) - bsuccess = login(zero); - } - } - } - } - - lf_finalize(); - reply_ng(CMD_LF_EM4X50_WIPE, bsuccess, 0, 0); -} - void em4x50_reset(void) { // reset EM4x50 diff --git a/armsrc/em4x50.h b/armsrc/em4x50.h index d1a94d662..a6030d7ba 100644 --- a/armsrc/em4x50.h +++ b/armsrc/em4x50.h @@ -23,7 +23,6 @@ void em4x50_info(em4x50_data_t *etd); void em4x50_write(em4x50_data_t *etd); void em4x50_writepwd(em4x50_data_t *etd); void em4x50_read(em4x50_data_t *etd); -void em4x50_wipe(uint32_t *password); void em4x50_brute(em4x50_data_t *etd); void em4x50_login(uint32_t *password); void em4x50_reset(void); diff --git a/include/pm3_cmd.h b/include/pm3_cmd.h index d90b78f60..10799cb13 100644 --- a/include/pm3_cmd.h +++ b/include/pm3_cmd.h @@ -507,7 +507,6 @@ typedef struct { #define CMD_LF_EM4X50_WRITE 0x0241 #define CMD_LF_EM4X50_WRITEPWD 0x0242 #define CMD_LF_EM4X50_READ 0x0243 -#define CMD_LF_EM4X50_WIPE 0x0244 #define CMD_LF_EM4X50_BRUTE 0x0245 #define CMD_LF_EM4X50_LOGIN 0x0246 #define CMD_LF_EM4X50_RESET 0x0247