From 1ca946425669cb62fadf5a9209907f257c3306e0 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 a3dc6c558..4095dea8f 100644 --- a/arch.mk +++ b/arch.mk @@ -75,8 +75,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 188c4f19c..18962e397 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