Prevents core from crashing when qca provider plugin is missing.
The plugin is needed at runtime. Can occurres when packagers did
not install it.
*/
#include "cipher.h"
+#include "logger.h"
Cipher::Cipher()
}
return decoded;
}
+
+bool Cipher::neededFeaturesAvailable()
+{
+ QCA::Initializer init;
+
+ if (QCA::isSupported("blowfish-ecb") && QCA::isSupported("blowfish-cbc") && QCA::isSupported("dh"))
+ return true;
+
+ qWarning() << "QCA provider plugin not found. It is usually provided by the qca-ossl plugin.";
+ return false;
+}
QByteArray key() { return m_key; }
bool setType(const QString &type);
QString type() { return m_type; }
+ static bool neededFeaturesAvailable();
private:
//direction is true for encrypt, false for decrypt
}
void CoreIrcChannel::setEncrypted(bool e) {
+ if(!Cipher::neededFeaturesAvailable())
+ return;
+
if(e) {
if(topic().isEmpty())
return;
if(target.isEmpty())
return 0;
+ if(!Cipher::neededFeaturesAvailable())
+ return 0;
+
QByteArray key = cipherKey(target);
if(key.isEmpty())
return 0;
if(!bufferInfo.isValid())
return;
+ if(!Cipher::neededFeaturesAvailable())
+ return;
+
QStringList parms = msg.split(' ', QString::SkipEmptyParts);
if(parms.isEmpty() && !bufferInfo.bufferName().isEmpty())
if(!bufferInfo.isValid())
return;
+ if(!Cipher::neededFeaturesAvailable())
+ return;
+
QStringList parms = msg.split(' ', QString::SkipEmptyParts);
if(parms.count() == 1 && !bufferInfo.bufferName().isEmpty())
if(message_.isEmpty())
return message_;
+ if(!Cipher::neededFeaturesAvailable())
+ return message_;
+
Cipher *cipher = network()->cipher(target);
if(!cipher)
return message_;
if(message.isEmpty())
return message;
+ if(!Cipher::neededFeaturesAvailable())
+ return message;
+
Cipher *cipher = qobject_cast<CoreNetwork *>(network)->cipher(bufferName);
if(!cipher)
return message;