--- src/crypto/ocb_internal.cc 2022-08-04 09:34:20.000000000 +0800 +++ src/crypto/ocb_internal.cc 2024-06-04 23:09:15.000000000 +0800 @@ -220,12 +220,12 @@ } #elif __ALTIVEC__ && _CALL_ELF != 2 #include - typedef vector unsigned block; + typedef __vector unsigned block; #define xor_block(x,y) vec_xor(x,y) #define zero_block() vec_splat_u32(0) #define unequal_blocks(x,y) vec_any_ne(x,y) #define swap_if_le(b) (b) - #if __PPC64__ + #if defined(__PPC64__) || defined(__ppc64__) static block gen_offset(uint64_t KtopStr[3], unsigned bot) { union {uint64_t u64[2]; block bl;} rval; rval.u64[0] = (KtopStr[0] << bot) | (KtopStr[1] >> (64-bot)); @@ -235,34 +235,34 @@ #else /* Special handling: Shifts are mod 32, and no 64-bit types */ static block gen_offset(uint64_t KtopStr[3], unsigned bot) { - const vector unsigned k32 = {32,32,32,32}; - vector unsigned hi = *(vector unsigned *)(KtopStr+0); - vector unsigned lo = *(vector unsigned *)(KtopStr+2); - vector unsigned bot_vec; + const __vector unsigned k32 = {32,32,32,32}; + __vector unsigned hi = *(__vector unsigned *)(KtopStr+0); + __vector unsigned lo = *(__vector unsigned *)(KtopStr+2); + __vector unsigned bot_vec; if (bot < 32) { lo = vec_sld(hi,lo,4); } else { - vector unsigned t = vec_sld(hi,lo,4); + __vector unsigned t = vec_sld(hi,lo,4); lo = vec_sld(hi,lo,8); hi = t; bot = bot - 32; } if (bot == 0) return hi; *(unsigned *)&bot_vec = bot; - vector unsigned lshift = vec_splat(bot_vec,0); - vector unsigned rshift = vec_sub(k32,lshift); + __vector unsigned lshift = vec_splat(bot_vec,0); + __vector unsigned rshift = vec_sub(k32,lshift); hi = vec_sl(hi,lshift); lo = vec_sr(lo,rshift); return vec_xor(hi,lo); } #endif static inline block double_block(block b) { - const vector unsigned char mask = {135,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; - const vector unsigned char perm = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0}; - const vector unsigned char shift7 = vec_splat_u8(7); - const vector unsigned char shift1 = vec_splat_u8(1); - vector unsigned char c = (vector unsigned char)b; - vector unsigned char t = vec_sra(c,shift7); + const __vector unsigned char mask = {135,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; + const __vector unsigned char perm = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0}; + const __vector unsigned char shift7 = vec_splat_u8(7); + const __vector unsigned char shift1 = vec_splat_u8(1); + __vector unsigned char c = (__vector unsigned char)b; + __vector unsigned char t = vec_sra(c,shift7); t = vec_and(t,mask); t = vec_perm(t,t,perm); c = vec_sl(c,shift1);