From: tb Date: Sun, 12 Dec 2021 20:22:08 +0000 (+0000) Subject: Make ts.c compile with opaque EVP_MD_CTX. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=387397ab25c4cd7fdfda608f6062b16510f04e27;p=openbsd Make ts.c compile with opaque EVP_MD_CTX. ok inoguchi --- diff --git a/usr.bin/openssl/ts.c b/usr.bin/openssl/ts.c index cac10d0d3f8..9ac3aca6e5a 100644 --- a/usr.bin/openssl/ts.c +++ b/usr.bin/openssl/ts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ts.c,v 1.15 2018/02/07 05:47:55 jsing Exp $ */ +/* $OpenBSD: ts.c,v 1.16 2021/12/12 20:22:08 tb Exp $ */ /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL * project 2002. */ @@ -547,7 +547,7 @@ create_digest(BIO * input, char *digest, const EVP_MD * md, goto err; if (input) { /* Digest must be computed from an input file. */ - EVP_MD_CTX md_ctx; + EVP_MD_CTX *md_ctx; unsigned char buffer[4096]; int length; @@ -555,11 +555,16 @@ create_digest(BIO * input, char *digest, const EVP_MD * md, if (*md_value == 0) goto err; - EVP_DigestInit(&md_ctx, md); + if ((md_ctx = EVP_MD_CTX_new()) == NULL) + goto err; + + EVP_DigestInit(md_ctx, md); while ((length = BIO_read(input, buffer, sizeof(buffer))) > 0) { - EVP_DigestUpdate(&md_ctx, buffer, length); + EVP_DigestUpdate(md_ctx, buffer, length); } - EVP_DigestFinal(&md_ctx, *md_value, NULL); + EVP_DigestFinal(md_ctx, *md_value, NULL); + + EVP_MD_CTX_free(md_ctx); } else { /* Digest bytes are specified with digest. */ long digest_len;