Commit 1f3b7ab7 authored by Matthieu Tanon's avatar Matthieu Tanon

Rename [encryption] section to [lime] in config

parent 67e0310a
......@@ -143,7 +143,7 @@ static void linphone_proxy_config_init(LinphoneCore* lc, LinphoneProxyConfig *cf
cfg->avpf_rr_interval = lc ? !!lp_config_get_default_int(lc->config, "proxy", "avpf_rr_interval", 5) : 5;
cfg->publish_expires= lc ? lp_config_get_default_int(lc->config, "proxy", "publish_expires", -1) : -1;
cfg->publish = lc ? !!lp_config_get_default_int(lc->config, "proxy", "publish", FALSE) : FALSE;
cfg->lime_v2 = lc ? !!lp_config_get_int(lc->config, "encryption", "lime_v2", FALSE) : FALSE; // Disabled by default unless you have a lime_v2=1 in config
cfg->lime_v2 = lc ? !!lp_config_get_int(lc->config, "lime", "lime_v2", FALSE) : FALSE;
cfg->push_notification_allowed = lc ? !!lp_config_get_default_int(lc->config, "proxy", "push_notification_allowed", TRUE) : TRUE;
cfg->refkey = refkey ? ms_strdup(refkey) : NULL;
if (nat_policy_ref) {
......
......@@ -771,7 +771,7 @@ void ClientGroupChatRoom::onParticipantDeviceAdded (const shared_ptr<ConferenceP
// If LIMEv2 enabled and if too many devices for a participant, throw a local security alert event
int nbDevice = int(participant->getPrivate()->getDevices().size());
int maxNbDevicesPerParticipant = linphone_config_get_int(linphone_core_get_config(L_GET_C_BACK_PTR(getCore())), "encryption", "max_nb_device_per_participant", 1);
int maxNbDevicesPerParticipant = linphone_config_get_int(linphone_core_get_config(L_GET_C_BACK_PTR(getCore())), "lime", "max_nb_device_per_participant", 1);
if (getCore()->limeV2Enabled() && nbDevice > maxNbDevicesPerParticipant) {
lWarning() << "LIMEv2 maximum number of devices exceeded for " << participant->getAddress();
......
......@@ -25,6 +25,7 @@
#include "content/header/header-param.h"
#include "conference/participant-p.h"
#include "conference/participant-device.h"
#include "core/core.h"
#include "c-wrapper/c-wrapper.h"
#include "event-log/conference/conference-security-event.h"
#include "lime-v2.h"
......@@ -110,11 +111,11 @@ BelleSipLimeManager::BelleSipLimeManager (const string &dbAccess, belle_http_pro
LimeV2::LimeV2 (const std::string &dbAccess, belle_http_provider_t *prov, LinphoneCore *lc) {
engineType = EncryptionEngineListener::EngineType::LimeV2;
curve = lime::CurveId::c25519; // c448
x3dhServerUrl = linphone_config_get_string(linphone_core_get_config(lc), "encryption", "x3dh_server_url", "");
x3dhServerUrl = linphone_config_get_string(linphone_core_get_config(lc), "lime", "x3dh_server_url", "");
_dbAccess = dbAccess;
belleSipLimeManager = unique_ptr<BelleSipLimeManager>(new BelleSipLimeManager(dbAccess, prov, lc));
lastLimeUpdate = linphone_config_get_int(lc->config, "encryption", "last_lime_update_time", 0);
maxNbDevicePerParticipant = linphone_config_get_int(lc->config, "encryption", "max_nb_device_per_participant", 1); // TODO discuss default value
lastLimeUpdate = linphone_config_get_int(lc->config, "lime", "last_lime_update_time", 0);
maxNbDevicePerParticipant = linphone_config_get_int(lc->config, "lime", "max_nb_device_per_participant", 1); // TODO discuss default value
}
string LimeV2::getX3dhServerUrl () const {
......@@ -135,6 +136,7 @@ ChatMessageModifier::Result LimeV2::processOutgoingMessage (const shared_ptr<Cha
// Add participants to the recipient list
bool tooManyDevices = FALSE;
int maxNbDevicePerParticipant = linphone_config_get_int(linphone_core_get_config(chatRoom->getCore()->getCCore()), "lime", "max_nb_device_per_participant", 1);
auto recipients = make_shared<vector<lime::RecipientData>>();
const list<shared_ptr<Participant>> participants = chatRoom->getParticipants();
for (const shared_ptr<Participant> &participant : participants) {
......@@ -367,7 +369,7 @@ ChatMessageModifier::Result LimeV2::processIncomingMessage (const shared_ptr<Cha
void LimeV2::update (LinphoneConfig *lpconfig) {
lime::limeCallback callback = setLimeCallback("Keys update");
belleSipLimeManager->update(callback);
lp_config_set_int(lpconfig, "encryption", "last_lime_update_time", (int)lastLimeUpdate);
lp_config_set_int(lpconfig, "lime", "last_lime_update_time", (int)lastLimeUpdate);
}
bool LimeV2::encryptionEnabledForFileTransfer (const shared_ptr<AbstractChatRoom> &chatRoom) {
......@@ -501,18 +503,18 @@ void LimeV2::onRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegis
lime::limeCallback callback = setLimeCallback(operation.str());
LinphoneConfig *lpconfig = linphone_core_get_config(linphone_proxy_config_get_core(cfg));
lastLimeUpdate = linphone_config_get_int(lpconfig, "encryption", "last_lime_update_time", -1); // TODO should be done by the tester
lastLimeUpdate = linphone_config_get_int(lpconfig, "lime", "last_lime_update_time", -1); // TODO should be done by the tester
try {
// create user if not exist
belleSipLimeManager->create_user(localDeviceId, x3dhServerUrl, curve, callback);
lastLimeUpdate = ms_time(NULL);
lp_config_set_int(lpconfig, "encryption", "last_lime_update_time", (int)lastLimeUpdate);
lp_config_set_int(lpconfig, "lime", "last_lime_update_time", (int)lastLimeUpdate);
} catch (const exception &e) {
lInfo() << e.what() << " while creating lime user";
// update keys if necessary
int limeUpdateThreshold = lp_config_get_int(lpconfig, "encryption", "lime_update_threshold", 86400);
int limeUpdateThreshold = lp_config_get_int(lpconfig, "lime", "lime_update_threshold", 86400);
if (ms_time(NULL) - lastLimeUpdate > limeUpdateThreshold) { // 24 hours = 86400 ms
update(lpconfig);
lastLimeUpdate = ms_time(NULL);
......
......@@ -217,7 +217,7 @@ void Core::enableLimeV2 (bool enable) {
LimeV2 *limeV2Engine;
if (d->imee == nullptr) {
LinphoneConfig *lpconfig = linphone_core_get_config(getCCore());
string filename = lp_config_get_string(lpconfig, "encryption", "x3dh_db_path", "x3dh.c25519.sqlite3");
string filename = lp_config_get_string(lpconfig, "lime", "x3dh_db_path", "x3dh.c25519.sqlite3");
string dbAccess = getDataPath() + filename;
belle_http_provider_t *prov = linphone_core_get_http_provider(getCCore());
......
[misc]
xmlrpc_server_url=http://subscribe.example.org/flexisip-account-manager/xmlrpc.php
[encryption]
[lime]
lime_v2=1
x3dh_server_url=http://x3dh.linphone.org/flexisip-account-manager/x3dh-25519.php
x3dh_db_path=chloe.x3dh.sqlite3
......
[misc]
xmlrpc_server_url=http://subscribe.example.org/flexisip-account-manager/xmlrpc.php
[encryption]
[lime]
lime_v2=1
x3dh_server_url=http://x3dh.linphone.org/flexisip-account-manager/x3dh-25519.php
x3dh_db_path=laure.x3dh.sqlite3
......
......@@ -3,7 +3,7 @@ enable_basic_to_client_group_chat_room_migration=1
basic_to_client_group_chat_room_migration_timer=180
xmlrpc_server_url=http://subscribe.example.org/flexisip-account-manager/xmlrpc.php
[encryption]
[lime]
lime_v2=1
x3dh_server_url=http://x3dh.linphone.org/flexisip-account-manager/x3dh-25519.php
x3dh_db_path=marie.x3dh.sqlite3
......
[misc]
xmlrpc_server_url=http://subscribe.example.org/flexisip-account-manager/xmlrpc.php
[encryption]
[lime]
lime_v2=1
x3dh_server_url=http://x3dh.linphone.org/flexisip-account-manager/x3dh-25519.php
x3dh_db_path=pauline.x3dh.sqlite3
......
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