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

Diff for /src/usr.bin/openssl/gendh.c between version 1.11 and 1.12

version 1.11, 2019/07/14 03:30:45 version 1.12, 2021/11/20 18:10:48
Line 84 
Line 84 
   
 #define DEFBITS 512  #define DEFBITS 512
   
 static int dh_cb(int p, int n, BN_GENCB * cb);  static int dh_cb(int p, int n, BN_GENCB *cb);
   
 static struct {  static struct {
         int g;          int g;
Line 128 
Line 128 
 int  int
 gendh_main(int argc, char **argv)  gendh_main(int argc, char **argv)
 {  {
         BN_GENCB cb;          BN_GENCB *cb = NULL;
         DH *dh = NULL;          DH *dh = NULL;
         int ret = 1, numbits = DEFBITS;          int ret = 1, numbits = DEFBITS;
         BIO *out = NULL;          BIO *out = NULL;
Line 141 
Line 141 
                 }                  }
         }          }
   
         BN_GENCB_set(&cb, dh_cb, bio_err);          if ((cb = BN_GENCB_new()) == NULL) {
                   BIO_printf(bio_err, "Error allocating BN_GENCB object\n");
                   goto end;
           }
   
           BN_GENCB_set(cb, dh_cb, bio_err);
   
         memset(&gendh_config, 0, sizeof(gendh_config));          memset(&gendh_config, 0, sizeof(gendh_config));
   
         gendh_config.g = 2;          gendh_config.g = 2;
Line 180 
Line 185 
         BIO_printf(bio_err, "This is going to take a long time\n");          BIO_printf(bio_err, "This is going to take a long time\n");
   
         if (((dh = DH_new()) == NULL) ||          if (((dh = DH_new()) == NULL) ||
             !DH_generate_parameters_ex(dh, numbits, gendh_config.g, &cb))              !DH_generate_parameters_ex(dh, numbits, gendh_config.g, cb))
                 goto end;                  goto end;
   
         if (!PEM_write_bio_DHparams(out, dh))          if (!PEM_write_bio_DHparams(out, dh))
Line 190 
Line 195 
         if (ret != 0)          if (ret != 0)
                 ERR_print_errors(bio_err);                  ERR_print_errors(bio_err);
         BIO_free_all(out);          BIO_free_all(out);
           BN_GENCB_free(cb);
         DH_free(dh);          DH_free(dh);
   
         return (ret);          return (ret);
 }  }
   
 static int  static int
 dh_cb(int p, int n, BN_GENCB * cb)  dh_cb(int p, int n, BN_GENCB *cb)
 {  {
         char c = '*';          char c = '*';
   
Line 208 
Line 214 
                 c = '*';                  c = '*';
         if (p == 3)          if (p == 3)
                 c = '\n';                  c = '\n';
         BIO_write(cb->arg, &c, 1);          BIO_write(BN_GENCB_get_arg(cb), &c, 1);
         (void) BIO_flush(cb->arg);          (void) BIO_flush(BN_GENCB_get_arg(cb));
         return 1;          return 1;
 }  }
 #endif  #endif

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12