version 1.7.2.6, 2002/03/08 17:04:42 |
version 1.8, 2000/11/12 19:50:37 |
|
|
/* $OpenBSD$ */ |
|
|
|
/* |
/* |
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. |
* Copyright (c) 2000 Markus Friedl. All rights reserved. |
* |
* |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* modification, are permitted provided that the following conditions |
|
|
#ifndef KEX_H |
#ifndef KEX_H |
#define KEX_H |
#define KEX_H |
|
|
#include <openssl/evp.h> |
|
#include "buffer.h" |
|
#include "cipher.h" |
|
#include "key.h" |
|
|
|
#define KEX_DH1 "diffie-hellman-group1-sha1" |
#define KEX_DH1 "diffie-hellman-group1-sha1" |
#define KEX_DHGEX "diffie-hellman-group-exchange-sha1" |
#define KEX_DHGEX "diffie-hellman-group-exchange-sha1" |
|
#define KEX_DSS "ssh-dss" |
|
|
enum kex_init_proposals { |
enum kex_init_proposals { |
PROPOSAL_KEX_ALGS, |
PROPOSAL_KEX_ALGS, |
|
|
DH_GRP1_SHA1, |
DH_GRP1_SHA1, |
DH_GEX_SHA1 |
DH_GEX_SHA1 |
}; |
}; |
|
|
#define KEX_INIT_SENT 0x0001 |
|
|
|
typedef struct Kex Kex; |
typedef struct Kex Kex; |
typedef struct Mac Mac; |
typedef struct Mac Mac; |
typedef struct Comp Comp; |
typedef struct Comp Comp; |
typedef struct Enc Enc; |
typedef struct Enc Enc; |
typedef struct Newkeys Newkeys; |
|
|
|
struct Enc { |
struct Enc { |
char *name; |
char *name; |
Cipher *cipher; |
Cipher *cipher; |
int enabled; |
int enabled; |
u_int key_len; |
unsigned char *key; |
u_int block_size; |
unsigned char *iv; |
u_char *key; |
|
u_char *iv; |
|
}; |
}; |
struct Mac { |
struct Mac { |
char *name; |
char *name; |
int enabled; |
int enabled; |
EVP_MD *md; |
EVP_MD *md; |
int mac_len; |
int mac_len; |
u_char *key; |
unsigned char *key; |
int key_len; |
int key_len; |
}; |
}; |
struct Comp { |
struct Comp { |
int type; |
int type; |
int enabled; |
int enabled; |
char *name; |
char *name; |
}; |
}; |
struct Newkeys { |
|
Enc enc; |
|
Mac mac; |
|
Comp comp; |
|
}; |
|
struct Kex { |
struct Kex { |
u_char *session_id; |
Enc enc [MODE_MAX]; |
int session_id_len; |
Mac mac [MODE_MAX]; |
Newkeys *newkeys[MODE_MAX]; |
Comp comp[MODE_MAX]; |
int we_need; |
int we_need; |
int server; |
int server; |
char *name; |
char *name; |
int hostkey_type; |
int hostkey_type; |
int kex_type; |
int kex_type; |
Buffer my; |
|
Buffer peer; |
|
int done; |
|
int flags; |
|
char *client_version_string; |
|
char *server_version_string; |
|
int (*verify_host_key)(Key *); |
|
Key *(*load_host_key)(int); |
|
}; |
}; |
|
|
Kex *kex_setup(char *[PROPOSAL_MAX]); |
Buffer *kex_init(char *myproposal[PROPOSAL_MAX]); |
void kex_finish(Kex *); |
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, unsigned 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 *); |
|
DH *dh_new_group1(); |
|
|
void kex_send_kexinit(Kex *); |
unsigned char * |
void kex_input_kexinit(int, u_int32_t, void *); |
kex_hash( |
void kex_derive_keys(Kex *, u_char *, BIGNUM *); |
char *client_version_string, |
|
char *server_version_string, |
|
char *ckexinit, int ckexinitlen, |
|
char *skexinit, int skexinitlen, |
|
char *serverhostkeyblob, int sbloblen, |
|
BIGNUM *client_dh_pub, |
|
BIGNUM *server_dh_pub, |
|
BIGNUM *shared_secret); |
|
|
void kexdh(Kex *); |
unsigned char * |
void kexgex(Kex *); |
kex_hash_gex( |
|
char *client_version_string, |
Newkeys *kex_get_newkeys(int); |
char *server_version_string, |
|
char *ckexinit, int ckexinitlen, |
#if defined(DEBUG_KEX) || defined(DEBUG_KEXDH) |
char *skexinit, int skexinitlen, |
void dump_digest(char *, u_char *, int); |
char *serverhostkeyblob, int sbloblen, |
#endif |
int minbits, BIGNUM *prime, BIGNUM *gen, |
|
BIGNUM *client_dh_pub, |
|
BIGNUM *server_dh_pub, |
|
BIGNUM *shared_secret); |
#endif |
#endif |