mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-05 20:55:46 +03:00
kex: add curve25519-sha256 as alias for curve25519-sha256@libssh.org
see: https://tools.ietf.org/id/draft-ietf-curdle-ssh-curves-07.html Signed-off-by: Tilo Eckert <tilo.eckert@flam.de> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
da0f360478
commit
e60cb2ee10
@@ -19,7 +19,7 @@ the interesting functions as you go.
|
|||||||
|
|
||||||
The libssh library provides:
|
The libssh library provides:
|
||||||
|
|
||||||
- <strong>Key Exchange Methods</strong>: <i>curve25519-sha256@libssh.org, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521</i>, diffie-hellman-group1-sha1, diffie-hellman-group14-sha1
|
- <strong>Key Exchange Methods</strong>: <i>curve25519-sha256, curve25519-sha256@libssh.org, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521</i>, diffie-hellman-group1-sha1, diffie-hellman-group14-sha1
|
||||||
- <strong>Hostkey Types</strong>: <i>ssh-ed25519, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521</i>, ssh-dss, ssh-rsa
|
- <strong>Hostkey Types</strong>: <i>ssh-ed25519, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521</i>, ssh-dss, ssh-rsa
|
||||||
- <strong>Ciphers</strong>: <i>aes256-ctr, aes192-ctr, aes128-ctr</i>, aes256-cbc (rijndael-cbc@lysator.liu.se), aes192-cbc, aes128-cbc, 3des-cbc, blowfish-cbc, none
|
- <strong>Ciphers</strong>: <i>aes256-ctr, aes192-ctr, aes128-ctr</i>, aes256-cbc (rijndael-cbc@lysator.liu.se), aes192-cbc, aes128-cbc, 3des-cbc, blowfish-cbc, none
|
||||||
- <strong>Compression Schemes</strong>: zlib, <i>zlib@openssh.com</i>, none
|
- <strong>Compression Schemes</strong>: zlib, <i>zlib@openssh.com</i>, none
|
||||||
|
@@ -60,7 +60,9 @@ enum ssh_key_exchange_e {
|
|||||||
/* ecdh-sha2-nistp521 */
|
/* ecdh-sha2-nistp521 */
|
||||||
SSH_KEX_ECDH_SHA2_NISTP521,
|
SSH_KEX_ECDH_SHA2_NISTP521,
|
||||||
/* curve25519-sha256@libssh.org */
|
/* curve25519-sha256@libssh.org */
|
||||||
SSH_KEX_CURVE25519_SHA256_LIBSSH_ORG
|
SSH_KEX_CURVE25519_SHA256_LIBSSH_ORG,
|
||||||
|
/* curve25519-sha256 */
|
||||||
|
SSH_KEX_CURVE25519_SHA256
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ssh_cipher_e {
|
enum ssh_cipher_e {
|
||||||
|
@@ -260,6 +260,7 @@ static int dh_handshake(ssh_session session) {
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CURVE25519
|
#ifdef HAVE_CURVE25519
|
||||||
|
case SSH_KEX_CURVE25519_SHA256:
|
||||||
case SSH_KEX_CURVE25519_SHA256_LIBSSH_ORG:
|
case SSH_KEX_CURVE25519_SHA256_LIBSSH_ORG:
|
||||||
rc = ssh_client_curve25519_init(session);
|
rc = ssh_client_curve25519_init(session);
|
||||||
break;
|
break;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* curve25519.c - Curve25519 ECDH functions for key exchange
|
* curve25519.c - Curve25519 ECDH functions for key exchange
|
||||||
* curve25519-sha256@libssh.org
|
* curve25519-sha256@libssh.org and curve25519-sha256
|
||||||
*
|
*
|
||||||
* This file is part of the SSH Library
|
* This file is part of the SSH Library
|
||||||
*
|
*
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
#include "libssh/bignum.h"
|
#include "libssh/bignum.h"
|
||||||
|
|
||||||
/** @internal
|
/** @internal
|
||||||
* @brief Starts curve25519-sha256@libssh.org key exchange
|
* @brief Starts curve25519-sha256@libssh.org / curve25519-sha256 key exchange
|
||||||
*/
|
*/
|
||||||
int ssh_client_curve25519_init(ssh_session session){
|
int ssh_client_curve25519_init(ssh_session session){
|
||||||
int rc;
|
int rc;
|
||||||
|
4
src/dh.c
4
src/dh.c
@@ -686,7 +686,8 @@ int ssh_make_sessionid(ssh_session session) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CURVE25519
|
#ifdef HAVE_CURVE25519
|
||||||
} else if (session->next_crypto->kex_type == SSH_KEX_CURVE25519_SHA256_LIBSSH_ORG) {
|
} else if ((session->next_crypto->kex_type == SSH_KEX_CURVE25519_SHA256) ||
|
||||||
|
(session->next_crypto->kex_type == SSH_KEX_CURVE25519_SHA256_LIBSSH_ORG)) {
|
||||||
rc = ssh_buffer_pack(buf,
|
rc = ssh_buffer_pack(buf,
|
||||||
"dPdP",
|
"dPdP",
|
||||||
CURVE25519_PUBKEY_SIZE,
|
CURVE25519_PUBKEY_SIZE,
|
||||||
@@ -722,6 +723,7 @@ int ssh_make_sessionid(ssh_session session) {
|
|||||||
session->next_crypto->secret_hash);
|
session->next_crypto->secret_hash);
|
||||||
break;
|
break;
|
||||||
case SSH_KEX_ECDH_SHA2_NISTP256:
|
case SSH_KEX_ECDH_SHA2_NISTP256:
|
||||||
|
case SSH_KEX_CURVE25519_SHA256:
|
||||||
case SSH_KEX_CURVE25519_SHA256_LIBSSH_ORG:
|
case SSH_KEX_CURVE25519_SHA256_LIBSSH_ORG:
|
||||||
session->next_crypto->digest_len = SHA256_DIGEST_LENGTH;
|
session->next_crypto->digest_len = SHA256_DIGEST_LENGTH;
|
||||||
session->next_crypto->mac_type = SSH_MAC_SHA256;
|
session->next_crypto->mac_type = SSH_MAC_SHA256;
|
||||||
|
@@ -78,7 +78,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CURVE25519
|
#ifdef HAVE_CURVE25519
|
||||||
#define CURVE25519 "curve25519-sha256@libssh.org,"
|
#define CURVE25519 "curve25519-sha256,curve25519-sha256@libssh.org,"
|
||||||
#else
|
#else
|
||||||
#define CURVE25519 ""
|
#define CURVE25519 ""
|
||||||
#endif
|
#endif
|
||||||
@@ -673,6 +673,8 @@ int ssh_kex_select_methods (ssh_session session){
|
|||||||
session->next_crypto->kex_type=SSH_KEX_ECDH_SHA2_NISTP521;
|
session->next_crypto->kex_type=SSH_KEX_ECDH_SHA2_NISTP521;
|
||||||
} else if(strcmp(session->next_crypto->kex_methods[SSH_KEX], "curve25519-sha256@libssh.org") == 0){
|
} else if(strcmp(session->next_crypto->kex_methods[SSH_KEX], "curve25519-sha256@libssh.org") == 0){
|
||||||
session->next_crypto->kex_type=SSH_KEX_CURVE25519_SHA256_LIBSSH_ORG;
|
session->next_crypto->kex_type=SSH_KEX_CURVE25519_SHA256_LIBSSH_ORG;
|
||||||
|
} else if(strcmp(session->next_crypto->kex_methods[SSH_KEX], "curve25519-sha256") == 0){
|
||||||
|
session->next_crypto->kex_type=SSH_KEX_CURVE25519_SHA256;
|
||||||
}
|
}
|
||||||
SSH_LOG(SSH_LOG_INFO, "Negotiated %s,%s,%s,%s,%s,%s,%s,%s,%s,%s",
|
SSH_LOG(SSH_LOG_INFO, "Negotiated %s,%s,%s,%s,%s,%s,%s,%s,%s,%s",
|
||||||
session->next_crypto->kex_methods[SSH_KEX],
|
session->next_crypto->kex_methods[SSH_KEX],
|
||||||
|
@@ -116,6 +116,7 @@ SSH_PACKET_CALLBACK(ssh_packet_dh_reply){
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CURVE25519
|
#ifdef HAVE_CURVE25519
|
||||||
|
case SSH_KEX_CURVE25519_SHA256:
|
||||||
case SSH_KEX_CURVE25519_SHA256_LIBSSH_ORG:
|
case SSH_KEX_CURVE25519_SHA256_LIBSSH_ORG:
|
||||||
rc = ssh_client_curve25519_reply(session, packet);
|
rc = ssh_client_curve25519_reply(session, packet);
|
||||||
break;
|
break;
|
||||||
|
@@ -221,6 +221,7 @@ SSH_PACKET_CALLBACK(ssh_packet_kexdh_init){
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CURVE25519
|
#ifdef HAVE_CURVE25519
|
||||||
|
case SSH_KEX_CURVE25519_SHA256:
|
||||||
case SSH_KEX_CURVE25519_SHA256_LIBSSH_ORG:
|
case SSH_KEX_CURVE25519_SHA256_LIBSSH_ORG:
|
||||||
rc = ssh_server_curve25519_init(session, packet);
|
rc = ssh_server_curve25519_init(session, packet);
|
||||||
break;
|
break;
|
||||||
|
@@ -356,6 +356,8 @@ const char* ssh_get_kex_algo(ssh_session session) {
|
|||||||
return "ecdh-sha2-nistp384";
|
return "ecdh-sha2-nistp384";
|
||||||
case SSH_KEX_ECDH_SHA2_NISTP521:
|
case SSH_KEX_ECDH_SHA2_NISTP521:
|
||||||
return "ecdh-sha2-nistp521";
|
return "ecdh-sha2-nistp521";
|
||||||
|
case SSH_KEX_CURVE25519_SHA256:
|
||||||
|
return "curve25519-sha256";
|
||||||
case SSH_KEX_CURVE25519_SHA256_LIBSSH_ORG:
|
case SSH_KEX_CURVE25519_SHA256_LIBSSH_ORG:
|
||||||
return "curve25519-sha256@libssh.org";
|
return "curve25519-sha256@libssh.org";
|
||||||
default:
|
default:
|
||||||
|
Reference in New Issue
Block a user