From d05f008e760c44c603c30b4c6abd086ec20bf5b6 Mon Sep 17 00:00:00 2001 From: Romain Tartiere Date: Sat, 20 Nov 2010 14:19:04 +0000 Subject: [PATCH] Change some numbers with corresponding constants. --- libfreefare/mifare_desfire_authenticate.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/libfreefare/mifare_desfire_authenticate.c b/libfreefare/mifare_desfire_authenticate.c index 2cdba38..4a89d4e 100644 --- a/libfreefare/mifare_desfire_authenticate.c +++ b/libfreefare/mifare_desfire_authenticate.c @@ -142,11 +142,10 @@ mifare_cryto_preprocess_data (MifareTag tag, void *data, size_t *nbytes, off_t o return data; switch (communication_settings) { - case 0: - case 2: + case MDCM_PLAIN: res = data; break; - case 1: + case MDCM_MACED: edl = padded_data_length (*nbytes - offset, key_block_size (MIFARE_DESFIRE (tag)->session_key)) + offset; if (!(res = assert_crypto_buffer_size (tag, edl))) abort(); @@ -170,7 +169,7 @@ mifare_cryto_preprocess_data (MifareTag tag, void *data, size_t *nbytes, off_t o *nbytes += 4; break; - case 3: + case MDCM_ENCIPHERED: edl = enciphered_data_length (MIFARE_DESFIRE (tag)->session_key, *nbytes - offset) + offset; if (!(res = assert_crypto_buffer_size (tag, edl))) abort(); @@ -203,10 +202,9 @@ mifare_cryto_postprocess_data (MifareTag tag, void *data, ssize_t *nbytes, int c void *edata; switch (communication_settings) { - case 0: - case 2: + case MDCM_PLAIN: break; - case 1: + case MDCM_MACED: *nbytes -= 4; edl = enciphered_data_length (MIFARE_DESFIRE (tag)->session_key, *nbytes); @@ -229,7 +227,7 @@ mifare_cryto_postprocess_data (MifareTag tag, void *data, ssize_t *nbytes, int c free (edata); break; - case 3: + case MDCM_ENCIPHERED: mifare_cbc_des (MIFARE_DESFIRE (tag)->session_key, MIFARE_DESFIRE (tag)->ivect, res, *nbytes, MD_RECEIVE, 0); /*