[BACK]Return to authfd.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/authfd.c between version 1.1 and 1.2

version 1.1, 1999/09/26 20:53:33 version 1.2, 1999/09/28 04:45:35
Line 24 
Line 24 
 #include "xmalloc.h"  #include "xmalloc.h"
 #include "getput.h"  #include "getput.h"
   
   #include <ssl/rsa.h>
   
 /* Returns the number of the authentication fd, or -1 if there is none. */  /* Returns the number of the authentication fd, or -1 if there is none. */
   
 int ssh_get_authentication_fd()  int
   ssh_get_authentication_fd()
 {  {
   const char *authfd, *authsocket;    const char *authfd, *authsocket;
   int sock;    int sock;
Line 202 
Line 205 
    The caller must initialize the integers before the call, and free the     The caller must initialize the integers before the call, and free the
    comment after a successful call (before calling ssh_get_next_identity). */     comment after a successful call (before calling ssh_get_next_identity). */
   
 int ssh_get_first_identity(AuthenticationConnection *auth,  int
                            int *bitsp, MP_INT *e, MP_INT *n, char **comment)  ssh_get_first_identity(AuthenticationConnection *auth,
                          int *bitsp, BIGNUM *e, BIGNUM *n, char **comment)
 {  {
   unsigned char msg[8192];    unsigned char msg[8192];
   int len, l;    int len, l;
Line 273 
Line 277 
    function.  This returns 0 if there are no more identities.  The caller     function.  This returns 0 if there are no more identities.  The caller
    must free comment after a successful return. */     must free comment after a successful return. */
   
 int ssh_get_next_identity(AuthenticationConnection *auth,  int
                           int *bitsp, MP_INT *e, MP_INT *n, char **comment)  ssh_get_next_identity(AuthenticationConnection *auth,
                         int *bitsp, BIGNUM *e, BIGNUM *n, char **comment)
 {  {
   /* Return failure if no more entries. */    /* Return failure if no more entries. */
   if (auth->howmany <= 0)    if (auth->howmany <= 0)
Line 283 
Line 288 
   /* 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);    *bitsp = buffer_get_int(&auth->identities);
   buffer_get_mp_int(&auth->identities, e);    buffer_get_bignum(&auth->identities, e);
   buffer_get_mp_int(&auth->identities, n);    buffer_get_bignum(&auth->identities, n);
   *comment = buffer_get_string(&auth->identities, NULL);    *comment = buffer_get_string(&auth->identities, NULL);
   
   /* Decrement the number of remaining entries. */    /* Decrement the number of remaining entries. */
Line 299 
Line 304 
    desired, with 0 corresponding to protocol version 1.0 (no longer supported)     desired, with 0 corresponding to protocol version 1.0 (no longer supported)
    and 1 corresponding to protocol version 1.1. */     and 1 corresponding to protocol version 1.1. */
   
 int ssh_decrypt_challenge(AuthenticationConnection *auth,  int
                           int bits, MP_INT *e, MP_INT *n, MP_INT *challenge,  ssh_decrypt_challenge(AuthenticationConnection *auth,
                           unsigned char session_id[16],                        int bits, BIGNUM *e, BIGNUM *n, BIGNUM *challenge,
                           unsigned int response_type,                        unsigned char session_id[16],
                           unsigned char response[16])                        unsigned int response_type,
                         unsigned char response[16])
 {  {
   Buffer buffer;    Buffer buffer;
   unsigned char buf[8192];    unsigned char buf[8192];
Line 318 
Line 324 
   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, bits);
   buffer_put_mp_int(&buffer, e);    buffer_put_bignum(&buffer, e);
   buffer_put_mp_int(&buffer, n);    buffer_put_bignum(&buffer, n);
   buffer_put_mp_int(&buffer, challenge);    buffer_put_bignum(&buffer, challenge);
   buffer_append(&buffer, (char *)session_id, 16);    buffer_append(&buffer, (char *)session_id, 16);
   buffer_put_int(&buffer, response_type);    buffer_put_int(&buffer, response_type);
   
Line 405 
Line 411 
    be used by normal applications. */     be used by normal applications. */
   
 int ssh_add_identity(AuthenticationConnection *auth,  int ssh_add_identity(AuthenticationConnection *auth,
                      RSAPrivateKey *key, const char *comment)                       RSA *key, const char *comment)
 {  {
   Buffer buffer;    Buffer buffer;
   unsigned char buf[8192];    unsigned char buf[8192];
Line 414 
Line 420 
   /* Format a message to the agent. */    /* Format a message to the agent. */
   buffer_init(&buffer);    buffer_init(&buffer);
   buffer_put_char(&buffer, SSH_AGENTC_ADD_RSA_IDENTITY);    buffer_put_char(&buffer, SSH_AGENTC_ADD_RSA_IDENTITY);
   buffer_put_int(&buffer, key->bits);    buffer_put_int(&buffer, BN_num_bits(key->n));
   buffer_put_mp_int(&buffer, &key->n);    buffer_put_bignum(&buffer, key->n);
   buffer_put_mp_int(&buffer, &key->e);    buffer_put_bignum(&buffer, key->e);
   buffer_put_mp_int(&buffer, &key->d);    buffer_put_bignum(&buffer, key->d);
   buffer_put_mp_int(&buffer, &key->u);    /* To keep within the protocol: p < q for ssh. in SSL p > q */
   buffer_put_mp_int(&buffer, &key->p);    buffer_put_bignum(&buffer, key->iqmp); /* ssh key->u */
   buffer_put_mp_int(&buffer, &key->q);    buffer_put_bignum(&buffer, key->q); /* ssh key->p, SSL key->q */
     buffer_put_bignum(&buffer, key->p); /* ssh key->q, SSL key->p */
   buffer_put_string(&buffer, comment, strlen(comment));    buffer_put_string(&buffer, comment, strlen(comment));
   
   /* Get the length of the message, and format it in the buffer. */    /* Get the length of the message, and format it in the buffer. */
Line 495 
Line 502 
 /* Removes an identity from the authentication server.  This call is not meant  /* Removes an identity from the authentication server.  This call is not meant
    to be used by normal applications. */     to be used by normal applications. */
   
 int ssh_remove_identity(AuthenticationConnection *auth, RSAPublicKey *key)  int ssh_remove_identity(AuthenticationConnection *auth, RSA *key)
 {  {
   Buffer buffer;    Buffer buffer;
   unsigned char buf[8192];    unsigned char buf[8192];
Line 504 
Line 511 
   /* Format a message to the agent. */    /* Format a message to the agent. */
   buffer_init(&buffer);    buffer_init(&buffer);
   buffer_put_char(&buffer, SSH_AGENTC_REMOVE_RSA_IDENTITY);    buffer_put_char(&buffer, SSH_AGENTC_REMOVE_RSA_IDENTITY);
   buffer_put_int(&buffer, key->bits);    buffer_put_int(&buffer, BN_num_bits(key->n));
   buffer_put_mp_int(&buffer, &key->e);    buffer_put_bignum(&buffer, key->e);
   buffer_put_mp_int(&buffer, &key->n);    buffer_put_bignum(&buffer, key->n);
   
   /* Get the length of the message, and format it in the buffer. */    /* Get the length of the message, and format it in the buffer. */
   len = buffer_len(&buffer);    len = buffer_len(&buffer);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2