added login function
This commit is contained in:
@@ -1041,6 +1041,10 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||
em4x50_brute((em4x50_data_t *)packet->data.asBytes);
|
||||
break;
|
||||
}
|
||||
case CMD_LF_EM4X50_LOGIN: {
|
||||
em4x50_login((em4x50_data_t *)packet->data.asBytes);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WITH_ISO15693
|
||||
|
||||
@@ -1184,3 +1184,30 @@ void em4x50_brute(em4x50_data_t *etd) {
|
||||
lf_finalize();
|
||||
reply_ng(CMD_ACK, bsuccess, (uint8_t *)(&pwd), 32);
|
||||
}
|
||||
|
||||
void em4x50_login(em4x50_data_t *etd) {
|
||||
|
||||
// login into EM4x50
|
||||
|
||||
uint8_t status = 0;
|
||||
uint8_t bytes[4] = {0x0, 0x0, 0x0, 0x0};
|
||||
uint32_t rpwd = 0x0;
|
||||
|
||||
em4x50_setup_read();
|
||||
|
||||
// set gHigh and gLow
|
||||
if (get_signalproperties() && find_em4x50_tag()) {
|
||||
|
||||
// lsb -> msb
|
||||
rpwd = reflect32(etd->login_password);
|
||||
|
||||
// convert to "old" data format
|
||||
for (int i = 0; i < 4; i++)
|
||||
bytes[i] = (rpwd >> ((3 - i) * 8)) & 0xFF;
|
||||
|
||||
status = login(bytes);
|
||||
}
|
||||
|
||||
lf_finalize();
|
||||
reply_ng(CMD_ACK, status, 0, 0);
|
||||
}
|
||||
|
||||
@@ -27,5 +27,6 @@ void em4x50_write_password(em4x50_data_t *etd);
|
||||
void em4x50_read(em4x50_data_t *etd);
|
||||
void em4x50_wipe(em4x50_data_t *etd);
|
||||
void em4x50_brute(em4x50_data_t *etd);
|
||||
void em4x50_login(em4x50_data_t *etd);
|
||||
|
||||
#endif /* EM4X50_H */
|
||||
|
||||
Reference in New Issue
Block a user