=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/openssl/dsaparam.c,v retrieving revision 1.11 retrieving revision 1.12 diff -c -r1.11 -r1.12 *** src/usr.bin/openssl/dsaparam.c 2019/07/14 03:30:45 1.11 --- src/usr.bin/openssl/dsaparam.c 2021/11/20 18:10:48 1.12 *************** *** 1,4 **** ! /* $OpenBSD: dsaparam.c,v 1.11 2019/07/14 03:30:45 guenther Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * --- 1,4 ---- ! /* $OpenBSD: dsaparam.c,v 1.12 2021/11/20 18:10:48 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * *************** *** 156,162 **** options_usage(dsaparam_options); } ! static int dsa_cb(int p, int n, BN_GENCB * cb); int dsaparam_main(int argc, char **argv) --- 156,162 ---- options_usage(dsaparam_options); } ! static int dsa_cb(int p, int n, BN_GENCB *cb); int dsaparam_main(int argc, char **argv) *************** *** 164,169 **** --- 164,170 ---- DSA *dsa = NULL; int i; BIO *in = NULL, *out = NULL; + BN_GENCB *cb = NULL; int ret = 1; int numbits = -1; char *strbits = NULL; *************** *** 218,225 **** } if (numbits > 0) { ! BN_GENCB cb; ! BN_GENCB_set(&cb, dsa_cb, bio_err); dsa = DSA_new(); if (!dsa) { BIO_printf(bio_err, "Error allocating DSA object\n"); --- 219,232 ---- } if (numbits > 0) { ! if ((cb = BN_GENCB_new()) == NULL) { ! BIO_printf(bio_err, ! "Error allocating BN_GENCB object\n"); ! goto end; ! } ! ! BN_GENCB_set(cb, dsa_cb, bio_err); ! dsa = DSA_new(); if (!dsa) { BIO_printf(bio_err, "Error allocating DSA object\n"); *************** *** 227,233 **** } BIO_printf(bio_err, "Generating DSA parameters, %d bit long prime\n", numbits); BIO_printf(bio_err, "This could take some time\n"); ! if (!DSA_generate_parameters_ex(dsa, numbits, NULL, 0, NULL, NULL, &cb)) { ERR_print_errors(bio_err); BIO_printf(bio_err, "Error, DSA key generation failed\n"); goto end; --- 234,240 ---- } BIO_printf(bio_err, "Generating DSA parameters, %d bit long prime\n", numbits); BIO_printf(bio_err, "This could take some time\n"); ! if (!DSA_generate_parameters_ex(dsa, numbits, NULL, 0, NULL, NULL, cb)) { ERR_print_errors(bio_err); BIO_printf(bio_err, "Error, DSA key generation failed\n"); goto end; *************** *** 341,353 **** end: BIO_free(in); BIO_free_all(out); DSA_free(dsa); return (ret); } static int ! dsa_cb(int p, int n, BN_GENCB * cb) { char c = '*'; --- 348,361 ---- end: BIO_free(in); BIO_free_all(out); + BN_GENCB_free(cb); DSA_free(dsa); return (ret); } static int ! dsa_cb(int p, int n, BN_GENCB *cb) { char c = '*'; *************** *** 359,366 **** c = '*'; if (p == 3) c = '\n'; ! BIO_write(cb->arg, &c, 1); ! (void) BIO_flush(cb->arg); #ifdef GENCB_TEST if (stop_keygen_flag) return 0; --- 367,374 ---- c = '*'; if (p == 3) c = '\n'; ! BIO_write(BN_GENCB_get_arg(cb), &c, 1); ! (void) BIO_flush(BN_GENCB_get_arg(cb)); #ifdef GENCB_TEST if (stop_keygen_flag) return 0;