Skip to content

Commit 8f580de

Browse files
drakkangopherbot
authored andcommitted
ssh: remove Go 1.24 build tag for ML-KEM kex
Change-Id: Ia77ad1b6fef9919ab100fb10c42231725eb81c12 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/698775 LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Nicola Murino <[email protected]> Reviewed-by: Filippo Valsorda <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Reviewed-by: Roland Shoemaker <[email protected]>
1 parent a4d1237 commit 8f580de

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

ssh/common.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ var (
8383
// supportedKexAlgos specifies key-exchange algorithms implemented by this
8484
// package in preference order, excluding those with security issues.
8585
supportedKexAlgos = []string{
86+
KeyExchangeMLKEM768X25519,
8687
KeyExchangeCurve25519,
8788
KeyExchangeECDHP256,
8889
KeyExchangeECDHP384,
@@ -94,6 +95,7 @@ var (
9495
// defaultKexAlgos specifies the default preference for key-exchange
9596
// algorithms in preference order.
9697
defaultKexAlgos = []string{
98+
KeyExchangeMLKEM768X25519,
9799
KeyExchangeCurve25519,
98100
KeyExchangeECDHP256,
99101
KeyExchangeECDHP384,

ssh/kex.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ func init() {
438438
kexAlgoMap[keyExchangeCurve25519LibSSH] = &curve25519sha256{}
439439
kexAlgoMap[InsecureKeyExchangeDHGEXSHA1] = &dhGEXSHA{hashFunc: crypto.SHA1}
440440
kexAlgoMap[KeyExchangeDHGEXSHA256] = &dhGEXSHA{hashFunc: crypto.SHA256}
441+
kexAlgoMap[KeyExchangeMLKEM768X25519] = &mlkem768WithCurve25519sha256{}
441442
}
442443

443444
// curve25519sha256 implements the curve25519-sha256 (formerly known as

ssh/mlkem.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build go1.24
6-
75
package ssh
86

97
import (
@@ -13,23 +11,10 @@ import (
1311
"errors"
1412
"fmt"
1513
"io"
16-
"runtime"
17-
"slices"
1814

1915
"golang.org/x/crypto/curve25519"
2016
)
2117

22-
func init() {
23-
// After Go 1.24rc1 mlkem swapped the order of return values of Encapsulate.
24-
// See #70950.
25-
if runtime.Version() == "go1.24rc1" {
26-
return
27-
}
28-
supportedKexAlgos = slices.Insert(supportedKexAlgos, 0, KeyExchangeMLKEM768X25519)
29-
defaultKexAlgos = slices.Insert(defaultKexAlgos, 0, KeyExchangeMLKEM768X25519)
30-
kexAlgoMap[KeyExchangeMLKEM768X25519] = &mlkem768WithCurve25519sha256{}
31-
}
32-
3318
// mlkem768WithCurve25519sha256 implements the hybrid ML-KEM768 with
3419
// curve25519-sha256 key exchange method, as described by
3520
// draft-kampanakis-curdle-ssh-pq-ke-05 section 2.3.3.

0 commit comments

Comments
 (0)