From 3a5a00dd6d1d0d0d0ff9c882faf1a8d958469323 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 23 Dec 2018 19:37:22 +0300 Subject: we don't need this function, cause it's not called, and also we have openssl --- include/m_core.h | 2 -- libs/win32/mir_core.lib | Bin 322966 -> 322740 bytes libs/win64/mir_core.lib | Bin 324052 -> 323850 bytes src/mir_core/src/mir_core.def | 1 - src/mir_core/src/mir_core64.def | 1 - src/mir_core/src/sha256.cpp | 31 ------------------------------- 6 files changed, 35 deletions(-) diff --git a/include/m_core.h b/include/m_core.h index ec51cac5a8..64cb936986 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -381,8 +381,6 @@ MIR_CORE_DLL(void) mir_sha256_write(SHA256_CONTEXT *ctx, const void *dataIn, siz MIR_CORE_DLL(void) mir_sha256_final(SHA256_CONTEXT *ctx, BYTE hashout[MIR_SHA256_HASH_SIZE]); MIR_CORE_DLL(void) mir_sha256_hash(const void *dataIn, size_t len, BYTE hashout[MIR_SHA256_HASH_SIZE]); -MIR_CORE_DLL(void) mir_hmac_sha256(BYTE hashout[MIR_SHA256_HASH_SIZE], const BYTE *key, size_t keylen, const BYTE *text, size_t textlen); - /////////////////////////////////////////////////////////////////////////////// // strings diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib index ab262cf593..bf09e5def3 100644 Binary files a/libs/win32/mir_core.lib and b/libs/win32/mir_core.lib differ diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib index 1ce32c8d63..3e0ebc2eb5 100644 Binary files a/libs/win64/mir_core.lib and b/libs/win64/mir_core.lib differ diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 1b50cfafc5..f2cd22e6d2 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -958,7 +958,6 @@ mir_sha256_write @1147 mir_forkthreadowner @1148 hex2bin @1149 hex2binW @1150 -mir_hmac_sha256 @1151 Utf8toUcs2 @1152 db_add_contact @1153 db_delete_contact @1154 diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index f43d9b35ed..4b454ab756 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -958,7 +958,6 @@ mir_sha256_write @1147 mir_forkthreadowner @1148 hex2bin @1149 hex2binW @1150 -mir_hmac_sha256 @1151 Utf8toUcs2 @1152 db_add_contact @1153 db_delete_contact @1154 diff --git a/src/mir_core/src/sha256.cpp b/src/mir_core/src/sha256.cpp index 69821977e4..e3e5991f5f 100644 --- a/src/mir_core/src/sha256.cpp +++ b/src/mir_core/src/sha256.cpp @@ -287,34 +287,3 @@ MIR_CORE_DLL(void) mir_sha256_hash(const void *dataIn, size_t len, BYTE hashout[ mir_sha256_write(&tmp, dataIn, len); mir_sha256_final(&tmp, hashout); } - -///////////////////////////////////////////////////////////////////////////////////////// - -MIR_CORE_DLL(void) mir_hmac_sha256(BYTE hashout[MIR_SHA256_HASH_SIZE], const BYTE *key, size_t keylen, const BYTE *text, size_t textlen) -{ - SHA256_CONTEXT ctx; - BYTE usedKey[MIR_SHA_BLOCKSIZE] = { 0 }; - - if (keylen > MIR_SHA_BLOCKSIZE) { - mir_sha256_init(&ctx); - mir_sha256_write(&ctx, key, (int)keylen); - mir_sha256_final(&ctx, usedKey); - } - else memcpy(usedKey, key, keylen); - - for (size_t i = 0; i < MIR_SHA_BLOCKSIZE; i++) - usedKey[i] ^= 0x36; - - mir_sha256_init(&ctx); - mir_sha256_write(&ctx, usedKey, MIR_SHA_BLOCKSIZE); - mir_sha256_write(&ctx, text, textlen); - mir_sha256_final(&ctx, hashout); - - for (size_t i = 0; i < MIR_SHA_BLOCKSIZE; i++) - usedKey[i] ^= 0x5C ^ 0x36; - - mir_sha256_init(&ctx); - mir_sha256_write(&ctx, usedKey, MIR_SHA_BLOCKSIZE); - mir_sha256_write(&ctx, hashout, MIR_SHA256_HASH_SIZE); - mir_sha256_final(&ctx, hashout); -} -- cgit v1.2.3