diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2007-05-21 15:53:30 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2007-05-21 15:53:30 +0000 |
commit | 9c54e18bf037aad58dd19346fe23866a444df05c (patch) | |
tree | 75f4bccbe51a64382fd39cd16804368bc4bc8330 /apps/dgst.c | |
parent | 9aba74e55a320eb717617949c5604524e2cd99b9 (diff) |
Fixes for dgst tool. Initialize md_name, sig_name properly. Return error code
on failure. Keep output format consistent with previous versions.
Also flush stdout after printing ACCEPT in s_server.
Diffstat (limited to 'apps/dgst.c')
-rw-r--r-- | apps/dgst.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/apps/dgst.c b/apps/dgst.c index 7e79868e7a..67bc8d382a 100644 --- a/apps/dgst.c +++ b/apps/dgst.c @@ -85,7 +85,7 @@ int MAIN(int argc, char **argv) { ENGINE *e = NULL; unsigned char *buf=NULL; - int i,err=0; + int i,err=1; const EVP_MD *md=NULL,*m; BIO *in=NULL,*inp; BIO *bmd=NULL; @@ -234,7 +234,6 @@ int MAIN(int argc, char **argv) if(do_verify && !sigfile) { BIO_printf(bio_err, "No signature to verify: use the -signature option\n"); - err = 1; goto end; } @@ -288,7 +287,6 @@ int MAIN(int argc, char **argv) SN_whirlpool,SN_whirlpool); #endif err=1; - goto end; } in=BIO_new(BIO_s_file()); @@ -313,8 +311,10 @@ int MAIN(int argc, char **argv) } if(out_bin == -1) { - if(keyfile) out_bin = 1; - else out_bin = 0; + if(keyfile) + out_bin = 1; + else + out_bin = 0; } if(randfile) @@ -494,13 +494,8 @@ int MAIN(int argc, char **argv) } else { - const char *md_name, *sig_name; - if(out_bin) - { - md_name = NULL; - sig_name = NULL; - } - else + const char *md_name = NULL, *sig_name = NULL; + if(!out_bin) { if (sigkey) { @@ -512,6 +507,7 @@ int MAIN(int argc, char **argv) } md_name = EVP_MD_name(md); } + err = 0; for (i=0; i<argc; i++) { int r; @@ -608,11 +604,11 @@ 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_printf(out, "%s-%s(%s)= ", sig_name, md_name, file); else if (md_name) - BIO_printf(out, "%s(%s)=", md_name, file); + BIO_printf(out, "%s(%s)= ", md_name, file); else - BIO_printf(out, "(%s)=", file); + BIO_printf(out, "(%s)= ", file); for (i=0; i<(int)len; i++) { if (sep && (i != 0)) |