From bf5f6750f4b85558b01fa3a6b77415256f47e99c Mon Sep 17 00:00:00 2001 From: nvx Date: Thu, 4 Aug 2022 17:05:59 +1000 Subject: [PATCH] Fix gallagher KDF generation for Admin Cards aka Reader Config Cards --- common/generator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/generator.c b/common/generator.c index da1b4bac9..41bd49d89 100644 --- a/common/generator.c +++ b/common/generator.c @@ -491,7 +491,8 @@ int mfdes_kdf_input_gallagher(uint8_t *uid, uint8_t uidLen, uint8_t keyNo, uint3 int len = 0; // If the keyNo == 1 or the aid is 000000, then omit the UID. - if (keyNo != 1 && aid != 0x000000) { + // On the other hand, if the aid is 1f81f4 (config card) always include the UID. + if ((keyNo != 1 && aid != 0x000000) || (aid == 0x1f81f4)) { if (*kdfInputLen < (4 + uidLen)) { return PM3_EINVARG; }