diff options
author | Jieqiang Wang <jieqiang.wang@arm.com> | 2021-11-29 14:25:03 +0000 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2021-12-14 10:40:20 +0000 |
commit | 83b982be86c3f27f181fb65d4392b679488af0bc (patch) | |
tree | 82b92e4efcc9ce043b762c764c010d2ebfbf5872 /src/plugins/crypto_native/aes.h | |
parent | 8c43d4dc13d0d02b79a32f1226de607db1bb869f (diff) |
crypto-native: fix build error on Arm using clang-13
Building VPP on Arm using clang-13 as compiler will fail with following
error message. The root cause is the unmatched alignment of parameter
key for functions aes128_key_expand/aes256_key_expand on aarch64.
Fix this error by explicitly declaring parameter key as type u8x16u.
[285/2593] ccache /home/snowball/tasks/benchmark_compilers/clang_13/bin/clang-13 --target=aarch64-linux-gnu -D_FORTIFY_SOURCE=2 -I/home/snowball/tasks/benchmark_compilers/vpp-clang-13/src -ICMakeFiles -I/home/snowball/tasks/benchmark_compilers/vpp-clang-13/src/plugins -ICMakeFiles/plugins -fPIC -g -fPIC -Werror -Wall -Wno-address-of-packed-member -O3 -fstack-protector -fno-common -march=armv8.1-a+crc+crypto -MD -MT CMakeFiles/plugins/crypto_native/CMakeFiles/crypto_native_armv8.dir/aes_cbc.c.o -MF CMakeFiles/plugins/crypto_native/CMakeFiles/crypto_native_armv8.dir/aes_cbc.c.o.d -o CMakeFiles/plugins/crypto_native/CMakeFiles/crypto_native_armv8.dir/aes_cbc.c.o -c /home/snowball/tasks/benchmark_compilers/vpp-clang-13/src/plugins/crypto_native/aes_cbc.c
FAILED: CMakeFiles/plugins/crypto_native/CMakeFiles/crypto_native_armv8.dir/aes_cbc.c.o
ccache /home/snowball/tasks/benchmark_compilers/clang_13/bin/clang-13 --target=aarch64-linux-gnu -D_FORTIFY_SOURCE=2 -I/home/snowball/tasks/benchmark_compilers/vpp-clang-13/src -ICMakeFiles -I/home/snowball/tasks/benchmark_compilers/vpp-clang-13/src/plugins -ICMakeFiles/plugins -fPIC -g -fPIC -Werror -Wall -Wno-address-of-packed-member -O3 -fstack-protector -fno-common -march=armv8.1-a+crc+crypto -MD -MT CMakeFiles/plugins/crypto_native/CMakeFiles/crypto_native_armv8.dir/aes_cbc.c.o -MF CMakeFiles/plugins/crypto_native/CMakeFiles/crypto_native_armv8.dir/aes_cbc.c.o.d -o CMakeFiles/plugins/crypto_native/CMakeFiles/crypto_native_armv8.dir/aes_cbc.c.o -c /home/snowball/tasks/benchmark_compilers/vpp-clang-13/src/plugins/crypto_native/aes_cbc.c
In file included from /home/snowball/tasks/benchmark_compilers/vpp-clang-13/src/plugins/crypto_native/aes_cbc.c:22:
/home/snowball/tasks/benchmark_compilers/vpp-clang-13/src/plugins/crypto_native/aes.h:415:40: error: passing 1-byte aligned argument to 16-byte aligned parameter 2 of 'aes128_key_expand' may result in an unaligned pointer access [-Werror,-Walign-mismatch]
aes128_key_expand (key_schedule, (u8x16u const *) key);
^
/home/snowball/tasks/benchmark_compilers/vpp-clang-13/src/plugins/crypto_native/aes.h:421:40: error: passing 1-byte aligned argument to 16-byte aligned parameter 2 of 'aes256_key_expand' may result in an unaligned pointer access [-Werror,-Walign-mismatch]
aes256_key_expand (key_schedule, (u8x16u const *) key);
^
2 errors generated.
Type: fix
Fixes: 415b4b0bb ("crypto-native: refactor GCM code to use generic types")
Signed-off-by: Jieqiang Wang <jieqiang.wang@arm.com>
Reviewed-by: Lijian Zhang <lijian.zhang@arm.com>
Reviewed-by: Tianyu Li <tianyu.li@arm.com>
Change-Id: Ic99a63526031e60760929238922a6e4547388368
Diffstat (limited to 'src/plugins/crypto_native/aes.h')
-rw-r--r-- | src/plugins/crypto_native/aes.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/crypto_native/aes.h b/src/plugins/crypto_native/aes.h index 98555f2f316..0ba4e87af52 100644 --- a/src/plugins/crypto_native/aes.h +++ b/src/plugins/crypto_native/aes.h @@ -308,7 +308,7 @@ aes128_key_expand_round_neon (u8x16 * rk, u32 rcon) } static_always_inline void -aes128_key_expand (u8x16 * rk, const u8x16 * k) +aes128_key_expand (u8x16 *rk, u8x16u const *k) { rk[0] = k[0]; aes128_key_expand_round_neon (rk + 1, 0x01); @@ -385,7 +385,7 @@ aes256_key_expand_round_neon (u8x16 * rk, u32 rcon) } static_always_inline void -aes256_key_expand (u8x16 * rk, u8x16 const *k) +aes256_key_expand (u8x16 *rk, u8x16u const *k) { rk[0] = k[0]; rk[1] = k[1]; |