Skip to content

Commit a8761da

Browse files
committed
comments: update to reflect golang.org/x/crypto/ssh/knownhosts change
As of the next release of the golang.org/x/crypto module, it will be possible for golang.org/x/crypto/ssh/knownhosts to return multiple keys of the same type for the same host, per golang/crypto#254. We already handle that gracefully since v1.2.1 (see commit 3a35d9f), but the code comment describing this situation needed to be updated.
1 parent 93146c8 commit a8761da

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

knownhosts.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,9 @@ func (hkdb *HostKeyDB) HostKeys(hostWithPort string) (keys []PublicKey) {
194194
// in the known_hosts file will properly be converted to the corresponding
195195
// ssh.CertAlgo* values.
196196
func (hkdb *HostKeyDB) HostKeyAlgorithms(hostWithPort string) (algos []string) {
197-
// We ensure that algos never contains duplicates. This is done for robustness
198-
// even though currently golang.org/x/crypto/ssh/knownhosts never exposes
199-
// multiple keys of the same type. This way our behavior here is unaffected
200-
// even if https://github.com/golang/go/issues/28870 is implemented, for
201-
// example by https://github.com/golang/crypto/pull/254.
197+
// We ensure that the return value never contains duplicates. This is needed
198+
// since golang.org/x/crypto/ssh/knownhosts can now return multiple keys of
199+
// the same type after https://github.com/golang/crypto/pull/254 was merged.
202200
hostKeys := hkdb.HostKeys(hostWithPort)
203201
seen := make(map[string]struct{}, len(hostKeys))
204202
addAlgo := func(typ string, cert bool) {

0 commit comments

Comments
 (0)