unleashed-firmware/lib/nfc/SConscript

70 lines
2.5 KiB
Python
Raw Normal View History

[FL-2605] NFC new design (#1364) * nfc: add new read scene * lib: refactore nfc library * mifare desfire: add read card fuction * lib nfc: add auto read worker * nfc: add supported cards * nfc: add mifare classic read success scene * nfc: add troyka support * submodule: update protobuf * nfc: mifare classic keys cache * nfc: rework mifare classic key cache * Correct spelling * nfc: add user dictionary * nfc: introduce block read map in fff * nfc: rework dict attack * nfc: improve dict attack * nfc: rework mifare classic format * nfc: rework MFC read with Reader * nfc: add gui for MFC read success scene * nfc: fix dict attack view gui * nfc: add retry and exit confirm scenes * nfc: add retry and exit scenes navigation * nfc: check user dictionary * nfc: remove unused scenes * nfc: rename functions in nfc worker * nfc: rename mf_classic_dict_attack -> dict_attack * nfc: change scenes names * nfc: remove scene tick events * nfc: rework dict calls with buffer streams * nfc: fix notifications * nfc: fix mf desfire navigation * nfc: remove notification from mf classic read success * nfc: fix read sectors calculation * nfc: add fallback for unknown card * nfc: show file name while emulating * nfc: fix build * nfc: fix memory leak * nfc: fix desfire read * nfc: add no dict found navigation * nfc: add read views * nfc: update card fix * nfc: fix access bytes save * nfc: add exit and retry confirm to mf ultralight read success * nfc: introduce detect reader * nfc: change record open arg to macros * nfc: fix start from archive Co-authored-by: Astra <astra@astrra.space> Co-authored-by: あく <alleteam@gmail.com>
2022-07-26 15:30:49 +00:00
Import("env")
env.Append(
CPPPATH=[
"#/lib/nfc",
],
LINT_SOURCES=[
Dir("."),
],
SDK_HEADERS=[
# Main
File("nfc.h"),
File("nfc_device.h"),
File("nfc_listener.h"),
File("nfc_poller.h"),
File("nfc_scanner.h"),
# Protocols
File("protocols/iso14443_3a/iso14443_3a.h"),
File("protocols/iso14443_3b/iso14443_3b.h"),
File("protocols/iso14443_4a/iso14443_4a.h"),
File("protocols/iso14443_4b/iso14443_4b.h"),
File("protocols/mf_ultralight/mf_ultralight.h"),
File("protocols/mf_classic/mf_classic.h"),
File("protocols/mf_plus/mf_plus.h"),
File("protocols/mf_desfire/mf_desfire.h"),
File("protocols/slix/slix.h"),
File("protocols/st25tb/st25tb.h"),
[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 09:51:36 +00:00
File("protocols/felica/felica.h"),
# Pollers
File("protocols/iso14443_3a/iso14443_3a_poller.h"),
File("protocols/iso14443_3b/iso14443_3b_poller.h"),
File("protocols/iso14443_4a/iso14443_4a_poller.h"),
File("protocols/iso14443_4b/iso14443_4b_poller.h"),
File("protocols/mf_ultralight/mf_ultralight_poller.h"),
File("protocols/mf_classic/mf_classic_poller.h"),
File("protocols/mf_plus/mf_plus_poller.h"),
File("protocols/mf_desfire/mf_desfire_poller.h"),
Icons: compression fixes & larger dimension support (#3564) * toolbox, gui: fixes for compressed icon handling * ufbt: fixes for generated vscode project * scripts: increased max dimensions for image converter * icon type changes * linter fixes; api sync * gui: docs fix * toolbox: fixed potential decoder buffer overflow * minor cleanup * fbt: sdk: suppressed deprecation warnings in API table * toolbox: compress: added unit tests vscode: now installs resources for unit_tests unit_tests: now loads subghz region data * toolbox: compress: review fixes, pt 1 * compress: now passes decoder buffer size as constructor argument; auto-resize decoder buffer; crash on failed icon decompression * PVS fixes * pvs fixes, pt2 * doxygen fixes * investigating unit test failures * investigating unit test failures * investigating unit test failures * investigating unit test failures * investigating unit test failures * UnitTests: move all tests into plugins, brakes testing * UnitTests: add plugin API and update plugin entrypoints * UniTests: Test runner that works with plugins * fbt: extra filtering for extapps to include in build * UnitTests: filter tests by name * loader: restored API table for unit_test build config * Add various missing symbols to API table * UnitTest: fail on plugin load error * UnitTests: cleanup plugin api and reporting * unit_tests: composite resolver * UnitTests: remove unused declaration * unit_tests, nfc: moved mock nfc implementation to libnfc * unit_tests: api: removed redundant #define * toolbox: compress: removed size_hint for icons; triggering furi_check on oversized icons * gui: icon, icon_animation: removed size hit APIs * Format Sources. Cleanup code. * loader: refuse to start .fal as app * toolbox: compress: fixed memory corruption in operations with small destination buffer; added unit tests for that case * unit_tests: proper test skipping; better selective test interface * unit_tests: moved 'loading' logging to proper location Co-authored-by: あく <alleteam@gmail.com>
2024-05-20 17:23:47 +00:00
File("protocols/slix/slix_poller.h"),
File("protocols/st25tb/st25tb_poller.h"),
[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 09:51:36 +00:00
File("protocols/felica/felica_poller.h"),
# Listeners
File("protocols/iso14443_3a/iso14443_3a_listener.h"),
File("protocols/iso14443_4a/iso14443_4a_listener.h"),
File("protocols/mf_ultralight/mf_ultralight_listener.h"),
File("protocols/mf_classic/mf_classic_listener.h"),
[FL-3810] Felica emulation (#3673) * Moved some structs and defs from poller to generic felica * Buffer size increased for transferring more data * Felica HAL Tx function implemented * Some structs and fields for listener * Raw listener implementation * Added new event for felica activation * Proper config fot listener added * Moved some structs from poller in order to use them in listener too * New function for calculating MAC * Listener data structures and function definitions * Private listener functions implementation added * Raw felica listener logic implementation added * Fix total sector count both for poller and listener * Defined type for write handlers * New logic for write operations added * Removed old commented code * Splitted read logic into several separate functions * New type added and some fields to instance * New logic of read command implemented * Defines added for response codes * Functions moved to private namespace * Function visibility changed and some cleanups * Update felica_listener.c, felica_listener_i.c, and felica_listener_i.h * Some type adjustments * Moved frame_exchange function to private namespace * Error handling added * Function to get data_ptr for write request added * Missing declaration added * Add processing of nfc errors * write_with_mac is a local variable now * Adjustments to MAC calculation logic * Values replaced with defines * Update nfc_transport.c with felica logic * Sync felica poller added for unit tests * Felica unit_tests and data dump added * Fixed proper reading of MAC_A block when it is 1st * Macro definitions for MC added * Function simplified * More defines * CRC check for incomming packets added * Readonly logic adjusted * Block write validation adjusted * New logic for ID block writing * Some cleanups * New logic of moving across the block list with different element length * Some cleanups * Adjusted requires_mac logic to cover all blocks needed * Cleanups and renaming * New block list validation logic * Block list logic iteration simplified * Some asserts and checks added * Replaced MC[2] checks with macros * Marked def values as unsigned * Removed old code * Removed commented function declarations * Changed protected block in felica test card dump and adjusted tests * Fixes after merge * Moved defines to header * Now we allocate memory for max possible response pack in any case * Some renaming and documentation * Bump api symbols * Set feature to emulate full for felica * Removed 'More' button and added MoreInfo feature which adds this button back * Types renamed * Removed unnecessary code * Reformat comments * Fixing missing signatures * Replaced crash with error log and return value * Format doxygen comments Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2024-06-08 14:24:51 +00:00
File("protocols/felica/felica_listener.h"),
# Sync API
File("protocols/iso14443_3a/iso14443_3a_poller_sync.h"),
File("protocols/mf_ultralight/mf_ultralight_poller_sync.h"),
File("protocols/mf_classic/mf_classic_poller_sync.h"),
File("protocols/st25tb/st25tb_poller_sync.h"),
[FL-3810] Felica emulation (#3673) * Moved some structs and defs from poller to generic felica * Buffer size increased for transferring more data * Felica HAL Tx function implemented * Some structs and fields for listener * Raw listener implementation * Added new event for felica activation * Proper config fot listener added * Moved some structs from poller in order to use them in listener too * New function for calculating MAC * Listener data structures and function definitions * Private listener functions implementation added * Raw felica listener logic implementation added * Fix total sector count both for poller and listener * Defined type for write handlers * New logic for write operations added * Removed old commented code * Splitted read logic into several separate functions * New type added and some fields to instance * New logic of read command implemented * Defines added for response codes * Functions moved to private namespace * Function visibility changed and some cleanups * Update felica_listener.c, felica_listener_i.c, and felica_listener_i.h * Some type adjustments * Moved frame_exchange function to private namespace * Error handling added * Function to get data_ptr for write request added * Missing declaration added * Add processing of nfc errors * write_with_mac is a local variable now * Adjustments to MAC calculation logic * Values replaced with defines * Update nfc_transport.c with felica logic * Sync felica poller added for unit tests * Felica unit_tests and data dump added * Fixed proper reading of MAC_A block when it is 1st * Macro definitions for MC added * Function simplified * More defines * CRC check for incomming packets added * Readonly logic adjusted * Block write validation adjusted * New logic for ID block writing * Some cleanups * New logic of moving across the block list with different element length * Some cleanups * Adjusted requires_mac logic to cover all blocks needed * Cleanups and renaming * New block list validation logic * Block list logic iteration simplified * Some asserts and checks added * Replaced MC[2] checks with macros * Marked def values as unsigned * Removed old code * Removed commented function declarations * Changed protected block in felica test card dump and adjusted tests * Fixes after merge * Moved defines to header * Now we allocate memory for max possible response pack in any case * Some renaming and documentation * Bump api symbols * Set feature to emulate full for felica * Removed 'More' button and added MoreInfo feature which adds this button back * Types renamed * Removed unnecessary code * Reformat comments * Fixing missing signatures * Replaced crash with error log and return value * Format doxygen comments Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2024-06-08 14:24:51 +00:00
File("protocols/felica/felica_poller_sync.h"),
# Misc
File("helpers/nfc_util.h"),
File("helpers/iso14443_crc.h"),
File("helpers/iso13239_crc.h"),
File("helpers/nfc_data_generator.h"),
File("helpers/crypto1.h"),
],
[FL-2605] NFC new design (#1364) * nfc: add new read scene * lib: refactore nfc library * mifare desfire: add read card fuction * lib nfc: add auto read worker * nfc: add supported cards * nfc: add mifare classic read success scene * nfc: add troyka support * submodule: update protobuf * nfc: mifare classic keys cache * nfc: rework mifare classic key cache * Correct spelling * nfc: add user dictionary * nfc: introduce block read map in fff * nfc: rework dict attack * nfc: improve dict attack * nfc: rework mifare classic format * nfc: rework MFC read with Reader * nfc: add gui for MFC read success scene * nfc: fix dict attack view gui * nfc: add retry and exit confirm scenes * nfc: add retry and exit scenes navigation * nfc: check user dictionary * nfc: remove unused scenes * nfc: rename functions in nfc worker * nfc: rename mf_classic_dict_attack -> dict_attack * nfc: change scenes names * nfc: remove scene tick events * nfc: rework dict calls with buffer streams * nfc: fix notifications * nfc: fix mf desfire navigation * nfc: remove notification from mf classic read success * nfc: fix read sectors calculation * nfc: add fallback for unknown card * nfc: show file name while emulating * nfc: fix build * nfc: fix memory leak * nfc: fix desfire read * nfc: add no dict found navigation * nfc: add read views * nfc: update card fix * nfc: fix access bytes save * nfc: add exit and retry confirm to mf ultralight read success * nfc: introduce detect reader * nfc: change record open arg to macros * nfc: fix start from archive Co-authored-by: Astra <astra@astrra.space> Co-authored-by: あく <alleteam@gmail.com>
2022-07-26 15:30:49 +00:00
)
libenv = env.Clone(FW_LIB_NAME="nfc")
libenv.ApplyLibFlags()
sources = libenv.GlobRecursive("*.c*")
[FL-2605] NFC new design (#1364) * nfc: add new read scene * lib: refactore nfc library * mifare desfire: add read card fuction * lib nfc: add auto read worker * nfc: add supported cards * nfc: add mifare classic read success scene * nfc: add troyka support * submodule: update protobuf * nfc: mifare classic keys cache * nfc: rework mifare classic key cache * Correct spelling * nfc: add user dictionary * nfc: introduce block read map in fff * nfc: rework dict attack * nfc: improve dict attack * nfc: rework mifare classic format * nfc: rework MFC read with Reader * nfc: add gui for MFC read success scene * nfc: fix dict attack view gui * nfc: add retry and exit confirm scenes * nfc: add retry and exit scenes navigation * nfc: check user dictionary * nfc: remove unused scenes * nfc: rename functions in nfc worker * nfc: rename mf_classic_dict_attack -> dict_attack * nfc: change scenes names * nfc: remove scene tick events * nfc: rework dict calls with buffer streams * nfc: fix notifications * nfc: fix mf desfire navigation * nfc: remove notification from mf classic read success * nfc: fix read sectors calculation * nfc: add fallback for unknown card * nfc: show file name while emulating * nfc: fix build * nfc: fix memory leak * nfc: fix desfire read * nfc: add no dict found navigation * nfc: add read views * nfc: update card fix * nfc: fix access bytes save * nfc: add exit and retry confirm to mf ultralight read success * nfc: introduce detect reader * nfc: change record open arg to macros * nfc: fix start from archive Co-authored-by: Astra <astra@astrra.space> Co-authored-by: あく <alleteam@gmail.com>
2022-07-26 15:30:49 +00:00
lib = libenv.StaticLibrary("${FW_LIB_NAME}", sources)
libenv.Install("${LIB_DIST_DIR}", lib)
Return("lib")