Add ARM32 asm code for X25519 and Ed25519

Improvements to performance of ARM64 code for X25519 and Ed25519
This commit is contained in:
Sean Parkinson
2019-05-09 09:23:58 +10:00
parent ff5bf7aea1
commit 4e2e207e67
10 changed files with 23722 additions and 9717 deletions

View File

@@ -375,6 +375,7 @@ if BUILD_INTELASM
src_libwolfssl_la_SOURCES += wolfcrypt/src/fe_x25519_asm.S
else
if BUILD_ARMASM
src_libwolfssl_la_SOURCES += wolfcrypt/src/port/arm/armv7-curve25519.S
src_libwolfssl_la_SOURCES += wolfcrypt/src/port/arm/armv8-curve25519.S
else
src_libwolfssl_la_SOURCES += wolfcrypt/src/fe_operations.c
@@ -393,6 +394,7 @@ if BUILD_INTELASM
src_libwolfssl_la_SOURCES += wolfcrypt/src/fe_x25519_asm.S
else
if BUILD_ARMASM
src_libwolfssl_la_SOURCES += wolfcrypt/src/port/arm/armv7-curve25519.S
src_libwolfssl_la_SOURCES += wolfcrypt/src/port/arm/armv8-curve25519.S
else
src_libwolfssl_la_SOURCES += wolfcrypt/src/fe_operations.c

View File

@@ -42,7 +42,9 @@
#endif
#ifdef CURVED25519_X64
/* Assumbly code in fe_x25519_asm.* */
/* Assembly code in fe_x25519_asm.* */
#elif defined(WOLFSSL_ARMASM)
/* Assembly code in fe_armv[78]_x25519.* */
#elif defined(CURVED25519_128BIT)
#include "fe_x25519_128.i"
#else

File diff suppressed because it is too large Load Diff

View File

@@ -52,6 +52,8 @@ EXTRA_DIST += wolfcrypt/src/port/ti/ti-aes.c \
wolfcrypt/src/port/arm/armv8-sha256.c \
wolfcrypt/src/port/arm/armv8-curve25519.c \
wolfcrypt/src/port/arm/armv8-curve25519.S \
wolfcrypt/src/port/arm/armv7-curve25519.c \
wolfcrypt/src/port/arm/armv7-curve25519.S \
wolfcrypt/src/port/nxp/ksdk_port.c \
wolfcrypt/src/port/atmel/README.md \
wolfcrypt/src/port/xilinx/xil-sha3.c \

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -39,8 +39,17 @@
#define CURVED25519_128BIT
#endif
#if defined(CURVED25519_X64) || defined(WOLFSSL_ARMASM)
#if defined(CURVED25519_X64)
#define CURVED25519_ASM_64BIT
#define CURVED25519_ASM
#endif
#if defined(WOLFSSL_ARMASM)
#ifdef __aarch64__
#define CURVED25519_ASM_64BIT
#else
#define CURVED25519_ASM_32BIT
#endif
#define CURVED25519_ASM
#endif
/*
@@ -78,6 +87,8 @@ WOLFSSL_LOCAL int curve25519(byte * q, byte * n, byte * p);
#ifdef CURVED25519_ASM_64BIT
typedef int64_t fe[4];
#elif defined(CURVED25519_ASM_32BIT)
typedef int32_t fe[8];
#elif defined(CURVED25519_128BIT)
typedef int64_t fe[5];
#else
@@ -112,7 +123,7 @@ WOLFSSL_LOCAL void fe_pow22523(fe,const fe);
WOLFSSL_LOCAL uint64_t load_3(const unsigned char *in);
WOLFSSL_LOCAL uint64_t load_4(const unsigned char *in);
#ifdef CURVED25519_ASM_64BIT
#ifdef CURVED25519_ASM
WOLFSSL_LOCAL void fe_ge_to_p2(fe rx, fe ry, fe rz, const fe px, const fe py,
const fe pz, const fe pt);
WOLFSSL_LOCAL void fe_ge_to_p3(fe rx, fe ry, fe rz, fe rt, const fe px,
@@ -136,7 +147,7 @@ WOLFSSL_LOCAL void fe_ge_sub(fe rx, fe ry, fe rz, fe rt, const fe px,
const fe qt2d, const fe qyplusx,
const fe qyminusx);
WOLFSSL_LOCAL void fe_cmov_table(fe* r, fe* base, signed char b);
#endif /* CURVED25519_ASM_64BIT */
#endif /* CURVED25519_ASM */
#endif /* !CURVE25519_SMALL || !ED25519_SMALL */
/* Use less memory and only 32bit types or less, but is slower

View File

@@ -49,6 +49,8 @@ Representations:
typedef byte ge[F25519_SIZE];
#elif defined(CURVED25519_ASM_64BIT)
typedef int64_t ge[4];
#elif defined(CURVED25519_ASM_32BIT)
typedef int32_t ge[8];
#elif defined(CURVED25519_128BIT)
typedef int64_t ge[5];
#else