]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix BIO_get_md_ctx return value check
authorPeiwei Hu <jlu.hpw@foxmail.com>
Sat, 9 Oct 2021 01:25:27 +0000 (09:25 +0800)
committerTomas Mraz <tomas@openssl.org>
Fri, 22 Oct 2021 09:42:36 +0000 (11:42 +0200)
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16792)

apps/dgst.c

index e595f7d8186f3fe3430c2e13f8f4a215672818a6..b07fff3fb3188d870286b79abf9374fc32191d00 100644 (file)
@@ -316,7 +316,7 @@ int dgst_main(int argc, char **argv)
         EVP_MD_CTX *mctx = NULL;
         EVP_PKEY_CTX *pctx = NULL;
         int r;
-        if (!BIO_get_md_ctx(bmd, &mctx)) {
+        if (BIO_get_md_ctx(bmd, &mctx) <= 0) {
             BIO_printf(bio_err, "Error getting context\n");
             ERR_print_errors(bio_err);
             goto end;
@@ -345,7 +345,7 @@ int dgst_main(int argc, char **argv)
     /* we use md as a filter, reading from 'in' */
     else {
         EVP_MD_CTX *mctx = NULL;
-        if (!BIO_get_md_ctx(bmd, &mctx)) {
+        if (BIO_get_md_ctx(bmd, &mctx) <= 0) {
             BIO_printf(bio_err, "Error getting context\n");
             ERR_print_errors(bio_err);
             goto end;