mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-02 17:50:20 +00:00
31 lines
809 B
C
31 lines
809 B
C
|
#include <sparc-ifunc.h>
|
||
|
|
||
|
#define sha256_process_block sha256_process_block_generic
|
||
|
extern void sha256_process_block_generic (const void *buffer, size_t len,
|
||
|
struct sha256_ctx *ctx);
|
||
|
|
||
|
#include <crypt/sha256-block.c>
|
||
|
|
||
|
#undef sha256_process_block
|
||
|
|
||
|
extern void __sha256_process_block_crop (const void *buffer, size_t len,
|
||
|
struct sha256_ctx *ctx);
|
||
|
|
||
|
static bool cpu_supports_sha256(int hwcap)
|
||
|
{
|
||
|
unsigned long cfr;
|
||
|
|
||
|
if (!(hwcap & HWCAP_SPARC_CRYPTO))
|
||
|
return false;
|
||
|
|
||
|
__asm__ ("rd %%asr26, %0" : "=r" (cfr));
|
||
|
if (cfr & (1 << 6))
|
||
|
return true;
|
||
|
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
extern void sha256_process_block (const void *buffer, size_t len,
|
||
|
struct sha256_ctx *ctx);
|
||
|
sparc_libc_ifunc(sha256_process_block, cpu_supports_sha256(hwcap) ? __sha256_process_block_crop : sha256_process_block_generic);
|