summaryrefslogtreecommitdiffstats
path: root/apps/dsaparam.c
diff options
context:
space:
mode:
authorBeat Bolli <dev@drbeat.li>2018-07-30 07:34:32 +1000
committerPauli <paul.dale@oracle.com>2018-07-30 07:34:32 +1000
commit201b305a2409d9eb13b5e4bfbd4967e04e155a60 (patch)
tree67526bf1fe642f77025d5db3ebbd47bb7e6a039e /apps/dsaparam.c
parentcb809437d391176a1c2e76f6da77a790c9382c4b (diff)
apps/dsaparam.c generates code that is intended to be pasted or included
into an existing source file: the function is static, and the code doesn't include dsa.h. Match the generated C source style of dsaparam. Adjust apps/dhparam.c to match, and rename the BIGNUMs to their more usual single-letter names. Add an error return in the generated C source. both: simplify the callback function Signed-off-by: Beat Bolli <dev@drbeat.li> Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/6797)
Diffstat (limited to 'apps/dsaparam.c')
-rw-r--r--apps/dsaparam.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/apps/dsaparam.c b/apps/dsaparam.c
index 9d8af9ee6d..b227b76a37 100644
--- a/apps/dsaparam.c
+++ b/apps/dsaparam.c
@@ -248,16 +248,9 @@ int dsaparam_main(int argc, char **argv)
static int dsa_cb(int p, int n, BN_GENCB *cb)
{
- char c = '*';
+ static const char symbols[] = ".+*\n";
+ char c = (p >= 0 && (size_t)p < sizeof(symbols) - 1) ? symbols[p] : '?';
- if (p == 0)
- c = '.';
- if (p == 1)
- c = '+';
- if (p == 2)
- c = '*';
- if (p == 3)
- c = '\n';
BIO_write(BN_GENCB_get_arg(cb), &c, 1);
(void)BIO_flush(BN_GENCB_get_arg(cb));
return 1;