Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Wallace <184975+kevinwallace@users.noreply.github.com>2022-06-21 17:58:22 +0300
committerGitHub <noreply@github.com>2022-06-21 17:58:22 +0300
commit88facf20c15f416551a2960dab0e22f09216e749 (patch)
tree55e5f085698e7a999e6254975ec5a52dbe93acd0 /applications/nfc/nfc_worker.c
parent92f763e5531daf7006d10bbaa88bae7233f2c7bf (diff)
nfc: DESFire fixes (#1334)
* nfc: don't give up on reading DESFire card if GET_KEY_SETTINGS fails Some cards are configured to refuse to provide key settings, but still provide other info. For example, Ubiquiti UniFi Protect access cards won't list keys or applications, but will still answer GET_FREE_MEMORY. * nfc: don't show error when saving DESFire card with no applications * nfc: fix DESFire load with 0 applications or no PICC key settings Co-authored-by: Kevin Wallace <git+flipperzero@kevin.wallace.seattle.wa.us> Co-authored-by: gornekich <n.gorbadey@gmail.com> Co-authored-by: あく <alleteam@gmail.com>
Diffstat (limited to 'applications/nfc/nfc_worker.c')
-rw-r--r--applications/nfc/nfc_worker.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/applications/nfc/nfc_worker.c b/applications/nfc/nfc_worker.c
index 8c8512f3..11b6b51e 100644
--- a/applications/nfc/nfc_worker.c
+++ b/applications/nfc/nfc_worker.c
@@ -576,28 +576,27 @@ void nfc_worker_read_mifare_desfire(NfcWorker* nfc_worker) {
FURI_LOG_W(TAG, "Bad DESFire GET_KEY_SETTINGS response");
free(data->master_key_settings);
data->master_key_settings = NULL;
- continue;
- }
-
- MifareDesfireKeyVersion** key_version_head =
- &data->master_key_settings->key_version_head;
- for(uint8_t key_id = 0; key_id < data->master_key_settings->max_keys; key_id++) {
- tx_rx.tx_bits = 8 * mf_df_prepare_get_key_version(tx_rx.tx_data, key_id);
- if(!furi_hal_nfc_tx_rx_full(&tx_rx)) {
- FURI_LOG_W(TAG, "Bad exchange getting key version");
- continue;
- }
- MifareDesfireKeyVersion* key_version = malloc(sizeof(MifareDesfireKeyVersion));
- memset(key_version, 0, sizeof(MifareDesfireKeyVersion));
- key_version->id = key_id;
- if(!mf_df_parse_get_key_version_response(
- tx_rx.rx_data, tx_rx.rx_bits / 8, key_version)) {
- FURI_LOG_W(TAG, "Bad DESFire GET_KEY_VERSION response");
- free(key_version);
- continue;
+ } else {
+ MifareDesfireKeyVersion** key_version_head =
+ &data->master_key_settings->key_version_head;
+ for(uint8_t key_id = 0; key_id < data->master_key_settings->max_keys; key_id++) {
+ tx_rx.tx_bits = 8 * mf_df_prepare_get_key_version(tx_rx.tx_data, key_id);
+ if(!furi_hal_nfc_tx_rx_full(&tx_rx)) {
+ FURI_LOG_W(TAG, "Bad exchange getting key version");
+ continue;
+ }
+ MifareDesfireKeyVersion* key_version = malloc(sizeof(MifareDesfireKeyVersion));
+ memset(key_version, 0, sizeof(MifareDesfireKeyVersion));
+ key_version->id = key_id;
+ if(!mf_df_parse_get_key_version_response(
+ tx_rx.rx_data, tx_rx.rx_bits / 8, key_version)) {
+ FURI_LOG_W(TAG, "Bad DESFire GET_KEY_VERSION response");
+ free(key_version);
+ continue;
+ }
+ *key_version_head = key_version;
+ key_version_head = &key_version->next;
}
- *key_version_head = key_version;
- key_version_head = &key_version->next;
}
}