ChaCha20, Poly1305 ASM for MSVC

Make ChaCha20 and Poly1305 asm available for MSVC.
pull/7319/head
Sean Parkinson 2024-03-12 15:41:36 +10:00
parent 9d7913508b
commit aab97fe9e2
17 changed files with 3094 additions and 527 deletions

View File

@ -74,6 +74,9 @@
#if 0
#define HAVE_INTEL_AVX2
#endif
#define USE_INTEL_CHACHA_SPEEDUP
#define USE_INTEL_POLY1305_SPEEDUP
#endif
/* Single Precision Support for RSA/DH 1024/2048/3072 and

View File

@ -1917,6 +1917,7 @@ static int numBlocks = NUM_BLOCKS;
static word32 bench_size = BENCH_SIZE;
static int base2 = 1;
static int digest_stream = 1;
static int encrypt_only = 0;
#ifdef MULTI_VALUE_STATISTICS
static int minimum_runs = 0;
@ -5767,27 +5768,54 @@ void bench_chacha(void)
XMEMSET(enc, 0, sizeof(ChaCha));
wc_Chacha_SetKey(enc, bench_key, 16);
bench_stats_start(&count, &start);
do {
for (i = 0; i < numBlocks; i++) {
ret = wc_Chacha_SetIV(enc, bench_iv, 0);
if (ret < 0) {
printf("wc_Chacha_SetIV error: %d\n", ret);
goto exit;
}
ret = wc_Chacha_Process(enc, bench_cipher, bench_plain, bench_size);
if (ret < 0) {
printf("wc_Chacha_Process error: %d\n", ret);
goto exit;
}
RECORD_MULTI_VALUE_STATS();
if (encrypt_only) {
ret = wc_Chacha_SetIV(enc, bench_iv, 0);
if (ret < 0) {
printf("wc_Chacha_SetIV error: %d\n", ret);
goto exit;
}
count += i;
} while (bench_stats_check(start)
#ifdef MULTI_VALUE_STATISTICS
|| runs < minimum_runs
#endif
);
bench_stats_start(&count, &start);
do {
for (i = 0; i < numBlocks; i++) {
ret = wc_Chacha_Process(enc, bench_cipher, bench_plain,
bench_size);
if (ret < 0) {
printf("wc_Chacha_Process error: %d\n", ret);
goto exit;
}
RECORD_MULTI_VALUE_STATS();
}
count += i;
} while (bench_stats_check(start)
#ifdef MULTI_VALUE_STATISTICS
|| runs < minimum_runs
#endif
);
}
else {
bench_stats_start(&count, &start);
do {
for (i = 0; i < numBlocks; i++) {
ret = wc_Chacha_SetIV(enc, bench_iv, 0);
if (ret < 0) {
printf("wc_Chacha_SetIV error: %d\n", ret);
goto exit;
}
ret = wc_Chacha_Process(enc, bench_cipher, bench_plain,
bench_size);
if (ret < 0) {
printf("wc_Chacha_Process error: %d\n", ret);
goto exit;
}
RECORD_MULTI_VALUE_STATS();
}
count += i;
} while (bench_stats_check(start)
#ifdef MULTI_VALUE_STATISTICS
|| runs < minimum_runs
#endif
);
}
bench_stats_sym_finish("CHACHA", 0, count, bench_size, start, 0);
#ifdef MULTI_VALUE_STATISTICS
@ -13419,6 +13447,8 @@ int wolfcrypt_benchmark_main(int argc, char** argv)
#endif
else if (string_matches(argv[1], "-dgst_full"))
digest_stream = 0;
else if (string_matches(argv[1], "-enc_only"))
encrypt_only = 1;
#ifndef NO_RSA
else if (string_matches(argv[1], "-rsa_sign"))
rsa_sign_verify = 1;

File diff suppressed because it is too large Load Diff

View File

@ -3496,7 +3496,7 @@ int CheckBitString(const byte* input, word32* inOutIdx, int* len,
#else
ASNGetData dataASN[bitStringASN_Length];
int ret;
int bits;
int bits = 0;
/* Parse BIT_STRING and check validity of unused bits. */
XMEMSET(dataASN, 0, sizeof(dataASN));
@ -7227,7 +7227,7 @@ int wc_CreatePKCS8Key(byte* out, word32* outSz, byte* key, word32 keySz,
return (int)(tmpSz + sz);
#else
DECL_ASNSETDATA(dataASN, pkcs8KeyASN_Length);
int sz;
int sz = 0;
int ret = 0;
word32 keyIdx = 0;
word32 tmpAlgId = 0;
@ -8903,7 +8903,7 @@ exit_dc:
DECL_ASNGETDATA(dataASN, pbes2ParamsASN_Length);
int ret = 0;
int id = 0;
int version;
int version = 0;
word32 idx = 0;
word32 pIdx = 0;
word32 iterations = 0;
@ -14430,7 +14430,7 @@ static int GetCertName(DecodedCert* cert, char* full, byte* hash, int nameType,
DECL_ASNGETDATA(dataASN, rdnASN_Length);
int ret = 0;
word32 idx = 0;
int len;
int len = 0;
word32 srcIdx = *inOutIdx;
#ifdef WOLFSSL_X509_NAME_AVAILABLE
WOLFSSL_X509_NAME* dName = NULL;
@ -16139,7 +16139,7 @@ word32 wc_EncodeSignature(byte* out, const byte* digest, word32 digSz,
#else
DECL_ASNSETDATA(dataASN, digestInfoASN_Length);
int ret = 0;
int sz;
int sz = 0;
unsigned char dgst[WC_MAX_DIGEST_SIZE];
CALLOC_ASNSETDATA(dataASN, digestInfoASN_Length, ret, NULL);
@ -21727,9 +21727,9 @@ static int DecodeCertInternal(DecodedCert* cert, int verify, int* criticalExt,
DECL_ASNGETDATA(dataASN, x509CertASN_Length);
int ret = 0;
int badDate = 0;
byte version;
byte version = 0;
word32 idx;
word32 serialSz;
word32 serialSz = 0;
const unsigned char* issuer = NULL;
word32 issuerSz = 0;
const unsigned char* subject = NULL;
@ -34365,7 +34365,8 @@ int wc_BuildEccKeyDer(ecc_key* key, byte* output, word32 *inLen,
return (int)totalSz;
#else
DECL_ASNSETDATA(dataASN, eccKeyASN_Length);
word32 privSz, pubSz;
word32 privSz = 0;
word32 pubSz = 0;
int sz = 0;
int ret = 0;
int curveIdSz = 0;

View File

@ -72,6 +72,10 @@ Public domain.
#elif defined(__clang__) && defined(NO_AVX2_SUPPORT)
#undef NO_AVX2_SUPPORT
#endif
#if defined(_MSC_VER) && (_MSC_VER <= 1900)
#undef NO_AVX2_SUPPORT
#define NO_AVX2_SUPPORT
#endif
#ifndef NO_AVX2_SUPPORT
#define HAVE_INTEL_AVX2

View File

@ -868,7 +868,7 @@ L_chacha20_avx1_loop128:
vmovdqa 240(%r9), %xmm15
jmp L_chacha20_avx1_start128
L_chacha20_avx1_done128:
shl $2, %eax
shll $2, %eax
addl %eax, 48(%rdi)
L_chacha20_avx1_end128:
cmpl $0x40, %ecx
@ -1456,7 +1456,7 @@ L_chacha20_avx2_loop256:
vmovdqa 480(%r9), %ymm15
jmp L_chacha20_avx2_start256
L_chacha20_avx2_done256:
shl $3, %eax
shll $3, %eax
addl %eax, 48(%rdi)
L_chacha20_avx2_end256:
#ifndef __APPLE__

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/* fe_x25519_asm.S */
/*
* Copyright (C) 2006-2023 wolfSSL Inc.
* Copyright (C) 2006-2024 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
@ -4140,7 +4140,7 @@ _fe_sq2_x64:
adcq %r11, %r8
adcq %r12, %r9
adcq %r13, %r10
mov %r10, %rax
movq %r10, %rax
shldq $0x01, %r9, %r10
shldq $0x01, %r8, %r9
shldq $0x01, %rcx, %r8
@ -5946,7 +5946,7 @@ _ge_p2_dbl_x64:
adcq %r13, %r10
adcq %r14, %r11
adcq %r15, %r12
mov %r12, %rax
movq %r12, %rax
shldq $0x01, %r11, %r12
shldq $0x01, %r10, %r11
shldq $0x01, %r9, %r10
@ -8676,7 +8676,7 @@ _sc_reduce_x64:
movq $0xa7ed9ce5a30a2c13, %rcx
movq %r12, %rax
mulq %rcx
mov $0x00, %rbp
movq $0x00, %rbp
addq %rax, %r8
adcq %rdx, %rbp
movq %r13, %rax
@ -8689,7 +8689,7 @@ _sc_reduce_x64:
addq %rbp, %r9
adcq %rax, %r10
adcq %rdx, %r11
mov $0x00, %rbx
movq $0x00, %rbx
adcq $0x00, %rbx
movq %r15, %rax
mulq %rcx
@ -8699,7 +8699,7 @@ _sc_reduce_x64:
movq $0xeb2106215d086329, %rcx
movq %r12, %rax
mulq %rcx
mov $0x00, %rbp
movq $0x00, %rbp
addq %rax, %r9
adcq %rdx, %rbp
movq %r13, %rax
@ -8712,7 +8712,7 @@ _sc_reduce_x64:
addq %rbp, %r10
adcq %rax, %r11
adcq %rdx, %rbx
mov $0x00, %rbp
movq $0x00, %rbp
adcq $0x00, %rbp
movq %r15, %rax
mulq %rcx
@ -8962,7 +8962,7 @@ _sc_muladd_x64:
movq $0xa7ed9ce5a30a2c13, %rbx
movq %r12, %rax
mulq %rbx
mov $0x00, %rbp
movq $0x00, %rbp
addq %rax, %r8
adcq %rdx, %rbp
movq %r13, %rax
@ -8975,7 +8975,7 @@ _sc_muladd_x64:
addq %rbp, %r9
adcq %rax, %r10
adcq %rdx, %r11
mov $0x00, %rsi
movq $0x00, %rsi
adcq $0x00, %rsi
movq %r15, %rax
mulq %rbx
@ -8985,7 +8985,7 @@ _sc_muladd_x64:
movq $0xeb2106215d086329, %rbx
movq %r12, %rax
mulq %rbx
mov $0x00, %rbp
movq $0x00, %rbp
addq %rax, %r9
adcq %rdx, %rbp
movq %r13, %rax
@ -8998,7 +8998,7 @@ _sc_muladd_x64:
addq %rbp, %r10
adcq %rax, %r11
adcq %rdx, %rsi
mov $0x00, %rbp
movq $0x00, %rbp
adcq $0x00, %rbp
movq %r15, %rax
mulq %rbx
@ -11371,7 +11371,7 @@ _fe_sq2_avx2:
adcxq %rax, %r10
adoxq %r14, %r11
adcxq %rcx, %r11
mov %r11, %rax
movq %r11, %rax
shldq $0x01, %r10, %r11
shldq $0x01, %r9, %r10
shldq $0x01, %r8, %r9
@ -12862,7 +12862,7 @@ _ge_p2_dbl_avx2:
adcxq %r9, %r12
adoxq %rbx, %r13
adcxq %rcx, %r13
mov %r13, %r9
movq %r13, %r9
shldq $0x01, %r12, %r13
shldq $0x01, %r11, %r12
shldq $0x01, %r10, %r11
@ -15206,33 +15206,33 @@ _sc_reduce_avx2:
adcq $0x00, %r15
# Sub product of top 4 words and order
movq $0xa7ed9ce5a30a2c13, %rdx
mulx %r12, %rcx, %rax
mulxq %r12, %rcx, %rax
addq %rcx, %r8
adcq %rax, %r9
mulx %r14, %rcx, %rax
mulxq %r14, %rcx, %rax
adcq %rcx, %r10
adcq %rax, %r11
mov $0x00, %rsi
movq $0x00, %rsi
adcq $0x00, %rsi
mulx %r13, %rcx, %rax
mulxq %r13, %rcx, %rax
addq %rcx, %r9
adcq %rax, %r10
mulx %r15, %rcx, %rax
mulxq %r15, %rcx, %rax
adcq %rcx, %r11
adcq %rax, %rsi
movq $0xeb2106215d086329, %rdx
mulx %r12, %rcx, %rax
mulxq %r12, %rcx, %rax
addq %rcx, %r9
adcq %rax, %r10
mulx %r14, %rcx, %rax
mulxq %r14, %rcx, %rax
adcq %rcx, %r11
adcq %rax, %rsi
mov $0x00, %rbx
movq $0x00, %rbx
adcq $0x00, %rbx
mulx %r13, %rcx, %rax
mulxq %r13, %rcx, %rax
addq %rcx, %r10
adcq %rax, %r11
mulx %r15, %rcx, %rax
mulxq %r15, %rcx, %rax
adcq %rcx, %rsi
adcq %rax, %rbx
subq %r12, %r10
@ -15265,21 +15265,21 @@ _sc_reduce_avx2:
# Sub product of top 2 words and order
# * -5812631a5cf5d3ed
movq $0xa7ed9ce5a30a2c13, %rdx
mulx %r12, %rbp, %rax
mulxq %r12, %rbp, %rax
movq $0x00, %rsi
addq %rbp, %r8
adcq %rax, %r9
mulx %r13, %rbp, %rax
mulxq %r13, %rbp, %rax
adcq $0x00, %rsi
addq %rbp, %r9
adcq %rax, %rsi
# * -14def9dea2f79cd7
movq $0xeb2106215d086329, %rdx
mulx %r12, %rbp, %rax
mulxq %r12, %rbp, %rax
movq $0x00, %rbx
addq %rbp, %r9
adcq %rax, %r10
mulx %r13, %rbp, %rax
mulxq %r13, %rbp, %rax
adcq $0x00, %rbx
addq %rbp, %r10
adcq %rax, %rbx
@ -15450,33 +15450,33 @@ _sc_muladd_avx2:
adcq $0x00, %rbp
# Sub product of top 4 words and order
movq $0xa7ed9ce5a30a2c13, %rdx
mulx %r14, %rcx, %rax
mulxq %r14, %rcx, %rax
addq %rcx, %r10
adcq %rax, %r11
mulx %rbx, %rcx, %rax
mulxq %rbx, %rcx, %rax
adcq %rcx, %r12
adcq %rax, %r13
mov $0x00, %rsi
movq $0x00, %rsi
adcq $0x00, %rsi
mulx %r15, %rcx, %rax
mulxq %r15, %rcx, %rax
addq %rcx, %r11
adcq %rax, %r12
mulx %rbp, %rcx, %rax
mulxq %rbp, %rcx, %rax
adcq %rcx, %r13
adcq %rax, %rsi
movq $0xeb2106215d086329, %rdx
mulx %r14, %rcx, %rax
mulxq %r14, %rcx, %rax
addq %rcx, %r11
adcq %rax, %r12
mulx %rbx, %rcx, %rax
mulxq %rbx, %rcx, %rax
adcq %rcx, %r13
adcq %rax, %rsi
mov $0x00, %r8
movq $0x00, %r8
adcq $0x00, %r8
mulx %r15, %rcx, %rax
mulxq %r15, %rcx, %rax
addq %rcx, %r12
adcq %rax, %r13
mulx %rbp, %rcx, %rax
mulxq %rbp, %rcx, %rax
adcq %rcx, %rsi
adcq %rax, %r8
subq %r14, %r12
@ -15509,21 +15509,21 @@ _sc_muladd_avx2:
# Sub product of top 2 words and order
# * -5812631a5cf5d3ed
movq $0xa7ed9ce5a30a2c13, %rdx
mulx %r14, %r9, %rax
mulxq %r14, %r9, %rax
movq $0x00, %rsi
addq %r9, %r10
adcq %rax, %r11
mulx %r15, %r9, %rax
mulxq %r15, %r9, %rax
adcq $0x00, %rsi
addq %r9, %r11
adcq %rax, %rsi
# * -14def9dea2f79cd7
movq $0xeb2106215d086329, %rdx
mulx %r14, %r9, %rax
mulxq %r14, %r9, %rax
movq $0x00, %r8
addq %r9, %r11
adcq %rax, %r12
mulx %r15, %r9, %rax
mulxq %r15, %r9, %rax
adcq $0x00, %r8
addq %r9, %r12
adcq %rax, %r8

View File

@ -15,6 +15,8 @@ EXTRA_DIST += wolfcrypt/src/evp.c
EXTRA_DIST += wolfcrypt/src/asm.c
EXTRA_DIST += wolfcrypt/src/aes_asm.asm
EXTRA_DIST += wolfcrypt/src/aes_gcm_asm.asm
EXTRA_DIST += wolfcrypt/src/chacha_asm.asm
EXTRA_DIST += wolfcrypt/src/poly1305_asm.asm
EXTRA_DIST += wolfcrypt/src/wc_dsp.c
EXTRA_DIST += wolfcrypt/src/sp_dsp32.c
EXTRA_DIST += wolfcrypt/src/sp_x86_64_asm.asm

View File

@ -55,7 +55,7 @@ and Daniel J. Bernstein
#pragma warning(disable: 4127)
#endif
#if defined(WOLFSSL_X86_64_BUILD) && defined(USE_INTEL_SPEEDUP)
#ifdef USE_INTEL_POLY1305_SPEEDUP
#include <emmintrin.h>
#include <immintrin.h>
@ -70,6 +70,10 @@ and Daniel J. Bernstein
#elif defined(__clang__) && defined(NO_AVX2_SUPPORT)
#undef NO_AVX2_SUPPORT
#endif
#if defined(_MSC_VER) && (_MSC_VER <= 1900)
#undef NO_AVX2_SUPPORT
#define NO_AVX2_SUPPORT
#endif
#define HAVE_INTEL_AVX1
#ifndef NO_AVX2_SUPPORT
@ -77,13 +81,12 @@ and Daniel J. Bernstein
#endif
#endif
#if defined(WOLFSSL_X86_64_BUILD) && defined(USE_INTEL_SPEEDUP)
#ifdef USE_INTEL_POLY1305_SPEEDUP
static word32 intel_flags = 0;
static word32 cpu_flags_set = 0;
#endif
#if (defined(WOLFSSL_X86_64_BUILD) && defined(USE_INTEL_SPEEDUP)) || \
defined(POLY130564)
#if defined(USE_INTEL_POLY1305_SPEEDUP) || defined(POLY130564)
#if defined(_MSC_VER)
#define POLY1305_NOINLINE __declspec(noinline)
#elif defined(__GNUC__)
@ -123,7 +126,7 @@ static word32 cpu_flags_set = 0;
#endif
#endif
#if defined(WOLFSSL_X86_64_BUILD) && defined(USE_INTEL_SPEEDUP)
#ifdef USE_INTEL_POLY1305_SPEEDUP
#ifdef __cplusplus
extern "C" {
#endif
@ -266,7 +269,7 @@ with a given ctx pointer to a Poly1305 structure.
static int poly1305_blocks(Poly1305* ctx, const unsigned char *m,
size_t bytes)
{
#if defined(WOLFSSL_X86_64_BUILD) && defined(USE_INTEL_SPEEDUP)
#ifdef USE_INTEL_POLY1305_SPEEDUP
/* AVX2 is handled in wc_Poly1305Update. */
SAVE_VECTOR_REGISTERS(return _svr_ret;);
poly1305_blocks_avx(ctx, m, bytes);
@ -400,7 +403,7 @@ number of bytes is less than the block size.
*/
static int poly1305_block(Poly1305* ctx, const unsigned char *m)
{
#if defined(WOLFSSL_X86_64_BUILD) && defined(USE_INTEL_SPEEDUP)
#ifdef USE_INTEL_POLY1305_SPEEDUP
/* No call to poly1305_block when AVX2, AVX2 does 4 blocks at a time. */
SAVE_VECTOR_REGISTERS(return _svr_ret;);
poly1305_block_avx(ctx, m);
@ -415,8 +418,7 @@ static int poly1305_block(Poly1305* ctx, const unsigned char *m)
#if !defined(WOLFSSL_ARMASM) || !defined(__aarch64__)
int wc_Poly1305SetKey(Poly1305* ctx, const byte* key, word32 keySz)
{
#if defined(POLY130564) && \
!(defined(WOLFSSL_X86_64_BUILD) && defined(USE_INTEL_SPEEDUP))
#if defined(POLY130564) && !defined(USE_INTEL_POLY1305_SPEEDUP)
word64 t0,t1;
#endif
@ -437,7 +439,7 @@ int wc_Poly1305SetKey(Poly1305* ctx, const byte* key, word32 keySz)
if (keySz != 32 || ctx == NULL)
return BAD_FUNC_ARG;
#if defined(WOLFSSL_X86_64_BUILD) && defined(USE_INTEL_SPEEDUP)
#ifdef USE_INTEL_POLY1305_SPEEDUP
if (!cpu_flags_set) {
intel_flags = cpuid_get_flags();
cpu_flags_set = 1;
@ -504,7 +506,7 @@ int wc_Poly1305SetKey(Poly1305* ctx, const byte* key, word32 keySz)
int wc_Poly1305Final(Poly1305* ctx, byte* mac)
{
#if defined(WOLFSSL_X86_64_BUILD) && defined(USE_INTEL_SPEEDUP)
#ifdef USE_INTEL_POLY1305_SPEEDUP
#elif defined(POLY130564)
word64 h0,h1,h2,c;
@ -523,7 +525,7 @@ int wc_Poly1305Final(Poly1305* ctx, byte* mac)
if (ctx == NULL || mac == NULL)
return BAD_FUNC_ARG;
#if defined(WOLFSSL_X86_64_BUILD) && defined(USE_INTEL_SPEEDUP)
#ifdef USE_INTEL_POLY1305_SPEEDUP
SAVE_VECTOR_REGISTERS(return _svr_ret;);
#ifdef HAVE_INTEL_AVX2
if (IS_INTEL_AVX2(intel_flags))
@ -709,7 +711,7 @@ int wc_Poly1305Update(Poly1305* ctx, const byte* m, word32 bytes)
printf("\n");
#endif
#if defined(WOLFSSL_X86_64_BUILD) && defined(USE_INTEL_SPEEDUP)
#ifdef USE_INTEL_POLY1305_SPEEDUP
#ifdef HAVE_INTEL_AVX2
if (IS_INTEL_AVX2(intel_flags)) {
SAVE_VECTOR_REGISTERS(return _svr_ret;);

View File

@ -1106,7 +1106,7 @@ L_poly1305_avx2_final_start_copy:
incb %cl
incb %dl
L_poly1305_avx2_final_cmp_copy:
cmp %rcx, %rax
cmpb %cl, %al
jne L_poly1305_avx2_final_start_copy
#ifndef __APPLE__
callq poly1305_final_avx@plt

File diff suppressed because it is too large Load Diff

View File

@ -3469,14 +3469,6 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha256_test(void)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit);
}
if (XMEMCMP(hash, b.output, WC_SHA256_DIGEST_SIZE) != 0) {
{
for (int ii = 0; ii < WC_SHA256_DIGEST_SIZE; ii++)
fprintf(stderr, " %02x", hash[ii]);
fprintf(stderr, "\n");
for (int ii = 0; ii < WC_SHA256_DIGEST_SIZE; ii++)
fprintf(stderr, " %02x", b.output[ii]);
fprintf(stderr, "\n");
}
ERROR_OUT(WC_TEST_RET_ENC_NC, exit);
}
#endif

View File

@ -199,6 +199,10 @@
RelativePath=".\wolfcrypt\src\aes_asm.asm"
>
</File>
<File
RelativePath=".\wolfcrypt\src\aes_gcm_asm.asm"
>
</File>
<File
RelativePath=".\wolfcrypt\src\arc4.c"
>
@ -227,6 +231,10 @@
RelativePath=".\wolfcrypt\src\chacha.c"
>
</File>
<File
RelativePath=".\wolfcrypt\src\chacha_asm.asm"
>
</File>
<File
RelativePath=".\wolfcrypt\src\chacha20_poly1305.c"
>
@ -331,6 +339,10 @@
RelativePath=".\wolfcrypt\src\poly1305.c"
>
</File>
<File
RelativePath=".\wolfcrypt\src\poly1305_asm.asm"
>
</File>
<File
RelativePath=".\wolfcrypt\src\pwdbased.c"
>

View File

@ -384,6 +384,34 @@
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)%(Filename).obj</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">$(IntDir)%(Filename).obj</Outputs>
</CustomBuild>
<CustomBuild Include="wolfcrypt\src\chacha_asm.asm">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64.exe /c /Zi /Fo"$(OutDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">ml64.exe /c /Zi /Fo"$(IntDir)%(Filename).obj" %(Identity)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)%(Filename).obj</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">$(IntDir)%(Filename).obj</Outputs>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64.exe /c /Zi /Fo"$(OutDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">ml64.exe /c /Zi /Fo"$(IntDir)%(Filename).obj" %(Identity)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)%(Filename).obj</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">$(IntDir)%(Filename).obj</Outputs>
</CustomBuild>
<CustomBuild Include="wolfcrypt\src\poly1305_asm.asm">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64.exe /c /Zi /Fo"$(OutDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">ml64.exe /c /Zi /Fo"$(IntDir)%(Filename).obj" %(Identity)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)%(Filename).obj</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">$(IntDir)%(Filename).obj</Outputs>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64.exe /c /Zi /Fo"$(OutDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">ml64.exe /c /Zi /Fo"$(IntDir)%(Filename).obj" %(Identity)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)%(Filename).obj</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">$(IntDir)%(Filename).obj</Outputs>
</CustomBuild>
<CustomBuild Include="wolfcrypt\src\sp_x86_64_asm.asm">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">false</ExcludedFromBuild>

View File

@ -77,7 +77,7 @@ enum {
typedef struct ChaCha {
word32 X[CHACHA_CHUNK_WORDS]; /* state of cipher */
#ifdef HAVE_INTEL_AVX1
#if defined(USE_INTEL_CHACHA_SPEEDUP)
/* vpshufd reads 16 bytes but we only use bottom 4. */
byte extra[12];
#endif

View File

@ -48,7 +48,14 @@
#define WC_HAS_GCC_4_4_64BIT
#endif
#if defined(WOLFSSL_X86_64_BUILD) && defined(USE_INTEL_SPEEDUP)
#ifdef WOLFSSL_X86_64_BUILD
#if defined(USE_INTEL_SPEEDUP) && !defined(NO_POLY1305_ASM)
#define USE_INTEL_POLY1305_SPEEDUP
#define HAVE_INTEL_AVX1
#endif
#endif
#if defined(USE_INTEL_POLY1305_SPEEDUP)
#elif (defined(WC_HAS_SIZEOF_INT128_64BIT) || defined(WC_HAS_MSVC_64BIT) || \
defined(WC_HAS_GCC_4_4_64BIT))
#define POLY130564
@ -67,7 +74,7 @@ enum {
/* Poly1305 state */
typedef struct Poly1305 {
#if defined(WOLFSSL_X86_64_BUILD) && defined(USE_INTEL_SPEEDUP)
#ifdef USE_INTEL_POLY1305_SPEEDUP
word64 r[3];
word64 h[3];
word64 pad[2];