mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
chg: 'lf hitag' - don't send garbage (@marshmellow42)
This commit is contained in:
parent
c3403da76c
commit
8f4c96cc81
1 changed files with 60 additions and 64 deletions
|
@ -1211,19 +1211,19 @@ void SimulateHitagTag(bool tag_mem_supplied, byte_t* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReaderHitag(hitag_function htf, hitag_data* htd) {
|
void ReaderHitag(hitag_function htf, hitag_data* htd) {
|
||||||
int frame_count;
|
int frame_count = 0;
|
||||||
int response;
|
int response = 0;
|
||||||
byte_t rx[HITAG_FRAME_LEN];
|
byte_t rx[HITAG_FRAME_LEN];
|
||||||
size_t rxlen = 0;
|
size_t rxlen = 0;
|
||||||
byte_t txbuf[HITAG_FRAME_LEN];
|
byte_t txbuf[HITAG_FRAME_LEN];
|
||||||
byte_t* tx = txbuf;
|
byte_t* tx = txbuf;
|
||||||
size_t txlen = 0;
|
size_t txlen = 0;
|
||||||
int lastbit;
|
int lastbit = 1;
|
||||||
bool bSkip;
|
bool bSkip;
|
||||||
int reset_sof;
|
int reset_sof;
|
||||||
int tag_sof;
|
int tag_sof;
|
||||||
int t_wait = HITAG_T_WAIT_MAX;
|
int t_wait = HITAG_T_WAIT_MAX;
|
||||||
bool bStop;
|
bool bStop = false;
|
||||||
bool bQuitTraceFull = false;
|
bool bQuitTraceFull = false;
|
||||||
|
|
||||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||||
|
@ -1330,12 +1330,6 @@ void ReaderHitag(hitag_function htf, hitag_data* htd) {
|
||||||
AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKEN | AT91C_TC_SWTRG;
|
AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKEN | AT91C_TC_SWTRG;
|
||||||
AT91C_BASE_TC1->TC_CCR = AT91C_TC_CLKEN | AT91C_TC_SWTRG;
|
AT91C_BASE_TC1->TC_CCR = AT91C_TC_CLKEN | AT91C_TC_SWTRG;
|
||||||
|
|
||||||
// Reset the received frame, frame count and timing info
|
|
||||||
frame_count = 0;
|
|
||||||
response = 0;
|
|
||||||
lastbit = 1;
|
|
||||||
bStop = false;
|
|
||||||
|
|
||||||
// Tag specific configuration settings (sof, timings, etc.)
|
// Tag specific configuration settings (sof, timings, etc.)
|
||||||
if (htf < 10){
|
if (htf < 10){
|
||||||
// hitagS settings
|
// hitagS settings
|
||||||
|
@ -1442,7 +1436,6 @@ void ReaderHitag(hitag_function htf, hitag_data* htd) {
|
||||||
bSkip = true;
|
bSkip = true;
|
||||||
tag_sof = reset_sof;
|
tag_sof = reset_sof;
|
||||||
response = 0;
|
response = 0;
|
||||||
//Dbprintf("DEBUG: Waiting to receive frame");
|
|
||||||
uint32_t errorCount = 0;
|
uint32_t errorCount = 0;
|
||||||
|
|
||||||
// Receive frame, watch for at most T0*EOF periods
|
// Receive frame, watch for at most T0*EOF periods
|
||||||
|
@ -1511,8 +1504,12 @@ void ReaderHitag(hitag_function htf, hitag_data* htd) {
|
||||||
AT91C_BASE_TC1->TC_CCR = AT91C_TC_CLKDIS;
|
AT91C_BASE_TC1->TC_CCR = AT91C_TC_CLKDIS;
|
||||||
AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKDIS;
|
AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKDIS;
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||||
// Dbprintf("DONE: frame received: %d",frame_count);
|
|
||||||
|
if ( bSuccessful )
|
||||||
cmd_send(CMD_ACK, bSuccessful, 0, 0, (byte_t*)tag.sectors, 48);
|
cmd_send(CMD_ACK, bSuccessful, 0, 0, (byte_t*)tag.sectors, 48);
|
||||||
|
else
|
||||||
|
cmd_send(CMD_ACK, bSuccessful, 0, 0, 0, 0);
|
||||||
|
|
||||||
set_tracing(false);
|
set_tracing(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1544,8 +1541,7 @@ void WriterHitag(hitag_function htf, hitag_data* htd, int page) {
|
||||||
|
|
||||||
// Check configuration
|
// Check configuration
|
||||||
switch(htf) {
|
switch(htf) {
|
||||||
case WHT2F_CRYPTO:
|
case WHT2F_CRYPTO: {
|
||||||
{
|
|
||||||
DbpString("Authenticating using key:");
|
DbpString("Authenticating using key:");
|
||||||
memcpy(key,htd->crypto.key,6); //HACK; 4 or 6?? I read both in the code.
|
memcpy(key,htd->crypto.key,6); //HACK; 4 or 6?? I read both in the code.
|
||||||
memcpy(writedata, htd->crypto.data, 4);
|
memcpy(writedata, htd->crypto.data, 4);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue