diff options
| author | 2016-09-10 11:12:10 -0400 | |
|---|---|---|
| committer | 2016-09-12 01:21:18 -0400 | |
| commit | b648a2db9aa64dcb8ac0f4d90be7333b2a876669 (patch) | |
| tree | fcbf8e19a1ebd3ccdbc421750eff8d7cadc4db65 /src/modules | |
| parent | Crypt: Add code for ActionCrypted icon (diff) | |
| download | KVIrc-b648a2db9aa64dcb8ac0f4d90be7333b2a876669.tar.gz KVIrc-b648a2db9aa64dcb8ac0f4d90be7333b2a876669.tar.bz2 KVIrc-b648a2db9aa64dcb8ac0f4d90be7333b2a876669.zip | |
Blowfish: Remove unnecessary dynamic allocation and clarify implecations of key length option choice to users.
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/rijndael/BlowFish.cpp | 8 | ||||
| -rw-r--r-- | src/modules/rijndael/libkvirijndael.cpp | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/modules/rijndael/BlowFish.cpp b/src/modules/rijndael/BlowFish.cpp index 3b63239a6..8e9ac39ba 100644 --- a/src/modules/rijndael/BlowFish.cpp +++ b/src/modules/rijndael/BlowFish.cpp @@ -334,14 +334,14 @@ BlowFish::BlowFish(unsigned char * ucKey, unsigned int keysize, const SBlock & r // avoid insane max key lengths if(maxKeysize < 4) maxKeysize = 4; - else if(maxKeysize > 80) - maxKeysize = 80; + else if(maxKeysize > 72) + maxKeysize = 72; if(keysize > maxKeysize) keysize = maxKeysize; // Allocate dynamically as we need a constant expression for the array size in c++ - unsigned char * aucLocalKey = new unsigned char[maxKeysize]; + unsigned char aucLocalKey[72]; unsigned int i, j; KviMemory::copy(aucLocalKey, ucKey, keysize); @@ -379,8 +379,6 @@ BlowFish::BlowFish(unsigned char * ucKey, unsigned int keysize, const SBlock & r for(j = 0; j < 4; j++) for(int k = 0; k < 256;) Encrypt(block), m_auiS[j][k++] = block.m_uil, m_auiS[j][k++] = block.m_uir; - - delete[] aucLocalKey; } //Sixteen Round Encipher of Block diff --git a/src/modules/rijndael/libkvirijndael.cpp b/src/modules/rijndael/libkvirijndael.cpp index 1f8067948..06646d031 100644 --- a/src/modules/rijndael/libkvirijndael.cpp +++ b/src/modules/rijndael/libkvirijndael.cpp @@ -756,7 +756,9 @@ static bool rijndael_module_init(KviModule * m) d->m_szDescription = __tr2qs("Popular cryptographic engine based on the Blowfish encryption algorithm. " "<br/>The text is first encrypted with Blowfish and then converted to base64 notation. " "The keys used have variable length and are specified as character strings. " - "You can specify keys long up to 56 bytes (448 bits) by default or change this with /option uintMaximumBlowFishKeySize UINT. " + "You can specify keys with length up to 56 bytes (448 bits) by default or change this with /option uintMaximumBlowFishKeySize UINT. " + "Blowfish allows for up to 72 bytes for keys, but it is not advised to use more than 56 bytes for security reasons. " + "Only increase this value if you need compatibility with another client's Blowfish implementation. " "If only one key is provided, this engine will use it for both encrypting and decrypting. " "<br/>This engine works in CBC mode by default: if you want to use the old and INSECURE ECB mode you must prefix your key(s) with \"ecb:\" or \"old:\"."); d->m_iFlags = KviCryptEngine::CanEncrypt | KviCryptEngine::CanDecrypt | KviCryptEngine::WantEncryptKey | KviCryptEngine::WantDecryptKey; |
