1 #include <sparc-ifunc.h> 2 3 #define __sha512_process_block __sha512_process_block_generic 4 extern void __sha512_process_block_generic (const void *buffer, size_t len, 5 struct sha512_ctx *ctx); 6 7 #include <crypt/sha512-block.c> 8 9 #undef __sha512_process_block 10 11 extern void __sha512_process_block_crop (const void *buffer, size_t len, 12 struct sha512_ctx *ctx); 13 cpu_supports_sha512(int hwcap)14static bool cpu_supports_sha512(int hwcap) 15 { 16 unsigned long cfr; 17 18 if (!(hwcap & HWCAP_SPARC_CRYPTO)) 19 return false; 20 21 __asm__ ("rd %%asr26, %0" : "=r" (cfr)); 22 if (cfr & (1 << 6)) 23 return true; 24 25 return false; 26 } 27 28 extern void __sha512_process_block (const void *buffer, size_t len, 29 struct sha512_ctx *ctx); 30 sparc_libc_ifunc (__sha512_process_block, 31 cpu_supports_sha512(hwcap) ? __sha512_process_block_crop 32 : __sha512_process_block_generic); 33