Commit graph

71 commits

Author SHA1 Message Date
Philippe Teuwen
024fca9cb7 make style 2017-04-01 00:46:12 +02:00
Simon Yorkston
6c44c20ffc Adding support for 4K magic cards 2017-03-01 18:41:16 +01:00
Philippe Teuwen
04ef5ca902 Reduce variables scopes 2017-02-18 22:20:15 +01:00
Philippe Teuwen
e4df2f3334 astyle 2017-02-18 13:05:59 +01:00
Philippe Teuwen
c5e8adc169 mfclassic: avoid hardcoded offsets & sizes 2017-02-17 11:31:13 +01:00
Philippe Teuwen
295c70911a Restrict MFC Mini detection according to AN10833 2017-02-16 22:31:10 +01:00
Olliver Schinagl
e1a25a8203 nfc-mfclassic: Add option to specify key
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>
2016-05-11 09:38:39 +02:00
Olliver Schinagl
898f3a4d2f nfc-mfclassic: check argc < 4 only once
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>
2016-05-11 09:38:39 +02:00
quantum-x
758cb0cc05 Update nfc-mfclassic.c 2015-11-03 18:52:39 +01:00
quantum-x
c71d7267ac Update nfc-mfclassic.c
Tweaking back the unlocked_read / write_block_zero after magic2 card discovered
2015-11-03 18:48:22 +01:00
quantum-x
20f22b97e7 Updating nesting typo 2015-11-03 18:39:03 +01:00
quantum-x
b5684c1755 Removing typo
Removing typo
2015-11-03 18:33:53 +01:00
quantum-x
87c6053d6f Updating nfc-mfclassic.c
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.
2015-11-03 18:11:51 +01:00
Adam Laurie
b978c45a11 tolerate errors when writing as well as reading 2014-05-25 16:39:47 +01:00
Philippe Teuwen
7a30e35496 nfc-mfclassic: update help & man page 2014-01-28 00:22:33 +01:00
Philippe Teuwen
4817a6e5c9 make style 2013-12-02 22:55:10 +01:00
Philippe Teuwen
b8e0eec91d nfc-mfclassic: initialize always bFormatCard 2013-11-12 00:43:25 +01:00
Adam Laurie
250068462b add format/wipe command to nfc-mfclassic 2013-11-11 22:03:09 +00:00
Philippe Teuwen
61884967ea nfc-mfclassic: verify return of nfc_initiator_select_passive_target()
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)".
2013-09-22 02:45:23 +02:00
Philippe Teuwen
a4f466df06 Verify return of nfc_device_set_property_bool()
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)".
2013-09-22 02:41:11 +02:00
Philippe Teuwen
d9b531f50f Verify return of nfc_device_set_property_bool()
Problem reported by Coverity
CID 1090319 (#1 of 1): Unchecked return value (CHECKED_RETURN)
  unchecked_value: No check of the return value of "nfc_device_set_property_bool(pnd, NP_EASY_FRAMING, nt.nti.nai.btSak & 0x20)".
CID 1090320 (#1 of 1): Unchecked return value (CHECKED_RETURN)
  unchecked_value: No check of the return value of "nfc_device_set_property_bool(dev, NP_HANDLE_CRC, false)".
CID 1090324 (#1 of 2): Unchecked return value (CHECKED_RETURN)
  unchecked_value: No check of the return value of "nfc_device_set_property_bool(pnd, NP_ACTIVATE_FIELD, true)".
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)".
2013-09-22 01:31:45 +02:00
Philippe Teuwen
bb5b712a74 Adding link to AUTHORS in the copyright headers 2013-07-17 13:57:56 +02:00
Philippe Teuwen
0841a94c65 nfc-mfclassic: allow option f for read operation too 2013-04-09 23:42:55 +02:00
Romuald Conty
e6ab66037d Better support for some special chinese cards
Fixes issue 190
2013-04-05 11:29:31 +02:00
Philippe Teuwen
e70a3314bf Update ChangeLog & make style 2013-03-12 17:07:09 +01:00
Philippe Teuwen
20e51e9752 nfc-mfclassic: add option to allow using keyfile from another card 2013-03-12 15:39:57 +01:00
Philippe Teuwen
16161e1a68 nfc-mfclassic: detect 2K MFP via RATS 2013-03-12 14:15:04 +01:00
Philippe Teuwen
56ea2e65dc nfc-mfclassic: use smaller files for cards < 4k 2013-03-12 10:56:57 +01:00
Philippe Teuwen
94617366a7 nfc-mfclassic: abort if expected UID is not matching real card 2013-03-12 10:56:20 +01:00
Philippe Teuwen
bb7b05681e nfc-mfclassic: fix reporting of processed blocks number 2013-03-12 10:55:45 +01:00
Philippe Teuwen
bf164220ee Unify copyright notices & update authors lists 2013-03-10 16:15:23 +01:00
Alex Lian
c72846e3c6 Convert by value passing of nfc_target to pointer for str_nfc_target and nfc_initiator_target_is_present
This becomes more consistent with all other pass by pointer of most structures.
Additionally, this should lessen stack memory usage, as building strings with str_nfc_target would push the target (283 bytes) plus then a copy of the info objects (up to 275) onto the stack as it dives into the sprintf functions.

Lastly, this makes my attempt at a .NET wrapper easier, as I can make passing by pointer work, but passing by value seems to bomb on the interop right now.
2013-03-07 09:16:33 +01:00
Philippe Teuwen
f0d5896140 Fix cppcheck style: "The scope of the variable can be reduced" 2013-03-06 11:02:47 +01:00
Philippe Teuwen
4769392157 Fix cppcheck style: scope of variable can be reduced
Fix the following cppcheck warnings:
[libnfc/drivers/pn532_uart.c:492]: (style) The scope of the variable 'res' can be reduced
[libnfc/chips/pn53x.c:320]: (style) The scope of the variable 'res' can be reduced
[libnfc/chips/pn53x.c:616]: (style) The scope of the variable 'res' can be reduced
[libnfc/nfc.c:356]: (style) The scope of the variable '_device_found' can be reduced
[utils/nfc-mfclassic.c:178]: (style) The scope of the variable 'key_index' can be reduced
2013-03-06 00:35:36 +01:00
Philippe Teuwen
73b5c9d0af nfc_init() return rather than exit on malloc error, examples fixed accordingly 2013-03-05 22:24:59 +01:00
Philippe Teuwen
bece73faaf Error conditions in utils & examples: fix leaks, unify style (see details)
* in main():
** errx()/err()/return -> exit()
** return values -> EXIT_SUCCESS & EXIT_FAILURE

* out of main:
** err()/errx()/exit() -> return
** change retval from size_t to int to allow returning errors
** don't use EXIT_SUCCESS / EXIT_FAILURE as retvals

* add nfc_close() & nfc_exit() to exit() on errors
* add missing fclose() on errors
* add missing test if (pnd == NULL)
* unify style if (pnd == / != NULL)
* remove goto's
* few related fixes
* remove if(pnd!=NULL) test on nfc_close() calls
2013-03-05 19:44:59 +01:00
Philippe Teuwen
b1448f6785 nfc-mfclassic: add option to tolerate RW errors & other enhancements
Reconciliate read & write operations.
Add option to tolerate or not RW failures.
Print success/failure for each block as ACL is per block.
2013-03-02 22:29:10 +01:00
Ludovic Rousseau
bd8a9fe96e Remove dead code
The local variable bFailure is set before a return.

nfc-mfclassic.c:319:11: warning: Value stored to 'bFailure' is never read
          bFailure = true;
          ^          ~~~~
2013-03-02 13:24:12 +01:00
Philippe Teuwen
386e08d8b3 Fix nfc_initiator_select_passive_target() in several utils if tag is missing 2013-02-01 20:52:49 +01:00
Romuald Conty
5b0e276572 Examples and utils are now updated to use the requiered nfc_context 2012-12-05 00:51:13 +01:00
Romuald Conty
3ee77eb79e Fix *transceive*() calls from examples and utils (bug introduced in previous commit) 2012-11-24 13:00:23 +01:00
Romuald Conty
9afa3c6598 Use copyright format recommended by GNU project.
http://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html
2012-10-21 14:09:16 +00:00
Romuald Conty
310d7eba07 New str_nfc_target() function in API.
This allow to convert a nfc_target struct into allocated string.
2012-09-17 13:47:54 +00:00
Romuald Conty
ce443d50ca Rename abtUid from struct mifare_param_auth into abtAuthUid: this is not the UID while using 7-bytes UID MIFARE Classic tags. 2012-06-03 21:02:54 +00:00
Philippe Teuwen
01303fab0d astyle --formatted --mode=c --indent=spaces=2 --indent-switches --indent-preprocessor --keep-one-line-blocks --max-instatement-indent=60 --brackets=linux --pad-oper --unpad-paren --pad-header 2012-05-29 15:54:36 +00:00
Philippe Teuwen
562205cc14 astyle --formatted --mode=c --indent=spaces=2 --indent-switches --indent-preprocessor --keep-one-line-blocks --max-instatement-indent=60 --brackets=linux --pad-oper 2012-05-29 15:54:00 +00:00
Philippe Teuwen
a2cd236441 astyle --formatted --mode=c --indent=spaces=2 --indent-switches --indent-preprocessor --keep-one-line-blocks --max-instatement-indent=60 2012-05-29 15:52:51 +00:00
Romuald Conty
26865bbc19 Remove extra whitespaces/tabs before EOL.
find . -name '*.[ch]' | xargs perl -pi -e 's/\t+$//; s/ +$//'

Thanks to Ludovic.
2012-05-29 00:33:22 +00:00
Romuald Conty
2c9275adde nfc_initiator_transceive_bytes() now take a constant size for Rx buffer to have a cleaner API: no more in/out parameters 2012-05-27 21:06:22 +00:00
Romuald Conty
3eba0e9b54 Prepare libnfc 1.6.0-rc1 2012-03-01 12:00:23 +00:00