From c8b5981d8775c25630797fb9faedec9f1d544f89 Mon Sep 17 00:00:00 2001 From: Elvio Basello Date: Wed, 29 Dec 2010 21:56:14 +0000 Subject: yet more splitting git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5264 17fca916-40b9-46aa-a4ea-0a15b648b75c --- doc/TODO-hu-notation | 3 ++ src/kvilib/CMakeLists.txt | 1 + src/kvilib/ext/KviCryptEngine.cpp | 58 +------------------- src/kvilib/ext/KviCryptEngine.h | 81 +++++++++------------------- src/kvilib/ext/KviCryptEngineDescription.h | 51 ++++++++++++++++++ src/kvilib/ext/KviCryptEngineManager.cpp | 87 ++++++++++++++++++++++++++++++ src/kvilib/ext/KviCryptEngineManager.h | 60 +++++++++++++++++++++ src/kvirc/module/KviModule.h | 2 + src/kvirc/ui/KviCryptController.cpp | 28 +++++----- src/kvirc/ui/KviCryptController.h | 2 + src/modules/lamerizer/libkvilamerizer.cpp | 4 +- src/modules/rijndael/libkvirijndael.cpp | 29 +++++----- src/modules/rijndael/libkvirijndael.h | 1 + src/modules/rot13/libkvirot13.cpp | 2 +- 14 files changed, 265 insertions(+), 144 deletions(-) create mode 100644 src/kvilib/ext/KviCryptEngineDescription.h create mode 100644 src/kvilib/ext/KviCryptEngineManager.cpp create mode 100644 src/kvilib/ext/KviCryptEngineManager.h diff --git a/doc/TODO-hu-notation b/doc/TODO-hu-notation index d93c8e5e0..aec74b31e 100644 --- a/doc/TODO-hu-notation +++ b/doc/TODO-hu-notation @@ -60,6 +60,9 @@ KviConfigurationFile.cpp KviConfigurationFile.h KviCryptEngine.cpp KviCryptEngine.h ++ KviCryptEngineDescription.h ++ KviCryptEngineManager.cpp ++ KviCryptEngineManager.h KviDataBuffer.cpp KviDataBuffer.h KviDbusAdaptor.cpp diff --git a/src/kvilib/CMakeLists.txt b/src/kvilib/CMakeLists.txt index 98271a4ab..fb6d67a8f 100644 --- a/src/kvilib/CMakeLists.txt +++ b/src/kvilib/CMakeLists.txt @@ -64,6 +64,7 @@ SET(kvilib_SRCS ext/KviCommandFormatter.cpp ext/KviConfigurationFile.cpp ext/KviCryptEngine.cpp + ext/KviCryptEngineManager.cpp ext/KviDataBuffer.cpp ext/KviDbusAdaptor.cpp ext/KviDebugContext.cpp diff --git a/src/kvilib/ext/KviCryptEngine.cpp b/src/kvilib/ext/KviCryptEngine.cpp index dc5cccc07..b52b6565c 100644 --- a/src/kvilib/ext/KviCryptEngine.cpp +++ b/src/kvilib/ext/KviCryptEngine.cpp @@ -25,6 +25,7 @@ #include "KviCryptEngine.h" #include "KviLocale.h" +#include "KviCString.h" #if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) #include "KviMemory.h" @@ -185,61 +186,4 @@ return DecryptError; } - - KviCryptEngineManager::KviCryptEngineManager() - { - m_pEngineDict = new KviPointerHashTable; - m_pEngineDict->setAutoDelete(true); - } - - KviCryptEngineManager::~KviCryptEngineManager() - { - delete m_pEngineDict; - } - - void KviCryptEngineManager::registerEngine(KviCryptEngineDescription * pDesc) - { - m_pEngineDict->replace(pDesc->m_szName,pDesc); - } - - void KviCryptEngineManager::unregisterEngine(const QString & szName) - { - m_pEngineDict->remove(szName); - } - - void KviCryptEngineManager::unregisterEngines(void * providerHandle) - { - KviPointerList lEnginesToRemove; - lEnginesToRemove.setAutoDelete(true); - - for(KviPointerHashTableEntry * pDesc = m_pEngineDict->firstEntry();pDesc;pDesc = m_pEngineDict->nextEntry()) - { - if(pDesc->data()->m_providerHandle == providerHandle) - lEnginesToRemove.append(new QString(pDesc->key())); - } - - for(QString * pszEngineName = lEnginesToRemove.first();pszEngineName;pszEngineName = lEnginesToRemove.next()) - m_pEngineDict->remove(*pszEngineName); - } - - KviCryptEngine * KviCryptEngineManager::allocateEngine(const QString & szName) - { - KviCryptEngineDescription * pDesc = m_pEngineDict->find(szName); - if(!pDesc) - return 0; - KviCryptEngine * pEngine = pDesc->m_allocFunc(); - if(!pEngine) - return 0; - pEngine->m_deallocFunc = pDesc->m_deallocFunc; // remember the dealloc func from now on - return pEngine; - } - - void KviCryptEngineManager::deallocateEngine(KviCryptEngine * pEngine) - { - if(!pEngine) - return; - crypt_engine_deallocator_func deallocFunc = pEngine->m_deallocFunc; - deallocFunc(pEngine); - } - #endif //COMPILE_CRYPT_SUPPORT diff --git a/src/kvilib/ext/KviCryptEngine.h b/src/kvilib/ext/KviCryptEngine.h index feef20538..5b01b4de5 100644 --- a/src/kvilib/ext/KviCryptEngine.h +++ b/src/kvilib/ext/KviCryptEngine.h @@ -1,5 +1,5 @@ -#ifndef _KVI_CRYPT_H_ -#define _KVI_CRYPT_H_ +#ifndef _KVI_CRYPT_ENGINE_H_ +#define _KVI_CRYPT_ENGINE_H_ //============================================================================= // @@ -37,13 +37,12 @@ // -#include "KviQString.h" -#include "KviCString.h" #include "KviHeapObject.h" -#include "KviPointerHashTable.h" #include +class KviCString; + #ifdef COMPILE_CRYPT_SUPPORT class KviCryptEngine; @@ -59,6 +58,26 @@ Q_OBJECT friend class KviCryptEngineManager; public: + enum EngineFlag { + CanEncrypt = 1, + CanDecrypt = 2, + WantEncryptKey = 4, + WantDecryptKey = 8 + }; + + enum EncryptResult { + Encrypted, + Encoded, + EncryptError + }; + + enum DecryptResult { + DecryptOkWasEncrypted, + DecryptOkWasEncoded, + DecryptOkWasPlainText, + DecryptError + }; + KviCryptEngine(); virtual ~KviCryptEngine(); @@ -85,7 +104,6 @@ // Theoretically we could allow NULLs in plainText // but this is not the case of KVIrc. // - enum EncryptResult { Encrypted, Encoded, EncryptError }; virtual EncryptResult encrypt(const char * plainText,KviCString &outBuffer); // // Decrypts the utf8 data in inBuffer and puts the decrypted utf8 @@ -94,14 +112,13 @@ // follows the same rules. // Should return false in case of error. // - enum DecryptResult { DecryptOkWasEncrypted, DecryptOkWasEncoded, DecryptOkWasPlainText, DecryptError }; virtual DecryptResult decrypt(const char * inBuffer,KviCString &plainText); // // Returns the string containing the description // of the last error or an empty string if there // was no error after the last init() call. // - const QString &lastError(){ return m_szLastError; }; + const QString & lastError(){ return m_szLastError; }; protected: // // The following two should have clear meaning @@ -111,50 +128,4 @@ #endif //COMPILE_CRYPT_SUPPORT }; -#ifdef COMPILE_CRYPT_SUPPORT - #define KVI_CRYPTENGINE_CAN_ENCRYPT 1 - #define KVI_CRYPTENGINE_CAN_DECRYPT 2 - #define KVI_CRYPTENGINE_WANT_ENCRYPT_KEY 4 - #define KVI_CRYPTENGINE_WANT_DECRYPT_KEY 8 - - class KVILIB_API KviCryptEngineDescription : public KviHeapObject - { - public: - KviCryptEngineDescription(){}; - virtual ~KviCryptEngineDescription(){}; - public: - QString m_szName; // engine name - QString m_szDescription; // details - QString m_szAuthor; // algorithm author - int m_iFlags; // properties - crypt_engine_allocator_func m_allocFunc; // engine allocator - crypt_engine_deallocator_func m_deallocFunc; // deallocation function (if called from outside the origin module) - void * m_providerHandle; // used to identify the provider module - }; - - - class KVILIB_API KviCryptEngineManager - { - public: - KviCryptEngineManager(); - virtual ~KviCryptEngineManager(); - private: - KviPointerHashTable * m_pEngineDict; - public: - const KviPointerHashTable * engineDict(){ return m_pEngineDict; }; - void registerEngine(KviCryptEngineDescription * d); - void unregisterEngine(const QString &szName); - void unregisterEngines(void * providerHandle); - // - // Allocates a crypt engine - // Please note that the engine may be deleted from outside - // so you'd better connect the "destroyed" signal - // - KviCryptEngine * allocateEngine(const QString &szName); - void deallocateEngine(KviCryptEngine * e); - }; - -#endif //COMPILE_CRYPT_SUPPORT - - -#endif //!_KVI_CRYPT_H_ +#endif // _KVI_CRYPT_ENGINE_H_ diff --git a/src/kvilib/ext/KviCryptEngineDescription.h b/src/kvilib/ext/KviCryptEngineDescription.h new file mode 100644 index 000000000..f5a6e7ee6 --- /dev/null +++ b/src/kvilib/ext/KviCryptEngineDescription.h @@ -0,0 +1,51 @@ +#ifndef _KVI_CRYPT_ENGINE_DESC_H_ +#define _KVI_CRYPT_ENGINE_DESC_H_ + +//============================================================================= +// +// File : KviCryptEngineManager.h +// Creation date : Wed Dec 29 2010 22:10:05 CEST by Elvio Basello +// +// This file is part of the KVIrc irc client distribution +// Copyright (C) 2010 Elvio Basello (hellvis69 at gmail dot com) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) any later version. +// +// This program is distributed in the HOPE that it will be USEFUL, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//============================================================================= + +// this file was originally part of KviCryptEngine.h + +#include "kvi_settings.h" +#include "KviHeapObject.h" + +#ifdef COMPILE_CRYPT_SUPPORT + + class KVILIB_API KviCryptEngineDescription : public KviHeapObject + { + public: + KviCryptEngineDescription(){}; + virtual ~KviCryptEngineDescription(){}; + public: + QString m_szName; /**< engine name */ + QString m_szDescription; /**< details */ + QString m_szAuthor; /**< algorithm author */ + int m_iFlags; /**< properties */ + crypt_engine_allocator_func m_allocFunc; /**< engine allocator */ + crypt_engine_deallocator_func m_deallocFunc; /**< deallocation function (if called from outside the origin module) */ + void * m_providerHandle; /**< used to identify the provider module */ + }; + +#endif //COMPILE_CRYPT_SUPPORT +#endif // _KVI_CRYPT_ENGINE_DESC_H_ diff --git a/src/kvilib/ext/KviCryptEngineManager.cpp b/src/kvilib/ext/KviCryptEngineManager.cpp new file mode 100644 index 000000000..6c9640665 --- /dev/null +++ b/src/kvilib/ext/KviCryptEngineManager.cpp @@ -0,0 +1,87 @@ +//============================================================================= +// +// File : KviCryptEngineManager.cpp +// Creation date : Wed Dec 29 2010 22:10:05 CEST by Elvio Basello +// +// This file is part of the KVIrc irc client distribution +// Copyright (C) 2010 Elvio Basello (hellvis69 at gmail dot com) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) any later version. +// +// This program is distributed in the HOPE that it will be USEFUL, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//============================================================================= + +#include "KviCryptEngineManager.h" +#include "KviCryptEngine.h" +#include "KviCryptEngineDescription.h" + +#ifdef COMPILE_CRYPT_SUPPORT + + KviCryptEngineManager::KviCryptEngineManager() + { + m_pEngineDict = new KviPointerHashTable; + m_pEngineDict->setAutoDelete(true); + } + + KviCryptEngineManager::~KviCryptEngineManager() + { + delete m_pEngineDict; + } + + void KviCryptEngineManager::registerEngine(KviCryptEngineDescription * pDesc) + { + m_pEngineDict->replace(pDesc->m_szName,pDesc); + } + + void KviCryptEngineManager::unregisterEngine(const QString & szName) + { + m_pEngineDict->remove(szName); + } + + void KviCryptEngineManager::unregisterEngines(void * providerHandle) + { + KviPointerList lEnginesToRemove; + lEnginesToRemove.setAutoDelete(true); + + for(KviPointerHashTableEntry * pDesc = m_pEngineDict->firstEntry();pDesc;pDesc = m_pEngineDict->nextEntry()) + { + if(pDesc->data()->m_providerHandle == providerHandle) + lEnginesToRemove.append(new QString(pDesc->key())); + } + + for(QString * pszEngineName = lEnginesToRemove.first();pszEngineName;pszEngineName = lEnginesToRemove.next()) + m_pEngineDict->remove(*pszEngineName); + } + + KviCryptEngine * KviCryptEngineManager::allocateEngine(const QString & szName) + { + KviCryptEngineDescription * pDesc = m_pEngineDict->find(szName); + if(!pDesc) + return 0; + KviCryptEngine * pEngine = pDesc->m_allocFunc(); + if(!pEngine) + return 0; + pEngine->m_deallocFunc = pDesc->m_deallocFunc; // remember the dealloc func from now on + return pEngine; + } + + void KviCryptEngineManager::deallocateEngine(KviCryptEngine * pEngine) + { + if(!pEngine) + return; + crypt_engine_deallocator_func deallocFunc = pEngine->m_deallocFunc; + deallocFunc(pEngine); + } + +#endif // COMPILE_CRYPT_SUPPORT diff --git a/src/kvilib/ext/KviCryptEngineManager.h b/src/kvilib/ext/KviCryptEngineManager.h new file mode 100644 index 000000000..2541e6782 --- /dev/null +++ b/src/kvilib/ext/KviCryptEngineManager.h @@ -0,0 +1,60 @@ +#ifndef _KVI_CRYPT_ENGINE_MANAGER_H_ +#define _KVI_CRYPT_ENGINE_MANAGER_H_ + +//============================================================================= +// +// File : KviCryptEngineManager.h +// Creation date : Wed Dec 29 2010 22:10:05 CEST by Elvio Basello +// +// This file is part of the KVIrc irc client distribution +// Copyright (C) 2010 Elvio Basello (hellvis69 at gmail dot com) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) any later version. +// +// This program is distributed in the HOPE that it will be USEFUL, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//============================================================================= + +// this file was originally part of KviCryptEngine.h + +#include "kvi_settings.h" +#include "KviPointerHashTable.h" + +class KviCryptEngine; +class KviCryptEngineDescription; + +#ifdef COMPILE_CRYPT_SUPPORT + + class KVILIB_API KviCryptEngineManager + { + public: + KviCryptEngineManager(); + virtual ~KviCryptEngineManager(); + private: + KviPointerHashTable * m_pEngineDict; + public: + const KviPointerHashTable * engineDict(){ return m_pEngineDict; }; + void registerEngine(KviCryptEngineDescription * pDesc); + void unregisterEngine(const QString & szName); + void unregisterEngines(void * providerHandle); + // + // Allocates a crypt engine + // Please note that the engine may be deleted from outside + // so you'd better connect the "destroyed" signal + // + KviCryptEngine * allocateEngine(const QString & szName); + void deallocateEngine(KviCryptEngine * pEngine); + }; + +#endif // COMPILE_CRYPT_SUPPORT +#endif // _KVI_CRYPT_ENGINE_MANAGER_H_ \ No newline at end of file diff --git a/src/kvirc/module/KviModule.h b/src/kvirc/module/KviModule.h index e84fd0a8f..10407562d 100644 --- a/src/kvirc/module/KviModule.h +++ b/src/kvirc/module/KviModule.h @@ -37,6 +37,8 @@ #ifdef COMPILE_CRYPT_SUPPORT #include "KviCryptEngine.h" + #include "KviCryptEngineDescription.h" + #include "KviCryptEngineManager.h" #endif diff --git a/src/kvirc/ui/KviCryptController.cpp b/src/kvirc/ui/KviCryptController.cpp index 049a7ff8d..2ebbaf751 100644 --- a/src/kvirc/ui/KviCryptController.cpp +++ b/src/kvirc/ui/KviCryptController.cpp @@ -192,19 +192,19 @@ szDesc += "

"; szDesc += __tr2qs("If you don't want to encrypt a particular text line then just start it with the CTRL+P prefix"); m_pDescriptionLabel->setText(szDesc); - m_pEnableEncrypt->setEnabled(pEngine->m_iFlags & KVI_CRYPTENGINE_CAN_ENCRYPT); - m_pEncryptKeyLabel->setEnabled((pEngine->m_iFlags & KVI_CRYPTENGINE_CAN_ENCRYPT) && - (pEngine->m_iFlags & KVI_CRYPTENGINE_WANT_ENCRYPT_KEY)); - m_pEncryptKeyEdit->setEnabled((pEngine->m_iFlags & KVI_CRYPTENGINE_CAN_ENCRYPT) && - (pEngine->m_iFlags & KVI_CRYPTENGINE_WANT_ENCRYPT_KEY)); + m_pEnableEncrypt->setEnabled(pEngine->m_iFlags & KviCryptEngine::CanEncrypt); + m_pEncryptKeyLabel->setEnabled((pEngine->m_iFlags & KviCryptEngine::CanEncrypt) && + (pEngine->m_iFlags & KviCryptEngine::WantEncryptKey)); + m_pEncryptKeyEdit->setEnabled((pEngine->m_iFlags & KviCryptEngine::CanEncrypt) && + (pEngine->m_iFlags & KviCryptEngine::WantEncryptKey)); m_pEnableEncrypt->setChecked(m_pEncryptKeyEdit->isEnabled()); - m_pEnableDecrypt->setEnabled(pEngine->m_iFlags & KVI_CRYPTENGINE_CAN_DECRYPT); + m_pEnableDecrypt->setEnabled(pEngine->m_iFlags & KviCryptEngine::CanDecrypt); m_pEncryptHexKeyCheck->setEnabled(m_pEncryptKeyEdit->isEnabled()); m_pEncryptHexKeyCheck->setChecked(false); - m_pDecryptKeyLabel->setEnabled((pEngine->m_iFlags & KVI_CRYPTENGINE_CAN_DECRYPT) && - (pEngine->m_iFlags & KVI_CRYPTENGINE_WANT_DECRYPT_KEY)); - m_pDecryptKeyEdit->setEnabled((pEngine->m_iFlags & KVI_CRYPTENGINE_CAN_DECRYPT) && - (pEngine->m_iFlags & KVI_CRYPTENGINE_WANT_DECRYPT_KEY)); + m_pDecryptKeyLabel->setEnabled((pEngine->m_iFlags & KviCryptEngine::CanDecrypt) && + (pEngine->m_iFlags & KviCryptEngine::WantDecryptKey)); + m_pDecryptKeyEdit->setEnabled((pEngine->m_iFlags & KviCryptEngine::CanDecrypt) && + (pEngine->m_iFlags & KviCryptEngine::WantDecryptKey)); m_pEnableDecrypt->setChecked(m_pDecryptKeyEdit->isEnabled()); m_pDecryptHexKeyCheck->setEnabled(m_pDecryptKeyEdit->isEnabled()); m_pDecryptHexKeyCheck->setChecked(false); @@ -223,12 +223,12 @@ m_pListBox->setEnabled(bEnabled); m_pAuthorLabel->setEnabled(bEnabled && m_pLastItem); m_pDescriptionLabel->setEnabled(bEnabled && m_pLastItem); - bool bCanDecrypt = m_pLastItem ? m_pLastItem->m_iFlags & KVI_CRYPTENGINE_CAN_DECRYPT : false; - bool bCanEncrypt = m_pLastItem ? m_pLastItem->m_iFlags & KVI_CRYPTENGINE_CAN_ENCRYPT : false; + bool bCanDecrypt = m_pLastItem ? m_pLastItem->m_iFlags & KviCryptEngine::CanDecrypt : false; + bool bCanEncrypt = m_pLastItem ? m_pLastItem->m_iFlags & KviCryptEngine::CanEncrypt : false; m_pEnableEncrypt->setEnabled(bEnabled && bCanEncrypt); m_pEnableDecrypt->setEnabled(bEnabled && bCanDecrypt); - bool bWantDecryptKey = m_pLastItem ? (bCanDecrypt && (m_pLastItem->m_iFlags & KVI_CRYPTENGINE_WANT_DECRYPT_KEY)) : false; - bool bWantEncryptKey = m_pLastItem ? (bCanEncrypt && (m_pLastItem->m_iFlags & KVI_CRYPTENGINE_WANT_ENCRYPT_KEY)) : false; + bool bWantDecryptKey = m_pLastItem ? (bCanDecrypt && (m_pLastItem->m_iFlags & KviCryptEngine::WantDecryptKey)) : false; + bool bWantEncryptKey = m_pLastItem ? (bCanEncrypt && (m_pLastItem->m_iFlags & KviCryptEngine::WantEncryptKey)) : false; m_pEncryptKeyLabel->setEnabled(bEnabled && m_pEnableEncrypt->isChecked() && bWantEncryptKey); m_pDecryptKeyLabel->setEnabled(bEnabled && m_pEnableDecrypt->isChecked() && bWantDecryptKey); m_pEncryptKeyEdit->setEnabled(m_pEncryptKeyLabel->isEnabled()); diff --git a/src/kvirc/ui/KviCryptController.h b/src/kvirc/ui/KviCryptController.h index 2c7291996..66b549a0d 100644 --- a/src/kvirc/ui/KviCryptController.h +++ b/src/kvirc/ui/KviCryptController.h @@ -28,6 +28,8 @@ #if defined(COMPILE_CRYPT_SUPPORT) #include "KviCryptEngine.h" + #include "KviCryptEngineDescription.h" + #include "KviCryptEngineManager.h" #include "KviHeapObject.h" #include "KviWindowToolWidget.h" #include "KviTalListWidget.h" diff --git a/src/modules/lamerizer/libkvilamerizer.cpp b/src/modules/lamerizer/libkvilamerizer.cpp index 52298fae8..0041deb35 100644 --- a/src/modules/lamerizer/libkvilamerizer.cpp +++ b/src/modules/lamerizer/libkvilamerizer.cpp @@ -217,7 +217,7 @@ static bool lamerizer_module_init(KviModule * m) d->m_szName = "Lamerizer"; d->m_szAuthor = "Szymon Stefanek and Jan Wagner"; d->m_szDescription = __tr2qs("A really lame text transformation engine :D"); - d->m_iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT; + d->m_iFlags = KviCryptEngine::CanEncrypt; d->m_allocFunc = allocLamerizerEngine; d->m_deallocFunc = deallocLamerizerEngine; m->registerCryptEngine(d); @@ -227,7 +227,7 @@ static bool lamerizer_module_init(KviModule * m) d->m_szName = "LamerizerLight"; d->m_szAuthor = "Szymon Stefanek and Jan Wagner"; d->m_szDescription = __tr2qs("A really lame text transformation engine: Light Version."); - d->m_iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT; + d->m_iFlags = KviCryptEngine::CanEncrypt; d->m_allocFunc = allocLightLamerizerEngine; d->m_deallocFunc = deallocLamerizerEngine; m->registerCryptEngine(d); diff --git a/src/modules/rijndael/libkvirijndael.cpp b/src/modules/rijndael/libkvirijndael.cpp index a60f15587..3ec5e46a7 100644 --- a/src/modules/rijndael/libkvirijndael.cpp +++ b/src/modules/rijndael/libkvirijndael.cpp @@ -62,7 +62,6 @@ #if defined(COMPILE_CRYPT_SUPPORT) || defined(Q_MOC_RUN) - #include "KviMemory.h" #include "KviMemory.h" #include "KviPointerList.h" @@ -722,8 +721,8 @@ static bool rijndael_module_init(KviModule * m) d->m_szName = "Rijndael128Hex"; d->m_szAuthor = "Szymon Stefanek"; d->m_szDescription = QString(szFormat).arg(__tr2qs("hexadecimal")).arg(128); - d->m_iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT | KVI_CRYPTENGINE_CAN_DECRYPT | - KVI_CRYPTENGINE_WANT_ENCRYPT_KEY | KVI_CRYPTENGINE_WANT_DECRYPT_KEY; + d->m_iFlags = KviCryptEngine::CanEncrypt | KviCryptEngine::CanDecrypt | + KviCryptEngine::WantEncryptKey | KviCryptEngine::WantDecryptKey; d->m_allocFunc = allocRijndael128HexEngine; d->m_deallocFunc = deallocRijndaelCryptEngine; m->registerCryptEngine(d); @@ -732,8 +731,8 @@ static bool rijndael_module_init(KviModule * m) d->m_szName = "Rijndael192Hex"; d->m_szAuthor = "Szymon Stefanek"; d->m_szDescription = QString(szFormat).arg(__tr2qs("hexadecimal")).arg(192); - d->m_iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT | KVI_CRYPTENGINE_CAN_DECRYPT | - KVI_CRYPTENGINE_WANT_ENCRYPT_KEY | KVI_CRYPTENGINE_WANT_DECRYPT_KEY; + d->m_iFlags = KviCryptEngine::CanEncrypt | KviCryptEngine::CanDecrypt | + KviCryptEngine::WantEncryptKey | KviCryptEngine::WantDecryptKey; d->m_allocFunc = allocRijndael192HexEngine; d->m_deallocFunc = deallocRijndaelCryptEngine; m->registerCryptEngine(d); @@ -742,8 +741,8 @@ static bool rijndael_module_init(KviModule * m) d->m_szName = "Rijndael256Hex"; d->m_szAuthor = "Szymon Stefanek"; d->m_szDescription = QString(szFormat).arg(__tr2qs("hexadecimal")).arg(256); - d->m_iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT | KVI_CRYPTENGINE_CAN_DECRYPT | - KVI_CRYPTENGINE_WANT_ENCRYPT_KEY | KVI_CRYPTENGINE_WANT_DECRYPT_KEY; + d->m_iFlags = KviCryptEngine::CanEncrypt | KviCryptEngine::CanDecrypt | + KviCryptEngine::WantEncryptKey | KviCryptEngine::WantDecryptKey; d->m_allocFunc = allocRijndael256HexEngine; d->m_deallocFunc = deallocRijndaelCryptEngine; m->registerCryptEngine(d); @@ -752,8 +751,8 @@ static bool rijndael_module_init(KviModule * m) d->m_szName = "Rijndael128Base64"; d->m_szAuthor = "Szymon Stefanek"; d->m_szDescription = QString(szFormat).arg(__tr2qs("base64")).arg(128); - d->m_iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT | KVI_CRYPTENGINE_CAN_DECRYPT | - KVI_CRYPTENGINE_WANT_ENCRYPT_KEY | KVI_CRYPTENGINE_WANT_DECRYPT_KEY; + d->m_iFlags = KviCryptEngine::CanEncrypt | KviCryptEngine::CanDecrypt | + KviCryptEngine::WantEncryptKey | KviCryptEngine::WantDecryptKey; d->m_allocFunc = allocRijndael128Base64Engine; d->m_deallocFunc = deallocRijndaelCryptEngine; m->registerCryptEngine(d); @@ -762,8 +761,8 @@ static bool rijndael_module_init(KviModule * m) d->m_szName = "Rijndael192Base64"; d->m_szAuthor = "Szymon Stefanek"; d->m_szDescription = QString(szFormat).arg(__tr2qs("base64")).arg(192); - d->m_iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT | KVI_CRYPTENGINE_CAN_DECRYPT | - KVI_CRYPTENGINE_WANT_ENCRYPT_KEY | KVI_CRYPTENGINE_WANT_DECRYPT_KEY; + d->m_iFlags = KviCryptEngine::CanEncrypt | KviCryptEngine::CanDecrypt | + KviCryptEngine::WantEncryptKey | KviCryptEngine::WantDecryptKey; d->m_allocFunc = allocRijndael192Base64Engine; d->m_deallocFunc = deallocRijndaelCryptEngine; m->registerCryptEngine(d); @@ -772,8 +771,8 @@ static bool rijndael_module_init(KviModule * m) d->m_szName = "Rijndael256Base64"; d->m_szAuthor = "Szymon Stefanek"; d->m_szDescription = QString(szFormat).arg(__tr2qs("base64")).arg(256); - d->m_iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT | KVI_CRYPTENGINE_CAN_DECRYPT | - KVI_CRYPTENGINE_WANT_ENCRYPT_KEY | KVI_CRYPTENGINE_WANT_DECRYPT_KEY; + d->m_iFlags = KviCryptEngine::CanEncrypt | KviCryptEngine::CanDecrypt | + KviCryptEngine::WantEncryptKey | KviCryptEngine::WantDecryptKey; d->m_allocFunc = allocRijndael256Base64Engine; d->m_deallocFunc = deallocRijndaelCryptEngine; m->registerCryptEngine(d); @@ -794,8 +793,8 @@ static bool rijndael_module_init(KviModule * m) "This engine works in ECB mode by default:\n" \ "if you want to use CBC mode you must prefix\n" \ "your key(s) with \"cbc:\".\n"); - d->m_iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT | KVI_CRYPTENGINE_CAN_DECRYPT | - KVI_CRYPTENGINE_WANT_ENCRYPT_KEY | KVI_CRYPTENGINE_WANT_DECRYPT_KEY; + d->m_iFlags = KviCryptEngine::CanEncrypt | KviCryptEngine::CanDecrypt | + KviCryptEngine::WantEncryptKey | KviCryptEngine::WantDecryptKey; d->m_allocFunc = allocMircryptionEngine; d->m_deallocFunc = deallocRijndaelCryptEngine; m->registerCryptEngine(d); diff --git a/src/modules/rijndael/libkvirijndael.h b/src/modules/rijndael/libkvirijndael.h index 65fd50ea9..5845923af 100644 --- a/src/modules/rijndael/libkvirijndael.h +++ b/src/modules/rijndael/libkvirijndael.h @@ -26,6 +26,7 @@ //============================================================================= #include "kvi_settings.h" +#include "KviCString.h" #ifdef COMPILE_CRYPT_SUPPORT diff --git a/src/modules/rot13/libkvirot13.cpp b/src/modules/rot13/libkvirot13.cpp index c8ed5dfbf..622c23616 100644 --- a/src/modules/rot13/libkvirot13.cpp +++ b/src/modules/rot13/libkvirot13.cpp @@ -122,7 +122,7 @@ static bool rot13_module_init(KviModule * m) d->m_szName = "ROT13"; d->m_szAuthor = "Aeriana"; d->m_szDescription = __tr2qs("The simple Caesar-cypher encryption that replaces each letter with the one 13 places forward or back along the alphabet; it is used to enclose the text in a sealed wrapper that the reader must choose to open - e.g. for posting things that might offend some readers, or spoilers."); - d->m_iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT; + d->m_iFlags = KviCryptEngine::CanEncrypt; d->m_allocFunc = allocRot13Engine; d->m_deallocFunc = deallocRot13Engine; m->registerCryptEngine(d); -- cgit v1.3.1-10-gc9f91