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

Diff for /src/usr.bin/ssh/ssh-keygen.c between version 1.60.2.3 and 1.60.2.4

version 1.60.2.3, 2001/11/15 22:51:15 version 1.60.2.4, 2002/03/09 00:20:45
Line 73 
Line 73 
 int convert_from_ssh2 = 0;  int convert_from_ssh2 = 0;
 int print_public = 0;  int print_public = 0;
   
 /* default to RSA for SSH-1 */  char *key_type_name = NULL;
 char *key_type_name = "rsa1";  
   
 /* argv0 */  /* argv0 */
 extern char *__progname;  extern char *__progname;
Line 87 
Line 86 
         char buf[1024];          char buf[1024];
         char *name = NULL;          char *name = NULL;
   
         switch (key_type_from_name(key_type_name)) {          if (key_type_name == NULL)
         case KEY_RSA1:  
                 name = _PATH_SSH_CLIENT_IDENTITY;  
                 break;  
         case KEY_DSA:  
                 name = _PATH_SSH_CLIENT_ID_DSA;  
                 break;  
         case KEY_RSA:  
                 name = _PATH_SSH_CLIENT_ID_RSA;                  name = _PATH_SSH_CLIENT_ID_RSA;
                 break;          else
         default:                  switch (key_type_from_name(key_type_name)) {
                 fprintf(stderr, "bad key type");                  case KEY_RSA1:
                 exit(1);                          name = _PATH_SSH_CLIENT_IDENTITY;
                 break;                          break;
         }                  case KEY_DSA:
                           name = _PATH_SSH_CLIENT_ID_DSA;
                           break;
                   case KEY_RSA:
                           name = _PATH_SSH_CLIENT_ID_RSA;
                           break;
                   default:
                           fprintf(stderr, "bad key type");
                           exit(1);
                           break;
                   }
   
         snprintf(identity_file, sizeof(identity_file), "%s/%s", pw->pw_dir, name);          snprintf(identity_file, sizeof(identity_file), "%s/%s", pw->pw_dir, name);
         fprintf(stderr, "%s (%s): ", prompt, identity_file);          fprintf(stderr, "%s (%s): ", prompt, identity_file);
         fflush(stderr);          fflush(stderr);
Line 143 
Line 146 
 do_convert_to_ssh2(struct passwd *pw)  do_convert_to_ssh2(struct passwd *pw)
 {  {
         Key *k;          Key *k;
         int len;          u_int len;
         u_char *blob;          u_char *blob;
         struct stat st;          struct stat st;
   
Line 184 
Line 187 
         if (buffer_len(b) < bytes)          if (buffer_len(b) < bytes)
                 fatal("buffer_get_bignum_bits: input buffer too small: "                  fatal("buffer_get_bignum_bits: input buffer too small: "
                     "need %d have %d", bytes, buffer_len(b));                      "need %d have %d", bytes, buffer_len(b));
         BN_bin2bn((u_char *)buffer_ptr(b), bytes, value);          BN_bin2bn(buffer_ptr(b), bytes, value);
         buffer_consume(b, bytes);          buffer_consume(b, bytes);
 }  }
   
 static Key *  static Key *
 do_convert_private_ssh2_from_blob(u_char *blob, int blen)  do_convert_private_ssh2_from_blob(u_char *blob, u_int blen)
 {  {
         Buffer b;          Buffer b;
         Key *key = NULL;          Key *key = NULL;
Line 268 
Line 271 
                 break;                  break;
         }          }
         rlen = buffer_len(&b);          rlen = buffer_len(&b);
         if(rlen != 0)          if (rlen != 0)
                 error("do_convert_private_ssh2_from_blob: "                  error("do_convert_private_ssh2_from_blob: "
                     "remaining bytes in key blob %d", rlen);                      "remaining bytes in key blob %d", rlen);
         buffer_free(&b);          buffer_free(&b);
Line 329 
Line 332 
                 *p = '\0';                  *p = '\0';
                 strlcat(encoded, line, sizeof(encoded));                  strlcat(encoded, line, sizeof(encoded));
         }          }
         blen = uudecode(encoded, (u_char *)blob, sizeof(blob));          blen = uudecode(encoded, blob, sizeof(blob));
         if (blen < 0) {          if (blen < 0) {
                 fprintf(stderr, "uudecode failed.\n");                  fprintf(stderr, "uudecode failed.\n");
                 exit(1);                  exit(1);
Line 351 
Line 354 
                 exit(1);                  exit(1);
         }          }
         key_free(k);          key_free(k);
         fprintf(stdout, "\n");          if (!private)
                   fprintf(stdout, "\n");
         fclose(fp);          fclose(fp);
         exit(0);          exit(0);
 }  }
Line 389 
Line 393 
                 debug("#bytes %d", len); \                  debug("#bytes %d", len); \
                 if (BN_bn2bin(prv->rsa->x, elements[i]) < 0) \                  if (BN_bn2bin(prv->rsa->x, elements[i]) < 0) \
                         goto done; \                          goto done; \
         } while(0)          } while (0)
   
 static int  static int
 get_AUT0(char *aut0)  get_AUT0(char *aut0)
Line 530 
Line 534 
         FILE *f;          FILE *f;
         Key *public;          Key *public;
         char *comment = NULL, *cp, *ep, line[16*1024], *fp;          char *comment = NULL, *cp, *ep, line[16*1024], *fp;
         int i, skip = 0, num = 1, invalid = 1, rep, fptype;          int i, skip = 0, num = 1, invalid = 1;
           enum fp_rep rep;
           enum fp_type fptype;
         struct stat st;          struct stat st;
   
         fptype = print_bubblebabble ? SSH_FP_SHA1 : SSH_FP_MD5;          fptype = print_bubblebabble ? SSH_FP_SHA1 : SSH_FP_MD5;
Line 664 
Line 670 
                         read_passphrase("Enter new passphrase (empty for no "                          read_passphrase("Enter new passphrase (empty for no "
                             "passphrase): ", RP_ALLOW_STDIN);                              "passphrase): ", RP_ALLOW_STDIN);
                 passphrase2 = read_passphrase("Enter same passphrase again: ",                  passphrase2 = read_passphrase("Enter same passphrase again: ",
                      RP_ALLOW_STDIN);                      RP_ALLOW_STDIN);
   
                 /* Verify that they are the same. */                  /* Verify that they are the same. */
                 if (strcmp(passphrase1, passphrase2) != 0) {                  if (strcmp(passphrase1, passphrase2) != 0) {
Line 742 
Line 748 
                 fprintf(stderr, "Comments are only supported for RSA1 keys.\n");                  fprintf(stderr, "Comments are only supported for RSA1 keys.\n");
                 key_free(private);                  key_free(private);
                 exit(1);                  exit(1);
         }          }
         printf("Key now has comment '%s'\n", comment);          printf("Key now has comment '%s'\n", comment);
   
         if (identity_comment) {          if (identity_comment) {
Line 829 
Line 835 
 int  int
 main(int ac, char **av)  main(int ac, char **av)
 {  {
         char dotsshdir[16 * 1024], comment[1024], *passphrase1, *passphrase2;          char dotsshdir[MAXPATHLEN], comment[1024], *passphrase1, *passphrase2;
         char *reader_id = NULL;          char *reader_id = NULL;
         Key *private, *public;          Key *private, *public;
         struct passwd *pw;          struct passwd *pw;
Line 956 
Line 962 
   
         arc4random_stir();          arc4random_stir();
   
           if (key_type_name == NULL) {
                   printf("You must specify a key type (-t).\n");
                   usage();
           }
         type = key_type_from_name(key_type_name);          type = key_type_from_name(key_type_name);
         if (type == KEY_UNSPEC) {          if (type == KEY_UNSPEC) {
                 fprintf(stderr, "unknown key type %s\n", key_type_name);                  fprintf(stderr, "unknown key type %s\n", key_type_name);

Legend:
Removed from v.1.60.2.3  
changed lines
  Added in v.1.60.2.4