version 1.31, 2000/12/15 17:30:14 |
version 1.32, 2000/12/19 23:17:58 |
|
|
* SSH2 key exchange |
* SSH2 key exchange |
*/ |
*/ |
|
|
unsigned char *session_id2 = NULL; |
u_char *session_id2 = NULL; |
int session_id2_len = 0; |
int session_id2_len = 0; |
|
|
void |
void |
|
|
int i; |
int i; |
#endif |
#endif |
int plen, dlen; |
int plen, dlen; |
unsigned int klen, kout; |
u_int klen, kout; |
char *signature = NULL; |
char *signature = NULL; |
unsigned int slen; |
u_int slen; |
char *server_host_key_blob = NULL; |
char *server_host_key_blob = NULL; |
Key *server_host_key; |
Key *server_host_key; |
unsigned int sbloblen; |
u_int sbloblen; |
DH *dh; |
DH *dh; |
BIGNUM *dh_server_pub = 0; |
BIGNUM *dh_server_pub = 0; |
BIGNUM *shared_secret = 0; |
BIGNUM *shared_secret = 0; |
unsigned char *kbuf; |
u_char *kbuf; |
unsigned char *hash; |
u_char *hash; |
|
|
debug("Sending SSH2_MSG_KEXDH_INIT."); |
debug("Sending SSH2_MSG_KEXDH_INIT."); |
/* generate and send 'e', client DH public key */ |
/* generate and send 'e', client DH public key */ |
|
|
fprintf(stderr, "%02x", (hash[i])&0xff); |
fprintf(stderr, "%02x", (hash[i])&0xff); |
fprintf(stderr, "\n"); |
fprintf(stderr, "\n"); |
#endif |
#endif |
if (key_verify(server_host_key, (unsigned char *)signature, slen, hash, 20) != 1) |
if (key_verify(server_host_key, (u_char *)signature, slen, hash, 20) != 1) |
fatal("key_verify failed for server_host_key"); |
fatal("key_verify failed for server_host_key"); |
key_free(server_host_key); |
key_free(server_host_key); |
|
|
|
|
int i; |
int i; |
#endif |
#endif |
int plen, dlen; |
int plen, dlen; |
unsigned int klen, kout; |
u_int klen, kout; |
char *signature = NULL; |
char *signature = NULL; |
unsigned int slen, nbits; |
u_int slen, nbits; |
char *server_host_key_blob = NULL; |
char *server_host_key_blob = NULL; |
Key *server_host_key; |
Key *server_host_key; |
unsigned int sbloblen; |
u_int sbloblen; |
DH *dh; |
DH *dh; |
BIGNUM *dh_server_pub = 0; |
BIGNUM *dh_server_pub = 0; |
BIGNUM *shared_secret = 0; |
BIGNUM *shared_secret = 0; |
BIGNUM *p = 0, *g = 0; |
BIGNUM *p = 0, *g = 0; |
unsigned char *kbuf; |
u_char *kbuf; |
unsigned char *hash; |
u_char *hash; |
|
|
nbits = dh_estimate(kex->enc[MODE_OUT].cipher->key_len * 8); |
nbits = dh_estimate(kex->enc[MODE_OUT].cipher->key_len * 8); |
|
|
|
|
fprintf(stderr, "%02x", (hash[i])&0xff); |
fprintf(stderr, "%02x", (hash[i])&0xff); |
fprintf(stderr, "\n"); |
fprintf(stderr, "\n"); |
#endif |
#endif |
if (key_verify(server_host_key, (unsigned char *)signature, slen, hash, 20) != 1) |
if (key_verify(server_host_key, (u_char *)signature, slen, hash, 20) != 1) |
fatal("key_verify failed for server_host_key"); |
fatal("key_verify failed for server_host_key"); |
key_free(server_host_key); |
key_free(server_host_key); |
|
|
|
|
|
|
typedef int sign_cb_fn( |
typedef int sign_cb_fn( |
Authctxt *authctxt, Key *key, |
Authctxt *authctxt, Key *key, |
unsigned char **sigp, int *lenp, unsigned char *data, int datalen); |
u_char **sigp, int *lenp, u_char *data, int datalen); |
|
|
struct Authctxt { |
struct Authctxt { |
const char *server_user; |
const char *server_user; |
|
|
sign_and_send_pubkey(Authctxt *authctxt, Key *k, sign_cb_fn *sign_callback) |
sign_and_send_pubkey(Authctxt *authctxt, Key *k, sign_cb_fn *sign_callback) |
{ |
{ |
Buffer b; |
Buffer b; |
unsigned char *blob, *signature; |
u_char *blob, *signature; |
int bloblen, slen; |
int bloblen, slen; |
int skip = 0; |
int skip = 0; |
int ret = -1; |
int ret = -1; |
|
|
} |
} |
|
|
/* sign callback */ |
/* sign callback */ |
int key_sign_cb(Authctxt *authctxt, Key *key, unsigned char **sigp, int *lenp, |
int key_sign_cb(Authctxt *authctxt, Key *key, u_char **sigp, int *lenp, |
unsigned char *data, int datalen) |
u_char *data, int datalen) |
{ |
{ |
return key_sign(key, sigp, lenp, data, datalen); |
return key_sign(key, sigp, lenp, data, datalen); |
} |
} |
|
|
} |
} |
|
|
/* sign callback */ |
/* sign callback */ |
int agent_sign_cb(Authctxt *authctxt, Key *key, unsigned char **sigp, int *lenp, |
int agent_sign_cb(Authctxt *authctxt, Key *key, u_char **sigp, int *lenp, |
unsigned char *data, int datalen) |
u_char *data, int datalen) |
{ |
{ |
return ssh_agent_sign(authctxt->agent, key, sigp, lenp, data, datalen); |
return ssh_agent_sign(authctxt->agent, key, sigp, lenp, data, datalen); |
} |
} |
|
|
char *lang = NULL; |
char *lang = NULL; |
char *prompt = NULL; |
char *prompt = NULL; |
char *response = NULL; |
char *response = NULL; |
unsigned int num_prompts, i; |
u_int num_prompts, i; |
int echo = 0; |
int echo = 0; |
|
|
debug2("input_userauth_info_req"); |
debug2("input_userauth_info_req"); |