Skip to content

Commit

Permalink
Fix sshutil cpu.HasAES detection on linux/arm64
Browse files Browse the repository at this point in the history
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
  • Loading branch information
afbjorklund committed Jun 7, 2024
1 parent f6e81fb commit 37d4606
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 37d4606

Please sign in to comment.