Skip to content

Commit 3abd2ae

Browse files
authored
Merge pull request #2401 from afbjorklund/aes-arm64
Fix sshutil cpu.HasAES detection on linux/arm64
2 parents f6e81fb + 37d4606 commit 3abd2ae

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/sshutil/sshutil.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,11 @@ func detectValidPublicKey(content string) bool {
324324

325325
func detectAESAcceleration() bool {
326326
if !cpu.Initialized {
327+
if runtime.GOOS == "linux" && runtime.GOARCH == "arm64" {
328+
// cpu.Initialized seems to always be false, even when the cpu.ARM64 struct is filled out
329+
// it is only being set by readARM64Registers, but not by readHWCAP or readLinuxProcCPUInfo
330+
return cpu.ARM64.HasAES
331+
}
327332
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
328333
// golang.org/x/sys/cpu supports darwin/amd64, linux/amd64, and linux/arm64,
329334
// but apparently lacks support for darwin/arm64: https://github.com/golang/sys/blob/v0.5.0/cpu/cpu_arm64.go#L43-L60

0 commit comments

Comments
 (0)