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

Diff for /src/usr.bin/openssl/gendsa.c between version 1.16 and 1.17

version 1.16, 2022/11/11 17:07:39 version 1.17, 2023/03/06 14:32:06
Line 78 
Line 78 
         const EVP_CIPHER *enc;          const EVP_CIPHER *enc;
         char *outfile;          char *outfile;
         char *passargout;          char *passargout;
 } gendsa_config;  } cfg;
   
 static const EVP_CIPHER *get_cipher_by_name(char *name)  static const EVP_CIPHER *get_cipher_by_name(char *name)
 {  {
Line 122 
Line 122 
         if (*name++ != '-')          if (*name++ != '-')
                 return (1);                  return (1);
   
         if ((gendsa_config.enc = get_cipher_by_name(name)) == NULL)          if ((cfg.enc = get_cipher_by_name(name)) == NULL)
                 return (1);                  return (1);
   
         *argsused = 1;          *argsused = 1;
Line 197 
Line 197 
                 .argname = "file",                  .argname = "file",
                 .desc = "Output the key to 'file'",                  .desc = "Output the key to 'file'",
                 .type = OPTION_ARG,                  .type = OPTION_ARG,
                 .opt.arg = &gendsa_config.outfile,                  .opt.arg = &cfg.outfile,
         },          },
         {          {
                 .name = "passout",                  .name = "passout",
                 .argname = "src",                  .argname = "src",
                 .desc = "Output file passphrase source",                  .desc = "Output file passphrase source",
                 .type = OPTION_ARG,                  .type = OPTION_ARG,
                 .opt.arg = &gendsa_config.passargout,                  .opt.arg = &cfg.passargout,
         },          },
         { NULL },          { NULL },
 };  };
Line 234 
Line 234 
                 exit(1);                  exit(1);
         }          }
   
         memset(&gendsa_config, 0, sizeof(gendsa_config));          memset(&cfg, 0, sizeof(cfg));
   
         if (options_parse(argc, argv, gendsa_options, &dsaparams, NULL) != 0) {          if (options_parse(argc, argv, gendsa_options, &dsaparams, NULL) != 0) {
                 gendsa_usage();                  gendsa_usage();
Line 245 
Line 245 
                 gendsa_usage();                  gendsa_usage();
                 goto end;                  goto end;
         }          }
         if (!app_passwd(bio_err, NULL, gendsa_config.passargout, NULL,          if (!app_passwd(bio_err, NULL, cfg.passargout, NULL,
             &passout)) {              &passout)) {
                 BIO_printf(bio_err, "Error getting password\n");                  BIO_printf(bio_err, "Error getting password\n");
                 goto end;                  goto end;
Line 266 
Line 266 
         if (out == NULL)          if (out == NULL)
                 goto end;                  goto end;
   
         if (gendsa_config.outfile == NULL) {          if (cfg.outfile == NULL) {
                 BIO_set_fp(out, stdout, BIO_NOCLOSE);                  BIO_set_fp(out, stdout, BIO_NOCLOSE);
         } else {          } else {
                 if (BIO_write_filename(out, gendsa_config.outfile) <= 0) {                  if (BIO_write_filename(out, cfg.outfile) <= 0) {
                         perror(gendsa_config.outfile);                          perror(cfg.outfile);
                         goto end;                          goto end;
                 }                  }
         }          }
Line 280 
Line 280 
         if (!DSA_generate_key(dsa))          if (!DSA_generate_key(dsa))
                 goto end;                  goto end;
   
         if (!PEM_write_bio_DSAPrivateKey(out, dsa, gendsa_config.enc, NULL, 0,          if (!PEM_write_bio_DSAPrivateKey(out, dsa, cfg.enc, NULL, 0,
             NULL, passout))              NULL, passout))
                 goto end;                  goto end;
         ret = 0;          ret = 0;

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17