X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcipher.cpp;h=7cc75d0a5774cab7e972e0ceaa970ecd0edfe77b;hp=5ca3129385dfdd994ee8480715b4ff35954ba0e9;hb=d921c7e14b3bd35d2b9f022ae88b90d83b97d568;hpb=694f9bfbf7f1af19108461c7e00d133e55082bce diff --git a/src/core/cipher.cpp b/src/core/cipher.cpp index 5ca31293..7cc75d0a 100644 --- a/src/core/cipher.cpp +++ b/src/core/cipher.cpp @@ -35,8 +35,10 @@ Cipher::~Cipher() bool Cipher::setKey(QByteArray key) { - if (key.isEmpty()) + if (key.isEmpty()) { + m_key.clear(); return false; + } if (key.mid(0, 4).toLower() == "ecb:") { @@ -168,6 +170,13 @@ QByteArray Cipher::initKeyExchange() QByteArray Cipher::parseInitKeyX(QByteArray key) { QCA::Initializer init; + bool isCBC = false; + + if (key.endsWith(" CBC")) + { + isCBC = true; + key.chop(4); + } if (key.length() != 181) return QByteArray(); @@ -196,6 +205,9 @@ QByteArray Cipher::parseInitKeyX(QByteArray key) //remove trailing = because mircryption and fish think it's a swell idea. while (sharedKey.endsWith('=')) sharedKey.chop(1); + if (isCBC) + sharedKey.prepend("cbc:"); + bool success = setKey(sharedKey); if (!success) @@ -471,6 +483,5 @@ bool Cipher::neededFeaturesAvailable() 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; }