=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/openssl/dsaparam.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- src/usr.bin/openssl/dsaparam.c 2022/11/11 17:07:38 1.14 +++ src/usr.bin/openssl/dsaparam.c 2023/03/06 14:32:06 1.15 @@ -1,4 +1,4 @@ -/* $OpenBSD: dsaparam.c,v 1.14 2022/11/11 17:07:38 joshua Exp $ */ +/* $OpenBSD: dsaparam.c,v 1.15 2023/03/06 14:32:06 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -88,60 +88,60 @@ char *outfile; int outformat; int text; -} dsaparam_config; +} cfg; static const struct option dsaparam_options[] = { { .name = "C", .desc = "Convert DSA parameters into C code", .type = OPTION_FLAG, - .opt.flag = &dsaparam_config.C, + .opt.flag = &cfg.C, }, { .name = "genkey", .desc = "Generate a DSA key", .type = OPTION_FLAG, - .opt.flag = &dsaparam_config.genkey, + .opt.flag = &cfg.genkey, }, { .name = "in", .argname = "file", .desc = "Input file (default stdin)", .type = OPTION_ARG, - .opt.arg = &dsaparam_config.infile, + .opt.arg = &cfg.infile, }, { .name = "inform", .argname = "format", .desc = "Input format (DER or PEM (default))", .type = OPTION_ARG_FORMAT, - .opt.value = &dsaparam_config.informat, + .opt.value = &cfg.informat, }, { .name = "noout", .desc = "No output", .type = OPTION_FLAG, - .opt.flag = &dsaparam_config.noout, + .opt.flag = &cfg.noout, }, { .name = "out", .argname = "file", .desc = "Output file (default stdout)", .type = OPTION_ARG, - .opt.arg = &dsaparam_config.outfile, + .opt.arg = &cfg.outfile, }, { .name = "outform", .argname = "format", .desc = "Output format (DER or PEM (default))", .type = OPTION_ARG_FORMAT, - .opt.value = &dsaparam_config.outformat, + .opt.value = &cfg.outformat, }, { .name = "text", .desc = "Print as text", .type = OPTION_FLAG, - .opt.flag = &dsaparam_config.text, + .opt.flag = &cfg.text, }, { NULL }, }; @@ -174,10 +174,10 @@ exit(1); } - memset(&dsaparam_config, 0, sizeof(dsaparam_config)); + memset(&cfg, 0, sizeof(cfg)); - dsaparam_config.informat = FORMAT_PEM; - dsaparam_config.outformat = FORMAT_PEM; + cfg.informat = FORMAT_PEM; + cfg.outformat = FORMAT_PEM; if (options_parse(argc, argv, dsaparam_options, &strbits, NULL) != 0) { dsaparam_usage(); @@ -199,19 +199,19 @@ ERR_print_errors(bio_err); goto end; } - if (dsaparam_config.infile == NULL) + if (cfg.infile == NULL) BIO_set_fp(in, stdin, BIO_NOCLOSE); else { - if (BIO_read_filename(in, dsaparam_config.infile) <= 0) { - perror(dsaparam_config.infile); + if (BIO_read_filename(in, cfg.infile) <= 0) { + perror(cfg.infile); goto end; } } - if (dsaparam_config.outfile == NULL) { + if (cfg.outfile == NULL) { BIO_set_fp(out, stdout, BIO_NOCLOSE); } else { - if (BIO_write_filename(out, dsaparam_config.outfile) <= 0) { - perror(dsaparam_config.outfile); + if (BIO_write_filename(out, cfg.outfile) <= 0) { + perror(cfg.outfile); goto end; } } @@ -237,9 +237,9 @@ BIO_printf(bio_err, "Error, DSA key generation failed\n"); goto end; } - } else if (dsaparam_config.informat == FORMAT_ASN1) + } else if (cfg.informat == FORMAT_ASN1) dsa = d2i_DSAparams_bio(in, NULL); - else if (dsaparam_config.informat == FORMAT_PEM) + else if (cfg.informat == FORMAT_PEM) dsa = PEM_read_bio_DSAparams(in, NULL, NULL, NULL); else { BIO_printf(bio_err, "bad input format specified\n"); @@ -250,10 +250,10 @@ ERR_print_errors(bio_err); goto end; } - if (dsaparam_config.text) { + if (cfg.text) { DSAparams_print(out, dsa); } - if (dsaparam_config.C) { + if (cfg.C) { unsigned char *data; int l, len, bits_p; @@ -307,10 +307,10 @@ printf("\tDSA_set0_pqg(dsa, p, q, g);\n"); printf("\treturn(dsa);\n\t}\n"); } - if (!dsaparam_config.noout) { - if (dsaparam_config.outformat == FORMAT_ASN1) + if (!cfg.noout) { + if (cfg.outformat == FORMAT_ASN1) i = i2d_DSAparams_bio(out, dsa); - else if (dsaparam_config.outformat == FORMAT_PEM) + else if (cfg.outformat == FORMAT_PEM) i = PEM_write_bio_DSAparams(out, dsa); else { BIO_printf(bio_err, "bad output format specified for outfile\n"); @@ -322,7 +322,7 @@ goto end; } } - if (dsaparam_config.genkey) { + if (cfg.genkey) { DSA *dsakey; if ((dsakey = DSAparams_dup(dsa)) == NULL) @@ -332,9 +332,9 @@ DSA_free(dsakey); goto end; } - if (dsaparam_config.outformat == FORMAT_ASN1) + if (cfg.outformat == FORMAT_ASN1) i = i2d_DSAPrivateKey_bio(out, dsakey); - else if (dsaparam_config.outformat == FORMAT_PEM) + else if (cfg.outformat == FORMAT_PEM) i = PEM_write_bio_DSAPrivateKey(out, dsakey, NULL, NULL, 0, NULL, NULL); else { BIO_printf(bio_err, "bad output format specified for outfile\n");