Merge pull request #1220 from SparkiDev/sha2_asm_perf

Improve speed of Intel AVX1/2 ASM for SHA-256 and SHA-512
This commit is contained in:
toddouska 2017-11-16 13:47:12 -08:00 committed by GitHub
commit d741474f03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3575 additions and 1848 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -66,6 +66,14 @@
#include <wolfssl/wolfcrypt/async.h>
#endif
#if defined(_MSC_VER)
#define SHA256_NOINLINE __declspec(noinline)
#elif defined(__GNUC__)
#define SHA256_NOINLINE __attribute__((noinline))
#else
#define SHA256_NOINLINE
#endif
#ifndef NO_OLD_WC_NAMES
#define Sha256 wc_Sha256
#define SHA256 WC_SHA256
@ -96,6 +104,9 @@ typedef struct wc_Sha256 {
word32 loLen; /* length in bytes */
word32 hiLen; /* length in bytes */
void* heap;
#ifdef USE_INTEL_SPEEDUP
const byte* data;
#endif
#ifdef WOLFSSL_PIC32MZ_HASH
hashUpdCache cache; /* cache for updates */
#endif

View File

@ -59,6 +59,14 @@
#include <wolfssl/wolfcrypt/async.h>
#endif
#if defined(_MSC_VER)
#define SHA512_NOINLINE __declspec(noinline)
#elif defined(__GNUC__)
#define SHA512_NOINLINE __attribute__((noinline))
#else
#define SHA512_NOINLINE
#endif
#ifndef NO_OLD_WC_NAMES
#define Sha512 wc_Sha512
#define SHA512 WC_SHA512
@ -78,12 +86,15 @@ enum {
/* wc_Sha512 digest */
typedef struct wc_Sha512 {
word64 digest[WC_SHA512_DIGEST_SIZE / sizeof(word64)];
word64 buffer[WC_SHA512_BLOCK_SIZE / sizeof(word64)];
word32 buffLen; /* in bytes */
word64 loLen; /* length in bytes */
word64 hiLen; /* length in bytes */
word64 digest[WC_SHA512_DIGEST_SIZE / sizeof(word64)];
word64 buffer[WC_SHA512_BLOCK_SIZE / sizeof(word64)];
void* heap;
#ifdef USE_INTEL_SPEEDUP
const byte* data;
#endif
#ifdef WOLFSSL_ASYNC_CRYPT
WC_ASYNC_DEV asyncDev;
#endif /* WOLFSSL_ASYNC_CRYPT */