From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.24306.1676316003739138854 for ; Mon, 13 Feb 2023 11:20:04 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XAaTOmoB; spf=pass (domain: redhat.com, ip: 170.10.129.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676316002; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zp3tVWNAsrg1BtWwzhiw7OjDb/ow//o0wV8/7V3/NII=; b=XAaTOmoB5lEFILzETb6eeDN8LgDtz+Pz+0f1MQ7Oqfp0dBqdzel5Cvmf5hFQLAs92dGRqq jhqQ1FqKsqwjGWzkv4eSVQxUhMGoFBEV7p/uQXon+5/aNlsSew+MwIvEwHXPI1DY4oD3Z/ qP1B0BXd1+ayObquhu6cfAWoYFS31Tc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-547-aiQg7rdDOhiNpIeGxCm3jQ-1; Mon, 13 Feb 2023 14:20:01 -0500 X-MC-Unique: aiQg7rdDOhiNpIeGxCm3jQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3849485CCE2 for ; Mon, 13 Feb 2023 19:20:01 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 090722026D4B; Mon, 13 Feb 2023 19:20:01 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1D1631800613; Mon, 13 Feb 2023 20:19:58 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Oliver Steffen , Pawel Polawski , Gerd Hoffmann Subject: [PATCH 3/4] CryptoPkg/BaseCryptLib: avoid using SHA384() Date: Mon, 13 Feb 2023 20:19:57 +0100 Message-Id: <20230213191958.913689-4-kraxel@redhat.com> In-Reply-To: <20230213191958.913689-1-kraxel@redhat.com> References: <20230213191958.913689-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true In openssl 3.0 SHA384() goes through the provider logic, requiring a huge amount of openssl code. The individual functions do not, so use them instead. Signed-off-by: Gerd Hoffmann --- .../Library/BaseCryptLib/Hash/CryptSha512.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c index 59e570846588..2ab7188035e8 100644 --- a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c +++ b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c @@ -204,6 +204,8 @@ Sha384HashAll ( OUT UINT8 *HashValue ) { + SHA512_CTX Context; + // // Check input parameters. // @@ -218,11 +220,19 @@ Sha384HashAll ( // // OpenSSL SHA-384 Hash Computation. // - if (SHA384 (Data, DataSize, HashValue) == NULL) { + if (!SHA384_Init (&Context)) { return FALSE; - } else { - return TRUE; } + + if (!SHA384_Update (&Context, Data, DataSize)) { + return FALSE; + } + + if (!SHA384_Final (HashValue, &Context)) { + return FALSE; + } + + return TRUE; } /** -- 2.39.1