1 #include <sparc-ifunc.h> 2 3 #define __sha256_process_block __sha256_process_block_generic 4 extern void __sha256_process_block_generic (const void *buffer, size_t len, 5 struct sha256_ctx *ctx); 6 7 #include <crypt/sha256-block.c> 8 9 #undef __sha256_process_block 10 11 extern void __sha256_process_block_crop (const void *buffer, size_t len, 12 struct sha256_ctx *ctx); 13 cpu_supports_sha256(int hwcap)14static bool cpu_supports_sha256(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 __sha256_process_block (const void *buffer, size_t len, 29 struct sha256_ctx *ctx); 30 sparc_libc_ifunc (__sha256_process_block, 31 cpu_supports_sha256(hwcap) ? __sha256_process_block_crop 32 : __sha256_process_block_generic); 33