From d921c7e14b3bd35d2b9f022ae88b90d83b97d568 Mon Sep 17 00:00:00 2001 From: Bas Pape Date: Sun, 25 Aug 2013 15:52:40 +0200 Subject: [PATCH 1/1] Properly detect CBC in key negotiation. When FiSH starts a key exchange, it appends CBC to the key to indicate that it wants to use CBC rather than EBC. The cipher code simply rejected this key. --- src/core/cipher.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/cipher.cpp b/src/core/cipher.cpp index 9ea9c130..7cc75d0a 100644 --- a/src/core/cipher.cpp +++ b/src/core/cipher.cpp @@ -170,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(); @@ -198,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) -- 2.20.1