Commit 619bb910 authored by Ghislain MARY's avatar Ghislain MARY

Fix build for Android.

parent 3a232efe
......@@ -25,6 +25,7 @@
#
SET(_SOCI_ALL_PLUGINS mysql sqlite3)
SET(_SOCI_REQUIRED_VARS SOCI_INCLUDE_DIRS SOCI_LIBRARIES)
SET(_SOCI_VERSION "_4_0")
#
### FIRST STEP: Find the soci headers.
......@@ -37,7 +38,7 @@ MARK_AS_ADVANCED(SOCI_INCLUDE_DIRS)
### SECOND STEP: Find the soci core library. Respect LIB_SUFFIX
#
FIND_LIBRARY(SOCI_LIBRARIES
NAMES soci_core
NAMES soci_core soci_core${_SOCI_VERSION}
PATH_SUFFIXES lib lib64)
MARK_AS_ADVANCED(SOCI_LIBRARIES)
......@@ -54,13 +55,17 @@ IF(SOCI_INCLUDE_DIRS AND SOCI_LIBRARIES)
FIND_LIBRARY(
SOCI_${plugin}_PLUGIN
NAMES soci_${plugin}
NAMES soci_${plugin} soci_${plugin}${_SOCI_VERSION}
PATH_SUFFIXES lib lib64)
MARK_AS_ADVANCED(SOCI_${plugin}_PLUGIN)
IF(SOCI_${plugin}_PLUGIN)
MESSAGE(STATUS " * Plugin ${plugin} found ${SOCI_${plugin}_PLUGIN}.")
SET(SOCI_${plugin}_FOUND True)
if(IOS OR ANDROID)
list(APPEND SOCI_LIBRARIES ${SOCI_${plugin}_PLUGIN})
endif()
ELSE()
MESSAGE(STATUS " * Plugin ${plugin} not found.")
SET(SOCI_${plugin}_FOUND False)
......@@ -84,4 +89,3 @@ ENDIF()
#
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Soci DEFAULT_MSG ${_SOCI_REQUIRED_VARS})
......@@ -23,6 +23,7 @@
#include <unordered_map>
#include <vector>
#include <functional>
#include <string>
namespace lime {
......
......@@ -471,7 +471,6 @@ void HMAC_KDF(const std::vector<uint8_t> &salt, const std::vector<uint8_t> &ikm,
};
/* instanciate HMAC_KDF template with SHA512 and string or vector info */
template void HMAC<SHA512>(const uint8_t *const key, const size_t keySize, const uint8_t *const input, const size_t inputSize, uint8_t *hash, size_t hashSize);
template void HMAC_KDF<SHA512, std::vector<uint8_t>>(const uint8_t *const salt, const size_t saltSize, const uint8_t *const ikm, const size_t ikmSize, const std::vector<uint8_t> &info, uint8_t *output, size_t outputSize);
template void HMAC_KDF<SHA512, std::string>(const uint8_t *const salt, const size_t saltSize, const uint8_t *const ikm, const size_t ikmSize, const std::string &info, uint8_t *output, size_t outputSize);
template void HMAC_KDF<SHA512, std::vector<uint8_t>>(const std::vector<uint8_t> &salt, const std::vector<uint8_t> &ikm, const std::vector<uint8_t> &info, uint8_t *output, size_t outputSize);
......
......@@ -44,15 +44,38 @@ set(SOURCE_FILES_CXX
bc_apply_compile_flags(SOURCE_FILES_CXX STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX)
include_directories(${BELLESIP_INCLUDE_DIRS})
add_executable(lime_tester ${SOURCE_FILES_CXX} ${HEADER_FILES_CXX})
set_target_properties(lime_tester PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(lime_tester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
target_link_libraries(lime_tester ${LIME_LIBRARIES_FOR_TESTER} ${BCTOOLBOX_LIBRARIES} ${BCTOOLBOX_TESTER_LIBRARIES} ${BELLESIP_LIBRARIES} ${SOCI_LIBRARIES} ${SOCI_sqlite3_PLUGIN})
if(ANDROID OR IOS)
add_library(limetester SHARED ${HEADER_FILES_CXX} ${SOURCE_FILES_CXX})
target_include_directories(limetester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS} ${BELLESIP_INCLUDE_DIRS})
target_link_libraries(limetester ${LIME_LIBRARIES_FOR_TESTER} ${BCTOOLBOX_LIBRARIES} ${BCTOOLBOX_TESTER_LIBRARIES} ${BELLESIP_LIBRARIES} ${SOCI_LIBRARIES} ${SOCI_sqlite3_PLUGIN})
if(IOS)
set_target_properties(limetester PROPERTIES
FRAMEWORK TRUE
MACOSX_FRAMEWORK_IDENTIFIER com.belledonne-communications.limetester
PUBLIC_HEADER "${HEADER_FILES_CXX}"
)
endif()
install(TARGETS limetester
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
FRAMEWORK DESTINATION Frameworks
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(FILES ${HEADER_FILES_CXX}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lime
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
else()
add_executable(lime_tester ${SOURCE_FILES_CXX} ${HEADER_FILES_CXX})
set_target_properties(lime_tester PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(lime_tester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS} ${BELLESIP_INCLUDE_DIRS})
target_link_libraries(lime_tester ${LIME_LIBRARIES_FOR_TESTER} ${BCTOOLBOX_LIBRARIES} ${BCTOOLBOX_TESTER_LIBRARIES} ${BELLESIP_LIBRARIES} ${SOCI_LIBRARIES} ${SOCI_sqlite3_PLUGIN})
if(APPLE)
set_target_properties(lime_tester PROPERTIES LINK_FLAGS "-stdlib=libc++")
endif()
if(APPLE)
set_target_properties(lime_tester PROPERTIES LINK_FLAGS "-stdlib=libc++")
# lime test suit request a local server to be launched, so keep testing double ratchet only for now
add_test(NAME double_ratchet COMMAND lime_tester --verbose --resource-dir ${CMAKE_CURRENT_SOURCE_DIR} --suite "double ratchet")
endif()
# lime test suit request a local server to be launched, so keep testing double ratchet only for now
add_test(NAME double_ratchet COMMAND lime_tester --verbose --resource-dir ${CMAKE_CURRENT_SOURCE_DIR} --suite "double ratchet")
......@@ -345,7 +345,7 @@ static void dr_simple_exchange(std::shared_ptr<DR<Curve>> &DRsessionAlice, std::
bool is_directEncryptionType = lime_tester::DR_message_payloadDirectEncrypt(recipients[0].DRmessage);
if (getEncryptionPolicyAlice == lime::EncryptionPolicy::DRMessage) {
BC_ASSERT_TRUE(is_directEncryptionType);
BC_ASSERT_EQUAL(aliceCipher.size(), 0, size_t, "%ld"); // in direct Encryption mode, cipherMessage is empty
BC_ASSERT_EQUAL((int)aliceCipher.size(), 0, int, "%d"); // in direct Encryption mode, cipherMessage is empty
} else {
BC_ASSERT_FALSE(is_directEncryptionType);
}
......@@ -371,10 +371,10 @@ static void dr_simple_exchange(std::shared_ptr<DR<Curve>> &DRsessionAlice, std::
bool is_directEncryptionType = lime_tester::DR_message_payloadDirectEncrypt(recipients[0].DRmessage);
if (getEncryptionPolicyBob == lime::EncryptionPolicy::DRMessage) {
BC_ASSERT_TRUE(is_directEncryptionType);
BC_ASSERT_EQUAL(bobCipher.size(), 0, size_t, "%ld"); // in direct Encryption mode, cipherMessage is empty
BC_ASSERT_EQUAL((int)bobCipher.size(), 0, int, "%d"); // in direct Encryption mode, cipherMessage is empty
} else {
BC_ASSERT_FALSE(is_directEncryptionType);
BC_ASSERT_NOT_EQUAL(bobCipher.size(), 0, size_t, "%ld"); // in cipher message Encryption mode, cipherMessage is not empty
BC_ASSERT_NOT_EQUAL((int)bobCipher.size(), 0, int, "%d"); // in cipher message Encryption mode, cipherMessage is not empty
}
}
......@@ -477,7 +477,7 @@ static void dr_multidevice_exchange(std::string db_filename,
bool is_directEncryptionType = lime_tester::DR_message_payloadDirectEncrypt(recipients[0].DRmessage); // check on recipients[0], they shall all be the same
if (getEncryptionPolicy == lime::EncryptionPolicy::DRMessage) {
BC_ASSERT_TRUE(is_directEncryptionType);
BC_ASSERT_EQUAL(cipherMessage.size(), 0, size_t, "%ld"); // in direct Encryption mode, cipherMessage is empty
BC_ASSERT_EQUAL((int)cipherMessage.size(), 0, int, "%d"); // in direct Encryption mode, cipherMessage is empty
} else {
BC_ASSERT_FALSE(is_directEncryptionType);
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment