hf mfdes chk: track found keys per application
foundKeys was indexed [keytype][keyno] with no AID dimension and was never reset between applications, so a key number recovered on one AID was skipped without a single auth attempt on every later AID. On a card with AES key 00 set on two apps, only the first one was ever reported. Give every application its own desfire_app_keys_t and hand that to the checker. Saving to json now uses a new 'mfdes v2' format keyed by AID, with a loader that round-trips it; v1 is kept for existing files. Also in the same path: - one auth error below 7 broke out of the key number loop, abandoning every remaining key number for the AID. Only an algo mismatch (4, 50, 51) skips the key type now; an invalid key number (3) skips just that key number, and a transmit error retries after a reselect - 3TDEA keys were stored 16 bytes wide and written out as 24 - -k with a 24 byte key was rejected by the parser, making the 24 byte branch unreachable - DesfireGetAIDList() wrote unbounded into a 78 byte app_ids buffer Co-Authored-By: Claude Opus 5 (1M context)
This commit is contained in:
1 parent
f5d50bb9d7
commit
2cd5285cb2
5 files changed
+284
-157
No files matched your search
@@ -33,6 +33,14 @@
|
||||
#include "cmdhftopaz.h" // TOPAZ defines
|
||||
#include "mifare/mifaredefault.h" // MFP / AES defines
|
||||
#include "iso15.h" // iso15_tag_t
|
||||
#include "desfire.h" // desfire_app_keys_t
|
||||
|
||||
// keys recovered from a DESFire PICC by `hf mfdes chk`, one entry per application
|
||||
typedef struct {
|
||||
iso14a_card_select_t card_info;
|
||||
uint8_t appcount;
|
||||
desfire_app_keys_t app[DESFIRE_MAX_APP_COUNT];
|
||||
} desfire_keys_dump_t;
|
||||
|
||||
typedef union {
|
||||
void *v;
|
||||
@@ -42,6 +50,7 @@ typedef union {
|
||||
iso14a_mf_extdump_t *mfc;
|
||||
iso14a_mf_dump_ev1_t *mfc_ev1;
|
||||
iso15_tag_t *iso15;
|
||||
desfire_keys_dump_t *mfdes;
|
||||
} udata_t;
|
||||
|
||||
typedef enum {
|
||||
@@ -69,6 +78,7 @@ typedef enum {
|
||||
jsfMfPlusKeys,
|
||||
jsfCustom,
|
||||
jsfMfDesfireKeys,
|
||||
jsfMfDesfireKeys_v2,
|
||||
jsfEM4x05,
|
||||
jsfEM4x69,
|
||||
jsfEM4x50,
|
||||
|
||||
Reference in new issue
Block a user