mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-05 05:09:09 -07:00
nfc: Add NTAG authentication event to emulation
This commit is contained in:
@@ -1246,6 +1246,7 @@ void mf_ul_prepare_emulation(MfUltralightEmulator* emulator, MfUltralightData* d
|
||||
emulator->config = mf_ultralight_get_config_pages(&emulator->data);
|
||||
emulator->page_num = emulator->data.data_size / 4;
|
||||
emulator->data_changed = false;
|
||||
memset(&emulator->auth_attempt, 0, sizeof(MfUltralightAuth));
|
||||
mf_ul_reset_emulation(emulator, true);
|
||||
}
|
||||
|
||||
@@ -1706,6 +1707,13 @@ bool mf_ul_prepare_emulation_response(
|
||||
} else if(cmd == MF_UL_AUTH) {
|
||||
if(emulator->supported_features & MfUltralightSupportAuth) {
|
||||
if(buff_rx_len == (1 + 4) * 8) {
|
||||
// Record password sent by PCD
|
||||
memcpy(
|
||||
emulator->auth_attempt.pwd.raw,
|
||||
&buff_rx[1],
|
||||
sizeof(emulator->auth_attempt.pwd.raw));
|
||||
emulator->auth_attempted = true;
|
||||
|
||||
uint16_t scaled_authlim = mf_ultralight_calc_auth_count(&emulator->data);
|
||||
if(scaled_authlim != 0 && emulator->data.curr_authlim >= scaled_authlim) {
|
||||
if(emulator->data.curr_authlim != UINT16_MAX) {
|
||||
|
||||
@@ -185,6 +185,8 @@ typedef struct {
|
||||
bool sector_select_cmd_started;
|
||||
bool ntag_i2c_plus_sector3_lockout;
|
||||
bool read_counter_incremented;
|
||||
bool auth_attempted;
|
||||
MfUltralightAuth auth_attempt;
|
||||
} MfUltralightEmulator;
|
||||
|
||||
void mf_ul_reset(MfUltralightData* data);
|
||||
|
||||
Reference in New Issue
Block a user