Skip to content

Commit

Permalink
Merge pull request #2401 from afbjorklund/aes-arm64
Browse files Browse the repository at this point in the history
Fix sshutil cpu.HasAES detection on linux/arm64
  • Loading branch information
jandubois authored Jun 7, 2024
2 parents f6e81fb + 37d4606 commit 3abd2ae
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/sshutil/sshutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ func detectValidPublicKey(content string) bool {

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

0 comments on commit 3abd2ae

Please sign in to comment.