mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
FIX: some possible null - ref bugs in 'iclass' , 'iso15693' deviceside.
FIX: 0 is not a reference. FIX: iso15693 - wait wasn't implemented chg: 'hf 15' getTagInfo_15 renamned. chg: 'hf iclass loclass' some output got newline
This commit is contained in:
parent
db515ba6c4
commit
823a814cf6
4 changed files with 463 additions and 501 deletions
420
armsrc/iclass.c
420
armsrc/iclass.c
File diff suppressed because it is too large
Load diff
|
@ -219,19 +219,20 @@ static void TransmitTo15693Tag(const uint8_t *cmd, int len, int *samples, int *w
|
||||||
int c;
|
int c;
|
||||||
volatile uint32_t r;
|
volatile uint32_t r;
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_TX);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_TX);
|
||||||
if(*wait < 10) { *wait = 10; }
|
|
||||||
|
|
||||||
// for(c = 0; c < *wait;) {
|
if (wait) {
|
||||||
// if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_TXRDY)) {
|
if (*wait < 10) { *wait = 10; }
|
||||||
// AT91C_BASE_SSC->SSC_THR = 0x00; // For exact timing!
|
for (c = 0; c < *wait;) {
|
||||||
// ++c;
|
if (AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_TXRDY)) {
|
||||||
// }
|
AT91C_BASE_SSC->SSC_THR = 0x00; // For exact timing!
|
||||||
// if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
++c;
|
||||||
// r = AT91C_BASE_SSC->SSC_RHR;
|
}
|
||||||
// (void)r;
|
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
||||||
// }
|
r = AT91C_BASE_SSC->SSC_RHR; (void)r;
|
||||||
// WDT_HIT();
|
}
|
||||||
// }
|
WDT_HIT();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
c = 0;
|
c = 0;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
@ -240,12 +241,16 @@ static void TransmitTo15693Tag(const uint8_t *cmd, int len, int *samples, int *w
|
||||||
if( ++c >= len) break;
|
if( ++c >= len) break;
|
||||||
}
|
}
|
||||||
if (AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
if (AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
||||||
r = AT91C_BASE_SSC->SSC_RHR;
|
r = AT91C_BASE_SSC->SSC_RHR; (void)r;
|
||||||
(void)r;
|
|
||||||
}
|
}
|
||||||
WDT_HIT();
|
WDT_HIT();
|
||||||
}
|
}
|
||||||
|
if (samples) {
|
||||||
|
if (wait)
|
||||||
*samples = (c + *wait) << 3;
|
*samples = (c + *wait) << 3;
|
||||||
|
else
|
||||||
|
*samples = c << 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -256,7 +261,19 @@ static void TransmitTo15693Reader(const uint8_t *cmd, int len, int *samples, int
|
||||||
int c = 0;
|
int c = 0;
|
||||||
volatile uint32_t r;
|
volatile uint32_t r;
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_SIMULATOR|FPGA_HF_SIMULATOR_MODULATE_424K);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_SIMULATOR|FPGA_HF_SIMULATOR_MODULATE_424K);
|
||||||
|
if (wait) {
|
||||||
if (*wait < 10) { *wait = 10; }
|
if (*wait < 10) { *wait = 10; }
|
||||||
|
for (c = 0; c < *wait;) {
|
||||||
|
if (AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_TXRDY)) {
|
||||||
|
AT91C_BASE_SSC->SSC_THR = 0x00; // For exact timing!
|
||||||
|
++c;
|
||||||
|
}
|
||||||
|
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
||||||
|
r = AT91C_BASE_SSC->SSC_RHR; (void)r;
|
||||||
|
}
|
||||||
|
WDT_HIT();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_TXRDY)) {
|
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_TXRDY)) {
|
||||||
|
@ -264,12 +281,16 @@ static void TransmitTo15693Reader(const uint8_t *cmd, int len, int *samples, int
|
||||||
if( ++c >= len) break;
|
if( ++c >= len) break;
|
||||||
}
|
}
|
||||||
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
||||||
r = AT91C_BASE_SSC->SSC_RHR;
|
r = AT91C_BASE_SSC->SSC_RHR; (void)r;
|
||||||
(void)r;
|
|
||||||
}
|
}
|
||||||
WDT_HIT();
|
WDT_HIT();
|
||||||
}
|
}
|
||||||
|
if (samples) {
|
||||||
|
if (wait)
|
||||||
*samples = (c + *wait) << 3;
|
*samples = (c + *wait) << 3;
|
||||||
|
else
|
||||||
|
*samples = c << 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,7 @@ int getUID(uint8_t *buf)
|
||||||
// get a product description based on the UID
|
// get a product description based on the UID
|
||||||
// uid[8] tag uid
|
// uid[8] tag uid
|
||||||
// returns description of the best match
|
// returns description of the best match
|
||||||
static char* getTagInfo(uint8_t *uid) {
|
static char* getTagInfo_15(uint8_t *uid) {
|
||||||
uint64_t myuid, mask;
|
uint64_t myuid, mask;
|
||||||
int i = 0, best = -1;
|
int i = 0, best = -1;
|
||||||
memcpy(&myuid, uid, sizeof(uint64_t));
|
memcpy(&myuid, uid, sizeof(uint64_t));
|
||||||
|
@ -382,7 +382,7 @@ int HF15Reader(const char *Cmd, bool verbose)
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLog("Tag UID : %s", sprintUID(NULL,uid));
|
PrintAndLog("Tag UID : %s", sprintUID(NULL,uid));
|
||||||
PrintAndLog("Tag Info: %s",getTagInfo(uid));
|
PrintAndLog("Tag Info: %s", getTagInfo_15(uid));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ int CmdHF15DumpMem(const char*Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLog("Reading memory from tag UID=%s", sprintUID(NULL, uid));
|
PrintAndLog("Reading memory from tag UID=%s", sprintUID(NULL, uid));
|
||||||
PrintAndLog("Tag Info: %s",getTagInfo(uid));
|
PrintAndLog("Tag Info: %s", getTagInfo_15(uid));
|
||||||
|
|
||||||
for (int retry=0; retry<5; retry++) {
|
for (int retry=0; retry<5; retry++) {
|
||||||
|
|
||||||
|
@ -550,7 +550,7 @@ int CmdHF15CmdInquiry(const char *Cmd)
|
||||||
if (resp.arg[0]>=12) {
|
if (resp.arg[0]>=12) {
|
||||||
recv = resp.d.asBytes;
|
recv = resp.d.asBytes;
|
||||||
PrintAndLog("UID=%s", sprintUID(NULL, &recv[2]));
|
PrintAndLog("UID=%s", sprintUID(NULL, &recv[2]));
|
||||||
PrintAndLog("Tag Info: %s",getTagInfo(&recv[2]));
|
PrintAndLog("Tag Info: %s", getTagInfo_15(&recv[2]));
|
||||||
} else {
|
} else {
|
||||||
PrintAndLog("Response to short, just %i bytes. No tag?\n", resp.arg[0]);
|
PrintAndLog("Response to short, just %i bytes. No tag?\n", resp.arg[0]);
|
||||||
}
|
}
|
||||||
|
@ -819,7 +819,7 @@ int CmdHF15CmdSysinfo(const char *Cmd) {
|
||||||
strcat(output, "UID = ");
|
strcat(output, "UID = ");
|
||||||
strcat(output, sprintUID(NULL, recv+2));
|
strcat(output, sprintUID(NULL, recv+2));
|
||||||
strcat(output, "\n\r");
|
strcat(output, "\n\r");
|
||||||
strcat(output,getTagInfo(recv+2)); //ABC
|
strcat(output, getTagInfo_15(recv+2)); //ABC
|
||||||
strcat(output, "\n\r");
|
strcat(output, "\n\r");
|
||||||
i=10;
|
i=10;
|
||||||
if (recv[1] & 0x01)
|
if (recv[1] & 0x01)
|
||||||
|
|
|
@ -240,32 +240,29 @@ int CmdHFiClassSnoop(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdHFiClassSim(const char *Cmd) {
|
int CmdHFiClassSim(const char *Cmd) {
|
||||||
uint8_t simType = 0;
|
|
||||||
uint8_t CSN[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
|
||||||
|
|
||||||
if (strlen(Cmd)<1) return usage_hf_iclass_sim();
|
if (strlen(Cmd)<1) return usage_hf_iclass_sim();
|
||||||
|
|
||||||
|
uint8_t simType = 0;
|
||||||
|
uint8_t CSN[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
simType = param_get8ex(Cmd, 0, 0, 10);
|
simType = param_get8ex(Cmd, 0, 0, 10);
|
||||||
|
|
||||||
if(simType == 0)
|
if (simType == 0) {
|
||||||
{
|
|
||||||
if (param_gethex(Cmd, 1, CSN, 16)) {
|
if (param_gethex(Cmd, 1, CSN, 16)) {
|
||||||
PrintAndLog("A CSN should consist of 16 HEX symbols");
|
PrintAndLog("A CSN should consist of 16 HEX symbols");
|
||||||
return usage_hf_iclass_sim();
|
return usage_hf_iclass_sim();
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLog("--simtype:%02x csn:%s", simType, sprint_hex(CSN, 8));
|
PrintAndLog("--simtype:%02x csn:%s", simType, sprint_hex(CSN, 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(simType > 3)
|
if (simType > 3) {
|
||||||
{
|
|
||||||
PrintAndLog("Undefined simptype %d", simType);
|
PrintAndLog("Undefined simptype %d", simType);
|
||||||
return usage_hf_iclass_sim();
|
return usage_hf_iclass_sim();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t numberOfCSNs = 0;
|
uint8_t numberOfCSNs = 0;
|
||||||
if(simType == 2)
|
if (simType == 2) {
|
||||||
{
|
|
||||||
UsbCommand c = {CMD_SIMULATE_TAG_ICLASS, {simType,NUM_CSNS}};
|
UsbCommand c = {CMD_SIMULATE_TAG_ICLASS, {simType,NUM_CSNS}};
|
||||||
UsbCommand resp = {0};
|
UsbCommand resp = {0};
|
||||||
|
|
||||||
|
@ -283,7 +280,7 @@ int CmdHFiClassSim(const char *Cmd) {
|
||||||
0X0C, 0X90, 0X32, 0XF3, 0X5D, 0XFF, 0X12, 0XE0 // 10,13
|
0X0C, 0X90, 0X32, 0XF3, 0X5D, 0XFF, 0X12, 0XE0 // 10,13
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/* 00 13 94 7e 76 ff 12 e0
|
||||||
// pre-defined 15 CSN by Carl55
|
// pre-defined 15 CSN by Carl55
|
||||||
// but new entry[0] by iceman
|
// but new entry[0] by iceman
|
||||||
uint8_t csns[8*NUM_CSNS] = {
|
uint8_t csns[8*NUM_CSNS] = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue