diff options
author | George Hazan <george.hazan@gmail.com> | 2013-11-27 19:09:16 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-11-27 19:09:16 +0000 |
commit | cb80a37654ebc902769f87ffbadd38d161109333 (patch) | |
tree | 12b91f3d6920716b441c29aefa39dc858c264fe0 /src/core/stdcrypt/Rijndael.cpp | |
parent | ab1971b510fb004fc23aa3a69565ce69d8d0743e (diff) |
- strong cyphering for passwords in db3x_mmap;
- unique signature for the new mmap profiles;
git-svn-id: http://svn.miranda-ng.org/main/trunk@6997 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core/stdcrypt/Rijndael.cpp')
-rw-r--r-- | src/core/stdcrypt/Rijndael.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/stdcrypt/Rijndael.cpp b/src/core/stdcrypt/Rijndael.cpp index fd9cf84d83..95cc317099 100644 --- a/src/core/stdcrypt/Rijndael.cpp +++ b/src/core/stdcrypt/Rijndael.cpp @@ -963,8 +963,14 @@ int CRijndael::MakeKey(BYTE const* key, char const* chain, int keylength, int bl m_keylength = keylength;
m_blockSize = blockSize;
//Initialize the chain
- memcpy(m_chain0, chain, m_blockSize);
- memcpy(m_chain, chain, m_blockSize);
+ size_t len = strlen(chain);
+ if (len >= m_blockSize)
+ memcpy(m_chain0, chain, m_blockSize);
+ else {
+ memcpy(m_chain0, chain, len);
+ memset(m_chain0 + len, 0, m_blockSize - len);
+ }
+ memcpy(m_chain, m_chain0, m_blockSize);
//Calculate Number of Rounds
switch (m_keylength) {
case 16:
|