Merge remote-tracking branch 'origin/dev' into release-candidate

This commit is contained in:
Aleksandr Kutuzov 2023-03-27 16:42:32 +09:00
commit 9b9dce3676
3 changed files with 21 additions and 10 deletions

View File

@ -72,7 +72,7 @@ To run cleanup (think of `make clean`) for specified targets, add the `-c` optio
- `get_stlink` - output serial numbers for attached STLink probes. Used for specifying an adapter with `OPENOCD_ADAPTER_SERIAL=...`. - `get_stlink` - output serial numbers for attached STLink probes. Used for specifying an adapter with `OPENOCD_ADAPTER_SERIAL=...`.
- `lint`, `format` - run clang-format on the C source code to check and reformat it according to the `.clang-format` specs. - `lint`, `format` - run clang-format on the C source code to check and reformat it according to the `.clang-format` specs.
- `lint_py`, `format_py` - run [black](https://black.readthedocs.io/en/stable/index.html) on the Python source code, build system files & application manifests. - `lint_py`, `format_py` - run [black](https://black.readthedocs.io/en/stable/index.html) on the Python source code, build system files & application manifests.
- `firmware_pvs` - generate a PVS Studio report for the firmware. Requires PVS Studio to be availabe on your system's `PATH`. - `firmware_pvs` - generate a PVS Studio report for the firmware. Requires PVS Studio to be available on your system's `PATH`.
- `cli` - start a Flipper CLI session over USB. - `cli` - start a Flipper CLI session over USB.
### Firmware targets ### Firmware targets

View File

@ -62,6 +62,7 @@ bool ds_generic_write_blank(OneWireHost* host, iButtonProtocolData* protocol_dat
} }
static bool ds_generic_reset_callback(bool is_short, void* context) { static bool ds_generic_reset_callback(bool is_short, void* context) {
furi_assert(context);
DallasGenericProtocolData* data = context; DallasGenericProtocolData* data = context;
if(!is_short) { if(!is_short) {
onewire_slave_set_overdrive(data->state.bus, is_short); onewire_slave_set_overdrive(data->state.bus, is_short);
@ -93,7 +94,7 @@ void ds_generic_emulate(OneWireSlave* bus, iButtonProtocolData* protocol_data) {
DallasGenericProtocolData* data = protocol_data; DallasGenericProtocolData* data = protocol_data;
data->state.bus = bus; data->state.bus = bus;
onewire_slave_set_reset_callback(bus, ds_generic_reset_callback, NULL); onewire_slave_set_reset_callback(bus, ds_generic_reset_callback, protocol_data);
onewire_slave_set_command_callback(bus, ds_generic_command_callback, protocol_data); onewire_slave_set_command_callback(bus, ds_generic_command_callback, protocol_data);
} }

View File

@ -638,7 +638,8 @@ static void nfc_worker_mf_classic_key_attack(
(uint32_t)key); (uint32_t)key);
if(mf_classic_authenticate(tx_rx, block_num, key, MfClassicKeyA)) { if(mf_classic_authenticate(tx_rx, block_num, key, MfClassicKeyA)) {
mf_classic_set_key_found(data, i, MfClassicKeyA, key); mf_classic_set_key_found(data, i, MfClassicKeyA, key);
FURI_LOG_D(TAG, "Key found"); FURI_LOG_D(
TAG, "Key A found: %04lx%08lx", (uint32_t)(key >> 32), (uint32_t)key);
nfc_worker->callback(NfcWorkerEventFoundKeyA, nfc_worker->context); nfc_worker->callback(NfcWorkerEventFoundKeyA, nfc_worker->context);
uint64_t found_key; uint64_t found_key;
@ -661,7 +662,8 @@ static void nfc_worker_mf_classic_key_attack(
(uint32_t)key); (uint32_t)key);
if(mf_classic_authenticate(tx_rx, block_num, key, MfClassicKeyB)) { if(mf_classic_authenticate(tx_rx, block_num, key, MfClassicKeyB)) {
mf_classic_set_key_found(data, i, MfClassicKeyB, key); mf_classic_set_key_found(data, i, MfClassicKeyB, key);
FURI_LOG_D(TAG, "Key found"); FURI_LOG_D(
TAG, "Key B found: %04lx%08lx", (uint32_t)(key >> 32), (uint32_t)key);
nfc_worker->callback(NfcWorkerEventFoundKeyB, nfc_worker->context); nfc_worker->callback(NfcWorkerEventFoundKeyB, nfc_worker->context);
} }
} }
@ -760,9 +762,13 @@ void nfc_worker_mf_classic_dict_attack(NfcWorker* nfc_worker) {
furi_hal_nfc_sleep(); furi_hal_nfc_sleep();
deactivated = true; deactivated = true;
} else { } else {
mf_classic_set_key_not_found(data, i, MfClassicKeyA); // If the key A is marked as found and matches the searching key, invalidate it
is_key_a_found = false; if(mf_classic_is_key_found(data, i, MfClassicKeyA) &&
FURI_LOG_D(TAG, "Key %dA not found in attack", i); data->block[i].value[0] == key) {
mf_classic_set_key_not_found(data, i, MfClassicKeyA);
is_key_a_found = false;
FURI_LOG_D(TAG, "Key %dA not found in attack", i);
}
} }
if(!is_key_b_found) { if(!is_key_b_found) {
is_key_b_found = mf_classic_is_key_found(data, i, MfClassicKeyB); is_key_b_found = mf_classic_is_key_found(data, i, MfClassicKeyB);
@ -775,9 +781,13 @@ void nfc_worker_mf_classic_dict_attack(NfcWorker* nfc_worker) {
} }
deactivated = true; deactivated = true;
} else { } else {
mf_classic_set_key_not_found(data, i, MfClassicKeyB); // If the key B is marked as found and matches the searching key, invalidate it
is_key_b_found = false; if(mf_classic_is_key_found(data, i, MfClassicKeyB) &&
FURI_LOG_D(TAG, "Key %dB not found in attack", i); data->block[i].value[10] == key) {
mf_classic_set_key_not_found(data, i, MfClassicKeyB);
is_key_b_found = false;
FURI_LOG_D(TAG, "Key %dB not found in attack", i);
}
} }
if(is_key_a_found && is_key_b_found) break; if(is_key_a_found && is_key_b_found) break;
if(nfc_worker->state != NfcWorkerStateMfClassicDictAttack) break; if(nfc_worker->state != NfcWorkerStateMfClassicDictAttack) break;