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

Diff for /src/usr.bin/ssh/Attic/key.c between version 1.43.2.3 and 1.44

version 1.43.2.3, 2003/04/03 22:35:17 version 1.44, 2002/05/31 13:16:48
Line 39 
Line 39 
 #include "xmalloc.h"  #include "xmalloc.h"
 #include "key.h"  #include "key.h"
 #include "rsa.h"  #include "rsa.h"
   #include "ssh-dss.h"
   #include "ssh-rsa.h"
 #include "uuencode.h"  #include "uuencode.h"
 #include "buffer.h"  #include "buffer.h"
 #include "bufaux.h"  #include "bufaux.h"
Line 87 
Line 89 
         }          }
         return k;          return k;
 }  }
   
 Key *  Key *
 key_new_private(int type)  key_new_private(int type)
 {  {
Line 119 
Line 120 
         }          }
         return k;          return k;
 }  }
   
 void  void
 key_free(Key *k)  key_free(Key *k)
 {  {
Line 169 
Line 169 
         return 0;          return 0;
 }  }
   
 static u_char *  static u_char*
 key_fingerprint_raw(Key *k, enum fp_type dgst_type, u_int *dgst_raw_length)  key_fingerprint_raw(Key *k, enum fp_type dgst_type, u_int *dgst_raw_length)
 {  {
         const EVP_MD *md = NULL;          const EVP_MD *md = NULL;
Line 225 
Line 225 
         return retval;          return retval;
 }  }
   
 static char *  static char*
 key_fingerprint_hex(u_char *dgst_raw, u_int dgst_raw_len)  key_fingerprint_hex(u_char* dgst_raw, u_int dgst_raw_len)
 {  {
         char *retval;          char *retval;
         int i;          int i;
Line 242 
Line 242 
         return retval;          return retval;
 }  }
   
 static char *  static char*
 key_fingerprint_bubblebabble(u_char *dgst_raw, u_int dgst_raw_len)  key_fingerprint_bubblebabble(u_char* dgst_raw, u_int dgst_raw_len)
 {  {
         char vowels[] = { 'a', 'e', 'i', 'o', 'u', 'y' };          char vowels[] = { 'a', 'e', 'i', 'o', 'u', 'y' };
         char consonants[] = { 'b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm',          char consonants[] = { 'b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm',
Line 289 
Line 289 
         return retval;          return retval;
 }  }
   
 char *  char*
 key_fingerprint(Key *k, enum fp_type dgst_type, enum fp_rep dgst_rep)  key_fingerprint(Key *k, enum fp_type dgst_type, enum fp_rep dgst_rep)
 {  {
         char *retval = NULL;          char *retval = NULL;
Line 359 
Line 359 
         *cpp = cp;          *cpp = cp;
         return 1;          return 1;
 }  }
   
 static int  static int
 write_bignum(FILE *f, BIGNUM *num)  write_bignum(FILE *f, BIGNUM *num)
 {  {
Line 408 
Line 407 
         case KEY_DSA:          case KEY_DSA:
                 space = strchr(cp, ' ');                  space = strchr(cp, ' ');
                 if (space == NULL) {                  if (space == NULL) {
                         debug3("key_read: missing whitespace");                          debug3("key_read: no space");
                         return -1;                          return -1;
                 }                  }
                 *space = '\0';                  *space = '\0';
                 type = key_type_from_name(cp);                  type = key_type_from_name(cp);
                 *space = ' ';                  *space = ' ';
                 if (type == KEY_UNSPEC) {                  if (type == KEY_UNSPEC) {
                         debug3("key_read: missing keytype");                          debug3("key_read: no key found");
                         return -1;                          return -1;
                 }                  }
                 cp = space+1;                  cp = space+1;
Line 486 
Line 485 
         }          }
         return success;          return success;
 }  }
   
 int  int
 key_write(Key *key, FILE *f)  key_write(Key *key, FILE *f)
 {  {
         int n, success = 0;          int n, success = 0;
         u_int len, bits = 0;          u_int len, bits = 0;
         u_char *blob;          u_char *blob, *uu;
         char *uu;  
   
         if (key->type == KEY_RSA1 && key->rsa != NULL) {          if (key->type == KEY_RSA1 && key->rsa != NULL) {
                 /* size of modulus 'n' */                  /* size of modulus 'n' */
Line 519 
Line 516 
         }          }
         return success;          return success;
 }  }
   
 char *  char *
 key_type(Key *k)  key_type(Key *k)
 {  {
Line 536 
Line 532 
         }          }
         return "unknown";          return "unknown";
 }  }
   
 char *  char *
 key_ssh_name(Key *k)  key_ssh_name(Key *k)
 {  {
Line 550 
Line 545 
         }          }
         return "ssh-unknown";          return "ssh-unknown";
 }  }
   
 u_int  u_int
 key_size(Key *k)  key_size(Key *k)
 {  {
Line 728 
Line 722 
 {  {
         Buffer b;          Buffer b;
         int len;          int len;
           u_char *buf;
   
         if (key == NULL) {          if (key == NULL) {
                 error("key_to_blob: key == NULL");                  error("key_to_blob: key == NULL");
Line 753 
Line 748 
                 return 0;                  return 0;
         }          }
         len = buffer_len(&b);          len = buffer_len(&b);
         if (lenp != NULL)          buf = xmalloc(len);
                 *lenp = len;          memcpy(buf, buffer_ptr(&b), len);
         if (blobp != NULL) {  
                 *blobp = xmalloc(len);  
                 memcpy(*blobp, buffer_ptr(&b), len);  
         }  
         memset(buffer_ptr(&b), 0, len);          memset(buffer_ptr(&b), 0, len);
         buffer_free(&b);          buffer_free(&b);
           if (lenp != NULL)
                   *lenp = len;
           if (blobp != NULL)
                   *blobp = buf;
         return len;          return len;
 }  }
   
Line 812 
Line 807 
 }  }
   
 /* Converts a private to a public key */  /* Converts a private to a public key */
   
 Key *  Key *
 key_demote(Key *k)  key_demote(Key *k)
 {  {

Legend:
Removed from v.1.43.2.3  
changed lines
  Added in v.1.44