Skip to content

Commit

Permalink
Preliminary ICODE implementatio, cleaned up work by @fptrs
Browse files Browse the repository at this point in the history
  • Loading branch information
ceres-c committed Aug 26, 2020
1 parent 22023b7 commit f62c8fd
Show file tree
Hide file tree
Showing 23 changed files with 824 additions and 41 deletions.
Binary file added Doc/Fun_with_Icode.pdf
Binary file not shown.
Binary file added Dumps/ICODE_SLIXL_example.dmp
Binary file not shown.
1 change: 1 addition & 0 deletions Firmware/Chameleon-Mini/Application/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "TITagitstandard.h"
#include "Sniff14443A.h"
#include "EM4233.h"
#include "ICODE-SLIL.h"

/* Function wrappers */
INLINE void ApplicationInit(void) {
Expand Down
15 changes: 6 additions & 9 deletions Firmware/Chameleon-Mini/Application/EM4233.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ static enum {
STATE_QUIET
} State;

bool loggedIn;
uint8_t MyAFI; /* This variable holds current tag's AFI (is used in inventory) */

CurrentFrame FrameInfo;
bool EM4233LoggedIn;

void EM4233AppInit(void) {
State = STATE_READY;
Expand All @@ -36,7 +33,7 @@ void EM4233AppInit(void) {
FrameInfo.ParamLen = 0;
FrameInfo.Addressed = false;
FrameInfo.Selected = false;
loggedIn = false;
EM4233LoggedIn = false;
MemoryReadBlock(&MyAFI, EM4233_MEM_AFI_ADDRESS, 1);

}
Expand All @@ -50,7 +47,7 @@ void EM4233AppReset(void) {
FrameInfo.ParamLen = 0;
FrameInfo.Addressed = false;
FrameInfo.Selected = false;
loggedIn = false;
EM4233LoggedIn = false;
}

void EM4233AppTask(void) {
Expand Down Expand Up @@ -498,14 +495,14 @@ uint16_t EM4233_Login(uint8_t *FrameBuf, uint16_t FrameBytes) {

#ifdef EM4233_LOGIN_YES_CARD
/* Accept any password from reader as correct one */
loggedIn = true;
EM4233LoggedIn = true;

MemoryWriteBlock(FrameInfo.Parameters, EM4233_MEM_PSW_ADDRESS, 4); /* Store password in memory for retrival */

#else
/* Check if the password is actually the right one */
if (memcmp(Password, FrameInfo.Parameters, 4) != 0) { /* Incorrect password */
loggedIn = false;
EM4233LoggedIn = false;

// FrameBuf[ISO15693_ADDR_FLAGS] = ISO15693_RES_FLAG_ERROR;
// FrameBuf[ISO15693_RES_ADDR_PARAM] = ISO15693_RES_ERR_GENERIC;
Expand All @@ -515,7 +512,7 @@ uint16_t EM4233_Login(uint8_t *FrameBuf, uint16_t FrameBytes) {

#endif

loggedIn = true;
EM4233LoggedIn = true;

FrameBuf[ISO15693_ADDR_FLAGS] = ISO15693_RES_FLAG_NO_ERROR; /* flags */
ResponseByteCount += 1;
Expand Down
8 changes: 4 additions & 4 deletions Firmware/Chameleon-Mini/Application/EM4233.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
#define EM4233_MEM_DSFID_ADDRESS 0xD9 // DSFID byte adress
#define EM4233_MEM_INF_ADDRESS 0xDC // Some status bits

#define EM4233_MEM_LSM_ADDRESS 0xE0 // From 0xE0 to 0x0113 - Lock status masks
#define EM4233_MEM_LSM_ADDRESS 0xE0 // From 0xE0 to 0x0113 - Memory blocks lock status masks
#define EM4233_MEM_PSW_ADDRESS 0x0114 // From 0x0114 to 0x0117 - 32 bit Password
#define EM4233_MEM_KEY_ADDRESS 0x0118 // From 0x0118 to 0x0123 - 96 bit Encryption Key

#define EM4233_SYSINFO_BYTE 0x0F // == DSFID - AFI - VICC mem size - IC ref are present

/* Bit masks */
#define EM4233_MASK_READ_PROT ( 1 << 2 ) // For lock status byte
#define EM4233_MASK_READ_PROT ( 1 << 2 ) // For block status byte
#define EM4233_MASK_WRITE_PROT ( 1 << 3 )
#define EM4233_MASK_AFI_STATUS ( 1 << 0 )
#define EM4233_MASK_AFI_STATUS ( 1 << 0 ) // For status bits
#define EM4233_MASK_DSFID_STATUS ( 1 << 1 )

/* Custom command code */
Expand All @@ -55,7 +55,7 @@
/* Proprietary command code */
#define EM4233_CMD_AUTH1 0xE0
#define EM4233_CMD_AUTH2 0xE1
#define EM4233_CMD_GEN_READ 0xE2 // Implies some sort of singed CRC. Unknown at the moment
#define EM4233_CMD_GEN_READ 0xE2 // Implies some sort of signed CRC. Unknown at the moment
#define EM4233_CMD_GEN_WRITE 0xE3 // Same
#define EM4233_CMD_LOGIN 0xE4

Expand Down
Loading

0 comments on commit f62c8fd

Please sign in to comment.