Commit 460994cb authored by Matthieu Tanon's avatar Matthieu Tanon
Browse files

Attempt to determine encryption engine type for limeV2Enabled function

parent 7887859f
......@@ -37,6 +37,13 @@ class ChatMessage;
class EncryptionEngineListener {
public:
enum class EngineType {
Undefined = -1,
LimeV2 = 0,
Another = 1,
YetAnother = 2
};
virtual ~EncryptionEngineListener () = default;
virtual ChatMessageModifier::Result processOutgoingMessage (const std::shared_ptr<ChatMessage> &message, int &errorCode) { return ChatMessageModifier::Result::Skipped; }
......@@ -46,6 +53,10 @@ public:
virtual void generateFileTransferKeyCb (const std::shared_ptr<AbstractChatRoom> &ChatRoom, const std::shared_ptr<ChatMessage> &message) {}
virtual int downloadingFileCb (const std::shared_ptr<ChatMessage> &message, size_t offset, const uint8_t *buffer, size_t size, uint8_t *decryptedBuffer) { return 0; }
virtual int uploadingFileCb (const std::shared_ptr<ChatMessage> &message, size_t offset, const uint8_t *buffer, size_t size, uint8_t *encryptedBuffer) { return 0; }
virtual EncryptionEngineListener::EngineType getEngineType () { return EngineType::Undefined; }
protected:
EncryptionEngineListener::EngineType engineType;
};
LINPHONE_END_NAMESPACE
......
......@@ -126,6 +126,7 @@ BelleSipLimeManager::BelleSipLimeManager (const string &db_access, belle_http_pr
}
LimeV2::LimeV2 (const std::__cxx11::string &db_access, belle_http_provider_t *prov, LinphoneCore *lc) {
engineType = EncryptionEngineListener::EngineType::LimeV2;
x3dhServerUrl = linphone_config_get_string(linphone_core_get_config(lc), "misc", "x3dh_server_url", "");
cout << "LimeV2 constructor x3dhServerUrl = " << x3dhServerUrl << endl;
curve = lime::CurveId::c25519; // c448
......@@ -407,6 +408,9 @@ int LimeV2::uploadingFileCb (const shared_ptr<ChatMessage> &message, size_t offs
return 0;
}
EncryptionEngineListener::EngineType LimeV2::getEngineType () {
return engineType;
}
void LimeV2::onNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) {
// TODO Work in progress
}
......
......@@ -57,6 +57,7 @@ public:
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;
EncryptionEngineListener::EngineType getEngineType () override;
// CoreListener overrides
void onNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) override;
......
......@@ -269,6 +269,7 @@ bool Core::limeV2Enabled (void) const {
L_D();
// check lime_v2 parameter in proxy config
if (d->imee != nullptr)
if (d->imee != nullptr && d->imee->getEngineType() == EncryptionEngineListener::EngineType::LimeV2)
return true;
return false;
}
......
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