From 3eff52ae722026b1b9d90b4d68ae8f73f1b68cee Mon Sep 17 00:00:00 2001 From: David Garske Date: Tue, 29 Oct 2024 16:11:52 -0700 Subject: [PATCH] Support SHA3 with ARMASM. --- arch.mk | 3 ++- include/user_settings.h | 23 ++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/arch.mk b/arch.mk index 896783d9..04de6064 100644 --- a/arch.mk +++ b/arch.mk @@ -80,8 +80,9 @@ ifeq ($(ARCH),AARCH64) endif ifeq ($(NO_ASM),0) ARCH_FLAGS=-mstrict-align - CFLAGS+=$(ARCH_FLAGS) -DWOLFSSL_ARMASM -DWC_HASH_DATA_ALIGNMENT=8 + CFLAGS+=$(ARCH_FLAGS) -DWOLFSSL_ARMASM -DWOLFSSL_ARMASM_INLINE -DWC_HASH_DATA_ALIGNMENT=8 WOLFCRYPT_OBJS += lib/wolfssl/wolfcrypt/src/port/arm/armv8-sha256.o \ + lib/wolfssl/wolfcrypt/src/port/arm/armv8-sha3-asm_c.o \ lib/wolfssl/wolfcrypt/src/port/arm/armv8-aes.o endif endif diff --git a/include/user_settings.h b/include/user_settings.h index 5ddaaab6..a4a0a2a5 100644 --- a/include/user_settings.h +++ b/include/user_settings.h @@ -42,15 +42,20 @@ /* Stdlib Types */ #define CTYPE_USER /* don't let wolfCrypt types.h include ctype.h */ -#ifndef WOLFSSL_ARMASM -#ifndef toupper -extern int toupper(int c); -#endif -#ifndef tolower -extern int tolower(int c); -#endif -#define XTOUPPER(c) toupper((c)) -#define XTOLOWER(c) tolower((c)) +#ifdef WOLFSSL_ARMASM + /* armv8 uses stdint types like uint64_t */ + #ifdef __aarch64__ + #include + #endif +#else + #ifndef toupper + extern int toupper(int c); + #endif + #ifndef tolower + extern int tolower(int c); + #endif + #define XTOUPPER(c) toupper((c)) + #define XTOLOWER(c) tolower((c)) #endif #ifdef USE_FAST_MATH