Commit graph

101 commits

Author SHA1 Message Date
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
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
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
82a7b8df66 Merge de libfreefare-ultralight branch into trunk (Mifare UltraLightC support). 2010-12-28 11:30:31 +00:00
Romain Tartiere
8ff63ea1f3 Commit files forgotten as part of r733. 2010-12-24 20:39:54 +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
Audrey Diacre
29c8ef5c07 replace last deprecated bzero function by memset. 2010-12-24 13:33:02 +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
0d8a53308c Change the mifare_cbc_des() internal function prototype. 2010-12-24 11:41:15 +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
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
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
a6e52db696 Workaround invalid write in read_data () (sic)
This has to be improved to some extend in the near future (hence the FIXME).
2010-12-18 01:05:35 +00:00
Romain Tartiere
c9680fd7c7 Fix key_macing_length() return value when nbytes is 0. 2010-12-17 22:53:40 +00:00
Romain Tartiere
ed028d720a Fix the fix introduced at r697.
Yes, this type I typed 'make' before committing...
2010-12-17 22:45:56 +00:00
Romain Tartiere
0119a43208 Fix freed memory usage. 2010-12-17 22:38:51 +00:00
Romain Tartiere
94bf8d83c6 Fix mifare_desfire_get_key_version() when authenticated with an AES key. 2010-12-15 13:34:15 +00:00
Romain Tartiere
42f9457d9f Add support for Mifare DESFire EV1 with AES encryption. 2010-12-15 12:43:31 +00:00
Audrey Diacre
5133491c2c replace deprecated bzero function by memset. 2010-12-10 17:10:12 +00:00
Romain Tartiere
193809f949 Don't build libtestcommon.la if we are not using cutter. 2010-11-24 00:07:47 +00:00
Romain Tartiere
12de6ea4c4 Add forgotten files. 2010-11-23 18:42:25 +00:00
Romain Tartiere
c6f4343276 Fix autotools fun.
Tribute to Justice!
2010-11-23 18:38:10 +00:00
Romain Tartiere
b7a45b4da4 Use mifare_desfire_auto_authenticate() for authentication. 2010-11-21 00:32:38 +00:00
Romain Tartiere
02c9d33ce1 Move master key detection and authentication in a convenience library.
The autohell hack sucks and should be fixed, but I was unable to find the magic
trick to prevent automake from building broken libtool rules which produce
warnings about portability :-/.
2010-11-21 00:10:04 +00:00
Romain Tartiere
b932c923d5 Improve the test_mifare_rol() test. 2010-10-29 13:02:55 +00:00
Romain Tartiere
678b71edb0 Rename some macros for consistency. 2010-10-29 13:01:55 +00:00
Romain Tartiere
356219e21b Require the ivect to be provided to mifare_cbc_des().
- Store ivect in the struct mifare_desfire_tag;
- Reset it before and after authentication;
- Reset before each crypto operation (for now).
2010-10-29 12:22:47 +00:00
Romain Tartiere
13f03a60bb Change rol8() to rol() to work with buffers of any length. 2010-10-29 12:01:57 +00:00
Romain Tartiere
8dac813e53 New API function mifare_desfire_aid_get_aid(). 2010-10-17 20:21:06 +00:00
Romain Tartiere
07709c2835 New API function mifare_desfire_last_picc_error(). 2010-10-17 19:32:59 +00:00
Romain Tartiere
cf9f8d5246 Add missing file header & Id. 2010-10-08 11:43:04 +00:00
Romain Tartiere
53462219f4 Remove unused file.
The test in this file is already in test_mifare_desfire_des.c.
2010-10-08 11:41:52 +00:00
Romain Tartiere
a216a05299 Include fixture.h in fixture.c. 2010-10-08 11:34:50 +00:00
Romain Tartiere
8a477773f7 Rework OpenSSL usage.
- Lookup for crypto functions in libcrypto instead of libssl.  Some systems
  (Mac OS) do not provide libssl, and the other have crypto functions in
  libcrypto but libssl is dynamically linked against libcrypto:
  % ldd /usr/lib/libssl.so
  /usr/lib/libssl.so:
         libcrypto.so.6 => /lib/libcrypto.so.6 (0x800c00000)
         libc.so.7 => /lib/libc.so.7 (0x800647000)
- Do not explicitly link against libssl (instead of libcrypto BTW): the
  autotools magic already does this at some point;
- Improve error message when headers cannot be found.
2010-09-04 10:47:07 +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
d59e197ff9 Rename desfire_error_lookup() into mifare_desfire_error_lookup() for consistency with the rest of the code. 2010-09-03 11:24:25 +00:00
Romain Tartiere
a11d067d21 Free memory. 2010-09-03 11:13:29 +00:00
Romain Tartiere
087db1b298 New unit test to check Mifare DESFire AIDs containing a Mifare Classic AID. 2010-09-03 10:54:07 +00:00
Romuald Conty
1151ffdb7f fix test affected by r548. 2010-09-02 11:04:34 +00:00
Romain Tartiere
be45b25965 Remove Snappers workarounds: the bug is in the PN531 and has been fixed in r522. 2010-08-31 11:13:17 +00:00
Romain Tartiere
878af0e22a Remove extra semi-columns at end of macro definitions. 2010-08-31 10:08:40 +00:00
Romain Tartiere
e68ae59c5e Rename mad_application_(read|write) to mifare_application_(read|write).
Fixes issue 40.
2010-08-24 10:51:58 +00:00
Romain Tartiere
1f1db8692b Fix svn:keyword (I'll commit something to handle this automagically in ~2 commits). 2010-07-29 05:58:04 +00:00
Romain Tartiere
9872a1b087 Rename DESFIRE_4K to DESFIRE.
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.
2010-07-27 08:44:12 +00:00
Romain Tartiere
5779d6f945 Merge the freefare-desfire branch into trunk. 2010-07-26 21:48:18 +00:00