replace Kex typedef with 'struct kex'

This commit is contained in:
Markus Friedl
2012-10-12 16:22:45 +02:00
parent cfee790064
commit ad4ef1067c
15 changed files with 36 additions and 37 deletions

View File

@@ -192,7 +192,7 @@ kex_send_newkeys(struct ssh *ssh)
static int
kex_input_newkeys(int type, u_int32_t seq, struct ssh *ssh)
{
Kex *kex = ssh->kex;
struct kex *kex = ssh->kex;
int r;
debug("SSH2_MSG_NEWKEYS received");
@@ -212,7 +212,7 @@ int
kex_send_kexinit(struct ssh *ssh)
{
u_char *cookie;
Kex *kex = ssh->kex;
struct kex *kex = ssh->kex;
int r;
if (kex == NULL)
@@ -244,7 +244,7 @@ kex_send_kexinit(struct ssh *ssh)
int
kex_input_kexinit(int type, u_int32_t seq, struct ssh *ssh)
{
Kex *kex = ssh->kex;
struct kex *kex = ssh->kex;
const u_char *ptr;
u_int i;
size_t dlen;
@@ -294,9 +294,9 @@ kex_input_kexinit(int type, u_int32_t seq, struct ssh *ssh)
}
int
kex_new(struct ssh *ssh, char *proposal[PROPOSAL_MAX], Kex **kexp)
kex_new(struct ssh *ssh, char *proposal[PROPOSAL_MAX], struct kex **kexp)
{
Kex *kex;
struct kex *kex;
int r;
*kexp = NULL;
@@ -351,7 +351,7 @@ kex_free_newkeys(Newkeys *newkeys)
}
void
kex_free(Kex *kex)
kex_free(struct kex *kex)
{
u_int mode;
@@ -448,7 +448,7 @@ choose_comp(Comp *comp, char *client, char *server)
}
static int
choose_kex(Kex *k, char *client, char *server)
choose_kex(struct kex *k, char *client, char *server)
{
k->name = match_list(client, server, NULL);
@@ -478,7 +478,7 @@ choose_kex(Kex *k, char *client, char *server)
}
static int
choose_hostkeyalg(Kex *k, char *client, char *server)
choose_hostkeyalg(struct kex *k, char *client, char *server)
{
char *hostkeyalg = match_list(client, server, NULL);
@@ -524,7 +524,7 @@ kex_choose_conf(struct ssh *ssh)
int nenc, nmac, ncomp;
u_int mode, ctos, need;
int r, first_kex_follows;
Kex *kex = ssh->kex;
struct kex *kex = ssh->kex;
if ((r = kex_buf2prop(kex->my, NULL, &my)) != 0 ||
(r = kex_buf2prop(kex->peer, &first_kex_follows, &peer)) != 0)
@@ -607,7 +607,7 @@ static int
derive_key(struct ssh *ssh, int id, u_int need, u_char *hash, u_int hashlen,
BIGNUM *shared_secret, u_char **keyp)
{
Kex *kex = ssh->kex;
struct kex *kex = ssh->kex;
struct sshbuf *b = NULL;
EVP_MD_CTX md;
char c = id;
@@ -673,7 +673,7 @@ int
kex_derive_keys(struct ssh *ssh, u_char *hash, u_int hashlen,
BIGNUM *shared_secret)
{
Kex *kex = ssh->kex;
struct kex *kex = ssh->kex;
u_char *keys[NKEYS];
u_int i, j, mode, ctos;
int r;

View File

@@ -79,7 +79,6 @@ enum kex_exchange {
#define KEX_INIT_SENT 0x0001
typedef struct Kex Kex;
typedef struct sshmac Mac;
typedef struct Comp Comp;
typedef struct Enc Enc;
@@ -107,7 +106,7 @@ struct Newkeys {
struct ssh;
struct Kex {
struct kex {
u_char *session_id;
size_t session_id_len;
Newkeys *newkeys[MODE_MAX];
@@ -138,10 +137,10 @@ struct Kex {
int kex_names_valid(const char *);
int kex_new(struct ssh *, char *[PROPOSAL_MAX], Kex **);
int kex_new(struct ssh *, char *[PROPOSAL_MAX], struct kex **);
int kex_setup(struct ssh *, char *[PROPOSAL_MAX]);
void kex_free_newkeys(Newkeys *);
void kex_free(Kex *);
void kex_free(struct kex *);
int kex_buf2prop(struct sshbuf *, int *, char ***);
int kex_prop2buf(struct sshbuf *, char *proposal[PROPOSAL_MAX]);

View File

@@ -48,7 +48,7 @@ static int input_kex_dh(int, u_int32_t, struct ssh *);
int
kexdh_client(struct ssh *ssh)
{
Kex *kex = ssh->kex;
struct kex *kex = ssh->kex;
int r;
/* generate and send 'e', client DH public key */
@@ -89,7 +89,7 @@ kexdh_client(struct ssh *ssh)
static int
input_kex_dh(int type, u_int32_t seq, struct ssh *ssh)
{
Kex *kex = ssh->kex;
struct kex *kex = ssh->kex;
BIGNUM *dh_server_pub = NULL, *shared_secret = NULL;
struct sshkey *server_host_key = NULL;
u_char *kbuf = NULL, *server_host_key_blob = NULL, *signature = NULL;

View File

@@ -51,7 +51,7 @@ static int input_kex_dh_init(int, u_int32_t, struct ssh *);
int
kexdh_server(struct ssh *ssh)
{
Kex *kex = ssh->kex;
struct kex *kex = ssh->kex;
int r;
/* generate server DH public key */
@@ -83,7 +83,7 @@ kexdh_server(struct ssh *ssh)
int
input_kex_dh_init(int type, u_int32_t seq, struct ssh *ssh)
{
Kex *kex = ssh->kex;
struct kex *kex = ssh->kex;
BIGNUM *shared_secret = NULL, *dh_client_pub = NULL;
struct sshkey *server_host_public, *server_host_private;
u_char *kbuf = NULL, *signature = NULL, *server_host_key_blob = NULL;

View File

@@ -49,7 +49,7 @@ static int input_kex_ecdh_reply(int, u_int32_t, struct ssh *);
int
kexecdh_client(struct ssh *ssh)
{
Kex *kex = ssh->kex;
struct kex *kex = ssh->kex;
EC_KEY *client_key = NULL;
const EC_GROUP *group;
const EC_POINT *public_key;
@@ -96,7 +96,7 @@ kexecdh_client(struct ssh *ssh)
static int
input_kex_ecdh_reply(int type, u_int32_t seq, struct ssh *ssh)
{
Kex *kex = ssh->kex;
struct kex *kex = ssh->kex;
const EC_GROUP *group;
EC_POINT *server_public = NULL;
EC_KEY *client_key;

View File

@@ -59,7 +59,7 @@ kexecdh_server(struct ssh *ssh)
static int
input_kex_ecdh_init(int type, u_int32_t seq, struct ssh *ssh)
{
Kex *kex = ssh->kex;
struct kex *kex = ssh->kex;
EC_POINT *client_public;
EC_KEY *server_key = NULL;
const EC_GROUP *group;

View File

@@ -50,7 +50,7 @@ static int input_kex_dh_gex_reply(int, u_int32_t, struct ssh *);
int
kexgex_client(struct ssh *ssh)
{
Kex *kex = ssh->kex;
struct kex *kex = ssh->kex;
int r, nbits;
nbits = dh_estimate(kex->we_need * 8);
@@ -91,7 +91,7 @@ kexgex_client(struct ssh *ssh)
static int
input_kex_dh_gex_group(int type, u_int32_t seq, struct ssh *ssh)
{
Kex *kex = ssh->kex;
struct kex *kex = ssh->kex;
BIGNUM *p = NULL, *g = NULL;
int r;
@@ -143,7 +143,7 @@ out:
static int
input_kex_dh_gex_reply(int type, u_int32_t seq, struct ssh *ssh)
{
Kex *kex = ssh->kex;
struct kex *kex = ssh->kex;
BIGNUM *dh_server_pub = NULL, *shared_secret = NULL;
struct sshkey *server_host_key;
u_char *kbuf = NULL, *hash, *signature = NULL, *server_host_key_blob = NULL;

View File

@@ -65,7 +65,7 @@ kexgex_server(struct ssh *ssh)
static int
input_kex_dh_gex_request(int type, u_int32_t seq, struct ssh *ssh)
{
Kex *kex = ssh->kex;
struct kex *kex = ssh->kex;
int r, min = -1, max = -1, nbits = -1;
switch (type) {
@@ -137,7 +137,7 @@ input_kex_dh_gex_request(int type, u_int32_t seq, struct ssh *ssh)
static int
input_kex_dh_gex_init(int type, u_int32_t seq, struct ssh *ssh)
{
Kex *kex = ssh->kex;
struct kex *kex = ssh->kex;
BIGNUM *shared_secret = NULL, *dh_client_pub = NULL;
struct sshkey *server_host_public, *server_host_private;
u_char *kbuf = NULL, *signature = NULL, *server_host_key_blob = NULL;

View File

@@ -1474,7 +1474,7 @@ void
monitor_apply_keystate(struct monitor *pmonitor)
{
struct ssh *ssh = active_state; /* XXX */
Kex *kex;
struct kex *kex;
int r;
debug3("%s: packet_set_state", __func__);

View File

@@ -70,7 +70,7 @@ struct monitor {
int m_log_sendfd;
struct mm_master *m_zback;
struct mm_master *m_zlib;
struct Kex **m_pkex;
struct kex **m_pkex;
pid_t m_pid;
};

View File

@@ -216,7 +216,7 @@ int
mm_sshkey_sign(struct sshkey *key, u_char **sigp, size_t *lenp,
u_char *data, size_t datalen, u_int compat)
{
Kex *kex = *pmonitor->m_pkex;
struct kex *kex = *pmonitor->m_pkex;
struct sshbuf *m;
int r;

View File

@@ -2173,7 +2173,7 @@ ssh_packet_set_postauth(struct ssh *ssh)
/* turn kex into a blob for packet state serialization */
static int
kex_to_blob(struct sshbuf *m, Kex *kex)
kex_to_blob(struct sshbuf *m, struct kex *kex)
{
int r;
@@ -2363,12 +2363,12 @@ newkeys_from_blob(struct sshbuf *m, struct ssh *ssh, int mode)
/* restore kex from blob for packet state de-serialization */
static int
kex_from_blob(struct sshbuf *m, Kex **kexp)
kex_from_blob(struct sshbuf *m, struct kex **kexp)
{
Kex *kex;
struct kex *kex;
int r;
if ((kex = calloc(1, sizeof(Kex))) == NULL ||
if ((kex = calloc(1, sizeof(struct kex))) == NULL ||
(kex->my = sshbuf_new()) == NULL ||
(kex->peer = sshbuf_new()) == NULL) {
r = SSH_ERR_ALLOC_FAIL;

View File

@@ -48,7 +48,7 @@ struct ssh {
void *app_data;
/* Key exchange */
Kex *kex;
struct kex *kex;
Newkeys *current_keys[MODE_MAX];
/* Host key verification */

View File

@@ -382,7 +382,7 @@ _ssh_send_banner(struct ssh *ssh, char **bannerp)
int
_ssh_exchange_banner(struct ssh *ssh)
{
Kex *kex = ssh->kex;
struct kex *kex = ssh->kex;
int r;
/*

View File

@@ -2213,7 +2213,7 @@ do_ssh1_kex(struct ssh *ssh)
static void
do_ssh2_kex(struct ssh *ssh)
{
Kex *kex;
struct kex *kex;
int r;
if (options.ciphers != NULL) {