From 72d1352bd653a247c4472457dca54c4e6f2a162f Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Mon, 10 Aug 2020 11:59:10 +1000 Subject: [PATCH] Fix ARM builds Need to include options.h in assembly now. bufPt declared in block but not outside. poly1305_block and poly1305_blocks need prototype - declaration in wolfcrypt/src/port/arm/armv8-poly1305.c (__arch64__ only). --- configure.ac | 4 ++++ wolfcrypt/src/port/arm/armv8-sha256.c | 4 ++-- wolfssl/wolfcrypt/poly1305.h | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index e9bc085ff..0b54ebaf6 100644 --- a/configure.ac +++ b/configure.ac @@ -1029,6 +1029,8 @@ then *aarch64*) # +crypto needed for hardware acceleration AM_CPPFLAGS="$AM_CPPFLAGS -mcpu=generic+crypto" + # Include options.h + AM_CCASFLAGS="$AM_CCASFLAGS -DEXTERNAL_OPTS_OPENVPN" # Check for and set -mstrict-align compiler flag # Used to set assumption that Aarch64 systems will not handle @@ -1048,6 +1050,8 @@ then AC_MSG_NOTICE([64bit ARMv8 found, setting mcpu to generic+crypto]);; *) AM_CPPFLAGS="$AM_CPPFLAGS -mfpu=crypto-neon-fp-armv8" + # Include options.h + AM_CCASFLAGS="$AM_CCASFLAGS -DEXTERNAL_OPTS_OPENVPN" AC_MSG_NOTICE([32bit ARMv8 found, setting mfpu to crypto-neon-fp-armv8]);; esac esac diff --git a/wolfcrypt/src/port/arm/armv8-sha256.c b/wolfcrypt/src/port/arm/armv8-sha256.c index 7f214d47c..69b03dd60 100644 --- a/wolfcrypt/src/port/arm/armv8-sha256.c +++ b/wolfcrypt/src/port/arm/armv8-sha256.c @@ -1081,7 +1081,7 @@ static WC_INLINE int Sha256Final(wc_Sha256* sha256, byte* hash) /* store lengths */ #if defined(LITTLE_ENDIAN_ORDER) { - word32* bufPt = sha256->buffer; + word32* bufPt = sha256->buffer; __asm__ volatile ( "VLD1.32 {q0}, [%[in]] \n" "VREV32.8 q0, q0 \n" @@ -1106,7 +1106,7 @@ static WC_INLINE int Sha256Final(wc_Sha256* sha256, byte* hash) XMEMCPY(&local[WC_SHA256_PAD_SIZE + sizeof(word32)], &sha256->loLen, sizeof(word32)); - bufPt = sha256->buffer; + word32* bufPt = sha256->buffer; word32* digPt = sha256->digest; __asm__ volatile ( "#load leftover data\n" diff --git a/wolfssl/wolfcrypt/poly1305.h b/wolfssl/wolfcrypt/poly1305.h index fc84b5187..790ed5db1 100644 --- a/wolfssl/wolfcrypt/poly1305.h +++ b/wolfssl/wolfcrypt/poly1305.h @@ -119,6 +119,12 @@ WOLFSSL_API int wc_Poly1305_EncodeSizes(Poly1305* ctx, word32 aadSz, word32 data WOLFSSL_API int wc_Poly1305_MAC(Poly1305* ctx, byte* additional, word32 addSz, byte* input, word32 sz, byte* tag, word32 tagSz); +#if defined(__aarch64__ ) && defined(WOLFSSL_ARMASM) +void poly1305_blocks(Poly1305* ctx, const unsigned char *m, + size_t bytes); +void poly1305_block(Poly1305* ctx, const unsigned char *m); +#endif + #ifdef __cplusplus } /* extern "C" */ #endif