forked from atlassian-forks/xcrypto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ssh: support new curve25519-sha256 kex name
RFC 8731 standardized [email protected] as curve25519-sha256, and some systems only advertise support for the new name. Fixes golang/go#48756 Change-Id: Ice35874cd8c07ad48752686ac368bf11ab793f77 Co-authored-by: Filippo Valsorda <[email protected]> Reviewed-on: https://go-review.googlesource.com/c/crypto/+/385394 Trust: Filippo Valsorda <[email protected]> Run-TryBot: Filippo Valsorda <[email protected]> Trust: Matt Layher <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Roland Shoemaker <[email protected]>
- Loading branch information
1 parent
56e3008
commit 0e77833
Showing
2 changed files
with
12 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,12 +20,13 @@ import ( | |
) | ||
|
||
const ( | ||
kexAlgoDH1SHA1 = "diffie-hellman-group1-sha1" | ||
kexAlgoDH14SHA1 = "diffie-hellman-group14-sha1" | ||
kexAlgoECDH256 = "ecdh-sha2-nistp256" | ||
kexAlgoECDH384 = "ecdh-sha2-nistp384" | ||
kexAlgoECDH521 = "ecdh-sha2-nistp521" | ||
kexAlgoCurve25519SHA256 = "[email protected]" | ||
kexAlgoDH1SHA1 = "diffie-hellman-group1-sha1" | ||
kexAlgoDH14SHA1 = "diffie-hellman-group14-sha1" | ||
kexAlgoECDH256 = "ecdh-sha2-nistp256" | ||
kexAlgoECDH384 = "ecdh-sha2-nistp384" | ||
kexAlgoECDH521 = "ecdh-sha2-nistp521" | ||
kexAlgoCurve25519SHA256LibSSH = "[email protected]" | ||
kexAlgoCurve25519SHA256 = "curve25519-sha256" | ||
|
||
// For the following kex only the client half contains a production | ||
// ready implementation. The server half only consists of a minimal | ||
|
@@ -410,13 +411,13 @@ func init() { | |
kexAlgoMap[kexAlgoECDH384] = &ecdh{elliptic.P384()} | ||
kexAlgoMap[kexAlgoECDH256] = &ecdh{elliptic.P256()} | ||
kexAlgoMap[kexAlgoCurve25519SHA256] = &curve25519sha256{} | ||
kexAlgoMap[kexAlgoCurve25519SHA256LibSSH] = &curve25519sha256{} | ||
kexAlgoMap[kexAlgoDHGEXSHA1] = &dhGEXSHA{hashFunc: crypto.SHA1} | ||
kexAlgoMap[kexAlgoDHGEXSHA256] = &dhGEXSHA{hashFunc: crypto.SHA256} | ||
} | ||
|
||
// curve25519sha256 implements the [email protected] key | ||
// agreement protocol, as described in | ||
// https://git.libssh.org/projects/libssh.git/tree/doc/[email protected] | ||
// curve25519sha256 implements the curve25519-sha256 (formerly known as | ||
// [email protected]) key exchange method, as described in RFC 8731. | ||
type curve25519sha256 struct{} | ||
|
||
type curve25519KeyPair struct { | ||
|