]> andersk Git - gssapi-openssh.git/blame - openssh/kex.h
Merge from OPENSSH_3_8_1P1_GSSAPI_20040713 to OPENSSH_3_9P1_GSSAPI_20040818.
[gssapi-openssh.git] / openssh / kex.h
CommitLineData
1b56ff3d 1/* $OpenBSD: kex.h,v 1.35 2004/06/13 12:53:24 djm Exp $ */
3c0ef626 2
3/*
4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26#ifndef KEX_H
27#define KEX_H
28
29#include <openssl/evp.h>
30#include "buffer.h"
31#include "cipher.h"
32#include "key.h"
33
34#define KEX_DH1 "diffie-hellman-group1-sha1"
1b56ff3d 35#define KEX_DH14 "diffie-hellman-group14-sha1"
3c0ef626 36#define KEX_DHGEX "diffie-hellman-group-exchange-sha1"
37
38enum kex_init_proposals {
39 PROPOSAL_KEX_ALGS,
40 PROPOSAL_SERVER_HOST_KEY_ALGS,
41 PROPOSAL_ENC_ALGS_CTOS,
42 PROPOSAL_ENC_ALGS_STOC,
43 PROPOSAL_MAC_ALGS_CTOS,
44 PROPOSAL_MAC_ALGS_STOC,
45 PROPOSAL_COMP_ALGS_CTOS,
46 PROPOSAL_COMP_ALGS_STOC,
47 PROPOSAL_LANG_CTOS,
48 PROPOSAL_LANG_STOC,
49 PROPOSAL_MAX
50};
51
52enum kex_modes {
53 MODE_IN,
54 MODE_OUT,
55 MODE_MAX
56};
57
58enum kex_exchange {
1c14df9e 59 KEX_DH_GRP1_SHA1,
1b56ff3d 60 KEX_DH_GRP14_SHA1,
1c14df9e 61 KEX_DH_GEX_SHA1,
62 KEX_GSS_GRP1_SHA1,
63 KEX_MAX
3c0ef626 64};
65
66#define KEX_INIT_SENT 0x0001
67
68typedef struct Kex Kex;
69typedef struct Mac Mac;
70typedef struct Comp Comp;
71typedef struct Enc Enc;
72typedef struct Newkeys Newkeys;
73
74struct Enc {
75 char *name;
76 Cipher *cipher;
77 int enabled;
e9a17296 78 u_int key_len;
79 u_int block_size;
3c0ef626 80 u_char *key;
81 u_char *iv;
82};
83struct Mac {
84 char *name;
85 int enabled;
ff2d7a98 86 const EVP_MD *md;
3c0ef626 87 int mac_len;
88 u_char *key;
89 int key_len;
90};
91struct Comp {
92 int type;
93 int enabled;
94 char *name;
95};
96struct Newkeys {
97 Enc enc;
98 Mac mac;
99 Comp comp;
100};
b9a54c29 101
102struct KexOptions {
103 int gss_deleg_creds;
104};
105
3c0ef626 106struct Kex {
107 u_char *session_id;
e54b3d7c 108 u_int session_id_len;
3c0ef626 109 Newkeys *newkeys[MODE_MAX];
110 int we_need;
111 int server;
112 char *name;
113 int hostkey_type;
114 int kex_type;
115 Buffer my;
116 Buffer peer;
117 int done;
118 int flags;
119 char *client_version_string;
120 char *server_version_string;
88928908 121 struct KexOptions options;
3c0ef626 122 int (*verify_host_key)(Key *);
123 Key *(*load_host_key)(int);
2980ea68 124 int (*host_key_index)(Key *);
1c14df9e 125 void (*kex[KEX_MAX])(Kex *);
3c0ef626 126};
127
128Kex *kex_setup(char *[PROPOSAL_MAX]);
129void kex_finish(Kex *);
130
131void kex_send_kexinit(Kex *);
e9a17296 132void kex_input_kexinit(int, u_int32_t, void *);
3c0ef626 133void kex_derive_keys(Kex *, u_char *, BIGNUM *);
134
1c14df9e 135Newkeys *kex_get_newkeys(int);
136
137void kexdh_client(Kex *);
138void kexdh_server(Kex *);
139void kexgex_client(Kex *);
140void kexgex_server(Kex *);
b9a54c29 141#ifdef GSSAPI
88928908 142void kexgss_client(Kex *);
143void kexgss_server(Kex *);
b9a54c29 144#endif
3c0ef626 145
1c14df9e 146u_char *
147kex_dh_hash(char *, char *, char *, int, char *, int, u_char *, int,
148 BIGNUM *, BIGNUM *, BIGNUM *);
149u_char *
150kexgex_hash(char *, char *, char *, int, char *, int, u_char *, int,
151 int, int, int, BIGNUM *, BIGNUM *, BIGNUM *, BIGNUM *, BIGNUM *);
3c0ef626 152
1b56ff3d 153void
154derive_ssh1_session_id(BIGNUM *, BIGNUM *, u_int8_t[8], u_int8_t[16]);
155
3c0ef626 156#if defined(DEBUG_KEX) || defined(DEBUG_KEXDH)
157void dump_digest(char *, u_char *, int);
158#endif
159
160#endif
This page took 0.084131 seconds and 5 git commands to generate.