OpenSSL CVS Repository
http://cvs.openssl.org/
____________________________________________________________
________________
Server: cvs.openssl.org Name: Dr.
Stephen Henson
Root: /v/openssl/cvs Email: steve openssl.org
Module: openssl Date:
17-May-2007 18:19:18
Branch: HEAD Handle:
2007051717191700
Modified files:
openssl/apps dgst.c
openssl/crypto/asn1 ameth_lib.c
openssl/crypto/evp evp.h
Log:
Prepend signature name in dgst output.
Summary:
Revision Changes Path
1.46 +30 -19 openssl/apps/dgst.c
1.19 +5 -0 openssl/crypto/asn1/ameth_lib.c
1.175 +1 -0 openssl/crypto/evp/evp.h
____________________________________________________________
________________
patch -p0 <<' .'
Index: openssl/apps/dgst.c
============================================================
================
$ cvs diff -u -r1.45 -r1.46 dgst.c
--- openssl/apps/dgst.c 17 May 2007 12:55:03 -0000 1.45
+++ openssl/apps/dgst.c 17 May 2007 16:19:17 -0000 1.46
 -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 
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 
{
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<argc; i++)
{
- char *tmp,*tofree=NULL;
int r;
-
if (BIO_read_filename(in,argv[i]) <= 0)
{
perror(argv[i]);
err++;
continue;
}
- if(!out_bin)
- {
- size_t len = strlen(name)+strlen(argv[i])+(hmac_key ?
5 : 0)+5;
- tmp=tofree=OPENSSL_malloc(len);
- BIO_snprintf(tmp,len,"%s%s(%s)= ",
- hmac_key ? "HMAC-" :
"",name,argv[i]);
- }
else
- tmp="";
r=do_fp(out,buf,inp,separator,out_bin,sigkey,sigbuf,
- siglen,tmp,argv[i],bmd);
+ siglen,sig_name,md_name, argv[i],bmd);
if(r)
err=r;
- if(tofree)
- OPENSSL_free(tofree);
(void)BIO_reset(bmd);
}
}
 -546,7 +551,8 
}
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)
{
size_t len;
 -600,7 +606,12 
if(binout) BIO_write(out, buf, len);
else
{
- BIO_write(out,title,strlen(title));
+ if (sig_name)
+ BIO_printf(out, "%s-%s(%s)=", sig_name,
md_name, file);
+ else if (md_name)
+ BIO_printf(out, "%s(%s)=", md_name, file);
+ else
+ BIO_printf(out, "(%s)=", file);
for (i=0; i<(int)len; i++)
{
if (sep && (i != 0))
 .
patch -p0 <<' .'
Index: openssl/crypto/asn1/ameth_lib.c
============================================================
================
$ cvs diff -u -r1.18 -r1.19 ameth_lib.c
--- openssl/crypto/asn1/ameth_lib.c 15 May 2007 23:51:59
-0000 1.18
+++ openssl/crypto/asn1/ameth_lib.c 17 May 2007 16:19:17
-0000 1.19
 -276,6 +276,11 
return 1;
}
+const EVP_PKEY_ASN1_METHOD* EVP_PKEY_get0_asn1(EVP_PKEY
*pkey)
+ {
+ return pkey->ameth;
+ }
+
EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int
flags,
const char *pem_str, const char *info)
{
 .
patch -p0 <<' .'
Index: openssl/crypto/evp/evp.h
============================================================
================
$ cvs diff -u -r1.174 -r1.175 evp.h
--- openssl/crypto/evp/evp.h 15 May 2007 23:52:01
-0000 1.174
+++ openssl/crypto/evp/evp.h 17 May 2007 16:19:17
-0000 1.175
 -939,6 +939,7 
const char **pinfo, const char **ppem_str,
const EVP_PKEY_ASN1_METHOD *ameth);
+const EVP_PKEY_ASN1_METHOD* EVP_PKEY_get0_asn1(EVP_PKEY
*pkey);
EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int
flags,
const char *pem_str, const char *info);
void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst,
 .
____________________________________________________________
__________
OpenSSL Project http://www.openssl.org
CVS Repository Commit List
openssl-cvs openssl.org
Automated List Manager
majordomo openssl.org
|