diff options
| author | Aris Adamantiadis <aris@0xbadc0de.be> | 2013-09-21 23:34:50 +0200 |
|---|---|---|
| committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2013-09-27 16:06:09 +0200 |
| commit | 666db37e210c4d880cb1d9cfbfca9c11ed374ba7 (patch) | |
| tree | 579a9cfddd85ab6d33e4c5f697e3925d8e2abc4d /src/kex.c | |
| parent | 391bd8835572831e02b88f6bdb0dcb8785d9bbdb (diff) | |
kex: implement curve25519-sha256@libssh.org
Diffstat (limited to 'src/kex.c')
| -rw-r--r-- | src/kex.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -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; |
