mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
fix little endian vs big endian in the macros... again... but this time correct
This commit is contained in:
parent
88d9942d3f
commit
083e557b9f
2 changed files with 16 additions and 16 deletions
|
@ -344,7 +344,7 @@ int CmdEM4x50Login(const char *Cmd) {
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t password = BYTES2UINT32(pwd);
|
uint32_t password = BYTES2UINT32_BE(pwd);
|
||||||
|
|
||||||
// start
|
// start
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
|
@ -395,8 +395,8 @@ int CmdEM4x50Brute(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
em4x50_data_t etd;
|
em4x50_data_t etd;
|
||||||
etd.password1 = BYTES2UINT32(first);
|
etd.password1 = BYTES2UINT32_BE(first);
|
||||||
etd.password2 = BYTES2UINT32(last);
|
etd.password2 = BYTES2UINT32_BE(last);
|
||||||
|
|
||||||
// 27 passwords/second (empirical value)
|
// 27 passwords/second (empirical value)
|
||||||
const int speed = 27;
|
const int speed = 27;
|
||||||
|
@ -624,7 +624,7 @@ int CmdEM4x50Read(const char *Cmd) {
|
||||||
PrintAndLogEx(FAILED, "password length must be 4 bytes instead of %d", pwd_len);
|
PrintAndLogEx(FAILED, "password length must be 4 bytes instead of %d", pwd_len);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
} else {
|
} else {
|
||||||
etd.password1 = BYTES2UINT32(pwd);
|
etd.password1 = BYTES2UINT32_BE(pwd);
|
||||||
etd.pwd_given = true;
|
etd.pwd_given = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -663,7 +663,7 @@ int CmdEM4x50Info(const char *Cmd) {
|
||||||
PrintAndLogEx(FAILED, "password length must be 4 bytes instead of %d", pwd_len);
|
PrintAndLogEx(FAILED, "password length must be 4 bytes instead of %d", pwd_len);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
} else {
|
} else {
|
||||||
etd.password1 = BYTES2UINT32(pwd);
|
etd.password1 = BYTES2UINT32_BE(pwd);
|
||||||
etd.pwd_given = true;
|
etd.pwd_given = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -775,7 +775,7 @@ int CmdEM4x50Dump(const char *Cmd) {
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
} else {
|
} else {
|
||||||
etd.password1 = BYTES2UINT32(pwd);
|
etd.password1 = BYTES2UINT32_BE(pwd);
|
||||||
etd.pwd_given = true;
|
etd.pwd_given = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -867,14 +867,14 @@ int CmdEM4x50Write(const char *Cmd) {
|
||||||
PrintAndLogEx(FAILED, "password length must be 4 bytes instead of %d", pwd_len);
|
PrintAndLogEx(FAILED, "password length must be 4 bytes instead of %d", pwd_len);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
} else {
|
} else {
|
||||||
etd.password1 = BYTES2UINT32(pwd);
|
etd.password1 = BYTES2UINT32_BE(pwd);
|
||||||
etd.pwd_given = true;
|
etd.pwd_given = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
etd.addresses = (addr << 8) | addr;
|
etd.addresses = (addr << 8) | addr;
|
||||||
etd.addr_given = true;
|
etd.addr_given = true;
|
||||||
etd.word = BYTES2UINT32(word);
|
etd.word = BYTES2UINT32_BE(word);
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_LF_EM4X50_WRITE, (uint8_t *)&etd, sizeof(etd));
|
SendCommandNG(CMD_LF_EM4X50_WRITE, (uint8_t *)&etd, sizeof(etd));
|
||||||
|
@ -936,14 +936,14 @@ int CmdEM4x50WritePwd(const char *Cmd) {
|
||||||
PrintAndLogEx(FAILED, "password length must be 4 bytes instead of %d", pwd_len);
|
PrintAndLogEx(FAILED, "password length must be 4 bytes instead of %d", pwd_len);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
} else {
|
} else {
|
||||||
etd.password1 = BYTES2UINT32(pwd);
|
etd.password1 = BYTES2UINT32_BE(pwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (npwd_len != 4) {
|
if (npwd_len != 4) {
|
||||||
PrintAndLogEx(FAILED, "password length must be 4 bytes instead of %d", npwd_len);
|
PrintAndLogEx(FAILED, "password length must be 4 bytes instead of %d", npwd_len);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
} else {
|
} else {
|
||||||
etd.password2 = BYTES2UINT32(npwd);
|
etd.password2 = BYTES2UINT32_BE(npwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
|
@ -999,7 +999,7 @@ int CmdEM4x50Wipe(const char *Cmd) {
|
||||||
|
|
||||||
em4x50_data_t etd = {.pwd_given = false, .word = 0x0, .password2 = 0x0};
|
em4x50_data_t etd = {.pwd_given = false, .word = 0x0, .password2 = 0x0};
|
||||||
|
|
||||||
etd.password1 = BYTES2UINT32(pwd);
|
etd.password1 = BYTES2UINT32_BE(pwd);
|
||||||
etd.pwd_given = true;
|
etd.pwd_given = true;
|
||||||
|
|
||||||
// clear password
|
// clear password
|
||||||
|
@ -1095,7 +1095,7 @@ int CmdEM4x50Restore(const char *Cmd) {
|
||||||
PrintAndLogEx(FAILED, "password length must be 4 bytes instead of %d", pwd_len);
|
PrintAndLogEx(FAILED, "password length must be 4 bytes instead of %d", pwd_len);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
} else {
|
} else {
|
||||||
etd.password1 = BYTES2UINT32(pwd);
|
etd.password1 = BYTES2UINT32_BE(pwd);
|
||||||
etd.pwd_given = true;
|
etd.pwd_given = true;
|
||||||
// if password is available protection and control word can be restored
|
// if password is available protection and control word can be restored
|
||||||
startblock = EM4X50_PROTECTION;
|
startblock = EM4X50_PROTECTION;
|
||||||
|
@ -1122,7 +1122,7 @@ int CmdEM4x50Restore(const char *Cmd) {
|
||||||
PrintAndLogEx(INPLACE, "Restoring block %i", i);
|
PrintAndLogEx(INPLACE, "Restoring block %i", i);
|
||||||
|
|
||||||
etd.addresses = i << 8 | i;
|
etd.addresses = i << 8 | i;
|
||||||
etd.word = reflect32(BYTES2UINT32((data + 4 * i)));
|
etd.word = reflect32(BYTES2UINT32_BE((data + 4 * i)));
|
||||||
|
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
|
@ -1172,7 +1172,7 @@ int CmdEM4x50Sim(const char *Cmd) {
|
||||||
PrintAndLogEx(FAILED, "password length must be 4 bytes, got %d", pwd_len);
|
PrintAndLogEx(FAILED, "password length must be 4 bytes, got %d", pwd_len);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
} else {
|
} else {
|
||||||
password = BYTES2UINT32(pwd);
|
password = BYTES2UINT32_BE(pwd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -251,7 +251,7 @@ int CmdEM4x70Unlock(const char *Cmd) {
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
etd.pin = BYTES2UINT32_BE(pin);
|
etd.pin = BYTES2UINT32(pin);
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_LF_EM4X70_UNLOCK, (uint8_t *)&etd, sizeof(etd));
|
SendCommandNG(CMD_LF_EM4X70_UNLOCK, (uint8_t *)&etd, sizeof(etd));
|
||||||
|
@ -370,7 +370,7 @@ int CmdEM4x70WritePIN(const char *Cmd) {
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
etd.pin = BYTES2UINT32_BE(pin);
|
etd.pin = BYTES2UINT32(pin);
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_LF_EM4X70_WRITEPIN, (uint8_t *)&etd, sizeof(etd));
|
SendCommandNG(CMD_LF_EM4X70_WRITEPIN, (uint8_t *)&etd, sizeof(etd));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue