version 1.8, 1999/10/14 18:17:41 |
version 1.9, 1999/11/15 20:53:24 |
|
|
|
|
int |
int |
ssh_get_first_identity(AuthenticationConnection *auth, |
ssh_get_first_identity(AuthenticationConnection *auth, |
int *bitsp, BIGNUM *e, BIGNUM *n, char **comment) |
BIGNUM *e, BIGNUM *n, char **comment) |
{ |
{ |
unsigned char msg[8192]; |
unsigned char msg[8192]; |
int len, l; |
int len, l; |
|
|
fatal("Too many identities in authentication reply: %d\n", auth->howmany); |
fatal("Too many identities in authentication reply: %d\n", auth->howmany); |
|
|
/* Return the first entry (if any). */ |
/* Return the first entry (if any). */ |
return ssh_get_next_identity(auth, bitsp, e, n, comment); |
return ssh_get_next_identity(auth, e, n, comment); |
} |
} |
|
|
/* Returns the next authentication identity for the agent. Other functions |
/* Returns the next authentication identity for the agent. Other functions |
|
|
|
|
int |
int |
ssh_get_next_identity(AuthenticationConnection *auth, |
ssh_get_next_identity(AuthenticationConnection *auth, |
int *bitsp, BIGNUM *e, BIGNUM *n, char **comment) |
BIGNUM *e, BIGNUM *n, char **comment) |
{ |
{ |
|
unsigned int bits; |
|
|
/* Return failure if no more entries. */ |
/* Return failure if no more entries. */ |
if (auth->howmany <= 0) |
if (auth->howmany <= 0) |
return 0; |
return 0; |
|
|
/* Get the next entry from the packet. These will abort with a fatal |
/* Get the next entry from the packet. These will abort with a fatal |
error if the packet is too short or contains corrupt data. */ |
error if the packet is too short or contains corrupt data. */ |
*bitsp = buffer_get_int(&auth->identities); |
bits = buffer_get_int(&auth->identities); |
buffer_get_bignum(&auth->identities, e); |
buffer_get_bignum(&auth->identities, e); |
buffer_get_bignum(&auth->identities, n); |
buffer_get_bignum(&auth->identities, n); |
*comment = buffer_get_string(&auth->identities, NULL); |
*comment = buffer_get_string(&auth->identities, NULL); |
|
|
|
if (bits != BN_num_bits(n)) |
|
error("Warning: keysize mismatch: actual %d, announced %s", |
|
BN_num_bits(n), bits); |
|
|
/* Decrement the number of remaining entries. */ |
/* Decrement the number of remaining entries. */ |
auth->howmany--; |
auth->howmany--; |
|
|
|
|
|
|
int |
int |
ssh_decrypt_challenge(AuthenticationConnection *auth, |
ssh_decrypt_challenge(AuthenticationConnection *auth, |
int bits, BIGNUM *e, BIGNUM *n, BIGNUM *challenge, |
BIGNUM *e, BIGNUM *n, BIGNUM *challenge, |
unsigned char session_id[16], |
unsigned char session_id[16], |
unsigned int response_type, |
unsigned int response_type, |
unsigned char response[16]) |
unsigned char response[16]) |
|
|
buf[0] = SSH_AGENTC_RSA_CHALLENGE; |
buf[0] = SSH_AGENTC_RSA_CHALLENGE; |
buffer_init(&buffer); |
buffer_init(&buffer); |
buffer_append(&buffer, (char *)buf, 1); |
buffer_append(&buffer, (char *)buf, 1); |
buffer_put_int(&buffer, bits); |
buffer_put_int(&buffer, BN_num_bits(n)); |
buffer_put_bignum(&buffer, e); |
buffer_put_bignum(&buffer, e); |
buffer_put_bignum(&buffer, n); |
buffer_put_bignum(&buffer, n); |
buffer_put_bignum(&buffer, challenge); |
buffer_put_bignum(&buffer, challenge); |