when writing to gen2 and possible on gen3, it writes first block 3 wich is the trailing sector before writing to block 0, so the last write to block 0 fails because authenticate to old keyset
nfc-mfclassic.c:623:6: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
bool is_directwrite()
^~~~~~~~~~~~~~
nfc-mfclassic.c: In function ‘is_directwrite’:
nfc-mfclassic.c:623:6: warning: old-style function definition [-Wold-style-definition]
Adding support for extended Magic cards:
- DirectWrite cards
- One Time Write cards
Direct Write cards support modification of B0 directly, without any unlock codes. When we are attempting to detect if a card is 'magic', we will attempt to modify B0 directly as an initial check.
One Time Write cards support modification of B0 directly, one time only. They do not respond to magic commands, but have a fixed UID coming out of the factory. We now detect this UID, and if so, deem the card 'magic'.
The nfc-mfclassic utility will pick a seemingly random (the libnfc
default which seems to be the lowest UID). With the new (u|U) options
it is now possible to force a UID and thus write a specific tag, which
can be very useful if there are more then one tag visible.
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Currently the check on argc is done twice, once in each if branch. This
is silly and we can just check once and fail right away.
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Modifying behavior relating to magic cards.
If a user has a 'magic2' card (IE, direct-write, not a 'fully magic' card) - we'll warn them that they don't need to use the W / R modes, and then proceed with the unlock operation, instead of exiting.
Problem reported by Coverity:
CID 1090323 (#1 of 1): Unchecked return value (CHECKED_RETURN)
unchecked_value: No check of the return value of "nfc_initiator_select_passive_target(pnd, nmMifare, nt.nti.nai.abtUid, nt.nti.nai.szUidLen, NULL)".
Problem reported by Coverity:
CID 1090325 (#1 of 1): Unchecked return value (CHECKED_RETURN)
unchecked_value: No check of the return value of "nfc_device_set_property_bool(pnd, NP_AUTO_ISO14443_4, false)".