mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-11-23 01:45:14 +03:00
Refactor enums to avoid redefinition
This commit is contained in:
parent
3976f128dc
commit
a7c0819034
@ -97,9 +97,9 @@ typedef struct {
|
||||
bool is_key_attack;
|
||||
uint8_t key_attack_current_sector;
|
||||
bool is_card_present;
|
||||
uint8_t nested_phase;
|
||||
uint8_t prng_type;
|
||||
uint8_t backdoor;
|
||||
MfClassicNestedPhase nested_phase;
|
||||
MfClassicPrngType prng_type;
|
||||
MfClassicBackdoor backdoor;
|
||||
uint16_t nested_target_key;
|
||||
uint16_t msb_count;
|
||||
bool enhanced_dict;
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include <bit_lib/bit_lib.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
#include <lib/nfc/protocols/mf_classic/mf_classic_poller.h>
|
||||
|
||||
#define TAG "NfcMfClassicDictAttack"
|
||||
|
||||
|
@ -316,21 +316,21 @@ void dict_attack_reset_key_attack(DictAttack* instance) {
|
||||
instance->view, DictAttackViewModel * model, { model->is_key_attack = false; }, true);
|
||||
}
|
||||
|
||||
void dict_attack_set_nested_phase(DictAttack* instance, uint8_t nested_phase) {
|
||||
void dict_attack_set_nested_phase(DictAttack* instance, MfClassicNestedPhase nested_phase) {
|
||||
furi_assert(instance);
|
||||
|
||||
with_view_model(
|
||||
instance->view, DictAttackViewModel * model, { model->nested_phase = nested_phase; }, true);
|
||||
}
|
||||
|
||||
void dict_attack_set_prng_type(DictAttack* instance, uint8_t prng_type) {
|
||||
void dict_attack_set_prng_type(DictAttack* instance, MfClassicPrngType prng_type) {
|
||||
furi_assert(instance);
|
||||
|
||||
with_view_model(
|
||||
instance->view, DictAttackViewModel * model, { model->prng_type = prng_type; }, true);
|
||||
}
|
||||
|
||||
void dict_attack_set_backdoor(DictAttack* instance, uint8_t backdoor) {
|
||||
void dict_attack_set_backdoor(DictAttack* instance, MfClassicBackdoor backdoor) {
|
||||
furi_assert(instance);
|
||||
|
||||
with_view_model(
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <gui/view.h>
|
||||
#include <lib/nfc/protocols/mf_classic/mf_classic_poller.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -9,32 +10,6 @@ extern "C" {
|
||||
|
||||
typedef struct DictAttack DictAttack;
|
||||
|
||||
typedef enum {
|
||||
MfClassicNestedPhaseNone,
|
||||
MfClassicNestedPhaseAnalyzePRNG,
|
||||
MfClassicNestedPhaseDictAttack,
|
||||
MfClassicNestedPhaseDictAttackResume,
|
||||
MfClassicNestedPhaseCalibrate,
|
||||
MfClassicNestedPhaseRecalibrate,
|
||||
MfClassicNestedPhaseCollectNtEnc,
|
||||
MfClassicNestedPhaseFinished,
|
||||
} MfClassicNestedPhase;
|
||||
|
||||
typedef enum {
|
||||
MfClassicPrngTypeUnknown, // Tag not yet tested
|
||||
MfClassicPrngTypeNoTag, // No tag detected during test
|
||||
MfClassicPrngTypeWeak, // Weak PRNG, standard Nested
|
||||
MfClassicPrngTypeHard, // Hard PRNG, Hardnested
|
||||
} MfClassicPrngType;
|
||||
|
||||
typedef enum {
|
||||
MfClassicBackdoorUnknown, // Tag not yet tested
|
||||
MfClassicBackdoorNone, // No observed backdoor
|
||||
MfClassicBackdoorAuth1, // Tag responds to v1 auth backdoor
|
||||
MfClassicBackdoorAuth2, // Tag responds to v2 auth backdoor
|
||||
MfClassicBackdoorAuth3, // Tag responds to v3 auth backdoor (static encrypted nonce)
|
||||
} MfClassicBackdoor;
|
||||
|
||||
typedef enum {
|
||||
DictAttackEventSkipPressed,
|
||||
} DictAttackEvent;
|
||||
@ -71,11 +46,11 @@ void dict_attack_set_key_attack(DictAttack* instance, uint8_t sector);
|
||||
|
||||
void dict_attack_reset_key_attack(DictAttack* instance);
|
||||
|
||||
void dict_attack_set_nested_phase(DictAttack* instance, uint8_t nested_phase);
|
||||
void dict_attack_set_nested_phase(DictAttack* instance, MfClassicNestedPhase nested_phase);
|
||||
|
||||
void dict_attack_set_prng_type(DictAttack* instance, uint8_t prng_type);
|
||||
void dict_attack_set_prng_type(DictAttack* instance, MfClassicPrngType prng_type);
|
||||
|
||||
void dict_attack_set_backdoor(DictAttack* instance, uint8_t backdoor);
|
||||
void dict_attack_set_backdoor(DictAttack* instance, MfClassicBackdoor backdoor);
|
||||
|
||||
void dict_attack_set_nested_target_key(DictAttack* instance, uint16_t target_key);
|
||||
|
||||
|
@ -48,6 +48,41 @@ typedef enum {
|
||||
MfClassicPollerModeDictAttackEnhanced, /**< Poller enhanced dictionary attack mode. */
|
||||
} MfClassicPollerMode;
|
||||
|
||||
/**
|
||||
* @brief MfClassic poller nested attack phase.
|
||||
*/
|
||||
typedef enum {
|
||||
MfClassicNestedPhaseNone,
|
||||
MfClassicNestedPhaseAnalyzePRNG,
|
||||
MfClassicNestedPhaseDictAttack,
|
||||
MfClassicNestedPhaseDictAttackResume,
|
||||
MfClassicNestedPhaseCalibrate,
|
||||
MfClassicNestedPhaseRecalibrate,
|
||||
MfClassicNestedPhaseCollectNtEnc,
|
||||
MfClassicNestedPhaseFinished,
|
||||
} MfClassicNestedPhase;
|
||||
|
||||
/**
|
||||
* @brief MfClassic pseudorandom number generator (PRNG) type.
|
||||
*/
|
||||
typedef enum {
|
||||
MfClassicPrngTypeUnknown, // Tag not yet tested
|
||||
MfClassicPrngTypeNoTag, // No tag detected during test
|
||||
MfClassicPrngTypeWeak, // Weak PRNG, standard Nested
|
||||
MfClassicPrngTypeHard, // Hard PRNG, Hardnested
|
||||
} MfClassicPrngType;
|
||||
|
||||
/**
|
||||
* @brief MfClassic authentication backdoor type.
|
||||
*/
|
||||
typedef enum {
|
||||
MfClassicBackdoorUnknown, // Tag not yet tested
|
||||
MfClassicBackdoorNone, // No observed backdoor
|
||||
MfClassicBackdoorAuth1, // Tag responds to v1 auth backdoor
|
||||
MfClassicBackdoorAuth2, // Tag responds to v2 auth backdoor (sometimes static encrypted)
|
||||
MfClassicBackdoorAuth3, // Tag responds to v3 auth backdoor (static encrypted nonce)
|
||||
} MfClassicBackdoor;
|
||||
|
||||
/**
|
||||
* @brief MfClassic poller request mode event data.
|
||||
*
|
||||
@ -78,9 +113,9 @@ typedef struct {
|
||||
uint8_t sectors_read; /**< Number of sectors read. */
|
||||
uint8_t keys_found; /**< Number of keys found. */
|
||||
uint8_t current_sector; /**< Current sector number. */
|
||||
uint8_t nested_phase; /**< Nested attack phase. */
|
||||
uint8_t prng_type; /**< PRNG (weak or hard). */
|
||||
uint8_t backdoor; /**< Backdoor type. */
|
||||
MfClassicNestedPhase nested_phase; /**< Nested attack phase. */
|
||||
MfClassicPrngType prng_type; /**< PRNG (weak or hard). */
|
||||
MfClassicBackdoor backdoor; /**< Backdoor type. */
|
||||
uint16_t nested_target_key; /**< Target key for nested attack. */
|
||||
uint16_t
|
||||
msb_count; /**< Number of unique most significant bytes seen during Hardnested attack. */
|
||||
|
@ -48,32 +48,6 @@ typedef enum {
|
||||
MfClassicCardStateLost,
|
||||
} MfClassicCardState;
|
||||
|
||||
typedef enum {
|
||||
MfClassicNestedPhaseNone,
|
||||
MfClassicNestedPhaseAnalyzePRNG,
|
||||
MfClassicNestedPhaseDictAttack,
|
||||
MfClassicNestedPhaseDictAttackResume,
|
||||
MfClassicNestedPhaseCalibrate,
|
||||
MfClassicNestedPhaseRecalibrate,
|
||||
MfClassicNestedPhaseCollectNtEnc,
|
||||
MfClassicNestedPhaseFinished,
|
||||
} MfClassicNestedPhase;
|
||||
|
||||
typedef enum {
|
||||
MfClassicPrngTypeUnknown, // Tag not yet tested
|
||||
MfClassicPrngTypeNoTag, // No tag detected during test
|
||||
MfClassicPrngTypeWeak, // Weak PRNG, standard Nested
|
||||
MfClassicPrngTypeHard, // Hard PRNG, Hardnested
|
||||
} MfClassicPrngType;
|
||||
|
||||
typedef enum {
|
||||
MfClassicBackdoorUnknown, // Tag not yet tested
|
||||
MfClassicBackdoorNone, // No observed backdoor
|
||||
MfClassicBackdoorAuth1, // Tag responds to v1 auth backdoor
|
||||
MfClassicBackdoorAuth2, // Tag responds to v2 auth backdoor
|
||||
MfClassicBackdoorAuth3, // Tag responds to v3 auth backdoor (static encrypted nonce)
|
||||
} MfClassicBackdoor;
|
||||
|
||||
typedef struct {
|
||||
MfClassicKey key;
|
||||
MfClassicBackdoor type;
|
||||
|
Loading…
Reference in New Issue
Block a user