From edb1d93084f9e1f2e21a24536e9dff6c19ebfa05 Mon Sep 17 00:00:00 2001 From: Federico Cerutti Date: Tue, 4 Dec 2018 18:00:37 +0100 Subject: [PATCH] Checked read and lock out of bound errors against real tag and implemented in software. Updated authors --- Firmware/Chameleon-Mini/Application/ISO15693-A.c | 2 ++ .../Chameleon-Mini/Application/TITagitstandard.c | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Firmware/Chameleon-Mini/Application/ISO15693-A.c b/Firmware/Chameleon-Mini/Application/ISO15693-A.c index 5135135..f8a36da 100644 --- a/Firmware/Chameleon-Mini/Application/ISO15693-A.c +++ b/Firmware/Chameleon-Mini/Application/ISO15693-A.c @@ -62,6 +62,8 @@ bool ISO15693CheckCRC(void* FrameBuf, uint16_t FrameBufSize) * - true: Frame is valid and a response is needed * - false: Request is not addressed to us * Frame is not valid because it's too short or CRC is wrong + * + * Authors: ceres-c & MrMoDDoM */ bool ISO15693PrepareFrame(uint8_t* FrameBuf, uint16_t FrameBytes, CurrentFrame* FrameStruct, uint8_t* MyUid) { diff --git a/Firmware/Chameleon-Mini/Application/TITagitstandard.c b/Firmware/Chameleon-Mini/Application/TITagitstandard.c index 8441907..f5618f5 100644 --- a/Firmware/Chameleon-Mini/Application/TITagitstandard.c +++ b/Firmware/Chameleon-Mini/Application/TITagitstandard.c @@ -4,10 +4,7 @@ * Created on: 01-03-2017 * Author: Phillip Nash * Modified by rickventura for texas 15693 tag-it STANDARD - * Modified by ceres-c to finish things up - * TODO: - * - Check actual tag's response (error?) when trying to WRITE out of bound sectors - * - Check actual tag's response (error?) when trying to LOCK out of bound sectors + * Modified by ceres-c & MrMoDDoM to finish things up */ #include "ISO15693-A.h" @@ -118,7 +115,8 @@ uint16_t TITagitstandardAppProcess(uint8_t* FrameBuf, uint16_t FrameBytes) break; /* malformed: not enough or too much data */ if (PageAddress > TITAGIT_NUMBER_OF_SECTORS) - /* TODO: Check actual tag's response (error?) */ + FrameBuf[ISO15693_ADDR_FLAGS] = ISO15693_RES_FLAG_ERROR; + FrameBuf[ISO15693_RES_ADDR_PARAM] = ISO15693_RES_ERR_OPT_NOT_SUPP; break; /* malformed: trying to write in a non-existing block */ Dataptr = PageAddress + 0x01; @@ -144,7 +142,9 @@ uint16_t TITagitstandardAppProcess(uint8_t* FrameBuf, uint16_t FrameBytes) break; /* malformed: not enough or too much data */ if (PageAddress > TITAGIT_NUMBER_OF_SECTORS) - /* TODO: Check actual tag's response (error?) */ + FrameBuf[ISO15693_ADDR_FLAGS] = ISO15693_RES_FLAG_ERROR; + FrameBuf[ISO15693_RES_ADDR_PARAM] = ISO15693_RES_ERR_OPT_NOT_SUPP; + ResponseByteCount = 2; break; /* malformed: trying to lock a non-existing block */ if ((FactoryLockBits_Mask & (1 << PageAddress)) || (UserLockBits_Mask & (1 << PageAddress))) {