improved command hf mf sniff. Now it cant decode nested authentication and cant write emulator files

This commit is contained in:
Merlokbr@gmail.com 2012-07-16 14:49:51 +00:00
commit 55acbb2a39
8 changed files with 357 additions and 14 deletions

View file

@ -70,6 +70,12 @@ void FpgaGatherVersion(char *dst, int len);
void FpgaSetupSsc(void);
void SetupSpi(int mode);
void FpgaSetupSscDma(uint8_t *buf, int len);
void inline FpgaDisableSscDma(void){
AT91C_BASE_PDC_SSC->PDC_PTCR = AT91C_PDC_RXTDIS;
}
void inline FpgaEnableSscDma(void){
AT91C_BASE_PDC_SSC->PDC_PTCR = AT91C_PDC_RXTEN;
}
void SetAdcMuxFor(uint32_t whichGpio);
// Definitions for the FPGA commands.

View file

@ -2416,7 +2416,7 @@ void RAMFUNC SniffMifare(uint8_t param) {
if (++sniffCounter > 65) {
if (MfSniffSend(2000)) {
AT91C_BASE_PDC_SSC->PDC_PTCR = AT91C_PDC_RXTEN;
FpgaEnableSscDma();
}
sniffCounter = 0;
}
@ -2442,7 +2442,7 @@ void RAMFUNC SniffMifare(uint8_t param) {
if (!AT91C_BASE_PDC_SSC->PDC_RCR) {
AT91C_BASE_PDC_SSC->PDC_RPR = (uint32_t) dmaBuf;
AT91C_BASE_PDC_SSC->PDC_RCR = DMA_BUFFER_SIZE;
Dbprintf("RxEmpty ERROR!!! %d", dataLen); // temporary
Dbprintf("RxEmpty ERROR!!! data length:%d", dataLen); // temporary
}
// secondary buffer sets as primary, secondary buffer was stopped
if (!AT91C_BASE_PDC_SSC->PDC_RNCR) {
@ -2487,10 +2487,9 @@ void RAMFUNC SniffMifare(uint8_t param) {
DbpString("COMMAND FINISHED");
done:
AT91C_BASE_PDC_SSC->PDC_PTCR = AT91C_PDC_RXTDIS;
FpgaDisableSscDma();
MfSniffEnd();
Dbprintf("maxDataLen=%x, Uart.state=%x, Uart.byteCnt=%x", maxDataLen, Uart.state, Uart.byteCnt);
Dbprintf("Uart.byteCntMax=%x, traceLen=%x", Uart.byteCntMax, traceLen);
Dbprintf("maxDataLen=%x, Uart.state=%x, Uart.byteCnt=%x Uart.byteCntMax=%x", maxDataLen, Uart.state, Uart.byteCnt, Uart.byteCntMax);
LEDsoff();
}

View file

@ -42,7 +42,7 @@ int MfSniffEnd(void){
int RAMFUNC MfSniffLogic(const uint8_t * data, int len, int bitCnt, int reader) {
if ((len == 1) && (bitCnt = 9)) {
if ((len == 1) && (bitCnt = 9) && (data[0] > 0x0F)) {
sniffState = SNF_INIT;
}
@ -163,7 +163,7 @@ int intMfSniffSend() {
if (!traceLen) return 0;
AT91C_BASE_PDC_SSC->PDC_PTCR = AT91C_PDC_RXTDIS;
FpgaDisableSscDma();
while (pckLen > 0) {
pckSize = min(32, pckLen);