From 143042fb0b6511f412001a77b7755b9b653e4536 Mon Sep 17 00:00:00 2001 From: Romain Tartiere Date: Sat, 18 Dec 2010 01:09:30 +0000 Subject: [PATCH] Remove weird code. I should quit coding drunk... or maybe start to... --- libfreefare/freefare_internal.h | 1 - libfreefare/mifare_desfire.c | 3 --- libfreefare/mifare_desfire_authenticate.c | 3 +-- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/libfreefare/freefare_internal.h b/libfreefare/freefare_internal.h index 5f15e15..0296c1d 100644 --- a/libfreefare/freefare_internal.h +++ b/libfreefare/freefare_internal.h @@ -135,7 +135,6 @@ typedef enum { #define ENC_COMMAND 0x1000 #define NO_CRC 0x2000 -#define UNSPECIFIED_DATA_LENGTH 0x4000 #define MAC_MASK 0x0F0 #define CMAC_MACK 0xF00 diff --git a/libfreefare/mifare_desfire.c b/libfreefare/mifare_desfire.c index 75f1a05..a312d3f 100644 --- a/libfreefare/mifare_desfire.c +++ b/libfreefare/mifare_desfire.c @@ -1214,9 +1214,6 @@ read_data (MifareTag tag, uint8_t command, uint8_t file_no, off_t offset, size_t ((uint8_t *)data)[bytes_received++] = 0x00; ssize_t sr = bytes_received; - uint8_t uds = 0; - if (!length) - uds |= UNSPECIFIED_DATA_LENGTH; p = mifare_cryto_postprocess_data (tag, data, &sr, cs | CMAC_COMMAND | CMAC_VERIFY | MAC_VERIFY); return sr - 1; diff --git a/libfreefare/mifare_desfire_authenticate.c b/libfreefare/mifare_desfire_authenticate.c index 91d3dca..dc32790 100644 --- a/libfreefare/mifare_desfire_authenticate.c +++ b/libfreefare/mifare_desfire_authenticate.c @@ -590,9 +590,8 @@ mifare_cryto_postprocess_data (MifareTag tag, void *data, ssize_t *nbytes, int c while (!*p) { p--; } - if (UNSPECIFIED_DATA_LENGTH && (*p == 0x80)) { + if (0x80 == *p) p--; - } p -= 3; uint8_t crc_ref[4];