Commit e292f4b1 authored by Matthieu Tanon's avatar Matthieu Tanon

Use LIMEv2 by default and add BelleSipLimeManager class for X3DH server communication

parent 85957d5b
......@@ -50,6 +50,7 @@ option(ENABLE_DOC "Enable documentation generation with Doxygen." YES)
option(ENABLE_SPHINX_DOC "Enable sphinx documentation generation." NO)
option(ENABLE_JAVADOC "Add a target to generate documentation for Java API" NO)
option(ENABLE_LDAP "Enable LDAP support." NO)
option(ENABLE_LIME_V2 "Enable LIME v2 and X3DH." YES)
option(ENABLE_RELATIVE_PREFIX "Find resources relatively to the installation directory." NO)
option(ENABLE_ROOTCA_DOWNLOAD "Download rootca.pem at build time." YES)
option(ENABLE_SOCI_STORAGE "Turn on compilation soci storage, for messages, contacts, history" YES)
......@@ -63,7 +64,7 @@ option(ENABLE_UPDATE_CHECK "Enable update check." NO)
option(ENABLE_VCARD "Turn on compilation of vcard4 support." YES)
option(ENABLE_VIDEO "Build with video support." YES)
cmake_dependent_option(ENABLE_LIME "Enable Instant Messaging Encryption." YES "ENABLE_SQLITE_STORAGE" NO)
cmake_dependent_option(ENABLE_LIME "Enable Instant Messaging Encryption." NO "ENABLE_SQLITE_STORAGE" NO)
cmake_dependent_option(ENABLE_NOTIFY "Enable libnotify support." YES "ENABLE_GTK_UI;NOT APPLE" NO)
cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENABLE_GTK_UI" NO)
......@@ -163,6 +164,12 @@ endif()
if(ENABLE_ASSISTANT)
set(BUILD_WIZARD 1)
endif()
if(ENABLE_LIME AND ENABLE_LIME_V2)
message(FATAL_ERROR "Lime V1 and V2 cannot be used simultaneously")
endif()
if(ENABLE_LIME_V2)
find_package(Lime REQUIRED)
endif()
if(ENABLE_LIME)
#bzrtp is only required for LIME
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
......
......@@ -159,6 +159,9 @@ endif()
if(ENABLE_LIME)
list(APPEND LIBS ${BZRTP_LIBRARIES})
endif()
if(ENABLE_LIME_V2)
list(APPEND LIBS ${LIME_LIBRARIES})
endif()
if(ZLIB_FOUND)
list(APPEND LIBS ${ZLIB_LIBRARIES})
endif()
......
This diff is collapsed.
......@@ -20,20 +20,44 @@
#ifndef _L_LIME_V2_H_
#define _L_LIME_V2_H_
#include "belle-sip/http-listener.h"
#include "encryption-engine-listener.h"
#include "lime/lime.hpp"
#include <belle-sip/belle-sip.h>
//#include "linphone/utils/general.h"
#include "carddav.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class BelleSipLimeManager : public lime::LimeManager {
public:
BelleSipLimeManager(const std::string &db_access, belle_http_provider_t *prov);
//void X3DHBelleSipServerPost(const std::string &url, const std::string &from, const std::vector<uint8_t> &message, const lime::limeX3DHServerResponseProcess &responseProcess);
private:
static void processIoError (void *data, const belle_sip_io_error_event_t *event) noexcept;
static void processResponse(void *data, const belle_http_response_event_t *event) noexcept;
static void processAuthRequestedFromCarddavRequest(void *data, belle_sip_auth_event_t *event) noexcept;
std::function<void(void *data, belle_sip_auth_event *event)> mProcessAuthRequest;
};
class LimeV2 : public EncryptionEngineListener {
public:
ChatMessageModifier::Result processIncomingMessage (const std::shared_ptr<ChatMessage> &message, int &errorCode) override;
ChatMessageModifier::Result processOutgoingMessage (const std::shared_ptr<ChatMessage> &message, int &errorCode) override;
bool encryptionEnabledForFileTransferCb (const std::shared_ptr<AbstractChatRoom> &ChatRoom) override;
void generateFileTransferKeyCb (const std::shared_ptr<AbstractChatRoom> &ChatRoom, const std::shared_ptr<ChatMessage> &message) override;
int downloadingFileCb (const std::shared_ptr<ChatMessage> &message, size_t offset, const uint8_t *buffer, size_t size, uint8_t *decrypted_buffer) override;
int uploadingFileCb (const std::shared_ptr<ChatMessage> &message, size_t offset, const uint8_t *buffer, size_t size, uint8_t *encrypted_buffer) override;
LimeV2(const std::string &db_access, belle_http_provider_t *prov); // no manager without Database and http provider
ChatMessageModifier::Result processIncomingMessage (const std::shared_ptr<ChatMessage> &message, int &errorCode) override;
ChatMessageModifier::Result processOutgoingMessage (const std::shared_ptr<ChatMessage> &message, int &errorCode) override;
bool encryptionEnabledForFileTransferCb (const std::shared_ptr<AbstractChatRoom> &ChatRoom) override;
void generateFileTransferKeyCb (const std::shared_ptr<AbstractChatRoom> &ChatRoom, const std::shared_ptr<ChatMessage> &message) override;
int downloadingFileCb (const std::shared_ptr<ChatMessage> &message, size_t offset, const uint8_t *buffer, size_t size, uint8_t *decrypted_buffer) override;
int uploadingFileCb (const std::shared_ptr<ChatMessage> &message, size_t offset, const uint8_t *buffer, size_t size, uint8_t *encrypted_buffer) override;
private:
std::unique_ptr<BelleSipLimeManager> belleSipLimeManager;
};
LINPHONE_END_NAMESPACE
......
......@@ -40,6 +40,7 @@ class Participant : public Object {
friend class ClientGroupChatRoom;
friend class ClientGroupChatRoomPrivate;
friend class Conference;
friend class LimeV2;
friend class LocalConference;
friend class LocalConferenceCall;
friend class LocalConferenceCallPrivate;
......
......@@ -144,8 +144,10 @@ void Core::enableLimeV2 (bool enable) {
L_D();
if (enable) {
if (d->imee == nullptr) {
/*
LimeV2 *limev2 = new LimeV2();
setEncryptionEngine(limev2);
*/
}
}
// Risk of disabling another encryption engine
......
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