mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
args names
This commit is contained in:
parent
a27d549a60
commit
a52a0bf537
8 changed files with 73 additions and 73 deletions
|
@ -99,8 +99,8 @@ void WriteEM410x(uint32_t card, uint32_t id_hi, uint32_t id_lo);
|
||||||
void CopyIndala64toT55x7(uint32_t hi, uint32_t lo); // Clone Indala 64-bit tag by UID to T55x7
|
void CopyIndala64toT55x7(uint32_t hi, uint32_t lo); // Clone Indala 64-bit tag by UID to T55x7
|
||||||
void CopyIndala224toT55x7(uint32_t uid1, uint32_t uid2, uint32_t uid3, uint32_t uid4, uint32_t uid5, uint32_t uid6, uint32_t uid7); // Clone Indala 224-bit tag by UID to T55x7
|
void CopyIndala224toT55x7(uint32_t uid1, uint32_t uid2, uint32_t uid3, uint32_t uid4, uint32_t uid5, uint32_t uid6, uint32_t uid7); // Clone Indala 224-bit tag by UID to T55x7
|
||||||
void T55xxResetRead(void);
|
void T55xxResetRead(void);
|
||||||
void T55xxWriteBlock(uint32_t Data, uint8_t Block, uint32_t Pwd, uint8_t PwdMode);
|
void T55xxWriteBlock(uint32_t Data, uint8_t Block, uint32_t Pwd, uint8_t arg);
|
||||||
void T55xxWriteBlockExt(uint32_t Data, uint8_t Block, uint32_t Pwd, uint8_t PwdMode);
|
void T55xxWriteBlockExt(uint32_t Data, uint8_t Block, uint32_t Pwd, uint8_t arg);
|
||||||
void T55xxReadBlock(uint16_t arg0, uint8_t Block, uint32_t Pwd);
|
void T55xxReadBlock(uint16_t arg0, uint8_t Block, uint32_t Pwd);
|
||||||
void T55xxWakeUp(uint32_t Pwd);
|
void T55xxWakeUp(uint32_t Pwd);
|
||||||
void T55xx_ChkPwds(void);
|
void T55xx_ChkPwds(void);
|
||||||
|
@ -130,7 +130,7 @@ void ReaderIso14443a(UsbCommand *c);
|
||||||
|
|
||||||
// Also used in iclass.c
|
// Also used in iclass.c
|
||||||
//bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t len, uint32_t timestamp_start, uint32_t timestamp_end, uint8_t *parity, bool readerToTag);
|
//bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t len, uint32_t timestamp_start, uint32_t timestamp_end, uint8_t *parity, bool readerToTag);
|
||||||
void GetParity(const uint8_t *pbtCmd, uint16_t len, uint8_t *parity);
|
void GetParity(const uint8_t *pbtCmd, uint16_t len, uint8_t *par);
|
||||||
void iso14a_set_trigger(bool enable);
|
void iso14a_set_trigger(bool enable);
|
||||||
// also used in emv
|
// also used in emv
|
||||||
//bool prepare_allocated_tag_modulation(tag_response_info_t *response_info);
|
//bool prepare_allocated_tag_modulation(tag_response_info_t *response_info);
|
||||||
|
@ -212,15 +212,15 @@ void Iso15693InitReader(void);
|
||||||
void RAMFUNC SniffIClass(void);
|
void RAMFUNC SniffIClass(void);
|
||||||
void SimulateIClass(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
|
void SimulateIClass(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
|
||||||
void ReaderIClass(uint8_t arg0);
|
void ReaderIClass(uint8_t arg0);
|
||||||
void ReaderIClass_Replay(uint8_t arg0, uint8_t *MAC);
|
void ReaderIClass_Replay(uint8_t arg0, uint8_t *mac);
|
||||||
void iClass_Authentication(uint8_t *MAC);
|
void iClass_Authentication(uint8_t *mac);
|
||||||
void iClass_Authentication_fast(uint64_t arg0, uint64_t arg1, uint8_t *datain);
|
void iClass_Authentication_fast(uint64_t arg0, uint64_t arg1, uint8_t *datain);
|
||||||
void iClass_WriteBlock(uint8_t blockNo, uint8_t *data);
|
void iClass_WriteBlock(uint8_t blockno, uint8_t *data);
|
||||||
void iClass_ReadBlk(uint8_t blockNo);
|
void iClass_ReadBlk(uint8_t blockno);
|
||||||
bool iClass_ReadBlock(uint8_t blockNo, uint8_t *data, uint8_t datalen);
|
bool iClass_ReadBlock(uint8_t blockno, uint8_t *data, uint8_t len);
|
||||||
void iClass_Dump(uint8_t blockno, uint8_t numblks);
|
void iClass_Dump(uint8_t blockno, uint8_t numblks);
|
||||||
void iClass_Clone(uint8_t startblock, uint8_t endblock, uint8_t *data);
|
void iClass_Clone(uint8_t startblock, uint8_t endblock, uint8_t *data);
|
||||||
void iClass_ReadCheck(uint8_t blockNo, uint8_t keyType);
|
void iClass_ReadCheck(uint8_t blockno, uint8_t keytype);
|
||||||
|
|
||||||
// cmd.h
|
// cmd.h
|
||||||
uint8_t cmd_receive(UsbCommand *cmd);
|
uint8_t cmd_receive(UsbCommand *cmd);
|
||||||
|
|
|
@ -2107,7 +2107,7 @@ void ReaderIClass(uint8_t arg0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// turn off afterwards
|
// turn off afterwards
|
||||||
void ReaderIClass_Replay(uint8_t arg0, uint8_t *MAC) {
|
void ReaderIClass_Replay(uint8_t arg0, uint8_t *mac) {
|
||||||
|
|
||||||
uint8_t cardsize = 0;
|
uint8_t cardsize = 0;
|
||||||
uint8_t mem = 0;
|
uint8_t mem = 0;
|
||||||
|
@ -2134,7 +2134,7 @@ void ReaderIClass_Replay(uint8_t arg0, uint8_t *MAC) {
|
||||||
if (read_status < 2) continue;
|
if (read_status < 2) continue;
|
||||||
|
|
||||||
//for now replay captured auth (as cc not updated)
|
//for now replay captured auth (as cc not updated)
|
||||||
memcpy(check + 5, MAC, 4);
|
memcpy(check + 5, mac, 4);
|
||||||
|
|
||||||
if (!sendCmdGetResponseWithRetries(check, sizeof(check), resp, 4, 5)) {
|
if (!sendCmdGetResponseWithRetries(check, sizeof(check), resp, 4, 5)) {
|
||||||
DbpString("Error: Authentication Fail!");
|
DbpString("Error: Authentication Fail!");
|
||||||
|
@ -2227,8 +2227,8 @@ void ReaderIClass_Replay(uint8_t arg0, uint8_t *MAC) {
|
||||||
|
|
||||||
// not used. ?!? ( CMD_ICLASS_READCHECK)
|
// not used. ?!? ( CMD_ICLASS_READCHECK)
|
||||||
// turn off afterwards
|
// turn off afterwards
|
||||||
void iClass_ReadCheck(uint8_t blockNo, uint8_t keyType) {
|
void iClass_ReadCheck(uint8_t blockno, uint8_t keytype) {
|
||||||
uint8_t readcheck[] = { keyType, blockNo };
|
uint8_t readcheck[] = { keytype, blockno };
|
||||||
uint8_t resp[] = {0, 0, 0, 0, 0, 0, 0, 0};
|
uint8_t resp[] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
size_t isOK = 0;
|
size_t isOK = 0;
|
||||||
isOK = sendCmdGetResponseWithRetries(readcheck, sizeof(readcheck), resp, sizeof(resp), 6);
|
isOK = sendCmdGetResponseWithRetries(readcheck, sizeof(readcheck), resp, sizeof(resp), 6);
|
||||||
|
@ -2348,9 +2348,9 @@ out:
|
||||||
|
|
||||||
// Tries to read block.
|
// Tries to read block.
|
||||||
// retries 10times.
|
// retries 10times.
|
||||||
bool iClass_ReadBlock(uint8_t blockNo, uint8_t *data, uint8_t len) {
|
bool iClass_ReadBlock(uint8_t blockno, uint8_t *data, uint8_t len) {
|
||||||
uint8_t resp[10];
|
uint8_t resp[10];
|
||||||
uint8_t cmd[] = {ICLASS_CMD_READ_OR_IDENTIFY, blockNo, 0x00, 0x00};
|
uint8_t cmd[] = {ICLASS_CMD_READ_OR_IDENTIFY, blockno, 0x00, 0x00};
|
||||||
AddCrc(cmd + 1, 1);
|
AddCrc(cmd + 1, 1);
|
||||||
// expect size 10, retry 5times
|
// expect size 10, retry 5times
|
||||||
bool isOK = sendCmdGetResponseWithRetries(cmd, sizeof(cmd), resp, 10, 5);
|
bool isOK = sendCmdGetResponseWithRetries(cmd, sizeof(cmd), resp, 10, 5);
|
||||||
|
@ -2402,10 +2402,10 @@ void iClass_Dump(uint8_t blockno, uint8_t numblks) {
|
||||||
BigBuf_free();
|
BigBuf_free();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool iClass_WriteBlock_ext(uint8_t blockNo, uint8_t *data) {
|
bool iClass_WriteBlock_ext(uint8_t blockno, uint8_t *data) {
|
||||||
|
|
||||||
uint8_t resp[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
uint8_t resp[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
uint8_t write[] = { ICLASS_CMD_UPDATE, blockNo, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
uint8_t write[] = { ICLASS_CMD_UPDATE, blockno, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||||
memcpy(write + 2, data, 12); // data + mac
|
memcpy(write + 2, data, 12); // data + mac
|
||||||
AddCrc(write + 1, 13);
|
AddCrc(write + 1, 13);
|
||||||
|
|
||||||
|
@ -2416,7 +2416,7 @@ bool iClass_WriteBlock_ext(uint8_t blockNo, uint8_t *data) {
|
||||||
if (memcmp(write + 2, resp, 8)) {
|
if (memcmp(write + 2, resp, 8)) {
|
||||||
|
|
||||||
//if not programming key areas (note key blocks don't get programmed with actual key data it is xor data)
|
//if not programming key areas (note key blocks don't get programmed with actual key data it is xor data)
|
||||||
if (blockNo != 3 && blockNo != 4) {
|
if (blockno != 3 && blockno != 4) {
|
||||||
isOK = sendCmdGetResponseWithRetries(write, sizeof(write), resp, sizeof(resp), 5);
|
isOK = sendCmdGetResponseWithRetries(write, sizeof(write), resp, sizeof(resp), 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2425,8 +2425,8 @@ bool iClass_WriteBlock_ext(uint8_t blockNo, uint8_t *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// turn off afterwards
|
// turn off afterwards
|
||||||
void iClass_WriteBlock(uint8_t blockNo, uint8_t *data) {
|
void iClass_WriteBlock(uint8_t blockno, uint8_t *data) {
|
||||||
bool isOK = iClass_WriteBlock_ext(blockNo, data);
|
bool isOK = iClass_WriteBlock_ext(blockno, data);
|
||||||
cmd_send(CMD_ACK, isOK, 0, 0, 0, 0);
|
cmd_send(CMD_ACK, isOK, 0, 0, 0, 0);
|
||||||
switch_off();
|
switch_off();
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,12 +121,12 @@ uint32_t iso14a_get_timeout(void) {
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Generate the parity value for a byte sequence
|
// Generate the parity value for a byte sequence
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void GetParity(const uint8_t *pbtCmd, uint16_t iLen, uint8_t *par) {
|
void GetParity(const uint8_t *pbtCmd, uint16_t len, uint8_t *par) {
|
||||||
uint16_t paritybit_cnt = 0;
|
uint16_t paritybit_cnt = 0;
|
||||||
uint16_t paritybyte_cnt = 0;
|
uint16_t paritybyte_cnt = 0;
|
||||||
uint8_t parityBits = 0;
|
uint8_t parityBits = 0;
|
||||||
|
|
||||||
for (uint16_t i = 0; i < iLen; i++) {
|
for (uint16_t i = 0; i < len; i++) {
|
||||||
// Generate the parity bits
|
// Generate the parity bits
|
||||||
parityBits |= ((oddparity8(pbtCmd[i])) << (7 - paritybit_cnt));
|
parityBits |= ((oddparity8(pbtCmd[i])) << (7 - paritybit_cnt));
|
||||||
if (paritybit_cnt == 7) {
|
if (paritybit_cnt == 7) {
|
||||||
|
@ -193,9 +193,9 @@ void UartReset(void) {
|
||||||
Uart.syncBit = 9999;
|
Uart.syncBit = 9999;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UartInit(uint8_t *data, uint8_t *parity) {
|
void UartInit(uint8_t *data, uint8_t *par) {
|
||||||
Uart.output = data;
|
Uart.output = data;
|
||||||
Uart.parity = parity;
|
Uart.parity = par;
|
||||||
UartReset();
|
UartReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,9 +366,9 @@ void DemodReset(void) {
|
||||||
Demod.samples = 0;
|
Demod.samples = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DemodInit(uint8_t *data, uint8_t *parity) {
|
void DemodInit(uint8_t *data, uint8_t *par) {
|
||||||
Demod.output = data;
|
Demod.output = data;
|
||||||
Demod.parity = parity;
|
Demod.parity = par;
|
||||||
DemodReset();
|
DemodReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -636,7 +636,7 @@ void RAMFUNC SniffIso14443a(uint8_t param) {
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Prepare tag messages
|
// Prepare tag messages
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
static void CodeIso14443aAsTagPar(const uint8_t *cmd, uint16_t len, uint8_t *parity, bool collision) {
|
static void CodeIso14443aAsTagPar(const uint8_t *cmd, uint16_t len, uint8_t *par, bool collision) {
|
||||||
|
|
||||||
//uint8_t localCol = 0;
|
//uint8_t localCol = 0;
|
||||||
ToSendReset();
|
ToSendReset();
|
||||||
|
@ -679,7 +679,7 @@ static void CodeIso14443aAsTagPar(const uint8_t *cmd, uint16_t len, uint8_t *par
|
||||||
LastProxToAirDuration = 8 * ToSendMax;
|
LastProxToAirDuration = 8 * ToSendMax;
|
||||||
} else {
|
} else {
|
||||||
// Get the parity bit
|
// Get the parity bit
|
||||||
if (parity[i >> 3] & (0x80 >> (i & 0x0007))) {
|
if (par[i >> 3] & (0x80 >> (i & 0x0007))) {
|
||||||
ToSend[++ToSendMax] = SEC_D;
|
ToSend[++ToSendMax] = SEC_D;
|
||||||
LastProxToAirDuration = 8 * ToSendMax - 4;
|
LastProxToAirDuration = 8 * ToSendMax - 4;
|
||||||
} else {
|
} else {
|
||||||
|
@ -774,7 +774,7 @@ static void EmLogTraceTag(uint8_t *tag_data, uint16_t tag_len, uint8_t *tag_Pari
|
||||||
// stop when button is pressed
|
// stop when button is pressed
|
||||||
// or return TRUE when command is captured
|
// or return TRUE when command is captured
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
static int GetIso14443aCommandFromReader(uint8_t *received, uint8_t *parity, int *len) {
|
static int GetIso14443aCommandFromReader(uint8_t *received, uint8_t *par, int *len) {
|
||||||
// Set FPGA mode to "simulated ISO 14443 tag", no modulation (listen
|
// Set FPGA mode to "simulated ISO 14443 tag", no modulation (listen
|
||||||
// only, since we are receiving, not transmitting).
|
// only, since we are receiving, not transmitting).
|
||||||
// Signal field is off with the appropriate LED
|
// Signal field is off with the appropriate LED
|
||||||
|
@ -782,7 +782,7 @@ static int GetIso14443aCommandFromReader(uint8_t *received, uint8_t *parity, int
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_ISO14443A | FPGA_HF_ISO14443A_TAGSIM_LISTEN);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_ISO14443A | FPGA_HF_ISO14443A_TAGSIM_LISTEN);
|
||||||
|
|
||||||
// Now run a `software UART` on the stream of incoming samples.
|
// Now run a `software UART` on the stream of incoming samples.
|
||||||
UartInit(received, parity);
|
UartInit(received, par);
|
||||||
|
|
||||||
// clear RXRDY:
|
// clear RXRDY:
|
||||||
uint8_t b = (uint8_t)AT91C_BASE_SSC->SSC_RHR;
|
uint8_t b = (uint8_t)AT91C_BASE_SSC->SSC_RHR;
|
||||||
|
@ -1520,7 +1520,7 @@ static void TransmitFor14443a(const uint8_t *cmd, uint16_t len, uint32_t *timing
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Prepare reader command (in bits, support short frames) to send to FPGA
|
// Prepare reader command (in bits, support short frames) to send to FPGA
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CodeIso14443aBitsAsReaderPar(const uint8_t *cmd, uint16_t bits, const uint8_t *parity) {
|
void CodeIso14443aBitsAsReaderPar(const uint8_t *cmd, uint16_t bits, const uint8_t *par) {
|
||||||
int i, j;
|
int i, j;
|
||||||
int last = 0;
|
int last = 0;
|
||||||
uint8_t b;
|
uint8_t b;
|
||||||
|
@ -1559,9 +1559,9 @@ void CodeIso14443aBitsAsReaderPar(const uint8_t *cmd, uint16_t bits, const uint8
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only transmit parity bit if we transmitted a complete byte
|
// Only transmit parity bit if we transmitted a complete byte
|
||||||
if (j == 8 && parity != NULL) {
|
if (j == 8 && par != NULL) {
|
||||||
// Get the parity bit
|
// Get the parity bit
|
||||||
if (parity[i >> 3] & (0x80 >> (i & 0x0007))) {
|
if (par[i >> 3] & (0x80 >> (i & 0x0007))) {
|
||||||
// Sequence X
|
// Sequence X
|
||||||
ToSend[++ToSendMax] = SEC_X;
|
ToSend[++ToSendMax] = SEC_X;
|
||||||
LastProxToAirDuration = 8 * (ToSendMax + 1) - 2;
|
LastProxToAirDuration = 8 * (ToSendMax + 1) - 2;
|
||||||
|
@ -1599,8 +1599,8 @@ void CodeIso14443aBitsAsReaderPar(const uint8_t *cmd, uint16_t bits, const uint8
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Prepare reader command to send to FPGA
|
// Prepare reader command to send to FPGA
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CodeIso14443aAsReaderPar(const uint8_t *cmd, uint16_t len, const uint8_t *parity) {
|
void CodeIso14443aAsReaderPar(const uint8_t *cmd, uint16_t len, const uint8_t *par) {
|
||||||
CodeIso14443aBitsAsReaderPar(cmd, len * 8, parity);
|
CodeIso14443aBitsAsReaderPar(cmd, len * 8, par);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -1608,7 +1608,7 @@ void CodeIso14443aAsReaderPar(const uint8_t *cmd, uint16_t len, const uint8_t *p
|
||||||
// Stop when button is pressed (return 1) or field was gone (return 2)
|
// Stop when button is pressed (return 1) or field was gone (return 2)
|
||||||
// Or return 0 when command is captured
|
// Or return 0 when command is captured
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int EmGetCmd(uint8_t *received, uint16_t *len, uint8_t *parity) {
|
int EmGetCmd(uint8_t *received, uint16_t *len, uint8_t *par) {
|
||||||
*len = 0;
|
*len = 0;
|
||||||
|
|
||||||
uint32_t timer = 0, vtime = 0;
|
uint32_t timer = 0, vtime = 0;
|
||||||
|
@ -1632,7 +1632,7 @@ int EmGetCmd(uint8_t *received, uint16_t *len, uint8_t *parity) {
|
||||||
AT91C_BASE_ADC->ADC_CR = AT91C_ADC_START;
|
AT91C_BASE_ADC->ADC_CR = AT91C_ADC_START;
|
||||||
|
|
||||||
// Now run a 'software UART' on the stream of incoming samples.
|
// Now run a 'software UART' on the stream of incoming samples.
|
||||||
UartInit(received, parity);
|
UartInit(received, par);
|
||||||
|
|
||||||
// Clear RXRDY:
|
// Clear RXRDY:
|
||||||
uint8_t b = (uint8_t)AT91C_BASE_SSC->SSC_RHR;
|
uint8_t b = (uint8_t)AT91C_BASE_SSC->SSC_RHR;
|
||||||
|
@ -1884,17 +1884,17 @@ void ReaderTransmit(uint8_t *frame, uint16_t len, uint32_t *timing) {
|
||||||
ReaderTransmitBitsPar(frame, len * 8, par, timing);
|
ReaderTransmitBitsPar(frame, len * 8, par, timing);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ReaderReceiveOffset(uint8_t *receivedAnswer, uint16_t offset, uint8_t *parity) {
|
int ReaderReceiveOffset(uint8_t *receivedAnswer, uint16_t offset, uint8_t *par) {
|
||||||
if (!GetIso14443aAnswerFromTag(receivedAnswer, parity, offset))
|
if (!GetIso14443aAnswerFromTag(receivedAnswer, par, offset))
|
||||||
return false;
|
return false;
|
||||||
LogTrace(receivedAnswer, Demod.len, Demod.startTime * 16 - DELAY_AIR2ARM_AS_READER, Demod.endTime * 16 - DELAY_AIR2ARM_AS_READER, parity, false);
|
LogTrace(receivedAnswer, Demod.len, Demod.startTime * 16 - DELAY_AIR2ARM_AS_READER, Demod.endTime * 16 - DELAY_AIR2ARM_AS_READER, par, false);
|
||||||
return Demod.len;
|
return Demod.len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ReaderReceive(uint8_t *receivedAnswer, uint8_t *parity) {
|
int ReaderReceive(uint8_t *receivedAnswer, uint8_t *par) {
|
||||||
if (!GetIso14443aAnswerFromTag(receivedAnswer, parity, 0))
|
if (!GetIso14443aAnswerFromTag(receivedAnswer, par, 0))
|
||||||
return false;
|
return false;
|
||||||
LogTrace(receivedAnswer, Demod.len, Demod.startTime * 16 - DELAY_AIR2ARM_AS_READER, Demod.endTime * 16 - DELAY_AIR2ARM_AS_READER, parity, false);
|
LogTrace(receivedAnswer, Demod.len, Demod.startTime * 16 - DELAY_AIR2ARM_AS_READER, Demod.endTime * 16 - DELAY_AIR2ARM_AS_READER, par, false);
|
||||||
return Demod.len;
|
return Demod.len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2030,7 +2030,7 @@ static int GetATQA(uint8_t *resp, uint8_t *resp_par) {
|
||||||
// if anticollision is false, then the UID must be provided in uid_ptr[]
|
// if anticollision is false, then the UID must be provided in uid_ptr[]
|
||||||
// and num_cascades must be set (1: 4 Byte UID, 2: 7 Byte UID, 3: 10 Byte UID)
|
// and num_cascades must be set (1: 4 Byte UID, 2: 7 Byte UID, 3: 10 Byte UID)
|
||||||
// requests ATS unless no_rats is true
|
// requests ATS unless no_rats is true
|
||||||
int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32_t *cuid_ptr, bool anticollision, uint8_t num_cascades, bool no_rats) {
|
int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *resp_data, uint32_t *cuid_ptr, bool anticollision, uint8_t num_cascades, bool no_rats) {
|
||||||
|
|
||||||
uint8_t sel_all[] = { ISO14443A_CMD_ANTICOLL_OR_SELECT, 0x20 };
|
uint8_t sel_all[] = { ISO14443A_CMD_ANTICOLL_OR_SELECT, 0x20 };
|
||||||
uint8_t sel_uid[] = { ISO14443A_CMD_ANTICOLL_OR_SELECT, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
uint8_t sel_uid[] = { ISO14443A_CMD_ANTICOLL_OR_SELECT, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
@ -2044,19 +2044,19 @@ int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32
|
||||||
int cascade_level = 0;
|
int cascade_level = 0;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if (p_card) {
|
if (resp_data) {
|
||||||
p_card->uidlen = 0;
|
resp_data->uidlen = 0;
|
||||||
memset(p_card->uid, 0, 10);
|
memset(resp_data->uid, 0, 10);
|
||||||
p_card->ats_len = 0;
|
resp_data->ats_len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GetATQA(resp, resp_par)) {
|
if (!GetATQA(resp, resp_par)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_card) {
|
if (resp_data) {
|
||||||
p_card->atqa[0] = resp[0];
|
resp_data->atqa[0] = resp[0];
|
||||||
p_card->atqa[1] = resp[1];
|
resp_data->atqa[1] = resp[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anticollision) {
|
if (anticollision) {
|
||||||
|
@ -2151,14 +2151,14 @@ int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32
|
||||||
if (uid_ptr && anticollision)
|
if (uid_ptr && anticollision)
|
||||||
memcpy(uid_ptr + (cascade_level * 3), uid_resp, uid_resp_len);
|
memcpy(uid_ptr + (cascade_level * 3), uid_resp, uid_resp_len);
|
||||||
|
|
||||||
if (p_card) {
|
if (resp_data) {
|
||||||
memcpy(p_card->uid + (cascade_level * 3), uid_resp, uid_resp_len);
|
memcpy(resp_data->uid + (cascade_level * 3), uid_resp, uid_resp_len);
|
||||||
p_card->uidlen += uid_resp_len;
|
resp_data->uidlen += uid_resp_len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_card) {
|
if (resp_data) {
|
||||||
p_card->sak = sak;
|
resp_data->sak = sak;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PICC compilant with iso14443a-4 ---> (SAK & 0x20 != 0)
|
// PICC compilant with iso14443a-4 ---> (SAK & 0x20 != 0)
|
||||||
|
@ -2173,9 +2173,9 @@ int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32
|
||||||
|
|
||||||
if (!len) return 0;
|
if (!len) return 0;
|
||||||
|
|
||||||
if (p_card) {
|
if (resp_data) {
|
||||||
memcpy(p_card->ats, resp, sizeof(p_card->ats));
|
memcpy(resp_data->ats, resp, sizeof(resp_data->ats));
|
||||||
p_card->ats_len = len;
|
resp_data->ats_len = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset the PCB block number
|
// reset the PCB block number
|
||||||
|
|
|
@ -112,10 +112,10 @@ void GetParity(const uint8_t *pbtCmd, uint16_t len, uint8_t *par);
|
||||||
|
|
||||||
tDemod *GetDemod(void);
|
tDemod *GetDemod(void);
|
||||||
void DemodReset(void);
|
void DemodReset(void);
|
||||||
void DemodInit(uint8_t *data, uint8_t *parity);
|
void DemodInit(uint8_t *data, uint8_t *par);
|
||||||
tUart *GetUart(void);
|
tUart *GetUart(void);
|
||||||
void UartReset(void);
|
void UartReset(void);
|
||||||
void UartInit(uint8_t *data, uint8_t *parity);
|
void UartInit(uint8_t *data, uint8_t *par);
|
||||||
RAMFUNC bool MillerDecoding(uint8_t bit, uint32_t non_real_time);
|
RAMFUNC bool MillerDecoding(uint8_t bit, uint32_t non_real_time);
|
||||||
RAMFUNC int ManchesterDecoding(uint8_t bit, uint16_t offset, uint32_t non_real_time);
|
RAMFUNC int ManchesterDecoding(uint8_t bit, uint16_t offset, uint32_t non_real_time);
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ int EmSendCmd14443aRaw(uint8_t *resp, uint16_t respLen);
|
||||||
int EmSend4bit(uint8_t resp);
|
int EmSend4bit(uint8_t resp);
|
||||||
int EmSendCmd(uint8_t *resp, uint16_t respLen);
|
int EmSendCmd(uint8_t *resp, uint16_t respLen);
|
||||||
int EmSendCmdEx(uint8_t *resp, uint16_t respLen, bool collision);
|
int EmSendCmdEx(uint8_t *resp, uint16_t respLen, bool collision);
|
||||||
int EmGetCmd(uint8_t *received, uint16_t *len, uint8_t *parity);
|
int EmGetCmd(uint8_t *received, uint16_t *len, uint8_t *par);
|
||||||
int EmSendCmdPar(uint8_t *resp, uint16_t respLen, uint8_t *par);
|
int EmSendCmdPar(uint8_t *resp, uint16_t respLen, uint8_t *par);
|
||||||
int EmSendCmdParEx(uint8_t *resp, uint16_t respLen, uint8_t *par, bool collision);
|
int EmSendCmdParEx(uint8_t *resp, uint16_t respLen, uint8_t *par, bool collision);
|
||||||
int EmSendPrecompiledCmd(tag_response_info_t *response_info);
|
int EmSendPrecompiledCmd(tag_response_info_t *response_info);
|
||||||
|
|
|
@ -621,8 +621,8 @@ void Iso15693InitReader(void) {
|
||||||
|
|
||||||
// Encode (into the ToSend buffers) an identify request, which is the first
|
// Encode (into the ToSend buffers) an identify request, which is the first
|
||||||
// thing that you must send to a tag to get a response.
|
// thing that you must send to a tag to get a response.
|
||||||
// It expects "out" to be at least CMD_ID_RESP large
|
// It expects "cmdout" to be at least CMD_ID_RESP large
|
||||||
static void BuildIdentifyRequest(uint8_t *out) {
|
static void BuildIdentifyRequest(uint8_t *cmdout) {
|
||||||
uint8_t cmd[CMD_ID_RESP] = {0, ISO15_CMD_INVENTORY, 0, 0, 0};
|
uint8_t cmd[CMD_ID_RESP] = {0, ISO15_CMD_INVENTORY, 0, 0, 0};
|
||||||
// flags
|
// flags
|
||||||
cmd[0] = ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_INVENTORY | ISO15_REQINV_SLOT1;
|
cmd[0] = ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_INVENTORY | ISO15_REQINV_SLOT1;
|
||||||
|
@ -632,7 +632,7 @@ static void BuildIdentifyRequest(uint8_t *out) {
|
||||||
AddCrc(cmd, 3);
|
AddCrc(cmd, 3);
|
||||||
// coding as high speed (1 out of 4)
|
// coding as high speed (1 out of 4)
|
||||||
CodeIso15693AsReader(cmd, CMD_ID_RESP);
|
CodeIso15693AsReader(cmd, CMD_ID_RESP);
|
||||||
memcpy(out, cmd, CMD_ID_RESP);
|
memcpy(cmdout, cmd, CMD_ID_RESP);
|
||||||
}
|
}
|
||||||
|
|
||||||
// uid is in transmission order (which is reverse of display order)
|
// uid is in transmission order (which is reverse of display order)
|
||||||
|
@ -666,7 +666,7 @@ static void BuildReadBlockRequest(uint8_t **out, uint8_t *uid, uint8_t blockNumb
|
||||||
|
|
||||||
// Now the VICC>VCD responses when we are simulating a tag
|
// Now the VICC>VCD responses when we are simulating a tag
|
||||||
// It expects "out" to be at least CMD_INV_RESP large
|
// It expects "out" to be at least CMD_INV_RESP large
|
||||||
static void BuildInventoryResponse(uint8_t *out, uint8_t *uid) {
|
static void BuildInventoryResponse(uint8_t *cmdout, uint8_t *uid) {
|
||||||
|
|
||||||
uint8_t cmd[CMD_INV_RESP] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
uint8_t cmd[CMD_INV_RESP] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
|
@ -687,7 +687,7 @@ static void BuildInventoryResponse(uint8_t *out, uint8_t *uid) {
|
||||||
// CRC
|
// CRC
|
||||||
AddCrc(cmd, 10);
|
AddCrc(cmd, 10);
|
||||||
CodeIso15693AsReader(cmd, CMD_INV_RESP);
|
CodeIso15693AsReader(cmd, CMD_INV_RESP);
|
||||||
memcpy(out, cmd, CMD_INV_RESP);
|
memcpy(cmdout, cmd, CMD_INV_RESP);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Universal Method for sending to and recv bytes from a tag
|
// Universal Method for sending to and recv bytes from a tag
|
||||||
|
|
|
@ -16,6 +16,6 @@
|
||||||
|
|
||||||
void LegicRfInfo(void);
|
void LegicRfInfo(void);
|
||||||
void LegicRfReader(uint16_t offset, uint16_t len, uint8_t iv);
|
void LegicRfReader(uint16_t offset, uint16_t len, uint8_t iv);
|
||||||
void LegicRfWriter(uint16_t offset, uint16_t byte, uint8_t iv, uint8_t *data);
|
void LegicRfWriter(uint16_t offset, uint16_t len, uint8_t iv, uint8_t *data);
|
||||||
|
|
||||||
#endif /* __LEGICRF_H */
|
#endif /* __LEGICRF_H */
|
||||||
|
|
|
@ -651,7 +651,7 @@ void SimulateTagLowFrequency(int period, int gap, int ledcontrol) {
|
||||||
|
|
||||||
|
|
||||||
#define DEBUG_FRAME_CONTENTS 1
|
#define DEBUG_FRAME_CONTENTS 1
|
||||||
void SimulateTagLowFrequencyBidir(int divisor, int t0) {
|
void SimulateTagLowFrequencyBidir(int divisor, int max_bitlen) {
|
||||||
}
|
}
|
||||||
// compose fc/5 fc/8 waveform (FSK1)
|
// compose fc/5 fc/8 waveform (FSK1)
|
||||||
|
|
||||||
|
@ -824,7 +824,7 @@ void CmdHIDsimTAG(uint32_t hi, uint32_t lo, int ledcontrol) {
|
||||||
// prepare a waveform pattern in the buffer based on the ID given then
|
// prepare a waveform pattern in the buffer based on the ID given then
|
||||||
// simulate a FSK tag until the button is pressed
|
// simulate a FSK tag until the button is pressed
|
||||||
// arg1 contains fcHigh and fcLow, arg2 contains STT marker and clock
|
// arg1 contains fcHigh and fcLow, arg2 contains STT marker and clock
|
||||||
void CmdFSKsimTAG(uint16_t arg1, uint16_t arg2, size_t size, uint8_t *bits, int ledcontrol) {
|
void CmdFSKsimTAG(uint16_t arg1, uint16_t arg2, size_t size, uint8_t *BitStream, int ledcontrol) {
|
||||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||||
|
|
||||||
// free eventually allocated BigBuf memory
|
// free eventually allocated BigBuf memory
|
||||||
|
@ -846,7 +846,7 @@ void CmdFSKsimTAG(uint16_t arg1, uint16_t arg2, size_t size, uint8_t *bits, int
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
if (bits[i])
|
if (BitStream[i])
|
||||||
fcAll(fcLow, &n, clk, &modCnt);
|
fcAll(fcLow, &n, clk, &modCnt);
|
||||||
else
|
else
|
||||||
fcAll(fcHigh, &n, clk, &modCnt);
|
fcAll(fcHigh, &n, clk, &modCnt);
|
||||||
|
|
|
@ -248,9 +248,9 @@ uint32_t ReadLF(bool activeField, bool silent, int sample_size) {
|
||||||
* Initializes the FPGA for reader-mode (field on), and acquires the samples.
|
* Initializes the FPGA for reader-mode (field on), and acquires the samples.
|
||||||
* @return number of bits sampled
|
* @return number of bits sampled
|
||||||
**/
|
**/
|
||||||
uint32_t SampleLF(bool printCfg, int sample_size) {
|
uint32_t SampleLF(bool silent, int sample_size) {
|
||||||
BigBuf_Clear_ext(false);
|
BigBuf_Clear_ext(false);
|
||||||
return ReadLF(true, printCfg, sample_size);
|
return ReadLF(true, silent, sample_size);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Initializes the FPGA for sniffer-mode (field off), and acquires the samples.
|
* Initializes the FPGA for sniffer-mode (field off), and acquires the samples.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue