File tree 2 files changed +11
-4
lines changed
2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ var ARM64 struct {
70
70
HasSHA1 bool
71
71
HasSHA2 bool
72
72
HasSHA512 bool
73
+ HasSHA3 bool
73
74
HasCRC32 bool
74
75
HasATOMICS bool
75
76
HasCPUID bool
Original file line number Diff line number Diff line change @@ -9,15 +9,21 @@ package cpu
9
9
import _ "unsafe" // for linkname
10
10
11
11
func osInit () {
12
+ // macOS 12 moved these to the hw.optional.arm tree, but as of Go 1.24 we
13
+ // still support macOS 11. See [Determine Encryption Capabilities].
14
+ //
15
+ // [Determine Encryption Capabilities]: https://developer.apple.com/documentation/kernel/1387446-sysctlbyname/determining_instruction_set_characteristics#3918855
12
16
ARM64 .HasATOMICS = sysctlEnabled ([]byte ("hw.optional.armv8_1_atomics\x00 " ))
13
17
ARM64 .HasCRC32 = sysctlEnabled ([]byte ("hw.optional.armv8_crc32\x00 " ))
14
18
ARM64 .HasSHA512 = sysctlEnabled ([]byte ("hw.optional.armv8_2_sha512\x00 " ))
19
+ ARM64 .HasSHA3 = sysctlEnabled ([]byte ("hw.optional.armv8_2_sha3\x00 " ))
20
+
15
21
ARM64 .HasDIT = sysctlEnabled ([]byte ("hw.optional.arm.FEAT_DIT\x00 " ))
16
22
17
- // There are no hw.optional sysctl values for the below features on Mac OS 11.0
18
- // to detect their supported state dynamically. Assume the CPU features that
19
- // Apple Silicon M1 supports to be available as a minimal set of features
20
- // to all Go programs running on darwin/arm64 .
23
+ // There are no hw.optional sysctl values for the below features on macOS 11
24
+ // to detect their supported state dynamically (although they are available
25
+ // in the hw.optional.arm tree on macOS 12). Assume the CPU features that
26
+ // Apple Silicon M1 supports to be available on all future iterations .
21
27
ARM64 .HasAES = true
22
28
ARM64 .HasPMULL = true
23
29
ARM64 .HasSHA1 = true
You can’t perform that action at this time.
0 commit comments