Poly1305 ARM64 optimization

This commit is contained in:
Juliusz Sosinowicz
2019-05-10 14:26:53 +02:00
parent f4548945f7
commit 0fed159abd
5 changed files with 1614 additions and 1 deletions

View File

@@ -279,11 +279,15 @@ src_libwolfssl_la_SOURCES += wolfcrypt/src/coding.c
endif endif
if BUILD_POLY1305 if BUILD_POLY1305
if BUILD_ARMASM
src_libwolfssl_la_SOURCES += wolfcrypt/src/port/arm/armv8-poly1305.c
else
src_libwolfssl_la_SOURCES += wolfcrypt/src/poly1305.c src_libwolfssl_la_SOURCES += wolfcrypt/src/poly1305.c
if BUILD_INTELASM if BUILD_INTELASM
src_libwolfssl_la_SOURCES += wolfcrypt/src/poly1305_asm.S src_libwolfssl_la_SOURCES += wolfcrypt/src/poly1305_asm.S
endif endif
endif endif
endif
if BUILD_RC4 if BUILD_RC4
src_libwolfssl_la_SOURCES += wolfcrypt/src/arc4.c src_libwolfssl_la_SOURCES += wolfcrypt/src/arc4.c

View File

@@ -24,6 +24,8 @@
* and Daniel J. Bernstein * and Daniel J. Bernstein
*/ */
#ifndef WOLFSSL_ARMASM
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
@@ -818,4 +820,4 @@ int wc_Poly1305_MAC(Poly1305* ctx, byte* additional, word32 addSz,
} }
#endif /* HAVE_POLY1305 */ #endif /* HAVE_POLY1305 */
#endif /* WOLFSSL_ARMASM */

File diff suppressed because it is too large Load Diff

View File

@@ -4322,6 +4322,9 @@ int chacha_test(void)
ChaCha dec; ChaCha dec;
byte cipher[128]; byte cipher[128];
byte plain[128]; byte plain[128];
byte cipher_big[1305] = {0};
byte plain_big[1305] = {0};
byte input_big[1305] = {0};
byte sliver[64]; byte sliver[64];
byte input[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; byte input[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
word32 keySz = 32; word32 keySz = 32;

View File

@@ -82,6 +82,18 @@ typedef struct Poly1305 {
unsigned char finished; unsigned char finished;
unsigned char started; unsigned char started;
#else #else
#ifdef WOLFSSL_ARMASM
ALIGN128 word32 r[5];
ALIGN128 word32 r_2[5]; // r^2
ALIGN128 word32 r_4[5]; // r^2
ALIGN128 word32 h[5];
word32 pad[4];
#if defined(POLY130564) // use predictable size of leftover
word64 leftover;
#else
word32 leftover;
#endif /* POLY130564 */
#else
#if defined(POLY130564) #if defined(POLY130564)
word64 r[3]; word64 r[3];
word64 h[3]; word64 h[3];
@@ -92,6 +104,7 @@ typedef struct Poly1305 {
word32 pad[4]; word32 pad[4];
#endif #endif
size_t leftover; size_t leftover;
#endif /* WOLFSSL_ARMASM */
unsigned char buffer[POLY1305_BLOCK_SIZE]; unsigned char buffer[POLY1305_BLOCK_SIZE];
unsigned char finished; unsigned char finished;
#endif #endif