*/
#include "desfire_crypto.h"
-static void xor (const uint8_t *ivect, uint8_t *data, const size_t len);
-
-static size_t key_macing_length (desfirekey_t key);
+static void xor (const uint8_t *ivect, uint8_t *data, const size_t len);
+static size_t key_macing_length (desfirekey_t key);
static void xor (const uint8_t *ivect, uint8_t *data, const size_t len) {
for (size_t i = 0; i < len; i++) {
*nbytes = -1;
res = NULL;
#ifdef WITH_DEBUG
- printf ("No room for MAC!");
+ Dbprintf ("No room for MAC!");
#endif
break;
}
if (0 != memcmp ((uint8_t *)data + *nbytes - 1, (uint8_t *)edata + edl - 8, 4)) {
#ifdef WITH_DEBUG
- printf ("MACing not verified");
+ Dbprintf ("MACing not verified");
hexdump ((uint8_t *)data + *nbytes - 1, key_macing_length (key), "Expect ", 0);
hexdump ((uint8_t *)edata + edl - 8, key_macing_length (key), "Actual ", 0);
#endif
((uint8_t *)data)[*nbytes - 9] = first_cmac_byte;
if (0 != memcmp (DESFIRE (tag)->cmac, (uint8_t *)data + *nbytes - 9, 8)) {
#ifdef WITH_DEBUG
- printf ("CMAC NOT verified :-(");
+ Dbprintf ("CMAC NOT verified :-(");
hexdump ((uint8_t *)data + *nbytes - 9, 8, "Expect ", 0);
hexdump (DESFIRE (tag)->cmac, 8, "Actual ", 0);
#endif