Skip to content

Commit 7ca410c

Browse files
authored
Merge pull request #977 from afbjorklund/windows-aes
Add AES detection for Windows using cpuid
2 parents e7be8da + e579c88 commit 7ca410c

File tree

5 files changed

+25
-2
lines changed

5 files changed

+25
-2
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ require (
4343
github.com/golang/protobuf v1.5.2 // indirect
4444
github.com/hashicorp/errwrap v1.1.0 // indirect
4545
github.com/inconshreveable/mousetrap v1.0.0 // indirect
46+
github.com/intel-go/cpuid v0.0.0-20220614022739-219e067757cb // indirect
4647
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
4748
github.com/kr/fs v0.1.0 // indirect
4849
github.com/kr/text v0.2.0 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u
109109
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
110110
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
111111
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
112+
github.com/intel-go/cpuid v0.0.0-20220614022739-219e067757cb h1:Fg0Y/RDZ6UPwl3o7/IzPbneDq8g9+gH6DPs42KFUsy8=
113+
github.com/intel-go/cpuid v0.0.0-20220614022739-219e067757cb/go.mod h1:RmeVYf9XrPRbRc3XIx0gLYA8qOFvNoPOfaEZduRlEp4=
112114
github.com/jgautheron/goconst v0.0.0-20170703170152-9740945f5dcb/go.mod h1:82TxjOpWQiPmywlbIaB2ZkqJoSYJdLGPgAJDvM3PbKc=
113115
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
114116
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=

pkg/sshutil/sshutil_others.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//go:build !darwin && !linux
2-
// +build !darwin,!linux
1+
//go:build !darwin && !linux && !windows
2+
// +build !darwin,!linux,!windows
33

44
package sshutil
55

pkg/sshutil/sshutil_windows_amd64.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package sshutil
2+
3+
import (
4+
"github.com/intel-go/cpuid"
5+
)
6+
7+
func detectAESAcceleration() bool {
8+
return cpuid.HasFeature(cpuid.AES)
9+
}

pkg/sshutil/sshutil_windows_arm64.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package sshutil
2+
3+
import (
4+
"github.com/sirupsen/logrus"
5+
)
6+
7+
func detectAESAcceleration() bool {
8+
const fallback = false
9+
logrus.Warnf("cannot detect whether AES accelerator is available, assuming %v", fallback)
10+
return fallback
11+
}

0 commit comments

Comments
 (0)