libnfc changed its nfc_initiator_transceive_bytes(): it now takes a const size_t used as maximal allowed rx bytes.
libnfc now checks if rx buffer is large enough to get the full response, so libfreefare should take care about whole size of its buffers.
mifare_desfire.c:196: warning: no previous prototype for
'madame_soleil_get_read_communication_settings'
mifare_desfire.c:210: warning: no previous prototype for
'madame_soleil_get_write_communication_settings'
mifare_desfire.c:642: warning: no previous prototype for
'create_application'
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.
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.
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.
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.
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...
The create_application() function has iso_ parameters for creating ISO
application but this mode is not available yet so the code is unused which
annoys the compiler when told to be somewhat strict.
For Mifare DESFire EV1 support, we need to know when the user has called
mifare_desfire_select_application() after being authenticated and before
authenticated again.
Some cryptographic operations are performed on the whole data frame and not
only the payload with Mifare DESFire EV1. The solution for now is not perfect,
(one new macro wrapping another big macro) but makes the code a bit easier to
read, and with the MIFARE_DESFIRE macro rewriting as a function (at some point
in the future), the whole should be bearable :-)
This have been done for consistency with other targets support, but
cryptographic operations with Mifare DESFire EV1 tags would require to swap
again this byte because MACing is performed on the following data (in this
order):
- Plain data
- Status
- Padding