aboutsummaryrefslogtreecommitdiff
path: root/src/bind.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2014-09-03 09:32:32 +0200
committerAndreas Schneider <asn@cryptomilk.org>2015-02-02 14:45:52 +0100
commitc02b260e7ef8548d61d6491d76d0150da66c19c7 (patch)
tree21a8ac17e9a2953210135ba38eef37da0d5f151d /src/bind.c
parent01a6004171c6a899192c87dfe5a8ff27c30b1eaf (diff)
downloadlibssh-c02b260e7ef8548d61d6491d76d0150da66c19c7.tar.gz
libssh-c02b260e7ef8548d61d6491d76d0150da66c19c7.tar.xz
libssh-c02b260e7ef8548d61d6491d76d0150da66c19c7.zip
server: Add support for ed25519 keys in the server.
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/bind.c')
-rw-r--r--src/bind.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/bind.c b/src/bind.c
index b3239462..be348651 100644
--- a/src/bind.c
+++ b/src/bind.c
@@ -365,6 +365,7 @@ void ssh_bind_free(ssh_bind sshbind){
SAFE_FREE(sshbind->dsakey);
SAFE_FREE(sshbind->rsakey);
SAFE_FREE(sshbind->ecdsakey);
+ SAFE_FREE(sshbind->ed25519key);
ssh_key_free(sshbind->dsa);
sshbind->dsa = NULL;
@@ -372,6 +373,8 @@ void ssh_bind_free(ssh_bind sshbind){
sshbind->rsa = NULL;
ssh_key_free(sshbind->ecdsa);
sshbind->ecdsa = NULL;
+ ssh_key_free(sshbind->ed25519);
+ sshbind->ed25519 = NULL;
for (i = 0; i < 10; i++) {
if (sshbind->wanted_methods[i]) {
@@ -459,6 +462,14 @@ int ssh_bind_accept_fd(ssh_bind sshbind, ssh_session session, socket_t fd){
return SSH_ERROR;
}
}
+ if (sshbind->ed25519 != NULL) {
+ session->srv.ed25519_key = ssh_key_dup(sshbind->ed25519);
+ if (session->srv.ed25519_key == NULL){
+ ssh_set_error_oom(sshbind);
+ return SSH_ERROR;
+ }
+ }
+
/* force PRNG to change state in case we fork after ssh_bind_accept */
ssh_reseed();
return SSH_OK;