nfc_magic: Fix support of 4K fobs #102
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's new
What's currently being added to the config structure was the total amount of blocks - as per this definition - which is
256.However, what needs to be sent is the
maximum sector data(as per the Proxmark3 Gen4 card notes). That's because the first block is0, not1. So if you need256blocks, you actually need to be able to write up to the 255th block - i.e. send255- well more specifically,0xFF.Effectively, this also "fixes" the fact that for each card being cloned, an extra sector was being provisioned as writable when using a Flipper Zero.
Why
I was having issues cloning an S70 fob (7b UID, 4k data), because as soon as it was written by the Flipper, it would be immediately read as a Mifare Mini 0.3k... I bought a Proxmark3, and after reading the backdoor config from the card, I saw that the
6Bsetting was set to0x00.That's because the config is a structure storing
uint8_t, so trying to store the amount of blocks (256) instead of the maximum sector data we need (255) was causing an integer overflow... Because obviously, storing256needs more than 8 bits.Verification
nfc_magicwith the change.0xFFand not0x00.Checklist (For Reviewer)