summaryrefslogtreecommitdiffstats
path: root/apps/dgst.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2014-06-29 23:25:59 +0100
committerDr. Stephen Henson <steve@openssl.org>2014-06-29 23:44:44 +0100
commit90c1946e7a3aaabaed630474304485b7c850cfa6 (patch)
tree4d36bfa21a82af3309266981035e58049ecdea64 /apps/dgst.c
parent6e6ba36d980f67b6e5c7b139f78da7acbbf8ec76 (diff)
Don't core dump when using CMAC with dgst.
We can't unfortunately print the CMAC cipher used without extending the API. PR#2579
Diffstat (limited to 'apps/dgst.c')
-rw-r--r--apps/dgst.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/dgst.c b/apps/dgst.c
index d471dbdabd..19c9424be2 100644
--- a/apps/dgst.c
+++ b/apps/dgst.c
@@ -529,7 +529,8 @@ int MAIN(int argc, char **argv)
EVP_PKEY_asn1_get0_info(NULL, NULL,
NULL, NULL, &sig_name, ameth);
}
- md_name = EVP_MD_name(md);
+ if (md)
+ md_name = EVP_MD_name(md);
}
err = 0;
for (i=0; i<argc; i++)
@@ -641,7 +642,12 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
else
{
if (sig_name)
- BIO_printf(out, "%s-%s(%s)= ", sig_name, md_name, file);
+ {
+ BIO_puts(out, sig_name);
+ if (md_name)
+ BIO_printf(out, "-%s", md_name);
+ BIO_printf(out, "(%s)= ", file);
+ }
else if (md_name)
BIO_printf(out, "%s(%s)= ", md_name, file);
else