nfc: Move captured MFUL auth data from worker to device data

This commit is contained in:
Yukai Li
2022-10-10 22:25:42 -06:00
parent 543cdcb51b
commit e89741e434
5 changed files with 3 additions and 11 deletions

View File

@@ -4,7 +4,7 @@ bool nfc_scene_mf_ultralight_unlock_auto_worker_callback(NfcWorkerEvent event, v
Nfc* nfc = context;
if(event == NfcWorkerEventMfUltralightPwdAuth) {
MfUltralightAuth* auth = nfc_worker_get_event_data(nfc->worker);
MfUltralightAuth* auth = &nfc->dev->dev_data.mf_ul_auth;
memcpy(nfc->byte_input_store, auth->pwd.raw, sizeof(auth->pwd.raw));
nfc->dev->dev_data.mf_ul_data.auth_method = MfUltralightAuthMethodManual;
}

View File

@@ -53,6 +53,7 @@ typedef struct {
union {
NfcReaderRequestData reader_data;
NfcMfClassicDictAttackData mf_classic_dict_attack_data;
MfUltralightAuth mf_ul_auth;
};
union {
EmvData emv_data;

View File

@@ -20,7 +20,6 @@ NfcWorker* nfc_worker_alloc() {
nfc_worker->callback = NULL;
nfc_worker->context = NULL;
nfc_worker->event_data = NULL;
nfc_worker->storage = furi_record_open(RECORD_STORAGE);
// Initialize rfal
@@ -50,10 +49,6 @@ NfcWorkerState nfc_worker_get_state(NfcWorker* nfc_worker) {
return nfc_worker->state;
}
void* nfc_worker_get_event_data(NfcWorker* nfc_worker) {
return nfc_worker->event_data;
}
void nfc_worker_start(
NfcWorker* nfc_worker,
NfcWorkerState state,
@@ -449,12 +444,11 @@ void nfc_worker_emulate_mf_ultralight(NfcWorker* nfc_worker) {
5000);
// Check if there was an auth attempt
if(emulator.auth_attempted) {
nfc_worker->event_data = &emulator.auth_attempt;
nfc_worker->dev_data->mf_ul_auth = emulator.auth_attempt; // Make copy
if(nfc_worker->callback) {
nfc_worker->callback(NfcWorkerEventMfUltralightPwdAuth, nfc_worker->context);
}
emulator.auth_attempted = false;
nfc_worker->event_data = NULL;
}
// Check if data was modified
if(emulator.data_changed) {

View File

@@ -71,8 +71,6 @@ NfcWorker* nfc_worker_alloc();
NfcWorkerState nfc_worker_get_state(NfcWorker* nfc_worker);
void* nfc_worker_get_event_data(NfcWorker* nfc_worker);
void nfc_worker_free(NfcWorker* nfc_worker);
void nfc_worker_start(

View File

@@ -23,7 +23,6 @@ struct NfcWorker {
NfcWorkerCallback callback;
void* context;
void* event_data;
NfcWorkerState state;