=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/kex.h,v retrieving revision 1.2 retrieving revision 1.2.2.3 diff -u -r1.2 -r1.2.2.3 --- src/usr.bin/ssh/kex.h 2000/04/12 07:03:06 1.2 +++ src/usr.bin/ssh/kex.h 2001/03/12 15:44:11 1.2.2.3 @@ -1,3 +1,5 @@ +/* $OpenBSD: kex.h,v 1.2.2.3 2001/03/12 15:44:11 jason Exp $ */ + /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * @@ -9,11 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Markus Friedl. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -29,9 +26,12 @@ #ifndef KEX_H #define KEX_H -#define KEX_DH1 "diffie-hellman-group1-sha1" -#define KEX_DSS "ssh-dss" +#include +#include "buffer.h" +#define KEX_DH1 "diffie-hellman-group1-sha1" +#define KEX_DHGEX "diffie-hellman-group-exchange-sha1" + enum kex_init_proposals { PROPOSAL_KEX_ALGS, PROPOSAL_SERVER_HOST_KEY_ALGS, @@ -52,28 +52,30 @@ MODE_MAX }; +enum kex_exchange { + DH_GRP1_SHA1, + DH_GEX_SHA1 +}; + typedef struct Kex Kex; typedef struct Mac Mac; typedef struct Comp Comp; typedef struct Enc Enc; struct Enc { - int type; - int enabled; - int block_size; - unsigned char *key; - unsigned char *iv; - int key_len; - int iv_len; char *name; + Cipher *cipher; + int enabled; + u_char *key; + u_char *iv; }; struct Mac { - EVP_MD *md; + char *name; int enabled; + EVP_MD *md; int mac_len; - unsigned char *key; + u_char *key; int key_len; - char *name; }; struct Comp { int type; @@ -87,18 +89,27 @@ int we_need; int server; char *name; - char *hostkeyalg; + int hostkey_type; + int kex_type; }; Buffer *kex_init(char *myproposal[PROPOSAL_MAX]); -int dh_pub_is_valid(DH *dh, BIGNUM *dh_pub); -DH *dh_new_group1(); -Kex *kex_choose_conf(char *cprop[PROPOSAL_MAX], char *sprop[PROPOSAL_MAX], int server); -int kex_derive_keys(Kex *k, unsigned char *hash, BIGNUM *shared_secret); -void bignum_print(BIGNUM *b); +void +kex_exchange_kexinit( + Buffer *my_kexinit, Buffer *peer_kexint, + char *peer_proposal[PROPOSAL_MAX]); +Kex * +kex_choose_conf(char *cprop[PROPOSAL_MAX], + char *sprop[PROPOSAL_MAX], int server); +int kex_derive_keys(Kex *k, u_char *hash, BIGNUM *shared_secret); void packet_set_kex(Kex *k); +int dh_pub_is_valid(DH *dh, BIGNUM *dh_pub); +DH *dh_new_group_asc(const char *, const char *); +DH *dh_new_group(BIGNUM *, BIGNUM *); +void dh_gen_key(DH *); +DH *dh_new_group1(void); -unsigned char * +u_char * kex_hash( char *client_version_string, char *server_version_string, @@ -109,4 +120,15 @@ BIGNUM *server_dh_pub, BIGNUM *shared_secret); +u_char * +kex_hash_gex( + char *client_version_string, + char *server_version_string, + char *ckexinit, int ckexinitlen, + char *skexinit, int skexinitlen, + char *serverhostkeyblob, int sbloblen, + int minbits, BIGNUM *prime, BIGNUM *gen, + BIGNUM *client_dh_pub, + BIGNUM *server_dh_pub, + BIGNUM *shared_secret); #endif