From: Dr. Stephen Henson Date: Thu, 17 May 2007 16:19:17 +0000 (+0000) Subject: Prepend signature name in dgst output. X-Git-Tag: OpenSSL_0_9_8k^2~833 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e77dbf325f57cc86e6918baf36d597506e77266d;p=oweals%2Fopenssl.git Prepend signature name in dgst output. --- diff --git a/apps/dgst.c b/apps/dgst.c index deb829ae19..312d8804c3 100644 --- a/apps/dgst.c +++ b/apps/dgst.c @@ -75,7 +75,8 @@ #define PROG dgst_main int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, - EVP_PKEY *key, unsigned char *sigin, int siglen, const char *title, + EVP_PKEY *key, unsigned char *sigin, int siglen, + const char *sig_name, const char *md_name, const char *file,BIO *bmd); int MAIN(int, char **); @@ -89,7 +90,6 @@ int MAIN(int argc, char **argv) BIO *in=NULL,*inp; BIO *bmd=NULL; BIO *out = NULL; - const char *name; #define PROG_NAME_SIZE 39 char pname[PROG_NAME_SIZE+1]; int separator=0; @@ -490,37 +490,42 @@ int MAIN(int argc, char **argv) { BIO_set_fp(in,stdin,BIO_NOCLOSE); err=do_fp(out, buf,inp,separator, out_bin, sigkey, sigbuf, - siglen,"","(stdin)",bmd); + siglen,NULL,NULL,"stdin",bmd); } else { - name=OBJ_nid2sn(md->type); + const char *md_name, *sig_name; + if(out_bin) + { + md_name = NULL; + sig_name = NULL; + } + else + { + if (sigkey) + { + const EVP_PKEY_ASN1_METHOD *ameth; + ameth = EVP_PKEY_get0_asn1(sigkey); + if (ameth) + EVP_PKEY_asn1_get0_info(NULL, NULL, + NULL, NULL, &sig_name, ameth); + } + md_name = EVP_MD_name(md); + } for (i=0; i