From 8456e41b02c5961674e6cc454574c46968a01438 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Thu, 25 Jan 2024 00:37:15 +0100 Subject: [PATCH] forgot the reverse part --- armsrc/iso15693.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/armsrc/iso15693.c b/armsrc/iso15693.c index 5d1c2e182..a4a806ae9 100644 --- a/armsrc/iso15693.c +++ b/armsrc/iso15693.c @@ -2137,11 +2137,21 @@ void SimTagIso15693(uint8_t *uid, uint8_t block_size) { reply_ng(CMD_HF_ISO15693_SIMULATE, PM3_EFAILED, NULL, 0); return; } - if (uid != NULL) { // new tag (need initialization) - uint8_t nullUid[8] = { 0 }; - if (memcmp(uid, nullUid, 8) != 0) { + + // new tag (need initialization) + if (uid != NULL) { + uint8_t empty[8] = { 0 }; + if (memcmp(uid, empty, 8) != 0) { // simulate a new tag bazed on client parameters - memcpy(tag->uid, uid, 8); + tag->uid[0] = uid[7]; // always E0 + tag->uid[1] = uid[6]; // IC Manufacturer code + tag->uid[2] = uid[5]; + tag->uid[3] = uid[4]; + tag->uid[4] = uid[3]; + tag->uid[5] = uid[2]; + tag->uid[6] = uid[1]; + tag->uid[7] = uid[0]; + tag->dsfid = 0; tag->dsfidLock = false; tag->afi = 0; @@ -2153,6 +2163,7 @@ void SimTagIso15693(uint8_t *uid, uint8_t block_size) { memset(tag->data, 0, sizeof(tag->data)); } } + if (tag->pagesCount > ISO15693_TAG_MAX_PAGES || \ tag->pagesCount * tag->bytesPerPage > ISO15693_TAG_MAX_SIZE || tag->pagesCount == 0 || tag->bytesPerPage == 0) {