]> andersk Git - gssapi-openssh.git/blame - openssh/kex.h
Initial revision
[gssapi-openssh.git] / openssh / kex.h
CommitLineData
8afc6a66 1/* $OpenBSD: kex.h,v 1.33 2003/02/16 17:09:57 markus 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"
35#define KEX_DHGEX "diffie-hellman-group-exchange-sha1"
36
37enum kex_init_proposals {
38 PROPOSAL_KEX_ALGS,
39 PROPOSAL_SERVER_HOST_KEY_ALGS,
40 PROPOSAL_ENC_ALGS_CTOS,
41 PROPOSAL_ENC_ALGS_STOC,
42 PROPOSAL_MAC_ALGS_CTOS,
43 PROPOSAL_MAC_ALGS_STOC,
44 PROPOSAL_COMP_ALGS_CTOS,
45 PROPOSAL_COMP_ALGS_STOC,
46 PROPOSAL_LANG_CTOS,
47 PROPOSAL_LANG_STOC,
48 PROPOSAL_MAX
49};
50
51enum kex_modes {
52 MODE_IN,
53 MODE_OUT,
54 MODE_MAX
55};
56
57enum kex_exchange {
8afc6a66 58 KEX_DH_GRP1_SHA1,
59 KEX_DH_GEX_SHA1,
60 KEX_GSS_GRP1_SHA1,
61 KEX_MAX
3c0ef626 62};
63
64#define KEX_INIT_SENT 0x0001
65
66typedef struct Kex Kex;
67typedef struct Mac Mac;
68typedef struct Comp Comp;
69typedef struct Enc Enc;
70typedef struct Newkeys Newkeys;
71
72struct Enc {
73 char *name;
74 Cipher *cipher;
75 int enabled;
e9702f7d 76 u_int key_len;
77 u_int block_size;
3c0ef626 78 u_char *key;
79 u_char *iv;
80};
81struct Mac {
82 char *name;
83 int enabled;
44a053a3 84 const EVP_MD *md;
3c0ef626 85 int mac_len;
86 u_char *key;
87 int key_len;
88};
89struct Comp {
90 int type;
91 int enabled;
92 char *name;
93};
94struct Newkeys {
95 Enc enc;
96 Mac mac;
97 Comp comp;
98};
5598e598 99
100struct KexOptions {
101 int gss_deleg_creds;
102};
103
3c0ef626 104struct Kex {
105 u_char *session_id;
d03f4262 106 u_int session_id_len;
3c0ef626 107 Newkeys *newkeys[MODE_MAX];
108 int we_need;
109 int server;
110 char *name;
111 int hostkey_type;
112 int kex_type;
113 Buffer my;
114 Buffer peer;
115 int done;
116 int flags;
117 char *client_version_string;
118 char *server_version_string;
23987cb8 119 struct KexOptions options;
3c0ef626 120 int (*verify_host_key)(Key *);
121 Key *(*load_host_key)(int);
350391c5 122 int (*host_key_index)(Key *);
8afc6a66 123 void (*kex[KEX_MAX])(Kex *);
3c0ef626 124};
125
126Kex *kex_setup(char *[PROPOSAL_MAX]);
127void kex_finish(Kex *);
128
129void kex_send_kexinit(Kex *);
e9702f7d 130void kex_input_kexinit(int, u_int32_t, void *);
3c0ef626 131void kex_derive_keys(Kex *, u_char *, BIGNUM *);
132
8afc6a66 133Newkeys *kex_get_newkeys(int);
134
135void kexdh_client(Kex *);
136void kexdh_server(Kex *);
137void kexgex_client(Kex *);
138void kexgex_server(Kex *);
b2b34e95 139#ifdef GSSAPI
23987cb8 140void kexgss_client(Kex *);
141void kexgss_server(Kex *);
b2b34e95 142#endif
905081a4 143
8afc6a66 144u_char *
145kex_dh_hash(char *, char *, char *, int, char *, int, u_char *, int,
146 BIGNUM *, BIGNUM *, BIGNUM *);
147u_char *
148kexgex_hash(char *, char *, char *, int, char *, int, u_char *, int,
149 int, int, int, BIGNUM *, BIGNUM *, BIGNUM *, BIGNUM *, BIGNUM *);
3c0ef626 150
151#if defined(DEBUG_KEX) || defined(DEBUG_KEXDH)
152void dump_digest(char *, u_char *, int);
153#endif
154
155#endif
This page took 0.087982 seconds and 5 git commands to generate.