Fix clang 3.8 arm (#2449)

* Fix 'value size does not match register size' error in clang with arm assembly

* More readable casting
This commit is contained in:
julek-wolfssl
2019-09-09 02:46:48 -07:00
committed by GitHub
parent 4c88d94d13
commit 02419e248f
2 changed files with 6 additions and 5 deletions

View File

@@ -198,7 +198,7 @@ static WC_INLINE void wc_Chacha_encrypt_320(const word32* input, const byte* m,
#ifdef CHACHA_TEST
printf("Entering wc_Chacha_encrypt_320 with %d bytes\n", bytes);
#endif /*CHACHA_TEST */
word64 bytes64 = (word64) bytes;
__asm__ __volatile__ (
/*
* The layout of used registers is:
@@ -601,7 +601,7 @@ static WC_INLINE void wc_Chacha_encrypt_320(const word32* input, const byte* m,
"ADD v28.4s, v28.4s, v29.4s \n\t"
"BNE L_chacha20_arm64_outer_%= \n\t"
: [input] "+r" (input), [m] "+r" (m), [c] "+r" (c),
[bytes] "+r" (bytes)
[bytes] "+r" (bytes64)
: [L_chacha20_neon_add_all_counters] "r" (L_chacha20_neon_add_all_counters),
[L_chacha20_neon_rol8] "r" (L_chacha20_neon_rol8)
: "memory", "cc",
@@ -1680,6 +1680,7 @@ static WC_INLINE void wc_Chacha_encrypt_64(const word32* input, const byte* m,
#endif /*CHACHA_TEST */
#ifdef __aarch64__
word64 bytes64 = (word64) bytes;
__asm__ __volatile__ (
/* Load index look-up for rotating left 8 bits */
"LD1 {v13.16B}, [%[L_chacha20_neon_rol8]] \n\t"
@@ -2198,7 +2199,7 @@ static WC_INLINE void wc_Chacha_encrypt_64(const word32* input, const byte* m,
"BGE L_chacha20_arm64_64_loop_lt_8_%= \n\t"
"\n"
"L_chacha20_arm64_64_done_%=: \n\t"
: [input] "+r" (input), [m] "+r" (m), [c] "+r" (c), [bytes] "+r" (bytes)
: [input] "+r" (input), [m] "+r" (m), [c] "+r" (c), [bytes] "+r" (bytes64)
: [L_chacha20_neon_rol8] "r" (L_chacha20_neon_rol8),
[L_chacha20_neon_inc_first_word] "r" (L_chacha20_neon_inc_first_word)
: "memory", "x4", "x5", "x6", "x7", "v0", "v1", "v2", "v3",

View File

@@ -178,7 +178,7 @@ static WC_INLINE void poly1305_blocks_16(Poly1305* ctx, const unsigned char *m,
: [POLY1305_BLOCK_SIZE] "I" (POLY1305_BLOCK_SIZE),
[ctx_r] "m" (ctx->r[0]),
[ctx_r_4] "m" (ctx->r[4]),
[finished] "r" (ctx->finished)
[finished] "r" ((word64)ctx->finished)
: "memory", "cc",
"w2", "w3", "w4", "w5", "w6", "w7", "w8", "w9", "w10", "w15",
"w21", "w22", "w23", "w24", "w25", "x2", "x3", "x4", "x5", "x6",
@@ -858,7 +858,7 @@ void poly1305_blocks(Poly1305* ctx, const unsigned char *m,
[r] "r" (ctx->r),
[r_2] "r" (ctx->r_2),
[r_4] "r" (ctx->r_4),
[finished] "r" (ctx->finished)
[finished] "r" ((word64)ctx->finished)
: "memory", "cc",
"v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9",
"v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19",