diff options
| author | 2011-02-11 13:22:22 +0000 | |
|---|---|---|
| committer | 2011-02-11 13:22:22 +0000 | |
| commit | d07b987622bfc9fd13398ab412cd847541193c09 (patch) | |
| tree | db5290a5141e36439d520efad560ff07fe940014 | |
| parent | added turkish translation (diff) | |
| download | KVIrc-d07b987622bfc9fd13398ab412cd847541193c09.tar.gz KVIrc-d07b987622bfc9fd13398ab412cd847541193c09.tar.bz2 KVIrc-d07b987622bfc9fd13398ab412cd847541193c09.zip | |
Don't make Crypto++ and OpenSSL support mutally exclusive.
This allows using SSL encrypted connections and still use Crypto++ for
the remaining cryptographic functions.
Signed-off-by: Kai Wasserbäch <curan@debian.org>
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5466 17fca916-40b9-46aa-a4ea-0a15b648b75c
| -rw-r--r-- | CMakeLists.txt | 25 | ||||
| -rw-r--r-- | doc/INSTALL | 5 | ||||
| -rw-r--r-- | src/modules/file/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/modules/file/libkvifile.cpp | 4 | ||||
| -rw-r--r-- | src/modules/fish/libkvifish.cpp | 8 | ||||
| -rw-r--r-- | src/modules/str/CMakeLists.txt | 14 | ||||
| -rw-r--r-- | src/modules/str/libkvistr.cpp | 12 |
7 files changed, 19 insertions, 53 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e0b0c5a64..f3a30e19c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -571,8 +571,6 @@ OPTION(WANT_CRYPTOPP "Whether to use Crypto++ library" OFF) OPTION(WANT_OPENSSL "Whether to use OpenSSL library" ON) IF(WANT_CRYPTOPP) - SET(WANT_OPENSSL OFF) - FIND_PACKAGE(PkgConfig) # for every os/distribution @@ -604,8 +602,6 @@ ENDIF() ############################################################################ IF(WANT_OPENSSL) - SET(WANT_CRYPTOPP OFF) - FIND_PACKAGE(OpenSSL) IF(OPENSSL_FOUND) IF(WIN32) @@ -905,27 +901,6 @@ ELSE() ENDIF() ############################################################################ -# »No embedded code« (but slightly more dependecies) -# This might need some explanation, so here we go: -# I (Kai Wasserbäch) noticed as one of the Debian Maintainers of KVIrc, -# that KVIrc uses quite some embedded code and/or own implementations of -# code, that is available from widely tested libraries. This is not -# recommeded to do, as this most probably leads to security issues -# (keeping different versions of code across several projects in sync is -# prone to fail). Therefore I start hereby replacing such code copies -# with library calls. -# But a few people on #kvirc complained that new dependencies would be -# unfeasable. That leads to the following paragraph: we only use the -# saner way to build KVIrc if -DWITH_NO_EMBEDDED_CODE=YES is passed to -# CMake. -############################################################################ -OPTION(WANT_NO_EMBEDDED_CODE "Don't use embedded copies of code available from libraries" OFF) -IF(WANT_NO_EMBEDDED_CODE) - MESSAGE(STATUS "WANT_NO_EMBEDDED_CODE activated.") - MESSAGE(STATUS "You may want to use -DWANT_CRYPTOPP instead.") -ENDIF() - -############################################################################ # Win32 mingw/cmake build checks ############################################################################ IF(WIN32) diff --git a/doc/INSTALL b/doc/INSTALL index 5b3f2854f..009fd9042 100644 --- a/doc/INSTALL +++ b/doc/INSTALL @@ -489,11 +489,6 @@ General notes for the installation of the 4.0 release of KVIrc -DWANT_BEER (default: OFF) Add some beers to chat. :) - -DWANT_NO_EMBEDDED_CODE (default: OFF) - Use functions from widely tested libraries instead of embedded code or - reimplementations of code/functions available from such libraries. - For required dependencies see section two of this document. - ############################################################################### # 4. Interactive mode ############################################################################### diff --git a/src/modules/file/CMakeLists.txt b/src/modules/file/CMakeLists.txt index e1cfc32d0..40aa796f9 100644 --- a/src/modules/file/CMakeLists.txt +++ b/src/modules/file/CMakeLists.txt @@ -1,9 +1,5 @@ # CMakeLists for src/modules/file -IF(WANT_NO_EMBEDDED_CODE) - ADD_DEFINITIONS("-DCOMPILE_NO_EMBEDDED_CODE -fexceptions") -ENDIF(WANT_NO_EMBEDDED_CODE) - SET(kvifile_SRCS libkvifile.cpp ) diff --git a/src/modules/file/libkvifile.cpp b/src/modules/file/libkvifile.cpp index c30236114..1a3816bbb 100644 --- a/src/modules/file/libkvifile.cpp +++ b/src/modules/file/libkvifile.cpp @@ -37,7 +37,7 @@ #include <QTextCodec> #include <QByteArray> -#if defined(COMPILE_SSL_SUPPORT) +#if defined(COMPILE_SSL_SUPPORT) && !defined(COMPILE_CRYPTOPP_SUPPORT) // The current implementation #include <openssl/evp.h> #elif defined(COMPILE_CRYPTOPP_SUPPORT) @@ -1420,7 +1420,7 @@ static bool file_kvs_fnc_digest(KviKvsModuleFunctionCall * c) return true; } -#if defined(COMPILE_SSL_SUPPORT) +#if defined(COMPILE_SSL_SUPPORT) && !defined(COMPILE_CRYPTOPP_SUPPORT) if(szAlgo.isEmpty()) szAlgo = "md5"; EVP_MD_CTX mdctx; diff --git a/src/modules/fish/libkvifish.cpp b/src/modules/fish/libkvifish.cpp index 0f2d9c81a..2b80d2eff 100644 --- a/src/modules/fish/libkvifish.cpp +++ b/src/modules/fish/libkvifish.cpp @@ -53,7 +53,7 @@ // KviApplication.cpp extern KVIRC_API KviCryptEngineManager * g_pCryptEngineManager; - #ifdef COMPILE_SSL_SUPPORT + #if defined(COMPILE_SSL_SUPPORT) && !defined(COMPILE_CRYPTOPP_SUPPORT) #include <KviSSL.h> #include <openssl/blowfish.h> @@ -90,7 +90,7 @@ static bool fish_DH1080_gen(unsigned char ** szPubKey, int * iLen) { - #ifdef COMPILE_SSL_SUPPORT + #if defined(COMPILE_SSL_SUPPORT) && !defined(COMPILE_CRYPTOPP_SUPPORT) if(!g_fish_dh) { BIGNUM * dhp = BN_new(); @@ -236,7 +236,7 @@ KviCString szFinalKey; - #ifdef COMPILE_SSL_SUPPORT + #if defined(COMPILE_SSL_SUPPORT) && !defined(COMPILE_CRYPTOPP_SUPPORT) unsigned char * secret=(unsigned char *) KviMemory::allocate(DH_size(g_fish_dh)); int secretLen; BIGNUM *bn = BN_bin2bn((unsigned char *) szHisPubKey.data(), szHisPubKey.size(),NULL); @@ -341,7 +341,7 @@ static bool fish_module_init(KviModule * m) { #ifdef COMPILE_CRYPT_SUPPORT - #ifdef COMPILE_SSL_SUPPORT + #if defined( COMPILE_SSL_SUPPORT) && !defined(COMPILE_CRYPTOPP_SUPPORT) KviSSL::globalSSLInit(); #endif m->kvsRegisterAppEventHandler(KviEvent_OnQueryNotice,fish_event_onQueryNotice); diff --git a/src/modules/str/CMakeLists.txt b/src/modules/str/CMakeLists.txt index 55fce625a..c0c5bbf1f 100644 --- a/src/modules/str/CMakeLists.txt +++ b/src/modules/str/CMakeLists.txt @@ -1,14 +1,10 @@ # CMakeLists for src/modules/str -IF(WANT_NO_EMBEDDED_CODE) - ADD_DEFINITIONS("-DCOMPILE_NO_EMBEDDED_CODE -fexceptions") -ELSEIF(WANT_NO_EMBEDDED_CODE) - IF(UNIX) - IF(APPLE) - LIST(APPEND LIBS -lssl -lcrypto) - ENDIF() - ENDIF() -ENDIF(WANT_NO_EMBEDDED_CODE) +IF(UNIX) + IF(APPLE) + LIST(APPEND LIBS -lssl -lcrypto) + ENDIF() +ENDIF() SET(kvistr_SRCS libkvistr.cpp diff --git a/src/modules/str/libkvistr.cpp b/src/modules/str/libkvistr.cpp index 668fc8996..18556ac5c 100644 --- a/src/modules/str/libkvistr.cpp +++ b/src/modules/str/libkvistr.cpp @@ -38,12 +38,14 @@ #include <QRegExp> #include <QClipboard> -#if defined( COMPILE_SSL_SUPPORT ) +#ifdef COMPILE_SSL_SUPPORT // The current implementation #include <KviSSL.h> #include <openssl/evp.h> #include <openssl/pem.h> -#elif defined(COMPILE_CRYPTOPP_SUPPORT) +#endif + +#ifdef COMPILE_CRYPTOPP_SUPPORT // The preferred new implementation (until QCryptographicHash supports all // hashes we want). // As Crypto++ is concerned for security they warn about MD5 and friends, @@ -76,7 +78,9 @@ ); return szDigest; } -#else +#endif + +#if !defined(COMPILE_SSL_SUPPORT) && !defined(COMPILE_CRYPTOPP_SUPPORT) // The fallback we can always use, but with very limited set of // functionality. #include <QCryptographicHash> @@ -1371,7 +1375,7 @@ static bool str_kvs_fnc_digest(KviKvsModuleFunctionCall * c) KVSM_PARAMETER("algorithm",KVS_PT_NONEMPTYSTRING,KVS_PF_OPTIONAL,szType) KVSM_PARAMETERS_END(c) -#if defined(COMPILE_SSL_SUPPORT) +#if defined(COMPILE_SSL_SUPPORT) && !defined(COMPILE_CRYPTOPP_SUPPORT) if(szType.isEmpty()) szType = "md5"; EVP_MD_CTX mdctx; |
