diff --git a/CMakeLists.txt b/CMakeLists.txt index 71d44ea9f..4b91565da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,7 +62,6 @@ endif(TOLUA_FOUND) enable_testing() -add_subdirectory (crypt_blowfish) add_subdirectory (cJSON) add_subdirectory (storage) add_subdirectory (iniparser) diff --git a/crypt_blowfish/CMakeLists.txt b/crypt_blowfish/CMakeLists.txt deleted file mode 100644 index 21cc29dea..000000000 --- a/crypt_blowfish/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -cmake_minimum_required(VERSION 2.6) -project (bcrypt C) - -IF (MSVC) - include (MSVC) - MSVC_SET_WARNING_LEVEL(3) -ENDIF (MSVC) - -SET (LIB_SRC bcrypt.c wrapper.c crypt_blowfish.c crypt_gensalt.c) -ADD_LIBRARY (bcrypt ${LIB_SRC}) - -set (BCRYPT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "cJSON headers") -set (BCRYPT_LIBRARIES bcrypt CACHE INTERNAL "bcrypt libraries") - -IF(UNIX AND NOT APPLE) - FIND_LIBRARY(UNIX_MATH_LIBRARY m) - SET(BCRYPT_LIBRARIES ${BCRYPT_LIBRARIES} ${UNIX_MATH_LIBRARY} CACHE - INTERNAL "bcrypt libraries") -ENDIF() - -IF (MSVC) - MSVC_CRT_SECURE_NO_WARNINGS (bcrypt) -ENDIF (MSVC) - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c6ffe4a1e..506f35473 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,7 +3,7 @@ project (server C) include_directories (${CMAKE_CURRENT_SOURCE_DIR}) include_directories (${CJSON_INCLUDE_DIR}) -include_directories (${BCRYPT_INCLUDE_DIR}) +include_directories (${CRYPTO_INCLUDE_DIR}) include_directories (${CLIBS_INCLUDE_DIR}) include_directories (${STORAGE_INCLUDE_DIR}) include_directories (${TOLUA_INCLUDE_DIR}) @@ -180,7 +180,7 @@ target_link_libraries(eressea ${LUA_LIBRARIES} ${STORAGE_LIBRARIES} ${CLIBS_LIBRARIES} - ${BCRYPT_LIBRARIES} + ${CRYPTO_LIBRARIES} ${CJSON_LIBRARIES} ${INIPARSER_LIBRARIES} ) @@ -241,7 +241,7 @@ target_link_libraries(test_eressea ${LUA_LIBRARIES} ${CLIBS_LIBRARIES} ${STORAGE_LIBRARIES} - ${BCRYPT_LIBRARIES} + ${CRYPTO_LIBRARIES} ${CJSON_LIBRARIES} ${INIPARSER_LIBRARIES} ) diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index b462d2bd3..90059666a 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -1,5 +1,7 @@ project(util C) +add_subdirectory (crypto) + SET(_TEST_FILES attrib.test.c base36.test.c diff --git a/src/util/crypto/CMakeLists.txt b/src/util/crypto/CMakeLists.txt new file mode 100644 index 000000000..925c73380 --- /dev/null +++ b/src/util/crypto/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 2.6) +project (crypto C) + +IF (MSVC) + include (MSVC) + MSVC_SET_WARNING_LEVEL(3) +ENDIF (MSVC) + +SET (LIB_SRC + bcrypt.c + crypt_blowfish/wrapper.c + crypt_blowfish/crypt_blowfish.c + crypt_blowfish/crypt_gensalt.c +) +ADD_LIBRARY (crypto ${LIB_SRC}) + +set (CRYPTO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "cJSON headers") +set (CRYPTO_LIBRARIES crypto CACHE INTERNAL "crypto libraries") + +IF(WIN32) + FIND_LIBRARY(WIN32_CNG_LIBRARY bcrypt) + SET(CRYPTO_LIBRARIES ${CRYPTO_LIBRARIES} ${WIN32_CNG_LIBRARY} CACHE + INTERNAL "crypto libraries") +ENDIF() + +IF (MSVC) + MSVC_CRT_SECURE_NO_WARNINGS (crypto) +ENDIF (MSVC) diff --git a/crypt_blowfish/bcrypt.c b/src/util/crypto/bcrypt.c similarity index 99% rename from crypt_blowfish/bcrypt.c rename to src/util/crypto/bcrypt.c index a4c992258..bd8722beb 100644 --- a/crypt_blowfish/bcrypt.c +++ b/src/util/crypto/bcrypt.c @@ -19,7 +19,7 @@ #include #include "bcrypt.h" -#include "ow-crypt.h" +#include "crypt_blowfish/ow-crypt.h" #define RANDBYTES (16) diff --git a/crypt_blowfish/bcrypt.h b/src/util/crypto/bcrypt.h similarity index 100% rename from crypt_blowfish/bcrypt.h rename to src/util/crypto/bcrypt.h diff --git a/crypt_blowfish/LINKS b/src/util/crypto/crypt_blowfish/LINKS similarity index 100% rename from crypt_blowfish/LINKS rename to src/util/crypto/crypt_blowfish/LINKS diff --git a/crypt_blowfish/PERFORMANCE b/src/util/crypto/crypt_blowfish/PERFORMANCE similarity index 100% rename from crypt_blowfish/PERFORMANCE rename to src/util/crypto/crypt_blowfish/PERFORMANCE diff --git a/crypt_blowfish/README b/src/util/crypto/crypt_blowfish/README similarity index 100% rename from crypt_blowfish/README rename to src/util/crypto/crypt_blowfish/README diff --git a/crypt_blowfish/crypt.h b/src/util/crypto/crypt_blowfish/crypt.h similarity index 100% rename from crypt_blowfish/crypt.h rename to src/util/crypto/crypt_blowfish/crypt.h diff --git a/crypt_blowfish/crypt_blowfish.c b/src/util/crypto/crypt_blowfish/crypt_blowfish.c similarity index 100% rename from crypt_blowfish/crypt_blowfish.c rename to src/util/crypto/crypt_blowfish/crypt_blowfish.c diff --git a/crypt_blowfish/crypt_blowfish.h b/src/util/crypto/crypt_blowfish/crypt_blowfish.h similarity index 100% rename from crypt_blowfish/crypt_blowfish.h rename to src/util/crypto/crypt_blowfish/crypt_blowfish.h diff --git a/crypt_blowfish/crypt_gensalt.c b/src/util/crypto/crypt_blowfish/crypt_gensalt.c similarity index 100% rename from crypt_blowfish/crypt_gensalt.c rename to src/util/crypto/crypt_blowfish/crypt_gensalt.c diff --git a/crypt_blowfish/crypt_gensalt.h b/src/util/crypto/crypt_blowfish/crypt_gensalt.h similarity index 100% rename from crypt_blowfish/crypt_gensalt.h rename to src/util/crypto/crypt_blowfish/crypt_gensalt.h diff --git a/crypt_blowfish/ow-crypt.h b/src/util/crypto/crypt_blowfish/ow-crypt.h similarity index 100% rename from crypt_blowfish/ow-crypt.h rename to src/util/crypto/crypt_blowfish/ow-crypt.h diff --git a/crypt_blowfish/wrapper.c b/src/util/crypto/crypt_blowfish/wrapper.c similarity index 100% rename from crypt_blowfish/wrapper.c rename to src/util/crypto/crypt_blowfish/wrapper.c diff --git a/crypt_blowfish/x86.S b/src/util/crypto/crypt_blowfish/x86.S similarity index 100% rename from crypt_blowfish/x86.S rename to src/util/crypto/crypt_blowfish/x86.S diff --git a/src/util/password.c b/src/util/password.c index eb976ac8d..73e02c551 100644 --- a/src/util/password.c +++ b/src/util/password.c @@ -3,7 +3,7 @@ #endif #include "password.h" -#include +#include "crypto/bcrypt.h" #include #include