Commit graph

335 commits

Author SHA1 Message Date
Romain Tartiere
f27352180c Complete ISO 7816 compatibility for Mifare DESFire EV1
Fixes issue 37
2011-03-26 13:22:48 +00:00
Romain Tartiere
b41f93cd5b Start support of ISO files for Mifare DESFire EV1.
Fixes issue 57
New API functions:
  * mifare_desfire_create_application_iso()
  * mifare_desfire_create_application_3k3des_iso()
  * mifare_desfire_create_application_aes_iso()
  * mifare_desfire_get_df_names()

Plus unit test to check this.
2011-03-25 16:49:36 +00:00
Romain Tartiere
c7dc9f0ccc New API functions mifare_desfire_create_application_3k3des(), mifare_desfire_create_application_aes().
Update issue 37
Only ISO application creation as requested by Issue 57 is lacking now.
2011-03-25 13:00:24 +00:00
Romain Tartiere
4b41f8b78b Update for 0.3.1. 2011-02-23 15:12:47 +00:00
Romain Tartiere
db489b6cb7 R is const. 2011-02-23 15:08:47 +00:00
Romain Tartiere
ca1fc02d6e Do not systematically build the tests if cutter is installed.
Building them only when running the test-suite is probably enough.
2011-02-13 14:26:18 +00:00
Romain Tartiere
45ea1f5009 Shorter is better. 2011-02-13 14:20:46 +00:00
Romain Tartiere
22e9854995 Do not abort on crypto error.
Because in some circumstances the crypto is skipped regardless of the
communication settings by the Mifare DESFire (e.g. when reading a file which is
writable with any key), do not abort if the crypto fail, and make it possible
to the user to catch such an event to fix his code accordingly.

Only display crypto diagnostic if compiled with debug support.
2011-02-13 14:13:35 +00:00
Romain Tartiere
04fe89e78c prevent myself from shooting in my own foot. 2011-02-13 12:52:08 +00:00
Romain Tartiere
7c8c818a08 Fix mifare_classic_transfer() with some readers. 2011-02-13 12:50:41 +00:00
Romain Tartiere
d9ed7f2c24 Fix CRC localisation code.
New issue
Summary: Add regression tests for CRC location in encyphered data files.
The CRC position location code in mifare_cryto_postprocess_data() shall be
checked.

new issue
Summary: Rework mifare_cryto_postprocess_data() CRC localisations
The function has two different implementation of the same feature: locate a CRC
at the end of a decyphered stream and check it.  The crc32 will fail if the
last CRC byte is 0x80, and the crc16 code looks awful.  A refactoring would
make our life easier.
2011-01-01 15:27:36 +00:00
Romain Tartiere
8628d59c5b Do not exit if the master key settings are not readable. 2011-01-01 12:46:45 +00:00
Romain Tartiere
f418845fb4 Make mifare_desfire_authenticate() a bit more magic.
If the provided key is a 3K3DES key, authenticate in ISO mode.  If the key is
an AES one, authenticate in AES mode.  This sugar should help third party
applications to handle authentication in a more generic way.
2010-12-31 12:47:55 +00:00
Romain Tartiere
c2cc0ba53d Move away global variables. 2010-12-31 10:53:05 +00:00
Romain Tartiere
899ed3d7bb Fix create_file2().
ECOPYPASTETOOFAST | EBADLUCKITSVALID: The argument communication_settings is
not to be used to construct the parameters passed to the crypto functions
mifare_cryto_preprocess_data() & mifare_cryto_postprocess_data(), but only for
building the frame.
2010-12-29 22:18:30 +00:00
Romain Tartiere
8caa2da31e Fix write_data() return value when data is enciphered.
We only have to return the number of bytes of raw data which are sent.
2010-12-29 22:05:08 +00:00
Romain Tartiere
2750ed668c Fix usage of a potentially reallocated memory area. 2010-12-29 21:44:26 +00:00
Romain Tartiere
f19d9bd05f Fix parenthesis position. 2010-12-28 11:42:24 +00:00
Romain Tartiere
82a7b8df66 Merge de libfreefare-ultralight branch into trunk (Mifare UltraLightC support). 2010-12-28 11:30:31 +00:00
Romain Tartiere
e4057ef163 Update man pages. 2010-12-26 15:46:07 +00:00
Romain Tartiere
12ad1a452a Set the default ATS instead of a custom one.
This prevent some tools to work properly with a card afterthat.
2010-12-25 09:46:56 +00:00
Romain Tartiere
06c052db36 Detect Mifare DESFire targets with more than one historical character. 2010-12-24 22:14:56 +00:00
Romain Tartiere
9a4b7b5882 New API function mifare_desfire_set_ats(). 2010-12-24 22:08:56 +00:00
Romain Tartiere
58f64b881e Simplify redundant code. 2010-12-24 22:08:15 +00:00
Romain Tartiere
9d8c991f50 Fix example. 2010-12-24 21:10:48 +00:00
Romain Tartiere
adbba0342b New API function mifare_desfire_set_default_key(). 2010-12-24 20:41:43 +00:00
Romain Tartiere
8ff63ea1f3 Commit files forgotten as part of r733. 2010-12-24 20:39:54 +00:00
Romain Tartiere
e587e26aeb Rename some internal functions.
A function with DES in its name that can perform AES crypto is somewhat
disturbing.
2010-12-24 14:10:44 +00:00
Romain Tartiere
7837fa967d Freshen out cut_assert_success() macro. 2010-12-24 13:59:28 +00:00
Romain Tartiere
3f6327ebca Fix headers for memset(). 2010-12-24 13:49:09 +00:00
Romain Tartiere
4c3f0cd7d0 Sync man pages. 2010-12-24 13:34:25 +00:00
Audrey Diacre
29c8ef5c07 replace last deprecated bzero function by memset. 2010-12-24 13:33:02 +00:00
Romain Tartiere
417052fb2f Create forgotten man pages symlinks. 2010-12-24 13:24:13 +00:00
Romain Tartiere
01fff97d6c Add support for ISO authentication with 3DES keys. 2010-12-24 13:04:16 +00:00
Romain Tartiere
c5b893321e libfrefare: Use local ivect in test.
It looks like finally a global variable modified by a test can impact another
test.
2010-12-24 12:58:44 +00:00
Romain Tartiere
8d492abf5d Change the enciphered_data_length() internal function prototype. 2010-12-24 12:38:52 +00:00
Romain Tartiere
0d8a53308c Change the mifare_cbc_des() internal function prototype. 2010-12-24 11:41:15 +00:00
Romain Tartiere
873fd7dd3b Update the NEWS file regarding the mifare_desfire_get_file_settings() buffer overflow fixed in 0.2.3 (update versions). 2010-12-23 18:05:47 +00:00
Romain Tartiere
ee2fd54fa6 Bump version for the 0.3.x series. 2010-12-23 18:02:05 +00:00
Romain Tartiere
dd5156a997 Reindent. 2010-12-18 13:32:05 +00:00
Romain Tartiere
b300ef5fcf Update the MifareDirection structure for consistency. 2010-12-18 03:11:05 +00:00
Romain Tartiere
ebd98b32e0 Switch from obscure 'int mac' argument to 'MifareCryptoOperation operation'. 2010-12-18 03:07:16 +00:00
Romain Tartiere
683cbdf64f Rename mifare_desfire_authenticate.c to mifare_desfire_crypto.c. 2010-12-18 02:50:38 +00:00
Romain Tartiere
d098bf623f Add support for authentication using 3K3DES.
Please note that according to the NXP documentation of the Mifare DESFire EV1,
the mifare_desfire_authenticate_iso() function can be used using either 3DES or
3K3DES keys.  The former has not been tested yet and is likely not to work. To
word it differently, this is a 3K3DES crypto support, not a ISO authentication
support...
2010-12-18 02:28:27 +00:00
Romain Tartiere
f06b0ac5d3 Ignore the status code when deciphering (3)DES data. 2010-12-18 02:14:51 +00:00
Romain Tartiere
373cb4f0ef Rewrite some tests using switch statements.
Add a note for the reason I do this in the HACKING file.
2010-12-18 02:07:56 +00:00
Romain Tartiere
1d3c3f5dfd Improve the way data with already a CRC is preprocessed. 2010-12-18 01:52:48 +00:00
Romain Tartiere
79f6cb20e5 Update CMAC code to handle 64 and 128 bit keys. 2010-12-18 01:45:38 +00:00
Romain Tartiere
8d74401e87 Enlarge another buffer to workaround the read_data() buffer overrun. 2010-12-18 01:44:20 +00:00
Romain Tartiere
48b161d67c Invalidate authentication when changing the currently used key. 2010-12-18 01:32:56 +00:00