From 7a6f503161f91b0d5b952f410ff5d1ce92b6a682 Mon Sep 17 00:00:00 2001 From: Richard Knoll Date: Sat, 28 Aug 2021 14:28:06 +0100 Subject: [PATCH 1/2] Fix PAC/Stanley checksum calculation The parity bit needs to be discarded when calculating the final checksum byte value of PAC/Stanley card IDs. Verified by scanning a tag which is now correctly identified. --- client/src/cmdlfpac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/cmdlfpac.c b/client/src/cmdlfpac.c index b751b2af3..f1891cfc1 100644 --- a/client/src/cmdlfpac.c +++ b/client/src/cmdlfpac.c @@ -54,7 +54,7 @@ static int pac_buf_to_cardid(uint8_t *src, const size_t src_size, uint8_t *dst, PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: Parity check failed"); return PM3_ESOFT; } - if (idx < dataLength - 1) checksum ^= byte; + if (idx < dataLength - 1) checksum ^= dst[idx]; } if (dst[dataLength - 1] != checksum) { PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: Bad checksum - expected: %02X, actual: %02X", dst[dataLength - 1], checksum); From 997e7b39dcead5be89a0cc57f1bce6388cd975bb Mon Sep 17 00:00:00 2001 From: Richard Knoll Date: Sat, 28 Aug 2021 18:46:06 +0100 Subject: [PATCH 2/2] Add entry to CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02277ab23..7e2818a46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] + - Fix PAC/Stanley checksum calculation (@rknoll) - Added option --mem to `hf mf nested`, from icopyx source (@doegox) - Port fpga-xc3s100e and icopyx source code specificities to this repo (@doegox) - `hf mfdes` - Transactions. commit, abort, commit reader id. (@merlokk)