summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2004-08-05 18:09:50 +0000
committerDr. Stephen Henson <steve@openssl.org>2004-08-05 18:09:50 +0000
commitc128bb0fa28a34dede012892721047b7712ef62c (patch)
tree8ed4f2655190bd3a14149a3f7de258bb3fd1f205
parent30fe028f077567ae4be5f82e3bf58d05c40e1296 (diff)
Don't ignore return value of EVP_DigestInit_ex() in md BIOs and dgst utility.
-rw-r--r--apps/dgst.c8
-rw-r--r--crypto/evp/bio_md.c10
2 files changed, 13 insertions, 5 deletions
diff --git a/apps/dgst.c b/apps/dgst.c
index c1bacd79b7..3025314911 100644
--- a/apps/dgst.c
+++ b/apps/dgst.c
@@ -332,7 +332,13 @@ int MAIN(int argc, char **argv)
/* we use md as a filter, reading from 'in' */
- BIO_set_md(bmd,md);
+ if (!BIO_set_md(bmd,md))
+ {
+ BIO_printf(bio_err, "Error setting digest %s\n", pname);
+ ERR_print_errors(bio_err);
+ goto end;
+ }
+
inp=BIO_push(bmd,in);
if (argc == 0)
diff --git a/crypto/evp/bio_md.c b/crypto/evp/bio_md.c
index c632dfb202..27ec62f4b5 100644
--- a/crypto/evp/bio_md.c
+++ b/crypto/evp/bio_md.c
@@ -176,10 +176,11 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr)
{
case BIO_CTRL_RESET:
if (b->init)
- EVP_DigestInit_ex(ctx,ctx->digest, NULL);
+ ret = EVP_DigestInit_ex(ctx,ctx->digest, NULL);
else
ret=0;
- ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
+ if (ret > 0)
+ ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
break;
case BIO_C_GET_MD:
if (b->init)
@@ -207,8 +208,9 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr)
case BIO_C_SET_MD:
md=ptr;
- EVP_DigestInit_ex(ctx,md, NULL);
- b->init=1;
+ ret = EVP_DigestInit_ex(ctx,md, NULL);
+ if (ret > 0)
+ b->init=1;
break;
case BIO_CTRL_DUP:
dbio=ptr;