[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.402 and 1.407

version 1.402, 2020/03/06 18:29:14 version 1.407, 2020/04/20 04:43:57
Line 890 
Line 890 
 {  {
         struct stat st;          struct stat st;
         char *comment = NULL;          char *comment = NULL;
         struct sshkey *public = NULL;          struct sshkey *privkey = NULL, *pubkey = NULL;
         int r;          int r;
   
         if (stat(identity_file, &st) == -1)          if (stat(identity_file, &st) == -1)
                 fatal("%s: %s", path, strerror(errno));                  fatal("%s: %s", path, strerror(errno));
         if ((r = sshkey_load_public(path, &public, &comment)) != 0) {          if ((r = sshkey_load_public(path, &pubkey, &comment)) != 0)
                 debug("load public \"%s\": %s", path, ssh_err(r));                  debug("load public \"%s\": %s", path, ssh_err(r));
           if (pubkey == NULL || comment == NULL || *comment == '\0') {
                   free(comment);
                 if ((r = sshkey_load_private(path, NULL,                  if ((r = sshkey_load_private(path, NULL,
                     &public, &comment)) != 0) {                      &privkey, &comment)) != 0)
                         debug("load private \"%s\": %s", path, ssh_err(r));                          debug("load private \"%s\": %s", path, ssh_err(r));
                         fatal("%s is not a key file.", path);  
                 }  
         }          }
           if (pubkey == NULL && privkey == NULL)
                   fatal("%s is not a key file.", path);
   
         fingerprint_one_key(public, comment);          fingerprint_one_key(pubkey == NULL ? privkey : pubkey, comment);
         sshkey_free(public);          sshkey_free(pubkey);
           sshkey_free(privkey);
         free(comment);          free(comment);
 }  }
   
Line 2417 
Line 2420 
 }  }
   
 static void  static void
 do_check_krl(struct passwd *pw, int argc, char **argv)  do_check_krl(struct passwd *pw, int print_krl, int argc, char **argv)
 {  {
         int i, r, ret = 0;          int i, r, ret = 0;
         char *comment;          char *comment;
Line 2427 
Line 2430 
         if (*identity_file == '\0')          if (*identity_file == '\0')
                 fatal("KRL checking requires an input file");                  fatal("KRL checking requires an input file");
         load_krl(identity_file, &krl);          load_krl(identity_file, &krl);
           if (print_krl)
                   krl_dump(krl, stdout);
         for (i = 0; i < argc; i++) {          for (i = 0; i < argc; i++) {
                 if ((r = sshkey_load_public(argv[i], &k, &comment)) != 0)                  if ((r = sshkey_load_public(argv[i], &k, &comment)) != 0)
                         fatal("Cannot load public key %s: %s",                          fatal("Cannot load public key %s: %s",
Line 2454 
Line 2459 
         int r;          int r;
   
         /*          /*
          * If passed a public key filename, then try to locate the correponding           * If passed a public key filename, then try to locate the corresponding
          * private key. This lets us specify certificates on the command-line           * private key. This lets us specify certificates on the command-line
          * and have ssh-keygen find the appropriate private key.           * and have ssh-keygen find the appropriate private key.
          */           */
Line 2938 
Line 2943 
         struct sshkey **keys;          struct sshkey **keys;
         size_t nkeys, i;          size_t nkeys, i;
         int r, ok = -1;          int r, ok = -1;
         char *fp, *pin, *pass = NULL, *path, *pubpath;          char *fp, *pin = NULL, *pass = NULL, *path, *pubpath;
         const char *ext;          const char *ext;
   
         if (skprovider == NULL)          if (skprovider == NULL)
                 fatal("Cannot download keys without provider");                  fatal("Cannot download keys without provider");
   
         pin = read_passphrase("Enter PIN for authenticator: ", RP_ALLOW_STDIN);          for (i = 0; i < 2; i++) {
         if ((r = sshsk_load_resident(skprovider, device, pin,                  if (i == 1) {
             &keys, &nkeys)) != 0) {                          pin = read_passphrase("Enter PIN for authenticator: ",
                 freezero(pin, strlen(pin));                              RP_ALLOW_STDIN);
                 error("Unable to load resident keys: %s", ssh_err(r));                  }
                 return -1;                  if ((r = sshsk_load_resident(skprovider, device, pin,
                       &keys, &nkeys)) != 0) {
                           if (i == 0 && r == SSH_ERR_KEY_WRONG_PASSPHRASE)
                                   continue;
                           freezero(pin, strlen(pin));
                           error("Unable to load resident keys: %s", ssh_err(r));
                           return -1;
                   }
         }          }
         if (nkeys == 0)          if (nkeys == 0)
                 logit("No keys to download");                  logit("No keys to download");
Line 3057 
Line 3069 
             "       ssh-keygen -A [-f prefix_path]\n"              "       ssh-keygen -A [-f prefix_path]\n"
             "       ssh-keygen -k -f krl_file [-u] [-s ca_public] [-z version_number]\n"              "       ssh-keygen -k -f krl_file [-u] [-s ca_public] [-z version_number]\n"
             "                  file ...\n"              "                  file ...\n"
             "       ssh-keygen -Q -f krl_file file ...\n"              "       ssh-keygen -Q [-l] -f krl_file [file ...]\n"
             "       ssh-keygen -Y find-principals -s signature_file -f allowed_signers_file\n"              "       ssh-keygen -Y find-principals -s signature_file -f allowed_signers_file\n"
             "       ssh-keygen -Y check-novalidate -n namespace -s signature_file\n"              "       ssh-keygen -Y check-novalidate -n namespace -s signature_file\n"
             "       ssh-keygen -Y sign -f key_file -n namespace file ...\n"              "       ssh-keygen -Y sign -f key_file -n namespace file ...\n"
Line 3409 
Line 3421 
                 return (0);                  return (0);
         }          }
         if (check_krl) {          if (check_krl) {
                 do_check_krl(pw, argc, argv);                  do_check_krl(pw, print_fingerprint, argc, argv);
                 return (0);                  return (0);
         }          }
         if (ca_key_path != NULL) {          if (ca_key_path != NULL) {

Legend:
Removed from v.1.402  
changed lines
  Added in v.1.407