summaryrefslogtreecommitdiff
path: root/kex.c
diff options
context:
space:
mode:
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 cf4ac0dc5..556a32e98 100644
--- a/kex.c
+++ b/kex.c
@@ -54,6 +54,10 @@
54#include "sshbuf.h" 54#include "sshbuf.h"
55#include "digest.h" 55#include "digest.h"
56 56
57#ifdef GSSAPI
58#include "ssh-gss.h"
59#endif
60
57#if OPENSSL_VERSION_NUMBER >= 0x00907000L 61#if OPENSSL_VERSION_NUMBER >= 0x00907000L
58# if defined(HAVE_EVP_SHA256) 62# if defined(HAVE_EVP_SHA256)
59# define evp_ssh_sha256 EVP_sha256 63# 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
@@ -605,6 +621,9 @@ kex_free(struct kex *kex)
605 sshbuf_free(kex->peer); 621 sshbuf_free(kex->peer);
606 sshbuf_free(kex->my); 622 sshbuf_free(kex->my);
607 free(kex->session_id); 623 free(kex->session_id);
624#ifdef GSSAPI
625 free(kex->gss_host);
626#endif /* GSSAPI */
608 free(kex->client_version_string); 627 free(kex->client_version_string);
609 free(kex->server_version_string); 628 free(kex->server_version_string);
610 free(kex->failed_choice); 629 free(kex->failed_choice);