Enable WITH_DEBUG for Windows (Fixes issue 65)

PR:		Issue 65
Submitted by:	glenn.ergeerts
This commit is contained in:
Romain Tartiere 2011-06-27 18:34:07 +00:00
parent 0be3b125e6
commit 0339fb51f4
4 changed files with 11 additions and 11 deletions

View file

@ -2,7 +2,7 @@
project(libfreefare C)
cmake_minimum_required(VERSION 2.6)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")
add_definitions("-std=c99")
@ -26,13 +26,10 @@ endif(MINGW)
message("CMAKE_C_FLAGS: " ${CMAKE_C_FLAGS})
message("CMAKE_SHARED_LINKER_FLAGS: " ${CMAKE_SHARED_LINKER_FLAGS})
include_directories(${LIBNFC_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${LIBNFC_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/contrib/libutil)
set(LIBS ${LIBS} ${LIBNFC_LIBRARIES} ${OPENSSL_LIBRARIES})
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
message("CMAKE_INSTALL_PREFIX not defined")
set(CMAKE_INSTALL_PREFIX "c:/projects/EVENT/install") # TODO
endif(NOT DEFINED CMAKE_INSTALL_PREFIX)
option(WITH_DEBUG "Extra debug information is outputted when this is turned on" OFF)
if(DEFINED CMAKE_INSTALL_LIBDIR)
set(libdir ${CMAKE_INSTALL_LIBDIR})

View file

@ -20,6 +20,8 @@
#ifndef __CONFIG_WINDOWS_H__
#define __CONFIG_WINDOWS_H__
#cmakedefine WITH_DEBUG
#include <winsock2.h>
#define htole32(x) (x)

View file

@ -12,6 +12,7 @@ set(LIBRARY_SOURCES
mifare_desfire_key
mifare_ultralight
tlv
../contrib/libutil/hexdump
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

View file

@ -423,7 +423,7 @@ mifare_cryto_preprocess_data (MifareTag tag, void *data, size_t *nbytes, off_t o
break;
default:
warnx ("Unknown communication settings");
#if WITH_DEBUG
#ifdef WITH_DEBUG
abort ();
#endif
*nbytes = -1;
@ -473,7 +473,7 @@ mifare_cryto_postprocess_data (MifareTag tag, void *data, ssize_t *nbytes, int c
mifare_cypher_blocks_chained (tag, NULL, NULL, edata, edl, MCD_SEND, MCO_ENCYPHER);
if (0 != memcmp ((uint8_t *)data + *nbytes - 1, (uint8_t *)edata + edl - 8, 4)) {
#if WITH_DEBUG
#ifdef WITH_DEBUG
warnx ("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);
@ -503,7 +503,7 @@ mifare_cryto_postprocess_data (MifareTag tag, void *data, ssize_t *nbytes, int c
if (communication_settings & CMAC_VERIFY) {
((uint8_t *)data)[*nbytes - 9] = first_cmac_byte;
if (0 != memcmp (MIFARE_DESFIRE (tag)->cmac, (uint8_t *)data + *nbytes - 9, 8)) {
#if WITH_DEBUG
#ifdef WITH_DEBUG
warnx ("CMAC NOT verified :-(");
hexdump ((uint8_t *)data + *nbytes - 9, 8, "Expect ", 0);
hexdump (MIFARE_DESFIRE (tag)->cmac, 8, "Actual ", 0);
@ -625,7 +625,7 @@ mifare_cryto_postprocess_data (MifareTag tag, void *data, ssize_t *nbytes, int c
} while (!verified && (end_crc_pos < *nbytes));
if (!verified) {
#if WITH_DEBUG
#ifdef WITH_DEBUG
/* FIXME In some configurations, the file is transmitted PLAIN */
warnx ("CRC not verified in decyphered stream");
#endif
@ -637,7 +637,7 @@ mifare_cryto_postprocess_data (MifareTag tag, void *data, ssize_t *nbytes, int c
break;
default:
warnx ("Unknown communication settings");
#if WITH_DEBUG
#ifdef WITH_DEBUG
abort ();
#endif
*nbytes = -1;