Use default md if none specified in dgst utility.
This commit is contained in:
parent
47b2e238e5
commit
f03620ea15
16
apps/dgst.c
16
apps/dgst.c
@ -231,8 +231,6 @@ int MAIN(int argc, char **argv)
|
|||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (md == NULL)
|
|
||||||
md=EVP_md5();
|
|
||||||
|
|
||||||
if(do_verify && !sigfile) {
|
if(do_verify && !sigfile) {
|
||||||
BIO_printf(bio_err, "No signature to verify: use the -signature option\n");
|
BIO_printf(bio_err, "No signature to verify: use the -signature option\n");
|
||||||
@ -447,12 +445,17 @@ int MAIN(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* we use md as a filter, reading from 'in' */
|
/* we use md as a filter, reading from 'in' */
|
||||||
else if (!BIO_set_md(bmd,md))
|
else
|
||||||
|
{
|
||||||
|
if (md == NULL)
|
||||||
|
md = EVP_md5();
|
||||||
|
if (!BIO_set_md(bmd,md))
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err, "Error setting digest %s\n", pname);
|
BIO_printf(bio_err, "Error setting digest %s\n", pname);
|
||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(sigfile && sigkey) {
|
if(sigfile && sigkey) {
|
||||||
BIO *sigbio;
|
BIO *sigbio;
|
||||||
@ -476,6 +479,13 @@ int MAIN(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
inp=BIO_push(bmd,in);
|
inp=BIO_push(bmd,in);
|
||||||
|
|
||||||
|
if (md == NULL)
|
||||||
|
{
|
||||||
|
EVP_MD_CTX *tctx;
|
||||||
|
BIO_get_md_ctx(bmd, &tctx);
|
||||||
|
md = EVP_MD_CTX_md(tctx);
|
||||||
|
}
|
||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
{
|
{
|
||||||
BIO_set_fp(in,stdin,BIO_NOCLOSE);
|
BIO_set_fp(in,stdin,BIO_NOCLOSE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user