From 899ed3d7bb891aa03755414523056ac2c082c641 Mon Sep 17 00:00:00 2001 From: Romain Tartiere Date: Wed, 29 Dec 2010 22:18:30 +0000 Subject: [PATCH] Fix create_file2(). ECOPYPASTETOOFAST | EBADLUCKITSVALID: The argument communication_settings is not to be used to construct the parameters passed to the crypto functions mifare_cryto_preprocess_data() & mifare_cryto_postprocess_data(), but only for building the frame. --- libfreefare/mifare_desfire.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libfreefare/mifare_desfire.c b/libfreefare/mifare_desfire.c index 27ea4e3..579d57f 100644 --- a/libfreefare/mifare_desfire.c +++ b/libfreefare/mifare_desfire.c @@ -1216,12 +1216,12 @@ create_file2 (MifareTag tag, uint8_t command, uint8_t file_no, uint8_t communica BUFFER_APPEND_LE (cmd, record_size, 3, sizeof (uint32_t)); BUFFER_APPEND_LE (cmd, max_number_of_records, 3, sizeof (uint32_t)); - char *p = mifare_cryto_preprocess_data (tag, cmd, &__cmd_n, 0, communication_settings | CMAC_COMMAND); + char *p = mifare_cryto_preprocess_data (tag, cmd, &__cmd_n, 0, MDCM_PLAIN | CMAC_COMMAND); DESFIRE_TRANSCEIVE2 (tag, p, __cmd_n, res); ssize_t sn = __res_n; - p = mifare_cryto_postprocess_data (tag, res, &sn, communication_settings | CMAC_COMMAND | CMAC_VERIFY); + p = mifare_cryto_postprocess_data (tag, res, &sn, MDCM_PLAIN | CMAC_COMMAND | CMAC_VERIFY); cached_file_settings_current[file_no] = false;