This should avoid failure in some advanced use cases and when the example will be able to add user-provided data without data-loss.
Suggested by: Romuald Conty <rconty@il4p.fr>
The code can work with virtually any size of DESFire (since the operating
system embedded in the card handle almost everything), so there is no need for
us to distinguish cards of different sizes.
- mifare_classic_format_sector() now wants a sector instead of a block (the name was really disturbing);
- New public API functions for Block <=> Sector conversions.
- New mifare_classic_first_sector_block(), mifare_classic_last_sector_block() functions to ease detection of sectors boundaries;
- New unit tests for mifare_classic_first_sector_block() and mifare_classic_last_sector_block();
- Start to update the API for consistently using blocks and not mixing blocks and sectors with mifare_classic_*() functions;
- Update the mifare-classic-format(1) example to handle MIFARE Classic 1k and 4k.
Many thanks to Johann Dantant from SpringCard for giving me MIFARE Classic 4k cards.
- Factorize Mifare*Tag as MifareTag;
- Factorize mifare_*_get_tags() / mifare_*_free_tags() as freefare_get_tags() and freefare_free_tags();
- Add a new freefare_get_tag_type() function to get a tag type;
- Update regression test suite;
- Update example.
While this is a major change that basically change all the API, programs using libfreefare should be easily modified by replacing any Mifare*Tag variable by a generic MifareTag one, adding a few lines of code to check the target's type using freefare_get_tag_type(), and changing any call to mifare_*_get_tags() / mifare_*_free_tags() by the generic freefare_get_tags() and freefare_free_tags() functions.