2 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #define KEX_DH1 "diffie-hellman-group1-sha1"
28 #define KEX_DHGEX "diffie-hellman-group-exchange-sha1"
29 #define KEX_DSS "ssh-dss"
31 enum kex_init_proposals {
33 PROPOSAL_SERVER_HOST_KEY_ALGS,
34 PROPOSAL_ENC_ALGS_CTOS,
35 PROPOSAL_ENC_ALGS_STOC,
36 PROPOSAL_MAC_ALGS_CTOS,
37 PROPOSAL_MAC_ALGS_STOC,
38 PROPOSAL_COMP_ALGS_CTOS,
39 PROPOSAL_COMP_ALGS_STOC,
56 typedef struct Kex Kex;
57 typedef struct Mac Mac;
58 typedef struct Comp Comp;
59 typedef struct Enc Enc;
92 Buffer *kex_init(char *myproposal[PROPOSAL_MAX]);
95 Buffer *my_kexinit, Buffer *peer_kexint,
96 char *peer_proposal[PROPOSAL_MAX]);
98 kex_choose_conf(char *cprop[PROPOSAL_MAX],
99 char *sprop[PROPOSAL_MAX], int server);
100 int kex_derive_keys(Kex *k, unsigned char *hash, BIGNUM *shared_secret);
101 void packet_set_kex(Kex *k);
102 int dh_pub_is_valid(DH *dh, BIGNUM *dh_pub);
103 DH *dh_new_group_asc(const char *, const char *);
104 DH *dh_new_group(BIGNUM *, BIGNUM *);
109 char *client_version_string,
110 char *server_version_string,
111 char *ckexinit, int ckexinitlen,
112 char *skexinit, int skexinitlen,
113 char *serverhostkeyblob, int sbloblen,
114 BIGNUM *client_dh_pub,
115 BIGNUM *server_dh_pub,
116 BIGNUM *shared_secret);
120 char *client_version_string,
121 char *server_version_string,
122 char *ckexinit, int ckexinitlen,
123 char *skexinit, int skexinitlen,
124 char *serverhostkeyblob, int sbloblen,
125 int minbits, BIGNUM *prime, BIGNUM *gen,
126 BIGNUM *client_dh_pub,
127 BIGNUM *server_dh_pub,
128 BIGNUM *shared_secret);