aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorGravatar Elvio Basello2010-08-14 02:46:11 +0000
committerGravatar Elvio Basello2010-08-14 02:46:11 +0000
commit6c5cef203bfeef3c26043e13ddd23c01da589fe1 (patch)
treeab80fc8e47e86d2957cc30ade3742953ed4f26b8 /src/modules
parentfinally fixed translation extraction (diff)
downloadKVIrc-6c5cef203bfeef3c26043e13ddd23c01da589fe1.tar.gz
KVIrc-6c5cef203bfeef3c26043e13ddd23c01da589fe1.tar.bz2
KVIrc-6c5cef203bfeef3c26043e13ddd23c01da589fe1.zip
improved hungarian notation;
cleaned code; git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@4869 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/dcc/chat.cpp14
-rw-r--r--src/modules/lamerizer/libkvilamerizer.cpp24
-rw-r--r--src/modules/rijndael/libkvirijndael.cpp84
-rw-r--r--src/modules/rijndael/libkvirijndael_cryptopp.cpp144
-rw-r--r--src/modules/rijndael/libkvirijndael_cryptopp.h12
-rw-r--r--src/modules/rot13/libkvirot13.cpp15
-rw-r--r--src/modules/window/libkviwindow.cpp8
7 files changed, 151 insertions, 150 deletions
diff --git a/src/modules/dcc/chat.cpp b/src/modules/dcc/chat.cpp
index e08f6bfa4..c1fdc03de 100644
--- a/src/modules/dcc/chat.cpp
+++ b/src/modules/dcc/chat.cpp
@@ -305,13 +305,13 @@ void KviDccChat::ownMessage(const QString &text, bool bUserFeedback)
#ifdef COMPILE_CRYPT_SUPPORT
if(cryptSessionInfo())
{
- if(cryptSessionInfo()->bDoEncrypt)
+ if(cryptSessionInfo()->m_bDoEncrypt)
{
if(*d != KVI_TEXT_CRYPTESCAPE)
{
KviStr encrypted;
- cryptSessionInfo()->pEngine->setMaxEncryptLen(-1);
- switch(cryptSessionInfo()->pEngine->encrypt(d,encrypted))
+ cryptSessionInfo()->m_pEngine->setMaxEncryptLen(-1);
+ switch(cryptSessionInfo()->m_pEngine->encrypt(d,encrypted))
{
case KviCryptEngine::Encrypted:
{
@@ -338,7 +338,7 @@ void KviDccChat::ownMessage(const QString &text, bool bUserFeedback)
break;
default: // also case KviCryptEngine::EncryptError
{
- QString szErr = cryptSessionInfo()->pEngine->lastError();
+ QString szErr = cryptSessionInfo()->m_pEngine->lastError();
output(KVI_OUT_SYSTEMERROR,
__tr2qs_ctx("The crypto engine was not able to encrypt the current message (%Q): %Q, no data was sent to the remote end","dcc"),
&text,&szErr);
@@ -450,10 +450,10 @@ bool KviDccChat::event(QEvent *e)
#ifdef COMPILE_CRYPT_SUPPORT
if(KviCryptSessionInfo * cinf = cryptSessionInfo())
{
- if(cinf->bDoDecrypt)
+ if(cinf->m_bDoDecrypt)
{
KviStr decryptedStuff;
- switch(cinf->pEngine->decrypt(d.ptr(),decryptedStuff))
+ switch(cinf->m_pEngine->decrypt(d.ptr(),decryptedStuff))
{
case KviCryptEngine::DecryptOkWasEncrypted:
case KviCryptEngine::DecryptOkWasEncoded:
@@ -470,7 +470,7 @@ bool KviDccChat::event(QEvent *e)
default: // also case KviCryptEngine::DecryptError
{
- QString szErr = cinf->pEngine->lastError();
+ QString szErr = cinf->m_pEngine->lastError();
output(KVI_OUT_SYSTEMERROR,
__tr2qs_ctx("The following message appears to be encrypted, but the crypto engine failed to decode it: %Q","dcc"),
&szErr);
diff --git a/src/modules/lamerizer/libkvilamerizer.cpp b/src/modules/lamerizer/libkvilamerizer.cpp
index c5cdd609b..4ebd0aa5b 100644
--- a/src/modules/lamerizer/libkvilamerizer.cpp
+++ b/src/modules/lamerizer/libkvilamerizer.cpp
@@ -214,22 +214,22 @@ static bool lamerizer_module_init(KviModule * m)
// FIXME: Maybe convert this repeated code to a function eh ?
KviCryptEngineDescription * d = new KviCryptEngineDescription;
- d->szName = "Lamerizer";
- d->szAuthor = "Szymon Stefanek and Jan Wagner";
- d->szDescription = __tr2qs("A really lame text transformation engine :D");
- d->iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT;
- d->allocFunc = allocLamerizerEngine;
- d->deallocFunc = deallocLamerizerEngine;
+ 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_allocFunc = allocLamerizerEngine;
+ d->m_deallocFunc = deallocLamerizerEngine;
m->registerCryptEngine(d);
d = new KviCryptEngineDescription;
- d->szName = "LamerizerLight";
- d->szAuthor = "Szymon Stefanek and Jan Wagner";
- d->szDescription = __tr2qs("A really lame text transformation engine: Light Version.");
- d->iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT;
- d->allocFunc = allocLightLamerizerEngine;
- d->deallocFunc = deallocLamerizerEngine;
+ 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_allocFunc = allocLightLamerizerEngine;
+ d->m_deallocFunc = deallocLamerizerEngine;
m->registerCryptEngine(d);
return true;
diff --git a/src/modules/rijndael/libkvirijndael.cpp b/src/modules/rijndael/libkvirijndael.cpp
index f399df8ef..d5ebd0997 100644
--- a/src/modules/rijndael/libkvirijndael.cpp
+++ b/src/modules/rijndael/libkvirijndael.cpp
@@ -718,70 +718,70 @@ static bool rijndael_module_init(KviModule * m)
// FIXME: Maybe convert this repeated code to a function eh ?
KviCryptEngineDescription * d = new KviCryptEngineDescription;
- d->szName = "Rijndael128Hex";
- d->szAuthor = "Szymon Stefanek";
- d->szDescription = QString(szFormat).arg(__tr2qs("hexadecimal")).arg(128);
- d->iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT | KVI_CRYPTENGINE_CAN_DECRYPT |
+ 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->allocFunc = allocRijndael128HexEngine;
- d->deallocFunc = deallocRijndaelCryptEngine;
+ d->m_allocFunc = allocRijndael128HexEngine;
+ d->m_deallocFunc = deallocRijndaelCryptEngine;
m->registerCryptEngine(d);
d = new KviCryptEngineDescription;
- d->szName = "Rijndael192Hex";
- d->szAuthor = "Szymon Stefanek";
- d->szDescription = QString(szFormat).arg(__tr2qs("hexadecimal")).arg(192);
- d->iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT | KVI_CRYPTENGINE_CAN_DECRYPT |
+ 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->allocFunc = allocRijndael192HexEngine;
- d->deallocFunc = deallocRijndaelCryptEngine;
+ d->m_allocFunc = allocRijndael192HexEngine;
+ d->m_deallocFunc = deallocRijndaelCryptEngine;
m->registerCryptEngine(d);
d = new KviCryptEngineDescription;
- d->szName = "Rijndael256Hex";
- d->szAuthor = "Szymon Stefanek";
- d->szDescription = QString(szFormat).arg(__tr2qs("hexadecimal")).arg(256);
- d->iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT | KVI_CRYPTENGINE_CAN_DECRYPT |
+ 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->allocFunc = allocRijndael256HexEngine;
- d->deallocFunc = deallocRijndaelCryptEngine;
+ d->m_allocFunc = allocRijndael256HexEngine;
+ d->m_deallocFunc = deallocRijndaelCryptEngine;
m->registerCryptEngine(d);
d = new KviCryptEngineDescription;
- d->szName = "Rijndael128Base64";
- d->szAuthor = "Szymon Stefanek";
- d->szDescription = QString(szFormat).arg(__tr2qs("base64")).arg(128);
- d->iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT | KVI_CRYPTENGINE_CAN_DECRYPT |
+ 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->allocFunc = allocRijndael128Base64Engine;
- d->deallocFunc = deallocRijndaelCryptEngine;
+ d->m_allocFunc = allocRijndael128Base64Engine;
+ d->m_deallocFunc = deallocRijndaelCryptEngine;
m->registerCryptEngine(d);
d = new KviCryptEngineDescription;
- d->szName = "Rijndael192Base64";
- d->szAuthor = "Szymon Stefanek";
- d->szDescription = QString(szFormat).arg(__tr2qs("base64")).arg(192);
- d->iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT | KVI_CRYPTENGINE_CAN_DECRYPT |
+ 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->allocFunc = allocRijndael192Base64Engine;
- d->deallocFunc = deallocRijndaelCryptEngine;
+ d->m_allocFunc = allocRijndael192Base64Engine;
+ d->m_deallocFunc = deallocRijndaelCryptEngine;
m->registerCryptEngine(d);
d = new KviCryptEngineDescription;
- d->szName = "Rijndael256Base64";
- d->szAuthor = "Szymon Stefanek";
- d->szDescription = QString(szFormat).arg(__tr2qs("base64")).arg(256);
- d->iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT | KVI_CRYPTENGINE_CAN_DECRYPT |
+ 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->allocFunc = allocRijndael256Base64Engine;
- d->deallocFunc = deallocRijndaelCryptEngine;
+ d->m_allocFunc = allocRijndael256Base64Engine;
+ d->m_deallocFunc = deallocRijndaelCryptEngine;
m->registerCryptEngine(d);
d = new KviCryptEngineDescription;
- d->szName = "Mircryption";
- d->szAuthor = "Szymon Stefanek";
- d->szDescription = __tr2qs("Popular cryptographic engine based on the\n" \
+ d->m_szName = "Mircryption";
+ d->m_szAuthor = "Szymon Stefanek";
+ d->m_szDescription = __tr2qs("Popular cryptographic engine based on the\n" \
"old Blowfish encryption algorithm.\n" \
"The text is first encrypted with Blowfish \n" \
"and then converted to base64 notation.\n" \
@@ -793,10 +793,10 @@ 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->iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT | KVI_CRYPTENGINE_CAN_DECRYPT |
+ d->m_iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT | KVI_CRYPTENGINE_CAN_DECRYPT |
KVI_CRYPTENGINE_WANT_ENCRYPT_KEY | KVI_CRYPTENGINE_WANT_DECRYPT_KEY;
- d->allocFunc = allocMircryptionEngine;
- d->deallocFunc = deallocRijndaelCryptEngine;
+ d->m_allocFunc = allocMircryptionEngine;
+ d->m_deallocFunc = deallocRijndaelCryptEngine;
m->registerCryptEngine(d);
diff --git a/src/modules/rijndael/libkvirijndael_cryptopp.cpp b/src/modules/rijndael/libkvirijndael_cryptopp.cpp
index 4502da23a..96375cc71 100644
--- a/src/modules/rijndael/libkvirijndael_cryptopp.cpp
+++ b/src/modules/rijndael/libkvirijndael_cryptopp.cpp
@@ -86,21 +86,21 @@ KviRijndaelEngine::~KviRijndaelEngine()
m_szDecKey.clear();
}
-bool KviRijndaelEngine::init(const char *encKey, int encKeyLen, const char *decKey, int decKeyLen)
+bool KviRijndaelEngine::init(const char * pcEncKey, int iEncKeyLen, const char * pcDecKey, int iDecKeyLen)
{
- if(encKey && (encKeyLen > 0))
+ if(pcEncKey && (iEncKeyLen > 0))
{
- if(!(decKey && (decKeyLen > 0)))
+ if(!(pcDecKey && (iDecKeyLen > 0)))
{
- decKey = encKey;
- decKeyLen = encKeyLen;
+ pcDecKey = pcEncKey;
+ iDecKeyLen = iEncKeyLen;
} // else all
} else {
// no encrypt key specified...
- if(decKey && decKeyLen)
+ if(pcDecKey && iDecKeyLen)
{
- encKey = decKey;
- encKeyLen = decKeyLen;
+ pcEncKey = pcDecKey;
+ iEncKeyLen = iDecKeyLen;
} else {
// both keys missing
setLastError(__tr2qs("Missing encryption and decryption key: at least one is needed"));
@@ -108,19 +108,19 @@ bool KviRijndaelEngine::init(const char *encKey, int encKeyLen, const char *decK
}
}
- m_szEncKey = encKey;
- m_szDecKey = decKey;
+ m_szEncKey = pcEncKey;
+ m_szDecKey = pcDecKey;
- if(encKeyLen > getKeyLen())
+ if(iEncKeyLen > getKeyLen())
m_szEncKey = m_szEncKey.substr(0,getKeyLen());
- if(encKeyLen < getKeyLen())
+ if(iEncKeyLen < getKeyLen())
m_szEncKey.resize(getKeyLen());
- if(decKeyLen > getKeyLen())
+ if(iDecKeyLen > getKeyLen())
m_szDecKey = m_szDecKey.substr(0,getKeyLen());
- if(decKeyLen < getKeyLen())
+ if(iDecKeyLen < getKeyLen())
m_szDecKey.resize(getKeyLen());
if(m_szEncKey.empty() || m_szDecKey.empty())
@@ -129,19 +129,19 @@ bool KviRijndaelEngine::init(const char *encKey, int encKeyLen, const char *decK
return true;
}
-KviCryptEngine::EncryptResult KviRijndaelEngine::encrypt(const char * plainText,KviStr &outBuffer)
+KviCryptEngine::EncryptResult KviRijndaelEngine::encrypt(const char * pcPlainText, KviStr & szOutBuffer)
{
- std::string cipher;
+ std::string szCipher;
// byte is a typedef by Crypto++ for unsigned char.
byte key[m_szEncKey.size()],iv[CryptoPP::AES::BLOCKSIZE];
- for(unsigned int i=0;i<m_szEncKey.size();i++)
- key[i] = m_szEncKey[i];
+ for(unsigned int u=0;u<m_szEncKey.size();u++)
+ key[u] = m_szEncKey[u];
// The following is absolute shit, but the module we replace does it like
// that, so we hardcode the IV to 0 in the required length...
- for(unsigned int i=0;i<sizeof(iv);i++)
- iv[i] = 0x00;
+ for(unsigned int u=0;u<sizeof(iv);u++)
+ iv[u] = 0x00;
// We hardcode CBC mode here, as the embedded code is always called in
// CBC mode too (see above, line 148), no need to use the external
@@ -154,19 +154,19 @@ KviCryptEngine::EncryptResult KviRijndaelEngine::encrypt(const char * plainText,
if(getEncoding() == KVI_RIJNDAEL_HEX)
{
- CryptoPP::StringSource(static_cast<std::string>(plainText), true,
+ CryptoPP::StringSource(static_cast<std::string>(pcPlainText), true,
new CryptoPP::StreamTransformationFilter(
encryptor, new CryptoPP::HexEncoder(
- new CryptoPP::StringSink( cipher )
+ new CryptoPP::StringSink( szCipher )
), CryptoPP::BlockPaddingSchemeDef::ZEROS_PADDING
)
);
} else if(getEncoding() == KVI_RIJNDAEL_B64)
{
- CryptoPP::StringSource(static_cast<std::string>(plainText), true,
+ CryptoPP::StringSource(static_cast<std::string>(pcPlainText), true,
new CryptoPP::StreamTransformationFilter(
encryptor, new CryptoPP::Base64Encoder(
- new CryptoPP::StringSink( cipher )
+ new CryptoPP::StringSink( szCipher )
), CryptoPP::BlockPaddingSchemeDef::ZEROS_PADDING
)
);
@@ -181,28 +181,28 @@ KviCryptEngine::EncryptResult KviRijndaelEngine::encrypt(const char * plainText,
return KviCryptEngine::EncryptError;
}
- outBuffer = cipher.c_str();
- outBuffer.prepend(KVI_TEXT_CRYPTESCAPE);
+ szOutBuffer = szCipher.c_str();
+ szOutBuffer.prepend(KVI_TEXT_CRYPTESCAPE);
return KviCryptEngine::Encrypted;
}
-KviCryptEngine::DecryptResult KviRijndaelEngine::decrypt(const char * inBuffer,KviStr &plainText)
+KviCryptEngine::DecryptResult KviRijndaelEngine::decrypt(const char * pcInBuffer, KviStr & szPlainText)
{
- std::string plain;
+ std::string szPlain;
byte key[m_szDecKey.size()],iv[CryptoPP::AES::BLOCKSIZE];
- std::string szIn = inBuffer;
+ std::string szIn = pcInBuffer;
- for(unsigned int i=0;i<m_szDecKey.size();i++)
- key[i] = m_szDecKey[i];
+ for(unsigned int u=0;u<m_szDecKey.size();u++)
+ key[u] = m_szDecKey[u];
// The following is absolute shit, but the module we replace does it like
// that, so we hardcode the IV to 0 in the required length...
- for(unsigned int i=0;i<sizeof(iv);i++)
- iv[i] = 0x00;
+ for(unsigned int u=0;u<sizeof(iv);u++)
+ iv[u] = 0x00;
if(static_cast<int>(szIn[0]) != KVI_TEXT_CRYPTESCAPE)
{
- plainText = inBuffer;
+ szPlainText = pcInBuffer;
return KviCryptEngine::DecryptOkWasPlainText;
}
@@ -210,7 +210,7 @@ KviCryptEngine::DecryptResult KviRijndaelEngine::decrypt(const char * inBuffer,K
if(szIn.empty())
{
- plainText = inBuffer;
+ szPlainText = pcInBuffer;
return KviCryptEngine::DecryptOkWasPlainText; // empty buffer
}
@@ -222,7 +222,7 @@ KviCryptEngine::DecryptResult KviRijndaelEngine::decrypt(const char * inBuffer,K
CryptoPP::StringSource(szIn, true,
new CryptoPP::HexDecoder(
new CryptoPP::StreamTransformationFilter(
- decryptor, new CryptoPP::StringSink( plain ),
+ decryptor, new CryptoPP::StringSink( szPlain ),
CryptoPP::BlockPaddingSchemeDef::ZEROS_PADDING )
)
);
@@ -231,7 +231,7 @@ KviCryptEngine::DecryptResult KviRijndaelEngine::decrypt(const char * inBuffer,K
CryptoPP::StringSource(szIn, true,
new CryptoPP::Base64Decoder(
new CryptoPP::StreamTransformationFilter(
- decryptor, new CryptoPP::StringSink( plain ),
+ decryptor, new CryptoPP::StringSink( szPlain ),
CryptoPP::BlockPaddingSchemeDef::ZEROS_PADDING )
)
);
@@ -246,7 +246,7 @@ KviCryptEngine::DecryptResult KviRijndaelEngine::decrypt(const char * inBuffer,K
return KviCryptEngine::DecryptError;
}
- plainText = plain.c_str();
+ szPlainText = szPlain.c_str();
return KviCryptEngine::DecryptOkWasEncrypted;
}
@@ -303,21 +303,21 @@ KviMircryptionEngine::~KviMircryptionEngine()
m_szDecKey.clear();
}
-bool KviMircryptionEngine::init(const char * encKey,int encKeyLen,const char * decKey,int decKeyLen)
+bool KviMircryptionEngine::init(const char * pcEncKey, int iEncKeyLen, const char * pcDecKey, int iDecKeyLen)
{
- if(encKey && (encKeyLen > 0))
+ if(pcEncKey && (iEncKeyLen > 0))
{
- if(!(decKey && (decKeyLen > 0)))
+ if(!(pcDecKey && (iDecKeyLen > 0)))
{
- decKey = encKey;
- decKeyLen = encKeyLen;
+ pcDecKey = pcEncKey;
+ iDecKeyLen = iEncKeyLen;
} // else all
} else {
// no encrypt key specified...
- if(decKey && decKeyLen)
+ if(pcDecKey && iDecKeyLen)
{
- encKey = decKey;
- encKeyLen = decKeyLen;
+ pcEncKey = pcDecKey;
+ iEncKeyLen = iDecKeyLen;
} else {
// both keys missing
setLastError(__tr2qs("Missing encryption and decryption key: at least one is needed"));
@@ -325,8 +325,8 @@ bool KviMircryptionEngine::init(const char * encKey,int encKeyLen,const char * d
}
}
- m_szEncKey = std::string(encKey,encKeyLen);
- m_szDecKey = std::string(decKey,decKeyLen);
+ m_szEncKey = std::string(pcEncKey,iEncKeyLen);
+ m_szDecKey = std::string(pcDecKey,iDecKeyLen);
if((m_szEncKey.find("cbc:",0,4) != std::string::npos) && (m_szEncKey.size() > 4))
{
@@ -347,25 +347,25 @@ bool KviMircryptionEngine::init(const char * encKey,int encKeyLen,const char * d
return true;
}
-KviCryptEngine::EncryptResult KviMircryptionEngine::encrypt(const char * plainText,KviStr &outBuffer)
+KviCryptEngine::EncryptResult KviMircryptionEngine::encrypt(const char * pcPlainText, KviStr & szOutBuffer)
{
- std::string cipher;
+ std::string szCipher;
byte key[m_szEncKey.size()], iv[CryptoPP::Blowfish::BLOCKSIZE];
- for(unsigned int i=0;i<m_szEncKey.size();i++)
- key[i] = m_szEncKey.at(i);
+ for(unsigned int u=0;u<m_szEncKey.size();u++)
+ key[u] = m_szEncKey.at(u);
if(m_bEncryptCBC)
{
try {
- for(unsigned int i=0;i<sizeof(iv);i++)
- iv[i] = 0x00;
+ for(unsigned int u=0;u<sizeof(iv);u++)
+ iv[u] = 0x00;
CryptoPP::CBC_Mode< CryptoPP::Blowfish >::Encryption encryptor( key, sizeof(key), iv );
- CryptoPP::StringSource(static_cast<std::string>(plainText), true,
+ CryptoPP::StringSource(static_cast<std::string>(pcPlainText), true,
new CryptoPP::StreamTransformationFilter(
encryptor, new CryptoPP::Base64Encoder(
- new CryptoPP::StringSink( cipher )
+ new CryptoPP::StringSink( szCipher )
), CryptoPP::BlockPaddingSchemeDef::ZEROS_PADDING
)
);
@@ -378,10 +378,10 @@ KviCryptEngine::EncryptResult KviMircryptionEngine::encrypt(const char * plainTe
} else {
try {
CryptoPP::ECB_Mode< CryptoPP::Blowfish >::Encryption encryptor( key, sizeof(key) );
- CryptoPP::StringSource(static_cast<std::string>(plainText), true,
+ CryptoPP::StringSource(static_cast<std::string>(pcPlainText), true,
new CryptoPP::StreamTransformationFilter(
encryptor, new CryptoPP::Base64Encoder(
- new CryptoPP::StringSink( cipher )
+ new CryptoPP::StringSink( szCipher )
), CryptoPP::BlockPaddingSchemeDef::ZEROS_PADDING
)
);
@@ -393,16 +393,16 @@ KviCryptEngine::EncryptResult KviMircryptionEngine::encrypt(const char * plainTe
}
}
- outBuffer = "+OK ";
- outBuffer.append(cipher.c_str());
+ szOutBuffer = "+OK ";
+ szOutBuffer.append(szCipher.c_str());
return KviCryptEngine::Encrypted;
}
-KviCryptEngine::DecryptResult KviMircryptionEngine::decrypt(const char * inBuffer,KviStr &plainText)
+KviCryptEngine::DecryptResult KviMircryptionEngine::decrypt(const char * pcInBuffer, KviStr & szPlainText)
{
- std::string plain;
- std::string szIn = inBuffer;
+ std::string szPlain;
+ std::string szIn = pcInBuffer;
byte key[m_szDecKey.size()], iv[CryptoPP::Blowfish::BLOCKSIZE];
// various old versions
@@ -414,25 +414,25 @@ KviCryptEngine::DecryptResult KviMircryptionEngine::decrypt(const char * inBuffe
// some servers seem to strip the + at the beginning...
szIn = szIn.substr(3);
} else {
- plainText = szIn.c_str();
+ szPlainText = szIn.c_str();
return KviCryptEngine::DecryptOkWasPlainText;
}
- for(unsigned int i=0;i<m_szDecKey.size();i++)
- key[i] = m_szDecKey.at(i);
+ for(unsigned int u=0;u<m_szDecKey.size();u++)
+ key[u] = m_szDecKey.at(u);
if(m_bDecryptCBC)
{
try {
- for(unsigned int i=0;i<sizeof(iv);i++)
- iv[i] = 0x00;
+ for(unsigned int u=0;u<sizeof(iv);u++)
+ iv[u] = 0x00;
CryptoPP::CBC_Mode< CryptoPP::Blowfish >::Decryption decryptor( key, sizeof(key), iv );
CryptoPP::StringSource(szIn, true,
new CryptoPP::Base64Decoder(
new CryptoPP::StreamTransformationFilter(
decryptor,
- new CryptoPP::StringSink( plain ),
+ new CryptoPP::StringSink( szPlain ),
CryptoPP::BlockPaddingSchemeDef::ZEROS_PADDING
)
)
@@ -449,7 +449,7 @@ KviCryptEngine::DecryptResult KviMircryptionEngine::decrypt(const char * inBuffe
CryptoPP::StringSource(szIn, true,
new CryptoPP::Base64Decoder(
new CryptoPP::StreamTransformationFilter(
- decryptor, new CryptoPP::StringSink( plain ),
+ decryptor, new CryptoPP::StringSink( szPlain ),
CryptoPP::BlockPaddingSchemeDef::ZEROS_PADDING )
)
);
@@ -461,7 +461,7 @@ KviCryptEngine::DecryptResult KviMircryptionEngine::decrypt(const char * inBuffe
}
}
- plainText = plain.c_str();
+ szPlainText = szPlain.c_str();
return KviCryptEngine::DecryptOkWasEncrypted;
}
@@ -581,7 +581,7 @@ static bool rijndael_module_init(KviModule * m)
return true;
}
-static bool rijndael_module_cleanup(KviModule *m)
+static bool rijndael_module_cleanup(KviModule * m)
{
while(g_pEngineList->first())
delete g_pEngineList->first();
diff --git a/src/modules/rijndael/libkvirijndael_cryptopp.h b/src/modules/rijndael/libkvirijndael_cryptopp.h
index 8b27921fa..a6f301523 100644
--- a/src/modules/rijndael/libkvirijndael_cryptopp.h
+++ b/src/modules/rijndael/libkvirijndael_cryptopp.h
@@ -54,9 +54,9 @@ private:
std::string m_szEncKey;
std::string m_szDecKey;
public:
- virtual bool init(const char *encKey,int encKeyLen,const char *decKey,int decKeyLen);
- virtual KviCryptEngine::EncryptResult encrypt(const char * plainText,KviStr &outBuffer);
- virtual KviCryptEngine::DecryptResult decrypt(const char * inBuffer,KviStr &plainText);
+ virtual bool init(const char * pcEncKey, int iEncKeyLen, const char * pcDecKey, int iDecKeyLen);
+ virtual KviCryptEngine::EncryptResult encrypt(const char * pcPlainText, KviStr & szOutBuffer);
+ virtual KviCryptEngine::DecryptResult decrypt(const char * pcInBuffer, KviStr & szPlainText);
};
class KviRijndael128HexEngine : public KviRijndaelEngine
@@ -133,9 +133,9 @@ public:
KviMircryptionEngine();
~KviMircryptionEngine();
- virtual bool init(const char *encKey,int encKeyLen,const char *decKey,int decKeyLen);
- virtual KviCryptEngine::EncryptResult encrypt(const char * plainText,KviStr &outBuffer);
- virtual KviCryptEngine::DecryptResult decrypt(const char * inBuffer,KviStr &plainText);
+ virtual bool init(const char * pcEncKey, int iEncKeyLen, const char * pcDecKey, int iDecKeyLen);
+ virtual KviCryptEngine::EncryptResult encrypt(const char * pcPlainText, KviStr & szOutBuffer);
+ virtual KviCryptEngine::DecryptResult decrypt(const char * pcInBuffer, KviStr & szPlainText);
private:
std::string m_szEncKey;
std::string m_szDecKey;
diff --git a/src/modules/rot13/libkvirot13.cpp b/src/modules/rot13/libkvirot13.cpp
index 937d6082e..8fc0a6fd3 100644
--- a/src/modules/rot13/libkvirot13.cpp
+++ b/src/modules/rot13/libkvirot13.cpp
@@ -119,12 +119,12 @@ static bool rot13_module_init(KviModule * m)
g_pEngineList->setAutoDelete(false);
KviCryptEngineDescription * d = new KviCryptEngineDescription;
- d->szName = "ROT13";
- d->szAuthor = "Aeriana";
- d->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->iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT;
- d->allocFunc = allocRot13Engine;
- d->deallocFunc = deallocRot13Engine;
+ 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_allocFunc = allocRot13Engine;
+ d->m_deallocFunc = deallocRot13Engine;
m->registerCryptEngine(d);
return true;
@@ -136,7 +136,8 @@ static bool rot13_module_init(KviModule * m)
static bool rot13_module_cleanup(KviModule *m)
{
#ifdef COMPILE_CRYPT_SUPPORT
- while(g_pEngineList->first())delete g_pEngineList->first();
+ while(g_pEngineList->first())
+ delete g_pEngineList->first();
delete g_pEngineList;
g_pEngineList = 0;
m->unregisterCryptEngines();
diff --git a/src/modules/window/libkviwindow.cpp b/src/modules/window/libkviwindow.cpp
index dd44c389c..753a9ca01 100644
--- a/src/modules/window/libkviwindow.cpp
+++ b/src/modules/window/libkviwindow.cpp
@@ -1518,11 +1518,11 @@ static bool window_kvs_cmd_setCryptEngine(KviKvsModuleCommandCall * c)
if(initializeCryptEngine(e,enc,dec,szError))
{
KviCryptSessionInfo * inf = KviCryptController::allocateCryptSessionInfo();
- inf->pEngine = e;
- inf->szEngineName = szEngine;
+ inf->m_pEngine = e;
+ inf->m_szEngineName = szEngine;
- inf->bDoEncrypt = (!c->hasSwitch('n',"onlydecrypt"));
- inf->bDoDecrypt = (!c->hasSwitch('m',"onlyencrypt")) || c->hasSwitch('n',"onlydecrypt");
+ inf->m_bDoEncrypt = (!c->hasSwitch('n',"onlydecrypt"));
+ inf->m_bDoDecrypt = (!c->hasSwitch('m',"onlyencrypt")) || c->hasSwitch('n',"onlydecrypt");
pWnd->setCryptSessionInfo(inf);
} else {
if(szError.isEmpty())szError = __tr2qs("Unknown engine error");