Please forgive my ignorance. I'm working on a Pine64 dev-board Pine64 supplies Linaro's GCC 4.9.2 toolchain.
I am catching a compile error, and I am trying to determine why.
Does Linaro's GCC 4.9 provide AES and SHA intrinsics?
**********
$ uname -a Linux pine64 3.10.102-2-pine64-longsleep #66 SMP PREEMPT Sat Jul 16 10:53:13 CEST 2016 aarch64 GNU/Linux
$ gcc --version gcc (Debian/Linaro 4.9.2-10) 4.9.2 Copyright (C) 2014 Free Software Foundation, Inc.
**********
$ CFLAGS="-DMBEDTLS_HAVE_ARMV8A_CE=1" make DEBUG=1 V=1 CC aes_armv8a_ce.c aes_armv8a_ce.c: In function 'mbedtls_armv8a_ce_aes_crypt_ecb': aes_armv8a_ce.c:65:4: warning: implicit declaration of function 'vaeseq_u8' [-Wimplicit-function-declaration] state_vec = vaeseq_u8( state_vec, roundkey_vec ); ^ aes_armv8a_ce.c:65:14: error: incompatible types when assigning to type 'uint8x16_t' from type 'int' state_vec = vaeseq_u8( state_vec, roundkey_vec ); ^ aes_armv8a_ce.c:67:4: warning: implicit declaration of function 'vaesmcq_u8' [-Wimplicit-function-declaration] state_vec = vaesmcq_u8( state_vec ); ^ aes_armv8a_ce.c:67:14: error: incompatible types when assigning to type 'uint8x16_t' from type 'int' state_vec = vaesmcq_u8( state_vec ); ^ aes_armv8a_ce.c:74:13: error: incompatible types when assigning to type 'uint8x16_t' from type 'int' state_vec = vaeseq_u8( state_vec, roundkey_vec ); ^ aes_armv8a_ce.c:84:4: warning: implicit declaration of function 'vaesdq_u8' [-Wimplicit-function-declaration] state_vec = vaesdq_u8( state_vec, roundkey_vec ); ^ aes_armv8a_ce.c:84:14: error: incompatible types when assigning to type 'uint8x16_t' from type 'int' state_vec = vaesdq_u8( state_vec, roundkey_vec ); ^ aes_armv8a_ce.c:86:4: warning: implicit declaration of function 'vaesimcq_u8' [-Wimplicit-function-declaration] state_vec = vaesimcq_u8( state_vec ); ^ aes_armv8a_ce.c:86:14: error: incompatible types when assigning to type 'uint8x16_t' from type 'int' state_vec = vaesimcq_u8( state_vec ); ^ aes_armv8a_ce.c:93:13: error: incompatible types when assigning to type 'uint8x16_t' from type 'int' state_vec = vaesdq_u8( state_vec, roundkey_vec ); ^ aes_armv8a_ce.c: In function 'mbedtls_armv8a_ce_gcm_mult': aes_armv8a_ce.c:138:2: warning: implicit declaration of function 'vmull_high_p64' [-Wimplicit-function-declaration] r1 = (uint8x16_t)vmull_high_p64( (poly64x2_t)a_p, (poly64x2_t)b_p ); ^ aes_armv8a_ce.c:138:2: error: can't convert between vector values of different size aes_armv8a_ce.c:141:2: error: can't convert between vector values of different size t0 = (uint8x16_t)vmull_high_p64( (poly64x2_t)a_p, (poly64x2_t)t0 ); ^ aes_armv8a_ce.c:150:2: error: can't convert between vector values of different size t0 = (uint8x16_t)vmull_high_p64( (poly64x2_t)r1, (poly64x2_t)p ); ^ Makefile:170: recipe for target 'aes_armv8a_ce.o' failed make[1]: *** [aes_armv8a_ce.o] Error 1 Makefile:17: recipe for target 'lib' failed make: *** [lib] Error 2
**********
CC sha1_armv8a_ce.c sha1_armv8a_ce.c: In function 'mbedtls_armv8a_ce_sha1_process': sha1_armv8a_ce.c:99:2: warning: implicit declaration of function 'vsha1h_u32' [-Wimplicit-function-declaration] e1 = vsha1h_u32( a ); ^ sha1_armv8a_ce.c:100:2: warning: implicit declaration of function 'vsha1cq_u32' [-Wimplicit-function-declaration] abcd = vsha1cq_u32( abcd, e, wk0 ); /* 0 */ ^ sha1_armv8a_ce.c:100:7: error: incompatible types when assigning to type 'uint32x4_t' from type 'int' abcd = vsha1cq_u32( abcd, e, wk0 ); /* 0 */ ^ sha1_armv8a_ce.c:102:2: warning: implicit declaration of function 'vsha1su0q_u32' [-Wimplicit-function-declaration] w0 = vsha1su0q_u32( w0, w1, w2 ); ^ sha1_armv8a_ce.c:102:5: error: incompatible types when assigning to type 'uint32x4_t' from type 'int' w0 = vsha1su0q_u32( w0, w1, w2 ); ^ sha1_armv8a_ce.c:106:7: error: incompatible types when assigning to type 'uint32x4_t' from type 'int' abcd = vsha1cq_u32( abcd, e1, wk1 ); /* 1 */ ^ sha1_armv8a_ce.c:108:2: warning: implicit declaration of function 'vsha1su1q_u32' [-Wimplicit-function-declaration] w0 = vsha1su1q_u32( w0, w3 ); ^ sha1_armv8a_ce.c:108:5: error: incompatible types when assigning to type 'uint32x4_t' from type 'int' w0 = vsha1su1q_u32( w0, w3 ); ^ sha1_armv8a_ce.c:109:5: error: incompatible types when assigning to type 'uint32x4_t' from type 'int' w1 = vsha1su0q_u32( w1, w2, w3 ); ^ ...
**********
$ grep -IR vaeseq_u8 /usr/include /usr/include/clang/3.5.0/include/arm_neon.h:__ai uint8x16_t vaeseq_u8(uint8x16_t __p0, uint8x16_t __p1) { /usr/include/clang/3.5.0/include/arm_neon.h:__ai uint8x16_t vaeseq_u8(uint8x16_t __p0, uint8x16_t __p1) { /usr/include/clang/3.5/include/arm_neon.h:__ai uint8x16_t vaeseq_u8(uint8x16_t __p0, uint8x16_t __p1) { /usr/include/clang/3.5/include/arm_neon.h:__ai uint8x16_t vaeseq_u8(uint8x16_t __p0, uint8x16_t __p1) { $
On Thu, Jan 12, 2017 at 10:55 PM, Jeffrey Walton noloader@gmail.com wrote:
Does Linaro's GCC 4.9 provide AES and SHA intrinsics?
Crypto is an optional feature that is not enabled by default when selecting the armv8-a architecture. You either need to specify a processor that implements the crypto extension, or else you need to specify the crypto extension when specifying the architecture. The latter is probably easier. For instance, you can do -march=armv8-a+crypto to enable the crypto support. You can also enable crc support by adding "+crc", separately, or in combination with +crypto.
$ grep -IR vaeseq_u8 /usr/include /usr/include/clang/3.5.0/include/arm_neon.h:__ai uint8x16_t vaeseq_u8(uint8x16_t __p0, uint8x16_t __p1) { ...
GCC specific header files are normally not in /usr/include. On my Ubuntu 14.04 system, it is /usr/lib/gcc/aarch64-linux-gnu/4.8/include/arm_neon.h and vaeseq_u8 is in there, but only enabled when crypto support is enabled.
Jim
linaro-toolchain@lists.linaro.org