mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 11:17:29 +02:00
Fixup assembly to compile with ARMv7a
This commit is contained in:
@ -2081,11 +2081,11 @@ then
|
|||||||
AC_MSG_NOTICE([64bit ARMv8 found, setting mcpu to generic+crypto])
|
AC_MSG_NOTICE([64bit ARMv8 found, setting mcpu to generic+crypto])
|
||||||
;;
|
;;
|
||||||
armv7a)
|
armv7a)
|
||||||
AM_CPPFLAGS="$AM_CPPFLAGS -march=armv7-a -mfpu=neon-vfpv3 -DWOLFSSL_ARMASM_NO_CRYPTO"
|
AM_CPPFLAGS="$AM_CPPFLAGS -march=armv7-a -mfpu=neon -DWOLFSSL_ARMASM_NO_CRYPTO -DWOLFSSL_ARM_ARCH=7"
|
||||||
# Include options.h
|
# Include options.h
|
||||||
AM_CCASFLAGS="$AM_CCASFLAGS -DEXTERNAL_OPTS_OPENVPN"
|
AM_CCASFLAGS="$AM_CCASFLAGS -DEXTERNAL_OPTS_OPENVPN"
|
||||||
ENABLED_ARMASM_CRYPTO=no
|
ENABLED_ARMASM_CRYPTO=no
|
||||||
AC_MSG_NOTICE([32bit ARMv7-a found, setting mfpu to neon-vfpv3])
|
AC_MSG_NOTICE([32bit ARMv7-a found, setting mfpu to neon])
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
AM_CPPFLAGS="$AM_CPPFLAGS -mfpu=crypto-neon-fp-armv8"
|
AM_CPPFLAGS="$AM_CPPFLAGS -mfpu=crypto-neon-fp-armv8"
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -987,7 +987,12 @@ static WC_INLINE int wc_Chacha_encrypt_256(const word32 input[CHACHA_CHUNK_WORDS
|
|||||||
"VMOV d4, r8, r9 \n\t"
|
"VMOV d4, r8, r9 \n\t"
|
||||||
"STRD r10, r11, %[x_10] \n\t"
|
"STRD r10, r11, %[x_10] \n\t"
|
||||||
"VMOV d5, r10, r11 \n\t"
|
"VMOV d5, r10, r11 \n\t"
|
||||||
|
#if defined(WOLFSSL_ARM_ARCH) && (WOLFSSL_ARM_ARCH < 8)
|
||||||
|
"LDR r11, [r14, #4*14] \n\t"
|
||||||
|
"LDR r10, [r14, #4*15] \n\t"
|
||||||
|
#else
|
||||||
"LDRD r11, r10, [r14, #4*14] \n\t"
|
"LDRD r11, r10, [r14, #4*14] \n\t"
|
||||||
|
#endif
|
||||||
"VMOV q4, q0 \n\t"
|
"VMOV q4, q0 \n\t"
|
||||||
"VMOV q5, q1 \n\t"
|
"VMOV q5, q1 \n\t"
|
||||||
"VMOV q6, q2 \n\t"
|
"VMOV q6, q2 \n\t"
|
||||||
@ -2754,11 +2759,9 @@ static WC_INLINE void wc_Chacha_encrypt_64(const word32* input, const byte* m,
|
|||||||
/* XOR 8 bytes */
|
/* XOR 8 bytes */
|
||||||
"CMP %[bytes], #8 \n\t"
|
"CMP %[bytes], #8 \n\t"
|
||||||
"BLT L_chacha20_arm32_64_lt_8_%= \n\t"
|
"BLT L_chacha20_arm32_64_lt_8_%= \n\t"
|
||||||
"VLDR d8, [%[m], #0] \n\t"
|
"VLD1.64 { d8 }, [%[m]]! \n\t"
|
||||||
"ADD %[m], %[m], #8 \n\t"
|
|
||||||
"VEOR d8, d8, d0 \n\t"
|
"VEOR d8, d8, d0 \n\t"
|
||||||
"VSTR d8, [%[c], #0] \n\t"
|
"VST1.64 { d8 }, [%[c]]! \n\t"
|
||||||
"ADD %[c], %[c], #8 \n\t"
|
|
||||||
"SUBS %[bytes], %[bytes], #8 \n\t"
|
"SUBS %[bytes], %[bytes], #8 \n\t"
|
||||||
"VMOV d0, d1 \n\t"
|
"VMOV d0, d1 \n\t"
|
||||||
"BEQ L_chacha20_arm32_64_done_%= \n\t"
|
"BEQ L_chacha20_arm32_64_done_%= \n\t"
|
||||||
@ -2772,7 +2775,7 @@ static WC_INLINE void wc_Chacha_encrypt_64(const word32* input, const byte* m,
|
|||||||
"EOR r12, r12, r14 \n\t"
|
"EOR r12, r12, r14 \n\t"
|
||||||
"STR r12, [%[c]], #4 \n\t"
|
"STR r12, [%[c]], #4 \n\t"
|
||||||
"SUBS %[bytes], %[bytes], #4 \n\t"
|
"SUBS %[bytes], %[bytes], #4 \n\t"
|
||||||
"VTRN.32 d0, d0 \n\t"
|
"VSHR.U64 d0, d0, #32 \n\t"
|
||||||
"BEQ L_chacha20_arm32_64_done_%= \n\t"
|
"BEQ L_chacha20_arm32_64_done_%= \n\t"
|
||||||
"\n"
|
"\n"
|
||||||
"L_chacha20_arm32_64_lt_4_%=: \n\t"
|
"L_chacha20_arm32_64_lt_4_%=: \n\t"
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <wolfssl/wolfcrypt/settings.h>
|
#include <wolfssl/wolfcrypt/settings.h>
|
||||||
|
#include <wolfssl/wolfcrypt/types.h>
|
||||||
|
|
||||||
#ifdef WOLFSSL_ARMASM
|
#ifdef WOLFSSL_ARMASM
|
||||||
#ifdef __aarch64__
|
#ifdef __aarch64__
|
||||||
|
@ -1537,7 +1537,11 @@ int wc_Sha256Transform(wc_Sha256* sha256, const unsigned char* data)
|
|||||||
#else
|
#else
|
||||||
XMEMCPY(sha256->buffer, data, WC_SHA256_BLOCK_SIZE);
|
XMEMCPY(sha256->buffer, data, WC_SHA256_BLOCK_SIZE);
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef WOLFSSL_ARMASM_NO_CRYPTO
|
||||||
Sha256Transform(sha256, data, 1);
|
Sha256Transform(sha256, data, 1);
|
||||||
|
#else
|
||||||
|
Transform_Sha256_Len(sha256, data, WC_SHA256_BLOCK_SIZE);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -43,6 +43,7 @@ on the specific device platform.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <wolfssl/wolfcrypt/settings.h>
|
#include <wolfssl/wolfcrypt/settings.h>
|
||||||
|
#include <wolfssl/wolfcrypt/types.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SHA256 Build Options:
|
* SHA256 Build Options:
|
||||||
|
@ -5921,8 +5921,10 @@ WOLFSSL_TEST_SUBROUTINE int chacha_test(void)
|
|||||||
return -4722;
|
return -4722;
|
||||||
|
|
||||||
for (i = 0; i < 18; ++i) {
|
for (i = 0; i < 18; ++i) {
|
||||||
/* this will test all paths */
|
/* this will test all paths
|
||||||
/* block sizes: 1 2 3 4 7 8 15 16 31 32 63 64 127 128 255 256 511 512 */
|
* block sizes: 1 3 7 15 31 63 127 255 511 (i = 0- 8)
|
||||||
|
* 2 4 8 16 32 64 128 256 512 (i = 9-17)
|
||||||
|
*/
|
||||||
block_size = (2 << (i%9)) - (i<9?1:0);
|
block_size = (2 << (i%9)) - (i<9?1:0);
|
||||||
keySz = 32;
|
keySz = 32;
|
||||||
|
|
||||||
@ -5936,16 +5938,16 @@ WOLFSSL_TEST_SUBROUTINE int chacha_test(void)
|
|||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret |= wc_Chacha_Process(&enc, cipher_big, plain_big, block_size);
|
ret |= wc_Chacha_Process(&enc, cipher_big, plain_big , block_size);
|
||||||
ret |= wc_Chacha_Process(&dec, plain_big, cipher_big, block_size);
|
ret |= wc_Chacha_Process(&dec, plain_big , cipher_big, block_size);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (XMEMCMP(plain_big, input_big, block_size))
|
if (XMEMCMP(plain_big, input_big, block_size))
|
||||||
return -4723-i;
|
return -4740-i*2;
|
||||||
|
|
||||||
if (XMEMCMP(cipher_big, cipher_big_result, block_size))
|
if (XMEMCMP(cipher_big, cipher_big_result, block_size))
|
||||||
return -4724-i;
|
return -4741-i*2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Streaming test */
|
/* Streaming test */
|
||||||
|
Reference in New Issue
Block a user