[NFC] Fix MIFARE Plus 2K SL1 transit parsers (#1037)#1038
Merged
Conversation
After #1016 promoted genuine MIFARE Plus S/X 2K cards in SL1 (SAK 0x08 + Plus ATS) from MfClassicType1k to the new MfClassicType2k, the supported- card parsers for those cards stopped working: - Type gates (get_card_config / extract_purse_data) knew only 1K/4K, so parse() rejected 2K -- plantain, troika. - mf_classic_is_card_read() now needs all 32 sectors / 64 keys for a 2K card, so a targeted read() that keys only its own sectors returns MfClassicErrorPartialRead -> is_read = false -> the app diverts to the dict-attack scene and never reaches parse() -- sevppk, szppk_so, two_cities (and the above). Handle MfClassicType2k explicitly as the Classic 1K these cards present (same lower-sector keys / data sector), and accept a partial read in the plugins' read() so parse() runs and validates the key. social_moscow / kazan (plain Classic) and sk_tk (4K) are not promoted to 2K and are left unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🤖 Build & analyze —
|
| Metric | Size |
|---|---|
| Firmware (flash) | 855.17 KiB |
| DFU image | 855.47 KiB |
| Reserved — radio stack + FUS | 164.00 KiB |
| Free flash (usable) | 4.83 KiB |
| RAM (.data + .bss) | 7.94 KiB |
1 MiB flash = firmware + usable free + radio/FUS. The BLE coprocessor stack sits at the top of flash (load addr 0x080D7000); the linker's .free_flash (168.83 KiB) counts that region as free, so usable free = .free_flash − reserved (164.00 KiB).
📋 Public API changes
✅ No public API changes in this PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #1037. After #1016 introduced
MfClassicType2kand promoted genuine MIFARE Plus S/X 2K cards in SL1 (SAK 0x08 + Plus ATS) fromMfClassicType1k, the supported-card parsers for those cards broke.Root cause
*_get_card_config()/ type-branched extraction accepted only 1K/4K, soparse()rejected 2K (plantain, troika).mf_classic_is_card_read()needs 32 sectors/64 keys for 2K (was 16/32). A targetedread()keying only its own sectors returnsMfClassicErrorPartialRead→is_read=false→ the app diverts to the dict-attack scene and never reachesparse()(sevppk, szppk_so, two_cities).Fix
Treat
MfClassicType2kas the Classic 1K these cards present (same lower-sector keys/data sector) and accept a partial read:get_card_config+extract_purse_data; acceptPartialReadget_card_config; acceptPartialReadPartialRead(parse is type-independent)social_moscow/kazan(plain Classic) andsk_tk(4K) aren't promoted to 2K → unchanged.Testing
fbt fap_{plantain,troika,szppk_so,two_cities,sev_tk}_parserbuilds clean. On-hardware validation with real cards still pending.Closes #1037
🤖 Generated with Claude Code