Commit graph

99 commits

Author SHA1 Message Date
gornekich
03f242618c mf plus: assert -> check in public API funxtion 2024-05-30 13:55:59 +01:00
gornekich
fd90567f0e mf plus: handle load and save errors 2024-05-30 13:49:27 +01:00
gornekich
5f7a139cff mf plus: fix return error codes 2024-05-30 12:54:05 +01:00
gornekich
bf41cc43a1 mf plus: fix read fail event handling 2024-05-29 18:23:34 +01:00
gornekich
ba0051967c mf plus: remove unused code 2024-05-29 17:01:14 +01:00
gornekich
6ccbc16e74 mf plus: code clean up 2024-05-29 16:53:12 +01:00
Astra
060a488ae9 ATQA byte swap fix 2024-05-22 19:55:12 +09:00
Astra
d3d483e60f Fix incorrect comparison 2024-05-22 19:10:26 +09:00
Astra
514fd244fa Fix atqa detection 2024-05-22 18:29:57 +09:00
Astra
c8a779da3f Review changes and extra logging 2024-05-21 19:30:05 +09:00
Astra
68eb196645 Merge branch 'astra/3746-mfp-detect' of https://github.com/flipperdevices/flipperzero-firmware into astra/3746-mfp-detect 2024-05-20 19:19:22 +09:00
Astra
2929955a3c Remove stray reminder comment 2024-05-20 19:19:11 +09:00
Astra
915304b986
Merge branch 'dev' into astra/3746-mfp-detect 2024-05-20 19:14:30 +09:00
Astra
cf9b09042e Remove leftover logging 2024-05-20 19:12:18 +09:00
Astra
54f63e06ec Fixes from code review 2024-05-20 19:08:54 +09:00
gornekich
217bfac2fc
NFC: add Slix capabilities (#3652)
* iso15693 listener: fix inventory cmd and buffer overflow
* iso15 listener: fix read multiple blocks command
* slix: print password
* slix: add capabilities field
* slix listener: skip password validation for special capability
* slix: fix capability name
* slix: add capabilities handler to verify and reset
* nfc test: introduce slix tests
* fbt: change toolchain back to 33 version
* slix: fix saving capablities comment
* unit tests: add slix files to resources
* slix: fix set passwrd signature
* nfc tests: add set correct password test
* nfc test: complete slix password tests
* nfc test: add slix file test
* nfc test: handle errors in worker callback
* iso15693_3: code clean up
* iso15693_listener: fix incorrect afi handling
* slix: chage capabilities format to one word camel case
* unit tests: update nfc files with new slix format

Co-authored-by: あく <alleteam@gmail.com>
2024-05-17 12:58:32 +01:00
gornekich
988b9cf155
Merge branch 'dev' into astra/3746-mfp-detect 2024-05-14 17:12:37 +01:00
gornekich
5f9b300ab2
NFC: Mf Desfire fix reading big files (#3616)
* mf desfire: fix incorrect long files reading
* nfc app: trim record size for mf desfire render
* mf desfire: rework reading long record files
* mf desfire: more robust size check

Co-authored-by: あく <alleteam@gmail.com>
2024-05-14 13:34:27 +01:00
Astra
2987a46322 Alloc takes no arguments 2024-04-23 11:00:37 +09:00
Astra
85fc0a2dd3
Merge branch 'dev' into astra/3746-mfp-detect 2024-04-23 10:39:34 +09:00
Astra
83ff6fb8bf Mifare Plus detection done 2024-04-22 21:09:06 +09:00
Leopold
286fd796e7
add support for S(WTX) request in iso14443_4a_poller (#3590)
Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
2024-04-19 21:11:22 +09:00
Astra
9042009b0b Proper detection (WIP) 2024-04-19 20:43:18 +09:00
Astra
7189026335 Initial MFPlus draft 2024-04-17 11:00:51 +09:00
gornekich
1a40fae003
[FL-3750] Mf Desfire multiple file rights support (#3576)
* mf desfire: remove unused type
* mf desfire: continue reading after failed get free mem cmd
* mf desfire: fix processing read master key settings command
* mf desfire: don't read applications if they are auth protected
* mf desfire: handle multiple rights
* mf desfire: fix PVS warnings
* mf desfire: fix print format
* mf desfire: fix logs
* mf classic: add send frame functions to poller
* unit tests: add test from mfc crypto frame exchange
* mf classic: add documentation
* mf classic: fix incorrect name
* target: fix api version
2024-04-16 14:55:24 +09:00
RebornedBrain
fb9728d570
[FL-3772] Felica poller (#3570)
* New types for felica poller
* New functions for felica data transmissions
* Felica memory map extended with new fields
* Init/deinit of mbedtls context added for felica encryption
* Functions for session key and mac calculations added
* Raw felica_poller implementation added
* Removed MAC type parameter from check_mac function
* Replaced all data fields needed for auth with context structure
* Clean up felica_poller.c
* Now RC block is filled with random numbers
* New parameter for counting well-read blocks
* Some cleanups
* Felica file save and load logic added
* Now we use card key from context for session key calculation
* Copying card key to card block from auth context when both authentications succeeded, otherwise decrement blocks count by 1
* New felica poller event added
* Moved some data structions to public namespace
* FelicaAuthenticationContext struct moved to felica.h
* Field type and name changed for better ones
* Helper functions for felica_auth added to the app
* New scene for felica card key input added
* Logic for felica key input added
* Auth context request processing added
* Added block index definitions and replaced all index numbers with them
* More macro defines
* Replace nesting with do while block
* New function for write operations mac calculation added
* Replace nesting with do while block
* Make functions static for now because they are used internally
* Wrote some comments
* Raw felica render implementation
* New felica scenes
* Adjusted felica dump rendering according design requirements
* New felica scene added
* Helper for switching scene during unlock added
* Added warning scene and transfer to it
* Moved unlock scene logic to separate files
* Magic number changed
* New felica render logic
* Felica scenes adjusted according to design requirements
* Felica poller cleanups
* Some asserts added and some fixed
* Replcaed asserts to checks in public api
* Fixed pvs warnings in felica_poller
* New event for felica_poller added for incomplete read actions
* Handling of new poller event added
* Update SConscript with felica files
* Update api_symbols.csv with felica functions
* Sync API versions

Co-authored-by: あく <alleteam@gmail.com>
2024-04-10 18:51:36 +09:00
Astra
27e61eb808
Move crypto1 to helpers, add it to the public API (#3567)
* Move crypto1 to helpers, add it to the public API
* F18 API version bump

Co-authored-by: あく <alleteam@gmail.com>
2024-04-07 23:47:48 +09:00
gornekich
74cda02368
[FL-3803] NFC: Fix mf desfire detect (#3548) 2024-03-29 10:32:15 +09:00
gornekich
f633f476c8
[FL-3787] NFC: Slix privacy password reveal and Desfire detect fix (#3504)
* slix: fix incorrect default privacy passwords
* slix poller: add check privacy password state
* mf desfire: change detect algorithm
* mf desfire: change detection algorithm to check master key version
* mf desfire: change assert to check
* Update api symbols and cleanup code

Co-authored-by: あく <alleteam@gmail.com>
2024-03-25 16:18:28 +09:00
あく
acc39a4bc0
Api Symbols: replace asserts with checks (#3507)
* Api Symbols: replace asserts with checks
* Api Symbols: replace asserts with checks part 2
* Update no args function signatures with void, to help compiler to track incorrect usage
* More unavoidable void
* Update PVS config and code to make it happy
* Format sources
* nfc: fix checks
* dead code cleanup & include fixes

Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: hedger <hedger@users.noreply.github.com>
Co-authored-by: hedger <hedger@nanode.su>
2024-03-19 23:43:52 +09:00
hedger
60a9d7e6cf
ble: profile rework (#3272)
* ble: profile rework, initial
* apps: hid: fix for pairing cleanup
* app: hid: select transport based on #define
* fixing PVS warnings
* ble: serial service: fixed uid naming
* bt service: on-demand dialog init; ble profiles: docs; battery svc: proper update
* Added shci_cmd_resp_wait/shci_cmd_resp_release impl with semaphore
* app: hid: separated transport code
* ble: fixed service init order for serial svc; moved hardfault check to ble_glue
* cli: ps: added thread prio to output, fixed heap display
* ble_glue: naming changes; separate thread for event processing;
* furi: added runtime stats; cli: added cpu% to `ps`
* cli: fixed thread time calculation
* furi: added getter for thread priority
* fixing pvs warnings
* hid profile: fixed naming
* more naming fixes
* hal: ble init small cleanup
* cleanup & draft beacon api
* f18: api sync
* apps: moved example_custom_font from debug to examples
* BLE extra beacon demo app
* naming fix
* UI fixes for demo app (wip)
* desktop, ble svc: added statusbar icon for beacon
* minor cleanup
* Minor cleanup & naming fixes
* api sync
* Removed stale header
* hal: added FURI_BLE_EXTRA_LOG for extra logging; comments & code cleanup
* naming & macro fixes
* quick fixes from review
* Eliminated stock svc_ctl
* cli: ps: removed runtime stats
* minor include fixes
* (void)
* naming fixes
* More naming fixes
* fbt: always build all libs
* fbt: explicitly globbing libs; dist: logging SDK path
* scripts: fixed lib path precedence
* hal: bt: profiles: naming changes, support for passing params to a profile; include cleanup
* ble: hid: added parameter processing for profile template
* api sync
* BLE HID: long name trim
* Removed unused check
* desktop: updated beacon status icon; ble: hid: cleaner device name management
* desktop: updated status icon

Co-authored-by: あく <alleteam@gmail.com>
Co-authored-by: nminaylov <nm29719@gmail.com>
2024-02-16 14:20:45 +07:00
Leptopt1los
dd988ba449
bit_lib and nfc_util refactor (#3383)
* nfc_util functions for processing bytes moved into bit_lib
* bitlib test update
* bit_lib moved from lfrfid to standalone lib
* Added bit functions for any supported data types
* Error fix and api add
* Added test for 64
* Added doc
* Testcase for 64 rewrited
* Realization error fix
* API version bump
* sync api version, fix after-merge old libs usage
* fix build errors
* build fix
* fbt format

Co-authored-by: assasinfil <nfa57643@gmail.com>
Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
2024-02-14 11:41:42 +07:00
hedger
14dabf523a
New toolchain with gcc 12 (#3254)
* changes for xPack 12.3
* support for gcc 13.2
* Update tools name
* Add new linux toolchain
* Fixed copro submodule
* Fix gdb-py
* Fixes for c++ apps
* Fix gdb-py3, add udev rules
* Fixed udev rules location
* Add MacOS arm, fix fbt toolchain download
* Fixed downloading error file
* fbt: fixed linker warnings; removed gcc 10 from list of supported toolchains
* ufbt: fixed supported toolchain versions
* nfc: replaced local malloc with calloc
* restored code with Warray-bounds to older state
* Update fbtenv.cmd
* Suppressing warnings
* Bump to 25
* Bump to 26
* lint: reformatted macros for new clang-format
* Bump to 27
* Fix m type word
* Bump to 28
* furi: added FURI_DEPRECATED macro
* scripts: toolchain download on Windows: fixing partially extracted cases

Co-authored-by: DrunkBatya <drunkbatya.js@gmail.com>
2024-02-12 09:04:12 +07:00
Tolly Hill
50e0521bf7
NFC: Custom UID entry when adding manually (#3363)
* NFC: Custom UID entry when adding manually
* Fix incorrect types
* Add Change UID option post-generation
* Update UID derived data when using set_uid method
* Fix PVS warnings

Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
2024-02-09 15:36:06 +07:00
gornekich
6bc63b7734
[FL-3676] Slix disable privacy (#3425)
* slix: add unlock option
* slix: add features for nxp get info and signature commands
* slix: working unlock
* nfc app: rewrite slix unlock
* slix poller: simplify unlock state handler
* nfc app: fix slix key setting
* nfc app: fix navigation
* slix poller: code clean up
* slix: resolve TODO, clean code
* nfc app: fix naming
* nfc app: rework slix unlock success scene
* slix poller: add documentation
* slix listener: fix password comparison

Co-authored-by: あく <alleteam@gmail.com>
2024-02-09 15:07:54 +07:00
Leptopt1los
ed34dfa1c6
NFC: MF Classic parsers read() fix (dictionary attack skip) (#3355)
* NFC: MF Classic lib: MfClassicErrorPartialRead added

* unnecessary imports removed

* MfClassicError refactor by @gornekich

Co-authored-by: gornekich <n.gorbadey@gmail.com>

---------

Co-authored-by: gornekich <n.gorbadey@gmail.com>
2024-02-06 20:53:42 +04:00
gornekich
4f50ef9b54
[FL-3648] Mf DESFire fixes (#3367)
* mf desfire: process loading applications with 0 files
* mf desfire: add HID desfire support
* nfc: fix mfdes loading and rendering crashes
* mf desfire: change handling HID cards
* mf desfire: fix PVS warnings
* mf desfire: fix cmp logic

Co-authored-by: あく <alleteam@gmail.com>
2024-01-16 18:41:51 +09:00
Leptopt1los
d289545bf8
NFC: system dict skip when user dict is skipped fix (#3356)
* NFC: system dict skip when user dict is skipped fix
* MFC poller allocator fix (by gornekich)

Co-authored-by: gornekich <n.gorbadey@gmail.com>
2024-01-12 17:41:19 +09:00
gornekich
a7b60bf2a6
MFC emulation fixes (#3324)
* mf classic listener: fix write block
* nfc: go to idle state instead of sleep
* lib nfc: fix documentation
2023-12-29 12:24:20 +09:00
gornekich
09540929c3
[FL-3717] MFC emulation fix (#3291)
* mf classic listener: reset state before sleep and after nack
* Fix PVS warnings
* Fix PVS and compiler disagree on builtins

Co-authored-by: あく <alleteam@gmail.com>
2023-12-15 17:51:20 +00:00
gornekich
155e4e9fa4
[FL-3706], [FL-3674] NFC NTAG and ISO14443-3b reading fix (#3285)
* mf ultralight poller: reset field after reading tearing flags
* iso14443-3b poller: change cid comparison in ATTRIB cmd

Co-authored-by: あく <alleteam@gmail.com>
2023-12-12 15:24:06 +00:00
gornekich
82baf1e923
[FL-3701] NFC fixes (#3264)
* nfc app: fix unlock with manual password crash
* nfc app: preserve card detected state
* nfc app: fix mf keys scene switch
* nfc app: fix multiple protocol tag detect notification
* nfc plugin: fix retrun in function body in aime parser
* iso14443-3b poller: rework ATTRIB response check
* nfc app: fix navigation after file load failur
* iso14443-3b poller: fix PVS warning
* mfc listener: add crutch in mfc emulation
2023-12-05 22:40:06 +09:00
pborsutzki
c6a14e1a67
Fixed a zero allocation error when reading an iso15693 nfc tag with no additional blocks. (#3229)
Co-authored-by: gornekich <n.gorbadey@gmail.com>
2023-12-02 16:27:58 +09:00
RebornedBrain
6a5d63803a
[FL-3675] Ntag21x write (#3246)
* New scenes for ultralight poller write mode
* Added new button and transition logic for write operation
   For now write is only possible for NTAG21x cards with default password and no AUTHLIM set
* Poller states extended
* Enums and datatypes extended for new poller mode
* Added mode field to poller instance datatype
* New states for poller added in order to implement write mode
* Added new event type for locked cards in order to simplify state flow
* New logic for poller write commands
* Scenes adjustments
* Scenes renamed
* New field added to poller instance
* Now we write in 'page per call' mode
* Now function takes callback return value into account
* Callback will be called only in write mode
* Event type added
* Log adjusted and start page to write set
* Logs added and check in now false at start, then it moves to true
* Now mf_ultralight_poller_handler_request_write_data halts card in case of check failure and stops poller
* All fail events now returns NfcCommandStop callback
* In case of fail we move back properly
* Remove garbage

Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
2023-12-02 13:45:47 +09:00
Augusto Zanellato
b51a754fd9
Mifare Classic nested auth support (#3238)
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2023-12-01 22:25:53 +09:00
Augusto Zanellato
c1e0d02afc
ST25TB poller refining + write support (#3239)
* nfc: st25tb: rework async poller
* nfc: st25tb: introduce sync poller
* nfc: st25tb: add write support
* nfc: st25tb: rewrite poller to use better states
* nfc: st25tb: move to mode request state after success
* nfc: st25tb: minor bug fixes
* type wasn't properly set on ready event
* sending NfcCustomEventPollerFailure on St25tbPollerEventTypeFailure caused poller to being freed and ultimately resulted in a thread crash

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2023-12-01 18:42:00 +09:00
hedger
890c9e87ce
[FL-3690] Libraries cleanup; u2f crypto rework to use mbedtls (#3234)
* examples: plugins: utilize fal_embedded
* libs: removed fnv1a_hash
* furi: added FURI_PACKED; apps, libs: changed to use FURI_PACKED
* lib: mbedtls: using custom config
* lib: toolbox: removed md5, switched to mbedtls
* targets: f18: link fix
* lib: added mbedtls_cfg.h
* apps: nfc: explicit dependency on libmbedtls
* u2f: reworking to mbedtls
* u2f: replaced sha256 & hmac with mbedtls
* u2f: functional rework using mbedtls
* libs: dropped micro-ecc
* u2f: dropped old implementation
* toolbox: removed sha256 impl
* mcheck() for mbedtls
* libs: removed libmisc; split into smaller libs
* apps: debug: fixed display_test
* apps: include cleanups
* fbt: fixed VERSIONCOMSTR
* furi: added FURI_CHECK_RETURN
* lib: removed qrcode
* cleanup
* fbt: lint_py+format_py: fixed excessive command length
* api: Removed bzero from f7
* api: Removed bzero from f18
* Bump API Symbols

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2023-12-01 18:16:48 +09:00
Astra
f9101d8084
[FL-3686] Mifare Classic fixes (#3221)
* Update Mifare Classic generators to create more accuate data
* Check the transfer buffer validity for NACK
* Fix the AC issues
* CRC errors don't really affect emulation, checking for them isn't worth it
* Make ATQA logic a bit easier to understand
* mf classic: change log level
* mf classic: fix log level

Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
2023-11-26 17:20:49 +09:00
RebornedBrain
1c3cbec661
[FL-3640] NFC: Felica UID emulation (#3190)
* Added basic template of Felica listener
* Raw nfc felica listener functions
* Added functions to setup chip for felica listener
* Cleanup function templates from unnecessary parts
* Removed todo comment
* Updated api versions
* Adjusted chip config for felica
* Set proper chip passive target mode for felica
* Added felica function to unit tests
* Update furi_hal_nfc_felica.c
* Removed duplication

Co-authored-by: gornekich <n.gorbadey@gmail.com>
2023-11-26 17:10:33 +09:00
gornekich
c00776ca22
[FL-3666] NFC API improvements (#3214)
* drivers: expose st25r3916 driver API
* nfc poller: add start with custom callback
* mf classic: rework sync API with poller custom start
* mf ultralight: rework sync API with poller custom start
* iso14443_3a poller: remove unused col res state
* nfc: rework nfc poller custom start
* mf ultralight: rename sync API
* mf classic: rename sync API
* iso14443-3a: rename sync API
* nfc: remove async prefix in internal functions
* nfc: expose internal API
* nfc: fix sync api include and docs
* targets: fix f18 build
* nfc: rework NfcGenericEventEx type
* nfc poller: add documentation
* iso14443-3a poller: add documentation
* felica poller: add documentation
* iso14443_3b poller: add documentation
* so14443_4a poller: add documentation
* iso14443_4b poller: add documentation
* iso15693 poller: add documentation
* slix poller: add documentation
* mf desfire poller: add documentation
* mf ultralight poller: fix API and add documentation
* mf classic poller: add documentation

Co-authored-by: あく <alleteam@gmail.com>
2023-11-15 17:32:45 +09:00