new ISO15693 dump file format with converters added. Needed since 0x100 pages and 8 byte blocks is possible

This commit is contained in:
iceman1001 committed 2026-08-29 11:19:39 +02:00
1 parent 80388c8fea
commit 0ae01a5331
4 files changed
+412 -57

No files matched your search

+51 -3
View File
@@ -24,6 +24,11 @@
#define ISO15693_UID_LENGTH 8
#define ISO15693_ATQB_LENGTH 7
// on-disk length of a raw iso15_tag_t dump, per struct revision. A .bin is
// identified by its length alone, so every revision needs a constant here.
#define ISO15_V4_DUMP_LENGTH 2235 // u8 pagesCount, locks[0xA0]
#define ISO15_V5_DUMP_LENGTH 2332 // u16 pagesCount, locks[0x100]
typedef struct {
uint8_t uid[ISO15693_UID_LENGTH];
uint8_t uidlen;
@@ -63,8 +68,23 @@ typedef struct {
uint8_t data[]; // concatenated response bytes
} PACKED iso15_inventory_response_t;
#define ISO15693_TAG_MAX_PAGES 160 // in pages (0xA0)
#define ISO15693_TAG_MAX_SIZE 2048 // in byte (64 pages of 256 bits)
// Two independent caps, not one expressed twice.
//
// MAX_PAGES sizes locks[], one byte per page. 0x100 is the real ceiling: a tag
// reports its block count in a single byte of the Get System Info
// response, so 256 blocks is as many as there can be.
// MAX_SIZE sizes data[], the whole payload.
//
// The product is what actually has to fit, and every load checks it:
//
// (pagesCount * bytesPerPage) > ISO15693_TAG_MAX_SIZE -> rejected
//
// so 2048 bytes covers 0x100 pages of 8, or 64 pages of 32 (256 bits), but not
// 0x100 pages of 16 or more. Tags with blocks larger than 8 bytes are therefore
// only supported up to 2048 bytes of memory. Raising this means raising
// CARD_MEMORY_SIZE too -- iso15_tag_t lives in BigBuf EM on the ARM.
#define ISO15693_TAG_MAX_PAGES 0x100 // in pages, one lock byte each
#define ISO15693_TAG_MAX_SIZE 2048 // in bytes, total payload
typedef struct {
uint8_t uid[8];
@@ -73,7 +93,7 @@ typedef struct {
uint8_t afi;
bool afiLock;
uint8_t bytesPerPage;
uint8_t pagesCount;
uint16_t pagesCount;
uint8_t ic;
uint8_t locks[ISO15693_TAG_MAX_PAGES];
uint8_t data[ISO15693_TAG_MAX_SIZE];
@@ -90,4 +110,32 @@ typedef struct {
bool expectFsk;
} PACKED iso15_tag_t;
// The previous on-disk layout. Kept so a v4 dump can be converted to the
// current struct instead of being rejected for having the wrong length.
// Note the state enum: v4 carries TAG_STATE_ACTIVATED, so the enumerators
// match iso15_tag_t one for one and `state` copies straight across.
typedef struct {
uint8_t uid[8];
uint8_t dsfid;
bool dsfidLock;
uint8_t afi;
bool afiLock;
uint8_t bytesPerPage;
uint8_t pagesCount;
uint8_t ic;
uint8_t locks[0xA0];
uint8_t data[ISO15693_TAG_MAX_SIZE];
uint8_t random[2];
uint8_t privacyPasswd[4];
enum {
TAGv4_STATE_NO_FIELD,
TAGv4_STATE_READY,
TAGv4_STATE_ACTIVATED, // useless ?
TAGv4_STATE_SELECTED,
TAGv4_STATE_SILENCED
} state;
bool expectFast;
bool expectFsk;
} PACKED iso15_tag_v4_t;
#endif // _ISO15_H_