From d7973b17de4eba3419a084920909c65b123c0d03 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 10 Apr 2015 18:56:30 +0000 Subject: inefficient code excluded git-svn-id: http://svn.miranda-ng.org/main/trunk@12752 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_core/src/sha1.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') 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; -- cgit v1.2.3