mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 09:58:01 +00:00
235f5bf8ae
uClibc-ng does not provide <sys/auxv.h>, and a non-Linux-kernel-based Unixlike system running on Arm will probably not provide <asm/hwcap.h>. Now we check for both of those headers at autoconf time, and if either one is absent, we don't do the runtime test for Arm crypto acceleration. This should only make a difference on systems where this module previously failed to compile at all. But obviously it would be nicer to find alternative ways to check for crypto acceleration on such systems; patches welcome.
61 lines
1.0 KiB
C
61 lines
1.0 KiB
C
#include "putty.h"
|
|
#include "ssh.h"
|
|
|
|
#if defined __linux__ && (defined __arm__ || defined __aarch64__) && \
|
|
HAVE_SYS_AUXV_H && HAVE_ASM_HWCAP_H
|
|
|
|
#include <sys/auxv.h>
|
|
#include <asm/hwcap.h>
|
|
|
|
bool platform_aes_hw_available(void)
|
|
{
|
|
#if defined HWCAP_AES
|
|
return getauxval(AT_HWCAP) & HWCAP_AES;
|
|
#elif defined HWCAP2_AES
|
|
return getauxval(AT_HWCAP2) & HWCAP2_AES;
|
|
#else
|
|
return false;
|
|
#endif
|
|
}
|
|
|
|
bool platform_sha256_hw_available(void)
|
|
{
|
|
#if defined HWCAP_SHA2
|
|
return getauxval(AT_HWCAP) & HWCAP_SHA2;
|
|
#elif defined HWCAP2_SHA2
|
|
return getauxval(AT_HWCAP2) & HWCAP2_SHA2;
|
|
#else
|
|
return false;
|
|
#endif
|
|
}
|
|
|
|
bool platform_sha1_hw_available(void)
|
|
{
|
|
#if defined HWCAP_SHA1
|
|
return getauxval(AT_HWCAP) & HWCAP_SHA1;
|
|
#elif defined HWCAP2_SHA1
|
|
return getauxval(AT_HWCAP2) & HWCAP2_SHA1;
|
|
#else
|
|
return false;
|
|
#endif
|
|
}
|
|
|
|
#else
|
|
|
|
bool platform_aes_hw_available(void)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
bool platform_sha256_hw_available(void)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
bool platform_sha1_hw_available(void)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
#endif
|