Commit graph

67 commits

Author SHA1 Message Date
Romain Tartiere
93011b4c07 Use the actual UID length to select a target.
Without it, the libfreefare cannot use 4-bytes-long random UIDs of Mifare
DESFire EV1.
2010-10-01 19:32:03 +00:00
Romain Tartiere
a77fa7ae4a Switch back to InDataExchange() for Mifare DESFire cards.
Wrapping all frames in ISO7816-4 ADPU workarounds the P3 (Lc) > 0xFA limitation
of the PN531.
2010-10-01 18:13:49 +00:00
Romain Tartiere
9a2a07ea53 Enhance error reporting.
Now that the libnfc has error handling, report errors triggered in the libnfc
and add support for errors triggered in libfreefare.
2010-09-28 19:01:28 +00:00
Romain Tartiere
91d3ff9cc4 Implement ISO14443-4 block numbers.
This feature was not used by the cards I initially used when coding the
, but is required for (at least some) Mifare DESFire EV1 to work.

IMPORTANT NOTE: The cards needing this block-number management to work out
break-down when mifare_desfire_format_picc() is performed on them.  The ATR
change from 0x7577810280 to 0x757781028f and further communication alway result
in a timeout.  At the time of committing, the reason is still unknown (bogus
cards, missed "Remarks" in the documentation, ...).  Other commands seems to
not expose additional problems.
2010-09-28 16:37:25 +00:00
Romain Tartiere
b6a4982102 Attempt to detect and use CoreFoundation's headers for endianness conversions on Mac OS X.
PR:		Issue 21
Submitted by:	MathewMcBride47
2010-09-04 11:06:14 +00:00
Romain Tartiere
7b9242e935 Reindent (2/2).
Align cases with switch statements.
Ça y est!  Le code est beau!
2010-09-03 18:04:12 +00:00
Romain Tartiere
af061a3c1a Reindent (1/2).
After trying to tweak gindent so that it does not mess-up my ASCII art, give
and read the help of Vim to setup 'cinoptions' according to my needs
(cino=t0(0).  This changeset reindent some bits that where not indented as they
should.  A future commit will reindent the switch/case according to my (bad)
taste now that I have setup cindent correctly on my system (cino=t0(0:0).
2010-09-03 18:01:02 +00:00
Romain Tartiere
036d2956f4 Update nfc_initiator_transceive_bytes() vs. nfc_initiator_transceive_dep_bytes().
nfc_initiator_transceive_dep_bytes() was removed, and
nfc_initiator_transceive_bytes() is now configured to behave like the one or
the other of the original functions.  For details, see:
http://code.google.com/p/libnfc/source/detail?r=592
2010-09-03 16:13:46 +00:00
Romain Tartiere
4abbb46515 Implement file settings caching.
For the regression test-suite test_mifare_desfire, it's a ~11% performance
boost, with 206 cache hits out of 488 calls to
mifare_desfire_get_file_settings().
2010-08-31 11:08:33 +00:00
Romain Tartiere
8171dd3960 Remove an irrelevant FIXME.
The check is already done by the PICC and we may not have access to the
required information to do the check from the library. Additionally, the
mifare_desfire_change_key() would require different keys to operate if we
detected an error, so no recovery of any kind is possible.
2010-08-31 10:20:24 +00:00
Romain Tartiere
878af0e22a Remove extra semi-columns at end of macro definitions. 2010-08-31 10:08:40 +00:00
Romain Tartiere
f7c4d99868 Enhance communication settings detection failures detection. 2010-08-31 10:06:55 +00:00
Romain Tartiere
88a4cbbe53 Use a lower-level communication with Mifare DESFire targets.
Instead of uting nfc_initiator_transceive_dep_bytes() to transmit commands,
prepend an ISO-14443-4 header to it and send it using
nfc_initiator_transceive_bytes().  In case of WTX reply, handle it, and then
extract relevant information from the data returned by the PICC.

This prevents failure that happen with ISO-14443-4 compliant targets when using
a PN531-based NFC-device, and allows using the libfreefare with Mifare DESFire
targets on such devices.
2010-07-29 09:48:08 +00:00
Romain Tartiere
28b6ab7196 Move buffer macros to freefare_internal.h.
While here, tweak <libutil.h> include.
2010-07-29 07:58:25 +00:00
Romain Tartiere
61a5ff4e4a Reintroduce the possibility to hexdump(3) PCD <=> PICC transmissions.
Not a hack this time:
  - Use the hexdump(3) function of the system if it exists;
  - Build the subpart of FreeBSD's libutil if not (contrib);
  - Do this only if configured --with-debug.

The Mifare Classic / Ultralight code will be eventually changed to also provide this functionality.
2010-07-29 06:11:27 +00:00
Romain Tartiere
eca3c540ad Remove the FreeBSD hexdump(3) code.
It was used for easing up development but is not needed anymore.
2010-07-27 08:35:15 +00:00
Romain Tartiere
5779d6f945 Merge the freefare-desfire branch into trunk. 2010-07-26 21:48:18 +00:00