From: Martin Holst Swende Date: Sat, 14 Feb 2015 20:30:26 +0000 (+0100) Subject: Started iclass emulator support on device side. Not functional yet X-Git-Tag: v2.0.0-rc1~12 X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/e80aeb969524acf070170d4224b8fb660e6c19f6?ds=inline Started iclass emulator support on device side. Not functional yet --- diff --git a/armsrc/BigBuf.c b/armsrc/BigBuf.c index 0c666bce..703ade65 100644 --- a/armsrc/BigBuf.c +++ b/armsrc/BigBuf.c @@ -224,3 +224,16 @@ int LogTraceHitag(const uint8_t * btBytes, int iBits, int iSamples, uint32_t dwP return TRUE; } +// Emulator memory +uint8_t emlSet(uint8_t *data, uint32_t offset, uint32_t length){ + uint8_t* mem = BigBuf_get_EM_addr(); + if(offset+length < CARD_MEMORY_SIZE) + { + memcpy(mem+offset, data, length); + return 0; + }else + { + Dbprintf("Error, trying to set memory outside of bounds! %d > %d", (offset+length), CARD_MEMORY_SIZE); + return 1; + } +} diff --git a/armsrc/BigBuf.h b/armsrc/BigBuf.h index be558979..b44a1263 100644 --- a/armsrc/BigBuf.h +++ b/armsrc/BigBuf.h @@ -34,4 +34,5 @@ void clear_trace(); void set_tracing(bool enable); bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_start, uint32_t timestamp_end, uint8_t *parity, bool readerToTag); int LogTraceHitag(const uint8_t * btBytes, int iBits, int iSamples, uint32_t dwParity, int bReader); +uint8_t emlSet(uint8_t *data, uint32_t offset, uint32_t length); #endif /* __BIGBUF_H */ diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 43f1df02..3da34777 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -900,6 +900,9 @@ void UsbPacketReceived(uint8_t *packet, int len) case CMD_READER_ICLASS_REPLAY: ReaderIClass_Replay(c->arg[0], c->d.asBytes); break; + case CMD_ICLASS_EML_MEMSET: + emlSet(c->d.asBytes,c->arg[0], c->arg[1]); + break; #endif case CMD_SIMULATE_TAG_HF_LISTEN: