summaryrefslogtreecommitdiff
path: root/kex.h
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-12-27 03:25:24 +0000
committerDamien Miller <djm@mindrot.org>2018-12-27 14:38:22 +1100
commit0a843d9a0e805f14653a555f5c7a8ba99d62c12d (patch)
tree481f36e9fd1918be5449e369a97c086a1a8d2432 /kex.h
parent434b587afe41c19391821e7392005068fda76248 (diff)
upstream: move client/server SSH-* banners to buffers under
ssh->kex and factor out the banner exchange. This eliminates some common code from the client and server. Also be more strict about handling \r characters - these should only be accepted immediately before \n (pointed out by Jann Horn). Inspired by a patch from Markus Schmidt. (lots of) feedback and ok markus@ OpenBSD-Commit-ID: 1cc7885487a6754f63641d7d3279b0941890275b
Diffstat (limited to 'kex.h')
-rw-r--r--kex.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/kex.h b/kex.h
index 0f67f58db..9ba860954 100644
--- a/kex.h
+++ b/kex.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: kex.h,v 1.92 2018/12/07 03:39:40 djm Exp $ */ 1/* $OpenBSD: kex.h,v 1.93 2018/12/27 03:25:25 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
@@ -145,12 +145,12 @@ struct kex {
145 int ext_info_c; 145 int ext_info_c;
146 struct sshbuf *my; 146 struct sshbuf *my;
147 struct sshbuf *peer; 147 struct sshbuf *peer;
148 struct sshbuf *client_version;
149 struct sshbuf *server_version;
148 sig_atomic_t done; 150 sig_atomic_t done;
149 u_int flags; 151 u_int flags;
150 int hash_alg; 152 int hash_alg;
151 int ec_nid; 153 int ec_nid;
152 char *client_version_string;
153 char *server_version_string;
154 char *failed_choice; 154 char *failed_choice;
155 int (*verify_host_key)(struct sshkey *, struct ssh *); 155 int (*verify_host_key)(struct sshkey *, struct ssh *);
156 struct sshkey *(*load_host_public_key)(int, int, struct ssh *); 156 struct sshkey *(*load_host_public_key)(int, int, struct ssh *);
@@ -173,7 +173,10 @@ char *kex_alg_list(char);
173char *kex_names_cat(const char *, const char *); 173char *kex_names_cat(const char *, const char *);
174int kex_assemble_names(char **, const char *, const char *); 174int kex_assemble_names(char **, const char *, const char *);
175 175
176int kex_new(struct ssh *, char *[PROPOSAL_MAX], struct kex **); 176int kex_exchange_identification(struct ssh *, int, const char *);
177
178struct kex *kex_new(void);
179int kex_ready(struct ssh *, char *[PROPOSAL_MAX]);
177int kex_setup(struct ssh *, char *[PROPOSAL_MAX]); 180int kex_setup(struct ssh *, char *[PROPOSAL_MAX]);
178void kex_free_newkeys(struct newkeys *); 181void kex_free_newkeys(struct newkeys *);
179void kex_free(struct kex *); 182void kex_free(struct kex *);
@@ -199,22 +202,23 @@ int kexecdh_server(struct ssh *);
199int kexc25519_client(struct ssh *); 202int kexc25519_client(struct ssh *);
200int kexc25519_server(struct ssh *); 203int kexc25519_server(struct ssh *);
201 204
202int kex_dh_hash(int, const char *, const char *, 205int kex_dh_hash(int, const struct sshbuf *, const struct sshbuf *,
203 const u_char *, size_t, const u_char *, size_t, const u_char *, size_t, 206 const u_char *, size_t, const u_char *, size_t, const u_char *, size_t,
204 const BIGNUM *, const BIGNUM *, const BIGNUM *, u_char *, size_t *); 207 const BIGNUM *, const BIGNUM *, const BIGNUM *, u_char *, size_t *);
205 208
206int kexgex_hash(int, const char *, const char *, 209int kexgex_hash(int, const struct sshbuf *, const struct sshbuf *,
207 const u_char *, size_t, const u_char *, size_t, const u_char *, size_t, 210 const u_char *, size_t, const u_char *, size_t, const u_char *, size_t,
208 int, int, int, 211 int, int, int,
209 const BIGNUM *, const BIGNUM *, const BIGNUM *, 212 const BIGNUM *, const BIGNUM *, const BIGNUM *,
210 const BIGNUM *, const BIGNUM *, 213 const BIGNUM *, const BIGNUM *,
211 u_char *, size_t *); 214 u_char *, size_t *);
212 215
213int kex_ecdh_hash(int, const EC_GROUP *, const char *, const char *, 216int kex_ecdh_hash(int, const EC_GROUP *,
217 const struct sshbuf *, const struct sshbuf *,
214 const u_char *, size_t, const u_char *, size_t, const u_char *, size_t, 218 const u_char *, size_t, const u_char *, size_t, const u_char *, size_t,
215 const EC_POINT *, const EC_POINT *, const BIGNUM *, u_char *, size_t *); 219 const EC_POINT *, const EC_POINT *, const BIGNUM *, u_char *, size_t *);
216 220
217int kex_c25519_hash(int, const char *, const char *, 221int kex_c25519_hash(int, const struct sshbuf *, const struct sshbuf *,
218 const u_char *, size_t, const u_char *, size_t, 222 const u_char *, size_t, const u_char *, size_t,
219 const u_char *, size_t, const u_char *, const u_char *, 223 const u_char *, size_t, const u_char *, const u_char *,
220 const u_char *, size_t, u_char *, size_t *); 224 const u_char *, size_t, u_char *, size_t *);