From 0c2c0a846d42b05b44d62a3c3fcaf410660f8a4d Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Wed, 30 Dec 2015 06:57:34 +0100 Subject: Cryptography: Optimize Whirlpool implementation by using public domain assembly code developed by Wei Dai --- src/Common/Pkcs5.c | 4 ++-- src/Common/Tcdefs.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/Common') diff --git a/src/Common/Pkcs5.c b/src/Common/Pkcs5.c index d2696d9c..5e626a32 100644 --- a/src/Common/Pkcs5.c +++ b/src/Common/Pkcs5.c @@ -581,8 +581,8 @@ void derive_key_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, uin typedef struct hmac_whirlpool_ctx_struct { WHIRLPOOL_CTX ctx; - char buf[WHIRLPOOL_BLOCKSIZE]; - char k[PKCS5_SALT_SIZE + 4]; /* enough to hold (salt_len + 4) and also the Whirlpool hash */ + CRYPTOPP_ALIGN_DATA(16) char buf[WHIRLPOOL_BLOCKSIZE]; + CRYPTOPP_ALIGN_DATA(16) char k[PKCS5_SALT_SIZE + 4]; /* enough to hold (salt_len + 4) and also the Whirlpool hash */ char u[WHIRLPOOL_DIGESTSIZE]; } hmac_whirlpool_ctx; diff --git a/src/Common/Tcdefs.h b/src/Common/Tcdefs.h index 5725c135..25b8a127 100644 --- a/src/Common/Tcdefs.h +++ b/src/Common/Tcdefs.h @@ -52,6 +52,7 @@ typedef unsigned __int32 TC_LARGEST_COMPILER_UINT; typedef unsigned __int64 TC_LARGEST_COMPILER_UINT; typedef __int64 int64; typedef unsigned __int64 uint64; +#define LL(x) x##ui64 #endif #else // !_MSC_VER @@ -68,6 +69,8 @@ typedef uint16_t uint16; typedef uint32_t uint32; typedef uint64_t uint64; +#define LL(x) x##ULL + #if UCHAR_MAX != 0xffU #error UCHAR_MAX != 0xff #endif -- cgit v1.2.3