move crypto implementations to util/crypto for easier inclusion

This commit is contained in:
Enno Rehling 2018-09-26 18:33:38 +02:00
parent 53afc86e00
commit 21e54e0933
19 changed files with 35 additions and 30 deletions

View File

@ -62,7 +62,6 @@ endif(TOLUA_FOUND)
enable_testing()
add_subdirectory (crypt_blowfish)
add_subdirectory (cJSON)
add_subdirectory (storage)
add_subdirectory (iniparser)

View File

@ -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)

View File

@ -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}
)

View File

@ -1,5 +1,7 @@
project(util C)
add_subdirectory (crypto)
SET(_TEST_FILES
attrib.test.c
base36.test.c

View File

@ -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)

View File

@ -19,7 +19,7 @@
#include <errno.h>
#include "bcrypt.h"
#include "ow-crypt.h"
#include "crypt_blowfish/ow-crypt.h"
#define RANDBYTES (16)

View File

@ -3,7 +3,7 @@
#endif
#include "password.h"
#include <bcrypt.h>
#include "crypto/bcrypt.h"
#include <assert.h>
#include <string.h>