From: Manuel Nickschas Date: Thu, 23 Oct 2014 21:48:57 +0000 (+0200) Subject: Merge pull request #96 from TheOneRing/qca_qt5 X-Git-Tag: 0.12-beta1~56 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=90803b4288736e6c53d50eeb4fbbe2525be968c3;hp=-c Merge pull request #96 from TheOneRing/qca_qt5 make quassel compile with qca enabled on qt5 --- 90803b4288736e6c53d50eeb4fbbe2525be968c3 diff --combined src/core/cipher.cpp index 7d1fe46a,3f299f40..a8232a3c --- a/src/core/cipher.cpp +++ b/src/core/cipher.cpp @@@ -364,10 -364,6 +364,10 @@@ QByteArray Cipher::blowfishECB(QByteArr } else { + // ECB Blowfish encodes in blocks of 12 chars, so anything else is malformed input + if ((temp.length() % 12) != 0) + return cipherText; + temp = b64ToByte(temp); while ((temp.length() % 8) != 0) temp.append('\0'); } @@@ -380,13 -376,8 +380,13 @@@ if (!cipher.ok()) return cipherText; - if (direction) + if (direction) { + // Sanity check + if ((temp2.length() % 8) != 0) + return cipherText; + temp2 = byteToB64(temp2); + } return temp2; } @@@ -429,13 -420,13 +429,13 @@@ QByteArray Cipher::byteToB64(QByteArra right += v; for (int i = 0; i < 6; i++) { - encoded.append(base64.at(right & 0x3F).toAscii()); + encoded.append(base64.at(right & 0x3F).toLatin1()); right = right >> 6; } - //TODO make sure the .toascii doesn't break anything + //TODO make sure the .toLatin1 doesn't break anything for (int i = 0; i < 6; i++) { - encoded.append(base64.at(left & 0x3F).toAscii()); + encoded.append(base64.at(left & 0x3F).toLatin1()); left = left >> 6; } }