Skip to content

Commit 2312cb4

Browse files
authored
Merge pull request #7667 from SparkiDev/sha3_thumb2_arm32_asm
SHA-3 Thumb2, ARM32 ASM: Add assembly implemention
2 parents 59c7abf + 8734f12 commit 2312cb4

16 files changed

Lines changed: 7156 additions & 27 deletions

src/include.am

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,15 @@ else
269269
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/armv8-sha3-asm.S
270270
endif !BUILD_ARMASM_INLINE
271271
endif BUILD_ARMASM_NEON
272+
if BUILD_ARMASM
273+
if BUILD_ARMASM_INLINE
274+
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/armv8-32-sha3-asm_c.c
275+
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/thumb2-sha3-asm_c.c
276+
else
277+
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/armv8-32-sha3-asm.S
278+
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/thumb2-sha3-asm.S
279+
endif !BUILD_ARMASM_INLINE
280+
endif BUILD_ARMASM
272281
if !BUILD_X86_ASM
273282
if BUILD_INTELASM
274283
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/sha3_asm.S
@@ -413,6 +422,15 @@ else
413422
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/armv8-sha3-asm.S
414423
endif !BUILD_ARMASM_INLINE
415424
endif BUILD_ARMASM_NEON
425+
if BUILD_ARMASM
426+
if BUILD_ARMASM_INLINE
427+
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/armv8-32-sha3-asm_c.c
428+
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/thumb2-sha3-asm_c.c
429+
else
430+
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/armv8-32-sha3-asm.S
431+
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/thumb2-sha3-asm.S
432+
endif !BUILD_ARMASM_INLINE
433+
endif BUILD_ARMASM
416434
if BUILD_INTELASM
417435
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/sha3_asm.S
418436
endif
@@ -748,6 +766,15 @@ else
748766
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/armv8-sha3-asm.S
749767
endif !BUILD_ARMASM_INLINE
750768
endif BUILD_ARMASM_NEON
769+
if BUILD_ARMASM
770+
if BUILD_ARMASM_INLINE
771+
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/armv8-32-sha3-asm_c.c
772+
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/thumb2-sha3-asm_c.c
773+
else
774+
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/armv8-32-sha3-asm.S
775+
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/port/arm/thumb2-sha3-asm.S
776+
endif !BUILD_ARMASM_INLINE
777+
endif BUILD_ARMASM
751778
if !BUILD_X86_ASM
752779
if BUILD_INTELASM
753780
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/sha3_asm.S

wolfcrypt/src/port/arm/armv8-32-aes-asm.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include <wolfssl/wolfcrypt/settings.h>
3131

3232
#ifdef WOLFSSL_ARMASM
33-
#if !defined(__aarch64__) && defined(__arm__)
33+
#if !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__)
3434
#ifndef WOLFSSL_ARMASM_INLINE
3535
#ifndef NO_AES
3636
#ifdef HAVE_AES_DECRYPT
@@ -5304,7 +5304,7 @@ L_AES_GCM_encrypt_end:
53045304
.size AES_GCM_encrypt,.-AES_GCM_encrypt
53055305
#endif /* HAVE_AESGCM */
53065306
#endif /* !NO_AES */
5307-
#endif /* !__aarch64__ && !__thumb__ */
5307+
#endif /* !__aarch64__ && __arm__ && !__thumb__ */
53085308
#endif /* WOLFSSL_ARMASM */
53095309

53105310
#if defined(__linux__) && defined(__ELF__)

wolfcrypt/src/port/arm/armv8-32-aes-asm_c.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include <wolfssl/wolfcrypt/error-crypt.h>
3232

3333
#ifdef WOLFSSL_ARMASM
34-
#if !defined(__aarch64__) && defined(__arm__)
34+
#if !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__)
3535
#include <stdint.h>
3636
#ifdef HAVE_CONFIG_H
3737
#include <config.h>
@@ -41,7 +41,7 @@
4141
#ifdef WOLFSSL_ARMASM_INLINE
4242

4343
#ifdef WOLFSSL_ARMASM
44-
#if !defined(__aarch64__) && defined(__arm__)
44+
#if !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__)
4545

4646
#ifdef __IAR_SYSTEMS_ICC__
4747
#define __asm__ asm
@@ -4786,9 +4786,9 @@ void AES_GCM_encrypt(const unsigned char* in_p, unsigned char* out_p, unsigned l
47864786

47874787
#endif /* HAVE_AESGCM */
47884788
#endif /* !NO_AES */
4789-
#endif /* !__aarch64__ && !__thumb__ */
4789+
#endif /* !__aarch64__ && __arm__ && !__thumb__ */
47904790
#endif /* WOLFSSL_ARMASM */
4791-
#endif /* !defined(__aarch64__) && defined(__arm__) */
4791+
#endif /* !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__) */
47924792
#endif /* WOLFSSL_ARMASM */
47934793

47944794
#endif /* WOLFSSL_ARMASM_INLINE */

wolfcrypt/src/port/arm/armv8-32-curve25519.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include <wolfssl/wolfcrypt/settings.h>
3131

3232
#ifdef WOLFSSL_ARMASM
33-
#if !defined(__aarch64__) && defined(__arm__)
33+
#if !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__)
3434
#ifndef WOLFSSL_ARMASM_INLINE
3535
#if defined(HAVE_CURVE25519) || defined(HAVE_ED25519)
3636
#if !defined(CURVE25519_SMALL) || !defined(ED25519_SMALL)
@@ -8771,7 +8771,7 @@ sc_muladd:
87718771

87728772
#endif /* !CURVE25519_SMALL || !ED25519_SMALL */
87738773
#endif /* HAVE_CURVE25519 || HAVE_ED25519 */
8774-
#endif /* !__aarch64__ && !__thumb__ */
8774+
#endif /* !__aarch64__ && __arm__ && !__thumb__ */
87758775
#endif /* WOLFSSL_ARMASM */
87768776

87778777
#if defined(__linux__) && defined(__ELF__)

wolfcrypt/src/port/arm/armv8-32-curve25519_c.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include <wolfssl/wolfcrypt/error-crypt.h>
3232

3333
#ifdef WOLFSSL_ARMASM
34-
#if !defined(__aarch64__) && defined(__arm__)
34+
#if !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__)
3535
#include <stdint.h>
3636
#ifdef HAVE_CONFIG_H
3737
#include <config.h>
@@ -41,7 +41,7 @@
4141
#ifdef WOLFSSL_ARMASM_INLINE
4242

4343
#ifdef WOLFSSL_ARMASM
44-
#if !defined(__aarch64__) && defined(__arm__)
44+
#if !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__)
4545

4646
#ifdef __IAR_SYSTEMS_ICC__
4747
#define __asm__ asm
@@ -8995,9 +8995,9 @@ void sc_muladd(byte* s_p, const byte* a_p, const byte* b_p, const byte* c_p)
89958995

89968996
#endif /* !CURVE25519_SMALL || !ED25519_SMALL */
89978997
#endif /* HAVE_CURVE25519 || HAVE_ED25519 */
8998-
#endif /* !__aarch64__ && !__thumb__ */
8998+
#endif /* !__aarch64__ && __arm__ && !__thumb__ */
89998999
#endif /* WOLFSSL_ARMASM */
9000-
#endif /* !defined(__aarch64__) && defined(__arm__) */
9000+
#endif /* !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__) */
90019001
#endif /* WOLFSSL_ARMASM */
90029002

90039003
#endif /* WOLFSSL_ARMASM_INLINE */

wolfcrypt/src/port/arm/armv8-32-sha256-asm.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include <wolfssl/wolfcrypt/settings.h>
3131

3232
#ifdef WOLFSSL_ARMASM
33-
#if !defined(__aarch64__) && defined(__arm__)
33+
#if !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__)
3434
#ifndef WOLFSSL_ARMASM_INLINE
3535
#ifndef NO_SHA256
3636
#ifdef WOLFSSL_ARMASM_NO_NEON
@@ -2865,7 +2865,7 @@ L_SHA256_transform_neon_len_start:
28652865
.size Transform_Sha256_Len,.-Transform_Sha256_Len
28662866
#endif /* WOLFSSL_ARMASM_NO_NEON */
28672867
#endif /* !NO_SHA256 */
2868-
#endif /* !__aarch64__ && !__thumb__ */
2868+
#endif /* !__aarch64__ && __arm__ && !__thumb__ */
28692869
#endif /* WOLFSSL_ARMASM */
28702870

28712871
#if defined(__linux__) && defined(__ELF__)

wolfcrypt/src/port/arm/armv8-32-sha256-asm_c.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include <wolfssl/wolfcrypt/error-crypt.h>
3232

3333
#ifdef WOLFSSL_ARMASM
34-
#if !defined(__aarch64__) && defined(__arm__)
34+
#if !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__)
3535
#include <stdint.h>
3636
#ifdef HAVE_CONFIG_H
3737
#include <config.h>
@@ -41,7 +41,7 @@
4141
#ifdef WOLFSSL_ARMASM_INLINE
4242

4343
#ifdef WOLFSSL_ARMASM
44-
#if !defined(__aarch64__) && defined(__arm__)
44+
#if !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__)
4545

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

28032803
#endif /* WOLFSSL_ARMASM_NO_NEON */
28042804
#endif /* !NO_SHA256 */
2805-
#endif /* !__aarch64__ && !__thumb__ */
2805+
#endif /* !__aarch64__ && __arm__ && !__thumb__ */
28062806
#endif /* WOLFSSL_ARMASM */
2807-
#endif /* !defined(__aarch64__) && defined(__arm__) */
2807+
#endif /* !defined(__aarch64__) && defined(__arm__) && !defined(__thumb__) */
28082808
#endif /* WOLFSSL_ARMASM */
28092809

28102810
#endif /* WOLFSSL_ARMASM_INLINE */

0 commit comments

Comments
 (0)