Skip to content

Commit

Permalink
SHA-3 Thumb2, ARM32 ASM: Add assembly implemention
Browse files Browse the repository at this point in the history
Add SHA-3 assembly implementation for Thumb2 and ARM32.
  • Loading branch information
SparkiDev committed Jun 21, 2024
1 parent 118d2cc commit 8734f12
Show file tree
Hide file tree
Showing 16 changed files with 7,156 additions and 27 deletions.
27 changes: 27 additions & 0 deletions src/include.am
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,15 @@ else
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/armv8-sha3-asm.S
endif !BUILD_ARMASM_INLINE
endif BUILD_ARMASM_NEON
if BUILD_ARMASM
if BUILD_ARMASM_INLINE
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/armv8-32-sha3-asm_c.c
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/thumb2-sha3-asm_c.c
else
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/armv8-32-sha3-asm.S
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/thumb2-sha3-asm.S
endif !BUILD_ARMASM_INLINE
endif BUILD_ARMASM
if !BUILD_X86_ASM
if BUILD_INTELASM
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/sha3_asm.S
Expand Down Expand Up @@ -413,6 +422,15 @@ else
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/armv8-sha3-asm.S
endif !BUILD_ARMASM_INLINE
endif BUILD_ARMASM_NEON
if BUILD_ARMASM
if BUILD_ARMASM_INLINE
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/armv8-32-sha3-asm_c.c
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/thumb2-sha3-asm_c.c
else
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/armv8-32-sha3-asm.S
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/thumb2-sha3-asm.S
endif !BUILD_ARMASM_INLINE
endif BUILD_ARMASM
if BUILD_INTELASM
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/sha3_asm.S
endif
Expand Down Expand Up @@ -748,6 +766,15 @@ else
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/armv8-sha3-asm.S
endif !BUILD_ARMASM_INLINE
endif BUILD_ARMASM_NEON
if BUILD_ARMASM
if BUILD_ARMASM_INLINE
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/armv8-32-sha3-asm_c.c
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/thumb2-sha3-asm_c.c
else
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/armv8-32-sha3-asm.S
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/thumb2-sha3-asm.S
endif !BUILD_ARMASM_INLINE
endif BUILD_ARMASM
if !BUILD_X86_ASM
if BUILD_INTELASM
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/sha3_asm.S
Expand Down
4 changes: 2 additions & 2 deletions wolfcrypt/src/port/arm/armv8-32-aes-asm.S
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <wolfssl/wolfcrypt/settings.h>

#ifdef WOLFSSL_ARMASM
#if !defined(__aarch64__) && defined(__arm__)
#if !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__)
#ifndef WOLFSSL_ARMASM_INLINE
#ifndef NO_AES
#ifdef HAVE_AES_DECRYPT
Expand Down Expand Up @@ -5304,7 +5304,7 @@ L_AES_GCM_encrypt_end:
.size AES_GCM_encrypt,.-AES_GCM_encrypt
#endif /* HAVE_AESGCM */
#endif /* !NO_AES */
#endif /* !__aarch64__ && !__thumb__ */
#endif /* !__aarch64__ && __arm__ && !__thumb__ */
#endif /* WOLFSSL_ARMASM */

#if defined(__linux__) && defined(__ELF__)
Expand Down
8 changes: 4 additions & 4 deletions wolfcrypt/src/port/arm/armv8-32-aes-asm_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <wolfssl/wolfcrypt/error-crypt.h>

#ifdef WOLFSSL_ARMASM
#if !defined(__aarch64__) && defined(__arm__)
#if !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__)
#include <stdint.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
Expand All @@ -41,7 +41,7 @@
#ifdef WOLFSSL_ARMASM_INLINE

#ifdef WOLFSSL_ARMASM
#if !defined(__aarch64__) && defined(__arm__)
#if !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__)

#ifdef __IAR_SYSTEMS_ICC__
#define __asm__ asm
Expand Down Expand Up @@ -4786,9 +4786,9 @@ void AES_GCM_encrypt(const unsigned char* in_p, unsigned char* out_p, unsigned l

#endif /* HAVE_AESGCM */
#endif /* !NO_AES */
#endif /* !__aarch64__ && !__thumb__ */
#endif /* !__aarch64__ && __arm__ && !__thumb__ */
#endif /* WOLFSSL_ARMASM */
#endif /* !defined(__aarch64__) && defined(__arm__) */
#endif /* !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__) */
#endif /* WOLFSSL_ARMASM */

#endif /* WOLFSSL_ARMASM_INLINE */
4 changes: 2 additions & 2 deletions wolfcrypt/src/port/arm/armv8-32-curve25519.S
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <wolfssl/wolfcrypt/settings.h>

#ifdef WOLFSSL_ARMASM
#if !defined(__aarch64__) && defined(__arm__)
#if !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__)
#ifndef WOLFSSL_ARMASM_INLINE
#if defined(HAVE_CURVE25519) || defined(HAVE_ED25519)
#if !defined(CURVE25519_SMALL) || !defined(ED25519_SMALL)
Expand Down Expand Up @@ -8771,7 +8771,7 @@ sc_muladd:

#endif /* !CURVE25519_SMALL || !ED25519_SMALL */
#endif /* HAVE_CURVE25519 || HAVE_ED25519 */
#endif /* !__aarch64__ && !__thumb__ */
#endif /* !__aarch64__ && __arm__ && !__thumb__ */
#endif /* WOLFSSL_ARMASM */

#if defined(__linux__) && defined(__ELF__)
Expand Down
8 changes: 4 additions & 4 deletions wolfcrypt/src/port/arm/armv8-32-curve25519_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <wolfssl/wolfcrypt/error-crypt.h>

#ifdef WOLFSSL_ARMASM
#if !defined(__aarch64__) && defined(__arm__)
#if !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__)
#include <stdint.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
Expand All @@ -41,7 +41,7 @@
#ifdef WOLFSSL_ARMASM_INLINE

#ifdef WOLFSSL_ARMASM
#if !defined(__aarch64__) && defined(__arm__)
#if !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__)

#ifdef __IAR_SYSTEMS_ICC__
#define __asm__ asm
Expand Down Expand Up @@ -8995,9 +8995,9 @@ void sc_muladd(byte* s_p, const byte* a_p, const byte* b_p, const byte* c_p)

#endif /* !CURVE25519_SMALL || !ED25519_SMALL */
#endif /* HAVE_CURVE25519 || HAVE_ED25519 */
#endif /* !__aarch64__ && !__thumb__ */
#endif /* !__aarch64__ && __arm__ && !__thumb__ */
#endif /* WOLFSSL_ARMASM */
#endif /* !defined(__aarch64__) && defined(__arm__) */
#endif /* !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__) */
#endif /* WOLFSSL_ARMASM */

#endif /* WOLFSSL_ARMASM_INLINE */
4 changes: 2 additions & 2 deletions wolfcrypt/src/port/arm/armv8-32-sha256-asm.S
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <wolfssl/wolfcrypt/settings.h>

#ifdef WOLFSSL_ARMASM
#if !defined(__aarch64__) && defined(__arm__)
#if !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__)
#ifndef WOLFSSL_ARMASM_INLINE
#ifndef NO_SHA256
#ifdef WOLFSSL_ARMASM_NO_NEON
Expand Down Expand Up @@ -2865,7 +2865,7 @@ L_SHA256_transform_neon_len_start:
.size Transform_Sha256_Len,.-Transform_Sha256_Len
#endif /* WOLFSSL_ARMASM_NO_NEON */
#endif /* !NO_SHA256 */
#endif /* !__aarch64__ && !__thumb__ */
#endif /* !__aarch64__ && __arm__ && !__thumb__ */
#endif /* WOLFSSL_ARMASM */

#if defined(__linux__) && defined(__ELF__)
Expand Down
8 changes: 4 additions & 4 deletions wolfcrypt/src/port/arm/armv8-32-sha256-asm_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <wolfssl/wolfcrypt/error-crypt.h>

#ifdef WOLFSSL_ARMASM
#if !defined(__aarch64__) && defined(__arm__)
#if !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__)
#include <stdint.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
Expand All @@ -41,7 +41,7 @@
#ifdef WOLFSSL_ARMASM_INLINE

#ifdef WOLFSSL_ARMASM
#if !defined(__aarch64__) && defined(__arm__)
#if !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__)

#ifdef __IAR_SYSTEMS_ICC__
#define __asm__ asm
Expand Down Expand Up @@ -2802,9 +2802,9 @@ void Transform_Sha256_Len(wc_Sha256* sha256_p, const byte* data_p, word32 len_p)

#endif /* WOLFSSL_ARMASM_NO_NEON */
#endif /* !NO_SHA256 */
#endif /* !__aarch64__ && !__thumb__ */
#endif /* !__aarch64__ && __arm__ && !__thumb__ */
#endif /* WOLFSSL_ARMASM */
#endif /* !defined(__aarch64__) && defined(__arm__) */
#endif /* !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__) */
#endif /* WOLFSSL_ARMASM */

#endif /* WOLFSSL_ARMASM_INLINE */
Loading

0 comments on commit 8734f12

Please sign in to comment.