mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
d13adebe1a
If the autoconf/ifdef system ends up taking the trivial branch through all the Arm-architecture ifdefs, then we define the always-fail version of getauxval as a 'static inline' function, and then (because none of our desired HWCAP_FOO values is defined at all) never call it. This leads to a compiler warning because we defined a static function and never called it - i.e. at the default -Werror, a build failure. Of course it's perfectly sensible to define a static inline function that never gets called! Header files do it all the time, and nobody is expected to ensure that if they include a header file then they take care to refer to every static inline function it defines. But if the definition is in the _source_ file rather than a header file, then clang (in particular on macOS) will give a warning. So the easy solution is to move the inline definitions of getauxval into a header file, which suppresses the warning without requiring me to faff about with further ifdefs to make the definitions conditional on at least one use.
42 lines
797 B
C
42 lines
797 B
C
#include "putty.h"
|
|
#include "ssh.h"
|
|
|
|
#include "uxutils.h"
|
|
|
|
#if defined __arm__ || defined __aarch64__
|
|
|
|
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
|
|
}
|
|
|
|
#endif /* defined __arm__ || defined __aarch64__ */
|