2019-03-26 18:40:51 +00:00
|
|
|
#include "putty.h"
|
2019-01-16 22:08:45 +00:00
|
|
|
#include "ssh.h"
|
|
|
|
|
2020-12-24 09:34:13 +00:00
|
|
|
#include "uxutils.h"
|
2020-10-09 18:14:57 +00:00
|
|
|
|
2020-12-24 09:34:13 +00:00
|
|
|
#if defined __arm__ || defined __aarch64__
|
2019-01-16 22:08:45 +00:00
|
|
|
|
|
|
|
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;
|
2020-12-24 10:04:08 +00:00
|
|
|
#elif defined __APPLE__
|
|
|
|
/* M1 macOS defines no optional sysctl flag indicating presence of
|
|
|
|
* the AES extension, which I assume to be because it's always
|
|
|
|
* present */
|
|
|
|
return true;
|
2019-01-16 22:08:45 +00:00
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-01-23 07:27:12 +00:00
|
|
|
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;
|
2020-12-24 10:04:08 +00:00
|
|
|
#elif defined __APPLE__
|
|
|
|
/* Assume always present on M1 macOS, similarly to AES */
|
|
|
|
return true;
|
2019-01-23 07:27:12 +00:00
|
|
|
#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;
|
2020-12-24 10:04:08 +00:00
|
|
|
#elif defined __APPLE__
|
|
|
|
/* Assume always present on M1 macOS, similarly to AES */
|
|
|
|
return true;
|
2019-01-23 07:27:12 +00:00
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2020-10-09 18:14:57 +00:00
|
|
|
#endif /* defined __arm__ || defined __aarch64__ */
|