iso15sim: add suppot for SET_PASSWORD
This commit is contained in:
1 parent
4a45aaf065
commit
f71eaaec55
2 files changed
+23
-2
No files matched your search
+21
-2
@@ -2176,6 +2176,7 @@ void SimTagIso15693(uint8_t *uid, uint8_t block_size) {
|
|||||||
uint8_t error = 0;
|
uint8_t error = 0;
|
||||||
uint8_t pageNum = 0;
|
uint8_t pageNum = 0;
|
||||||
uint8_t nbPages = 0;
|
uint8_t nbPages = 0;
|
||||||
|
uint8_t pwdId = 0;
|
||||||
|
|
||||||
while (exit_loop == false) {
|
while (exit_loop == false) {
|
||||||
|
|
||||||
@@ -2495,11 +2496,29 @@ void SimTagIso15693(uint8_t *uid, uint8_t block_size) {
|
|||||||
break;
|
break;
|
||||||
case ISO15693_GET_RANDOM_NUMBER:
|
case ISO15693_GET_RANDOM_NUMBER:
|
||||||
if (g_dbglevel >= DBG_DEBUG) Dbprintf("GetRandomNumber cmd");
|
if (g_dbglevel >= DBG_DEBUG) Dbprintf("GetRandomNumber cmd");
|
||||||
|
tag->random[0] = (uint8_t)(reader_eof_time) ^ 0xFF; // poor random number
|
||||||
|
tag->random[1] = (uint8_t)(reader_eof_time >> 8) ^ 0xFF;
|
||||||
recv[0] = ISO15_NOERROR;
|
recv[0] = ISO15_NOERROR;
|
||||||
recv[1] = (uint8_t)(reader_eof_time) ^ 0xFF; // poor random number
|
recv[1] = tag->random[0]; // poor random number
|
||||||
recv[2] = (uint8_t)(reader_eof_time >> 8) ^ 0xFF;
|
recv[2] = tag->random[1];
|
||||||
recvLen = 3;
|
recvLen = 3;
|
||||||
break;
|
break;
|
||||||
|
case ISO15693_SET_PASSWORD:
|
||||||
|
if (g_dbglevel >= DBG_DEBUG) Dbprintf("SetPassword cmd");
|
||||||
|
if (cmd[cmdCpt++] == tag->ic)
|
||||||
|
{
|
||||||
|
pwdId = cmd[cmdCpt++];
|
||||||
|
if (pwdId == 4) // Privacy password
|
||||||
|
{
|
||||||
|
tag->privacyPasswd[0] = cmd[cmdCpt] ^ tag->random[0];
|
||||||
|
tag->privacyPasswd[1] = cmd[cmdCpt+1] ^ tag->random[1];
|
||||||
|
tag->privacyPasswd[2] = cmd[cmdCpt+2] ^ tag->random[0];
|
||||||
|
tag->privacyPasswd[3] = cmd[cmdCpt+3] ^ tag->random[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
recv[0] = ISO15_NOERROR;
|
||||||
|
recvLen = 1;
|
||||||
|
break;
|
||||||
case ISO15693_ENABLE_PRIVACY:
|
case ISO15693_ENABLE_PRIVACY:
|
||||||
if (g_dbglevel >= DBG_DEBUG) Dbprintf("EnablePrivacy cmd");
|
if (g_dbglevel >= DBG_DEBUG) Dbprintf("EnablePrivacy cmd");
|
||||||
// not realy entering privacy mode
|
// not realy entering privacy mode
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ typedef struct iso15693_tag {
|
|||||||
uint8_t ic;
|
uint8_t ic;
|
||||||
uint8_t locks[ISO15693_TAG_MAX_PAGES];
|
uint8_t locks[ISO15693_TAG_MAX_PAGES];
|
||||||
uint8_t data[ISO15693_TAG_MAX_SIZE];
|
uint8_t data[ISO15693_TAG_MAX_SIZE];
|
||||||
|
uint8_t random[2];
|
||||||
|
uint8_t privacyPasswd[4];
|
||||||
enum {
|
enum {
|
||||||
TAG_STATE_NO_FIELD,
|
TAG_STATE_NO_FIELD,
|
||||||
TAG_STATE_READY,
|
TAG_STATE_READY,
|
||||||
|
|||||||
Reference in new issue
Block a user