summaryrefslogtreecommitdiff
path: root/kex.c
diff options
context:
space:
mode:
authorSimon Wilkinson <simon@sxw.org.uk>2014-02-09 16:09:48 +0000
committerColin Watson <cjwatson@debian.org>2016-08-07 12:18:35 +0100
commiteecddf8b72fcad83ccca43b1badb03782704f6b7 (patch)
treefd0046825c8d42bd267afa7839d5603b130cf847 /kex.c
parenta8ed8d256b2e2c05b0c15565a7938028c5192277 (diff)
GSSAPI key exchange support
This patch has been rejected upstream: "None of the OpenSSH developers are in favour of adding this, and this situation has not changed for several years. This is not a slight on Simon's patch, which is of fine quality, but just that a) we don't trust GSSAPI implementations that much and b) we don't like adding new KEX since they are pre-auth attack surface. This one is particularly scary, since it requires hooks out to typically root-owned system resources." However, quite a lot of people rely on this in Debian, and it's better to have it merged into the main openssh package rather than having separate -krb5 packages (as we used to have). It seems to have a generally good security history. Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1242 Last-Updated: 2016-08-07 Patch-Name: gssapi.patch
Diffstat (limited to 'kex.c')
-rw-r--r--kex.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/kex.c b/kex.c
index 50c7a0f9b..c17d652c9 100644
--- a/kex.c
+++ b/kex.c
@@ -55,6 +55,10 @@
55#include "sshbuf.h" 55#include "sshbuf.h"
56#include "digest.h" 56#include "digest.h"
57 57
58#ifdef GSSAPI
59#include "ssh-gss.h"
60#endif
61
58#if OPENSSL_VERSION_NUMBER >= 0x00907000L 62#if OPENSSL_VERSION_NUMBER >= 0x00907000L
59# if defined(HAVE_EVP_SHA256) 63# if defined(HAVE_EVP_SHA256)
60# define evp_ssh_sha256 EVP_sha256 64# define evp_ssh_sha256 EVP_sha256
@@ -113,6 +117,14 @@ static const struct kexalg kexalgs[] = {
113#endif /* HAVE_EVP_SHA256 || !WITH_OPENSSL */ 117#endif /* HAVE_EVP_SHA256 || !WITH_OPENSSL */
114 { NULL, -1, -1, -1}, 118 { NULL, -1, -1, -1},
115}; 119};
120static const struct kexalg kexalg_prefixes[] = {
121#ifdef GSSAPI
122 { KEX_GSS_GEX_SHA1_ID, KEX_GSS_GEX_SHA1, 0, SSH_DIGEST_SHA1 },
123 { KEX_GSS_GRP1_SHA1_ID, KEX_GSS_GRP1_SHA1, 0, SSH_DIGEST_SHA1 },
124 { KEX_GSS_GRP14_SHA1_ID, KEX_GSS_GRP14_SHA1, 0, SSH_DIGEST_SHA1 },
125#endif
126 { NULL, -1, -1, -1 },
127};
116 128
117char * 129char *
118kex_alg_list(char sep) 130kex_alg_list(char sep)
@@ -145,6 +157,10 @@ kex_alg_by_name(const char *name)
145 if (strcmp(k->name, name) == 0) 157 if (strcmp(k->name, name) == 0)
146 return k; 158 return k;
147 } 159 }
160 for (k = kexalg_prefixes; k->name != NULL; k++) {
161 if (strncmp(k->name, name, strlen(k->name)) == 0)
162 return k;
163 }
148 return NULL; 164 return NULL;
149} 165}
150 166
@@ -587,6 +603,9 @@ kex_free(struct kex *kex)
587 sshbuf_free(kex->peer); 603 sshbuf_free(kex->peer);
588 sshbuf_free(kex->my); 604 sshbuf_free(kex->my);
589 free(kex->session_id); 605 free(kex->session_id);
606#ifdef GSSAPI
607 free(kex->gss_host);
608#endif /* GSSAPI */
590 free(kex->client_version_string); 609 free(kex->client_version_string);
591 free(kex->server_version_string); 610 free(kex->server_version_string);
592 free(kex->failed_choice); 611 free(kex->failed_choice);