mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
uxutils.c: add special case for M1 macOS.
The M1 chip in the new range of Macs includes the crypto extension that permits AES, SHA-1 and SHA-256 acceleration. But you can't find that out by querying the ELF aux vector, because macOS isn't even ELF-based at all, so there isn't an ELF aux vector, and no web search I've tried has turned up any MachO thing obviously analogous to it. Running 'sysctl -a' does show some flags indicating CPU architecture extensions, but they're more advanced ones than this. So I think we have to assume that if we're on the new M1 macOS at all, then we have the basic crypto extension available. Accordingly, I've added a special case to all the query functions that simply returns true if defined __APPLE__.
This commit is contained in:
parent
d13adebe1a
commit
092c51afed
@ -11,6 +11,11 @@ bool platform_aes_hw_available(void)
|
||||
return getauxval(AT_HWCAP) & HWCAP_AES;
|
||||
#elif defined HWCAP2_AES
|
||||
return getauxval(AT_HWCAP2) & HWCAP2_AES;
|
||||
#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;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
@ -22,6 +27,9 @@ bool platform_sha256_hw_available(void)
|
||||
return getauxval(AT_HWCAP) & HWCAP_SHA2;
|
||||
#elif defined HWCAP2_SHA2
|
||||
return getauxval(AT_HWCAP2) & HWCAP2_SHA2;
|
||||
#elif defined __APPLE__
|
||||
/* Assume always present on M1 macOS, similarly to AES */
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
@ -33,6 +41,9 @@ bool platform_sha1_hw_available(void)
|
||||
return getauxval(AT_HWCAP) & HWCAP_SHA1;
|
||||
#elif defined HWCAP2_SHA1
|
||||
return getauxval(AT_HWCAP2) & HWCAP2_SHA1;
|
||||
#elif defined __APPLE__
|
||||
/* Assume always present on M1 macOS, similarly to AES */
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user