From: tb Date: Sat, 4 Mar 2023 06:25:42 +0000 (+0000) Subject: openssl/req: garbage collect a pointless EVP_MD_CTX_init() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=169544314c1b6f10a1e032e67166ac186d6b3ba8;p=openbsd openssl/req: garbage collect a pointless EVP_MD_CTX_init() Before do_sign_init(), the ctx is always allocated by EVP_MD_CTX_new() aka calloc(). There is no point in doing EVP_MD_CTX_init(), aka bzero(). ok jsing --- diff --git a/usr.bin/openssl/req.c b/usr.bin/openssl/req.c index abf1c53e1f2..1fa7e368b94 100644 --- a/usr.bin/openssl/req.c +++ b/usr.bin/openssl/req.c @@ -1,4 +1,4 @@ -/* $OpenBSD: req.c,v 1.24 2022/11/11 17:07:39 joshua Exp $ */ +/* $OpenBSD: req.c,v 1.25 2023/03/04 06:25:42 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1737,7 +1737,7 @@ do_sign_init(BIO * err, EVP_MD_CTX * ctx, EVP_PKEY * pkey, { EVP_PKEY_CTX *pkctx = NULL; int i; - EVP_MD_CTX_init(ctx); + if (!EVP_DigestSignInit(ctx, &pkctx, md, NULL, pkey)) return 0; for (i = 0; i < sk_OPENSSL_STRING_num(sigopts); i++) {