summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-04-10 18:56:30 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-04-10 18:56:30 +0000
commitd7973b17de4eba3419a084920909c65b123c0d03 (patch)
tree04f684e0e4c8274eae6377a09ba2b30ee7e13992 /src
parente372b5c98c28088a666e8f8050c0ec57e7b326de (diff)
inefficient code excluded
git-svn-id: http://svn.miranda-ng.org/main/trunk@12752 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/mir_core/src/sha1.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mir_core/src/sha1.cpp b/src/mir_core/src/sha1.cpp
index 5e82a3ce5b..b31e640657 100644
--- a/src/mir_core/src/sha1.cpp
+++ b/src/mir_core/src/sha1.cpp
@@ -173,8 +173,10 @@ MIR_CORE_DLL(void) mir_hmac_sha1(BYTE hashout[MIR_SHA1_HASH_SIZE], const BYTE *k
memcpy(k_ipad, key, keylen);
memcpy(k_opad, key, keylen);
- memset(k_ipad+keylen, 0x36, SHA_BLOCKSIZE - keylen);
- memset(k_opad+keylen, 0x5c, SHA_BLOCKSIZE - keylen);
+ if (keylen < SHA_BLOCKSIZE) {
+ memset(k_ipad + keylen, 0x36, SHA_BLOCKSIZE - keylen);
+ memset(k_opad + keylen, 0x5c, SHA_BLOCKSIZE - keylen);
+ }
for (unsigned i = 0; i < keylen; i++) {
k_ipad[i] ^= 0x36;