Skip to content

Commit

Permalink
multiple fixes for 2K and 4K cards (dotnet#2028)
Browse files Browse the repository at this point in the history
* multiple fixes for 2K and 4K cards

The last 8 sectors of a 4K card have 16 blocks per sector. There are still only 4 sets of
access control bits, so they apply to groups of blocks: (0-4, 5-9, 10-14, and 15).
Added some helper functions to map block numbers of sector and group, and use these
in the sector trailer encode/decode functions instead of blocknumber%4.

Fixed the spelling error of EncodeSectorAndClockTailer() by renaming to EncodeSectorAndBlockTailer()
and adding a synonym for the old name.

Fixed an error in FormatNdef for 2K and 4K cards - it was writing block 3 a second
time rather than writing block 67.

Renamed the first parameter of SetCapacity from ATAQ to ATQA.

fixed CRC byte for MAD directory in sector 16
write all four blocks in sector 16
re-factor writing of all NFC sector trailers

Rename blockNumber to blockGroup in DecodeSectorTailer
Treat KeyA in AuthenticateBlockKeyA the same as KeyB in AuthenticateBlockKeyB

* addressing review comments
  • Loading branch information
jdbruner authored Feb 16, 2023
1 parent a21e403 commit c73a9f6
Showing 1 changed file with 119 additions and 87 deletions.
Loading

0 comments on commit c73a9f6

Please sign in to comment.