summaryrefslogtreecommitdiffstats
path: root/src/kex.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2013-09-21 23:34:50 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2013-09-27 15:32:44 +0200
commit4cb6afcbd43ab503d4c3d3054b96a1492605ea8d (patch)
treedd142bcab88629a984936e708cca3d5ac9a1d1c6 /src/kex.c
parent4eae4d592cb9195cac49832bf3bd4052c418b948 (diff)
downloadlibssh-4cb6afcbd43ab503d4c3d3054b96a1492605ea8d.tar.gz
libssh-4cb6afcbd43ab503d4c3d3054b96a1492605ea8d.tar.xz
libssh-4cb6afcbd43ab503d4c3d3054b96a1492605ea8d.zip
kex: implement curve25519-sha256@libssh.org
Diffstat (limited to 'src/kex.c')
-rw-r--r--src/kex.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/kex.c b/src/kex.c
index 4de5a65..7cd404f 100644
--- a/src/kex.c
+++ b/src/kex.c
@@ -34,6 +34,7 @@
#include "libssh/session.h"
#include "libssh/ssh2.h"
#include "libssh/string.h"
+#include "libssh/curve25519.h"
#ifdef HAVE_LIBGCRYPT
# define BLOWFISH "blowfish-cbc,"
@@ -63,14 +64,21 @@
#define ZLIB "none"
#endif
+#ifdef HAVE_CURVE25519
+#define CURVE25519 "curve25519-sha256@libssh.org,"
+#else
+#define CURVE25519 ""
+#endif
+
#ifdef HAVE_ECDH
-#define KEY_EXCHANGE "ecdh-sha2-nistp256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1"
+#define ECDH "ecdh-sha2-nistp256,"
#define HOSTKEYS "ecdsa-sha2-nistp256,ssh-rsa,ssh-dss"
#else
-#define KEY_EXCHANGE "diffie-hellman-group14-sha1,diffie-hellman-group1-sha1"
#define HOSTKEYS "ssh-rsa,ssh-dss"
+#define ECDH ""
#endif
+#define KEY_EXCHANGE CURVE25519 ECDH "diffie-hellman-group14-sha1,diffie-hellman-group1-sha1"
#define KEX_METHODS_SIZE 10
/* NOTE: This is a fixed API and the index is defined by ssh_kex_types_e */
@@ -412,6 +420,8 @@ int ssh_kex_select_methods (ssh_session session){
session->next_crypto->kex_type=SSH_KEX_DH_GROUP14_SHA1;
} else if(strcmp(session->next_crypto->kex_methods[SSH_KEX], "ecdh-sha2-nistp256") == 0){
session->next_crypto->kex_type=SSH_KEX_ECDH_SHA2_NISTP256;
+ } 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;
}
return SSH_OK;