mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-15 03:34:22 +08:00
Rename MAGIC defines
This commit is contained in:
parent
8c89b35f1e
commit
b860cc6eaf
3 changed files with 12 additions and 12 deletions
|
@ -121,7 +121,7 @@ void SendCommandNG(uint16_t cmd, uint8_t *data, size_t len) {
|
|||
pthread_cond_wait(&txBufferSig, &txBufferMutex);
|
||||
}
|
||||
|
||||
txBufferNG.pre.magic = USB_COMMANDNG_PREAMBLE_MAGIC;
|
||||
txBufferNG.pre.magic = COMMANDNG_PREAMBLE_MAGIC;
|
||||
txBufferNG.pre.length = len;
|
||||
txBufferNG.pre.cmd = cmd;
|
||||
memcpy(&txBufferNG.data, data, len);
|
||||
|
@ -131,7 +131,7 @@ void SendCommandNG(uint16_t cmd, uint8_t *data, size_t len) {
|
|||
compute_crc(CRC_14443_A, (uint8_t *)&txBufferNG, sizeof(PacketCommandNGPreamble) + len, &first, &second);
|
||||
tx_post->crc = (first << 8) + second;
|
||||
} else {
|
||||
tx_post->crc = USB_COMMANDNG_POSTAMBLE_MAGIC;
|
||||
tx_post->crc = COMMANDNG_POSTAMBLE_MAGIC;
|
||||
}
|
||||
|
||||
|
||||
|
@ -309,7 +309,7 @@ __attribute__((force_align_arg_pointer))
|
|||
rx.length = rx_raw.pre.length;
|
||||
rx.status = rx_raw.pre.status;
|
||||
rx.cmd = rx_raw.pre.cmd;
|
||||
if (rx.magic == USB_REPLYNG_PREAMBLE_MAGIC) { // New style NG reply
|
||||
if (rx.magic == RESPONSENG_PREAMBLE_MAGIC) { // New style NG reply
|
||||
if (rx.length > USB_CMD_DATA_SIZE) {
|
||||
PrintAndLogEx(WARNING, "Received packet frame with incompatible length: 0x%04x", rx.length);
|
||||
error = true;
|
||||
|
@ -330,7 +330,7 @@ __attribute__((force_align_arg_pointer))
|
|||
}
|
||||
if (!error) { // Check CRC, accept MAGIC as placeholder
|
||||
rx.crc = rx_raw.foopost.crc;
|
||||
if (rx.crc != USB_REPLYNG_POSTAMBLE_MAGIC) {
|
||||
if (rx.crc != RESPONSENG_POSTAMBLE_MAGIC) {
|
||||
uint8_t first, second;
|
||||
compute_crc(CRC_14443_A, (uint8_t *)&rx_raw, sizeof(PacketResponseNGPreamble) + rx.length, &first, &second);
|
||||
if ((first << 8) + second != rx.crc) {
|
||||
|
|
|
@ -91,7 +91,7 @@ int16_t reply_ng(uint16_t cmd, int16_t status, uint8_t *data, size_t len) {
|
|||
// ((uint8_t *)&txBufferNG)[i] = 0x00;
|
||||
|
||||
// Compose the outgoing command frame
|
||||
txBufferNG.pre.magic = USB_REPLYNG_PREAMBLE_MAGIC;
|
||||
txBufferNG.pre.magic = RESPONSENG_PREAMBLE_MAGIC;
|
||||
txBufferNG.pre.cmd = cmd;
|
||||
txBufferNG.pre.status = status;
|
||||
if (len > USB_CMD_DATA_SIZE) {
|
||||
|
@ -114,7 +114,7 @@ int16_t reply_ng(uint16_t cmd, int16_t status, uint8_t *data, size_t len) {
|
|||
compute_crc(CRC_14443_A, (uint8_t *)&txBufferNG, sizeof(PacketResponseNGPreamble) + len, &first, &second);
|
||||
tx_post->crc = (first << 8) + second;
|
||||
} else {
|
||||
tx_post->crc = USB_REPLYNG_POSTAMBLE_MAGIC;
|
||||
tx_post->crc = RESPONSENG_POSTAMBLE_MAGIC;
|
||||
}
|
||||
txBufferNGLen = sizeof(PacketResponseNGPreamble) + len + sizeof(PacketResponseNGPostamble);
|
||||
|
||||
|
@ -143,7 +143,7 @@ int16_t receive_ng(PacketCommandNG *rx) {
|
|||
rx->magic = rx_raw.pre.magic;
|
||||
rx->length = rx_raw.pre.length;
|
||||
rx->cmd = rx_raw.pre.cmd;
|
||||
if (rx->magic == USB_COMMANDNG_PREAMBLE_MAGIC) { // New style NG command
|
||||
if (rx->magic == COMMANDNG_PREAMBLE_MAGIC) { // New style NG command
|
||||
if (rx->length > USB_CMD_DATA_SIZE)
|
||||
return PM3_EOVFLOW;
|
||||
// Get the core and variable length payload
|
||||
|
@ -157,7 +157,7 @@ int16_t receive_ng(PacketCommandNG *rx) {
|
|||
return PM3_EIO;
|
||||
// Check CRC, accept MAGIC as placeholder
|
||||
rx->crc = rx_raw.foopost.crc;
|
||||
if (rx->crc != USB_COMMANDNG_POSTAMBLE_MAGIC) {
|
||||
if (rx->crc != COMMANDNG_POSTAMBLE_MAGIC) {
|
||||
uint8_t first, second;
|
||||
compute_crc(CRC_14443_A, (uint8_t *)&rx_raw, sizeof(PacketCommandNGPreamble) + rx->length, &first, &second);
|
||||
if ((first << 8) + second != rx->crc)
|
||||
|
|
|
@ -41,8 +41,8 @@ typedef struct {
|
|||
uint16_t cmd;
|
||||
} PACKED PacketCommandNGPreamble;
|
||||
|
||||
#define USB_COMMANDNG_PREAMBLE_MAGIC 0x61334d50 // PM3a
|
||||
#define USB_COMMANDNG_POSTAMBLE_MAGIC 0x3361 // a3
|
||||
#define COMMANDNG_PREAMBLE_MAGIC 0x61334d50 // PM3a
|
||||
#define COMMANDNG_POSTAMBLE_MAGIC 0x3361 // a3
|
||||
|
||||
typedef struct {
|
||||
uint16_t crc;
|
||||
|
@ -85,8 +85,8 @@ typedef struct {
|
|||
uint16_t cmd;
|
||||
} PACKED PacketResponseNGPreamble;
|
||||
|
||||
#define USB_REPLYNG_PREAMBLE_MAGIC 0x62334d50 // PM3b
|
||||
#define USB_REPLYNG_POSTAMBLE_MAGIC 0x3362 // b3
|
||||
#define RESPONSENG_PREAMBLE_MAGIC 0x62334d50 // PM3b
|
||||
#define RESPONSENG_POSTAMBLE_MAGIC 0x3362 // b3
|
||||
|
||||
typedef struct {
|
||||
uint16_t crc;
|
||||
|
|
Loading…
Reference in a new issue