From 606a417fb2b6ce5d1d112f2f3f710c8085744627 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Wed, 17 Feb 2021 16:15:27 -0500 Subject: Fetch and free cipher and md's Reviewed-by: Richard Levitte Reviewed-by: Dmitry Belyavskiy (Merged from https://github.com/openssl/openssl/pull/14219) --- apps/enc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'apps/enc.c') diff --git a/apps/enc.c b/apps/enc.c index 3647a1ce61..242d3ef0aa 100644 --- a/apps/enc.c +++ b/apps/enc.c @@ -109,8 +109,8 @@ int enc_main(int argc, char **argv) BIO *in = NULL, *out = NULL, *b64 = NULL, *benc = NULL, *rbio = NULL, *wbio = NULL; EVP_CIPHER_CTX *ctx = NULL; - const EVP_CIPHER *cipher = NULL; - const EVP_MD *dgst = NULL; + EVP_CIPHER *cipher = NULL; + EVP_MD *dgst = NULL; const char *digestname = NULL; char *hkey = NULL, *hiv = NULL, *hsalt = NULL, *p; char *infile = NULL, *outfile = NULL, *prog; @@ -314,7 +314,7 @@ int enc_main(int argc, char **argv) goto opthelp; } if (dgst == NULL) - dgst = EVP_sha256(); + dgst = (EVP_MD *)EVP_sha256(); if (iter == 0) iter = 1; @@ -633,6 +633,8 @@ int enc_main(int argc, char **argv) BIO_free_all(out); BIO_free(benc); BIO_free(b64); + EVP_MD_free(dgst); + EVP_CIPHER_free(cipher); #ifdef ZLIB BIO_free(bzl); #endif -- cgit v1.2.3