From c2cc0ba53d23ecf606b9facc34fdb09d1f05cc2d Mon Sep 17 00:00:00 2001 From: Romain Tartiere Date: Fri, 31 Dec 2010 10:53:05 +0000 Subject: [PATCH] Move away global variables. --- libfreefare/mifare_desfire.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/libfreefare/mifare_desfire.c b/libfreefare/mifare_desfire.c index 579d57f..ffc11af 100644 --- a/libfreefare/mifare_desfire.c +++ b/libfreefare/mifare_desfire.c @@ -142,15 +142,6 @@ static ssize_t read_data (MifareTag tag, uint8_t command, uint8_t file_no, off_ * Convenience macros. */ -static uint8_t __msg[MAX_FRAME_SIZE] = { 0x90, 0x00, 0x00, 0x00, 0x00, /* ..., */ 0x00 }; -/* CLA INS P1 P2 Lc PAYLOAD LE*/ -static uint8_t __res[MAX_FRAME_SIZE]; - -uint8_t cmac_cmd_buf[4096]; -uint8_t cmac_res_buf[4096]; -size_t cmac_cmd_len = 0; -size_t cmac_res_len = 0; - #define FRAME_PAYLOAD_SIZE (MAX_FRAME_SIZE - 5) /* @@ -164,6 +155,9 @@ size_t cmac_res_len = 0; DESFIRE_TRANSCEIVE2 (tag, msg, __##msg##_n, res) #define DESFIRE_TRANSCEIVE2(tag, msg, msg_len, res) \ do { \ + static uint8_t __msg[MAX_FRAME_SIZE] = { 0x90, 0x00, 0x00, 0x00, 0x00, /* ..., */ 0x00 }; \ + /* CLA INS P1 P2 Lc PAYLOAD LE*/ \ + static uint8_t __res[MAX_FRAME_SIZE]; \ size_t __len = 5; \ errno = 0; \ __msg[1] = msg[0]; \