summaryrefslogtreecommitdiff
path: root/include/m_core.h
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-04-08 08:17:43 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-04-08 08:17:43 +0000
commitf4239191646ae0e49d4984a083d31110e9bc42c1 (patch)
tree7b7d21d416ec595cadd6432b9e59814644c7dc2d /include/m_core.h
parent699805f92b46fe6e3282672e89e693e20125497a (diff)
mir_hmac_sha256 added
git-svn-id: http://svn.miranda-ng.org/main/trunk@16609 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'include/m_core.h')
-rw-r--r--include/m_core.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/m_core.h b/include/m_core.h
index e70187306c..c1d031f564 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -341,6 +341,7 @@ MIR_APP_DLL(int) ProtoGetAvatarFileFormat(const TCHAR *ptszFileName);
// sha1 functions
#define MIR_SHA1_HASH_SIZE 20
+#define MIR_SHA_BLOCKSIZE 64
struct mir_sha1_ctx
{
@@ -351,9 +352,9 @@ struct mir_sha1_ctx
};
MIR_CORE_DLL(void) mir_sha1_init(mir_sha1_ctx *ctx);
-MIR_CORE_DLL(void) mir_sha1_append(mir_sha1_ctx *ctx, const BYTE *dataIn, int len);
+MIR_CORE_DLL(void) mir_sha1_append(mir_sha1_ctx *ctx, const BYTE *dataIn, size_t len);
MIR_CORE_DLL(void) mir_sha1_finish(mir_sha1_ctx *ctx, BYTE hashout[MIR_SHA1_HASH_SIZE]);
-MIR_CORE_DLL(void) mir_sha1_hash(BYTE *dataIn, int len, BYTE hashout[MIR_SHA1_HASH_SIZE]);
+MIR_CORE_DLL(void) mir_sha1_hash(BYTE *dataIn, size_t len, BYTE hashout[MIR_SHA1_HASH_SIZE]);
MIR_CORE_DLL(void) mir_hmac_sha1(BYTE hashout[MIR_SHA1_HASH_SIZE], const BYTE *key, size_t keylen, const BYTE *text, size_t textlen);
@@ -366,7 +367,7 @@ struct SHA256_CONTEXT
{
UINT32 h0, h1, h2, h3, h4, h5, h6, h7;
UINT32 nblocks;
- BYTE buf[64];
+ BYTE buf[MIR_SHA_BLOCKSIZE];
int count;
};
@@ -375,6 +376,8 @@ 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