mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
ADD: @pwpivi 's latest fixes for bigbuff
ADD: @marshmellow 14b changes. fix: fixes to the timing inside iso14443b.c sniff/sending. Between TX & RX there should be a 151us pause.
This commit is contained in:
parent
c830303d7e
commit
99cf19d9e8
12 changed files with 153 additions and 143 deletions
|
@ -39,10 +39,10 @@ void MifareReadBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
|
|||
struct Crypto1State *pcs;
|
||||
pcs = &mpcs;
|
||||
|
||||
// clear trace
|
||||
clear_trace();
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
clear_trace();
|
||||
|
||||
LED_A_ON();
|
||||
LED_B_OFF();
|
||||
LED_C_OFF();
|
||||
|
@ -90,9 +90,11 @@ void MifareUC_Auth(uint8_t arg0, uint8_t *keybytes){
|
|||
bool turnOffField = (arg0 == 1);
|
||||
|
||||
LED_A_ON(); LED_B_OFF(); LED_C_OFF();
|
||||
clear_trace();
|
||||
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
clear_trace();
|
||||
|
||||
if(!iso14443a_select_card(NULL, NULL, NULL)) {
|
||||
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Can't select card");
|
||||
OnError(0);
|
||||
|
@ -124,9 +126,10 @@ void MifareUReadBlock(uint8_t arg0, uint8_t arg1, uint8_t *datain)
|
|||
|
||||
LEDsoff();
|
||||
LED_A_ON();
|
||||
clear_trace();
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
clear_trace();
|
||||
|
||||
int len = iso14443a_select_card(NULL, NULL, NULL);
|
||||
if(!len) {
|
||||
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Can't select card (RC:%02X)",len);
|
||||
|
@ -194,11 +197,10 @@ void MifareReadSector(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
|
|||
struct Crypto1State *pcs;
|
||||
pcs = &mpcs;
|
||||
|
||||
// clear trace
|
||||
clear_trace();
|
||||
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
clear_trace();
|
||||
|
||||
LED_A_ON();
|
||||
LED_B_OFF();
|
||||
LED_C_OFF();
|
||||
|
@ -247,6 +249,10 @@ void MifareReadSector(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
|
|||
// datain = KEY bytes
|
||||
void MifareUReadCard(uint8_t arg0, uint16_t arg1, uint8_t arg2, uint8_t *datain)
|
||||
{
|
||||
LEDsoff();
|
||||
LED_A_ON();
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
// free eventually allocated BigBuf memory
|
||||
BigBuf_free();
|
||||
clear_trace();
|
||||
|
@ -264,10 +270,6 @@ void MifareUReadCard(uint8_t arg0, uint16_t arg1, uint8_t arg2, uint8_t *datain)
|
|||
return;
|
||||
}
|
||||
|
||||
LEDsoff();
|
||||
LED_A_ON();
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
int len = iso14443a_select_card(NULL, NULL, NULL);
|
||||
if (!len) {
|
||||
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Can't select card (RC:%d)",len);
|
||||
|
@ -361,11 +363,10 @@ void MifareWriteBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
|
|||
struct Crypto1State *pcs;
|
||||
pcs = &mpcs;
|
||||
|
||||
// clear trace
|
||||
clear_trace();
|
||||
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
clear_trace();
|
||||
|
||||
LED_A_ON();
|
||||
LED_B_OFF();
|
||||
LED_C_OFF();
|
||||
|
@ -467,9 +468,10 @@ void MifareUWriteBlock(uint8_t arg0, uint8_t arg1, uint8_t *datain)
|
|||
|
||||
LEDsoff();
|
||||
LED_A_ON();
|
||||
clear_trace();
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
clear_trace();
|
||||
|
||||
if(!iso14443a_select_card(NULL, NULL, NULL)) {
|
||||
if (MF_DBGLEVEL >= 1) Dbprintf("Can't select card");
|
||||
OnError(0);
|
||||
|
@ -525,9 +527,10 @@ void MifareUSetPwd(uint8_t arg0, uint8_t *datain){
|
|||
memcpy(pwd, datain, 16);
|
||||
|
||||
LED_A_ON(); LED_B_OFF(); LED_C_OFF();
|
||||
clear_trace();
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
clear_trace();
|
||||
|
||||
if(!iso14443a_select_card(NULL, NULL, NULL)) {
|
||||
if (MF_DBGLEVEL >= 1) Dbprintf("Can't select card");
|
||||
OnError(0);
|
||||
|
@ -627,17 +630,15 @@ void MifareNested(uint32_t arg0, uint32_t arg1, uint32_t calibrate, uint8_t *dat
|
|||
uint32_t auth1_time, auth2_time;
|
||||
static uint16_t delta_time;
|
||||
|
||||
// free eventually allocated BigBuf memory
|
||||
BigBuf_free();
|
||||
// clear trace
|
||||
clear_trace();
|
||||
set_tracing(false);
|
||||
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
LED_A_ON();
|
||||
LED_C_OFF();
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
// free eventually allocated BigBuf memory
|
||||
BigBuf_free();
|
||||
|
||||
clear_trace();
|
||||
set_tracing(false);
|
||||
|
||||
// statistics on nonce distance
|
||||
int16_t isOK = 0;
|
||||
|
@ -842,15 +843,13 @@ void MifareChkKeys(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
|
|||
int OLD_MF_DBGLEVEL = MF_DBGLEVEL;
|
||||
MF_DBGLEVEL = MF_DBG_NONE;
|
||||
|
||||
// clear trace
|
||||
clear_trace();
|
||||
set_tracing(TRUE);
|
||||
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
LED_A_ON();
|
||||
LED_B_OFF();
|
||||
LED_C_OFF();
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
clear_trace();
|
||||
set_tracing(TRUE);
|
||||
|
||||
for (i = 0; i < keyCount; i++) {
|
||||
if(mifare_classic_halt(pcs, cuid)) {
|
||||
|
@ -897,16 +896,23 @@ void MifareSetDbgLvl(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
|
|||
//-----------------------------------------------------------------------------
|
||||
// Work with emulator memory
|
||||
//
|
||||
// Note: we call FpgaDownloadAndGo(FPGA_BITSTREAM_HF) here although FPGA is not
|
||||
// involved in dealing with emulator memory. But if it is called later, it might
|
||||
// destroy the Emulator Memory.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MifareEMemClr(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain){
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
emlClearMem();
|
||||
}
|
||||
|
||||
void MifareEMemSet(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain){
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
emlSetMem(datain, arg0, arg1); // data, block num, blocks count
|
||||
}
|
||||
|
||||
void MifareEMemGet(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain){
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
byte_t buf[USB_CMD_DATA_SIZE];
|
||||
emlGetMem(buf, arg0, arg1); // data, block num, blocks count (max 4)
|
||||
|
||||
|
@ -933,15 +939,13 @@ void MifareECardLoad(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
|
|||
byte_t dataoutbuf2[16];
|
||||
uint8_t uid[10];
|
||||
|
||||
// clear trace
|
||||
clear_trace();
|
||||
set_tracing(false);
|
||||
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
LED_A_ON();
|
||||
LED_B_OFF();
|
||||
LED_C_OFF();
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
clear_trace();
|
||||
set_tracing(false);
|
||||
|
||||
bool isOK = true;
|
||||
|
||||
|
@ -1035,10 +1039,10 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
|
|||
LED_A_ON();
|
||||
LED_B_OFF();
|
||||
LED_C_OFF();
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
clear_trace();
|
||||
set_tracing(TRUE);
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
@ -1153,10 +1157,10 @@ void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
|
|||
LED_A_ON();
|
||||
LED_B_OFF();
|
||||
LED_C_OFF();
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
clear_trace();
|
||||
set_tracing(TRUE);
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
@ -1249,10 +1253,11 @@ void MifareCollectNonces(uint32_t arg0, uint32_t arg1){
|
|||
LED_A_ON();
|
||||
LED_B_OFF();
|
||||
LED_C_OFF();
|
||||
|
||||
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
clear_trace();
|
||||
set_tracing(TRUE);
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
|
||||
|
@ -1308,8 +1313,8 @@ void Mifare_DES_Auth1(uint8_t arg0, uint8_t *datain){
|
|||
uint8_t uid[10] = {0x00};
|
||||
uint32_t cuid = 0x00;
|
||||
|
||||
clear_trace();
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
clear_trace();
|
||||
|
||||
int len = iso14443a_select_card(uid, NULL, &cuid);
|
||||
if(!len) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue