From nobody Sun May 19 03:38:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+100127+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+100127+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1676316008; cv=none; d=zohomail.com; s=zohoarc; b=F6UIouQKXQM/GtleZaCbsq0E+70uAMA3q0doyr8lG/jeIS6a1/NdGut6VZTeL+iwaKeeKpV7Bb6ohiZ66fp6L5EQjdsQ+WK2t+gIQ7Ikzv/bCqw7l8lE5XIHp0fOFEIG75rN/9gUpX+E7h7aqHSN6J90vO9uFiZnlSfk9xWWd5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676316008; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=1+Z6TPQMZc/zh4ou702DoKpmfoNX+yF7Gus3+/lbToo=; b=Q1gNBrBBcXIbSfQXscFau3/trDd8IknEUN7bK553MHV1Pmtxk7uw11oKWKAXAbm5C1resaQz557e/c0jZaNoIGh3t7RSAuwORM0vTslIL/ksZ5Nkf75LThzdO203LwL4wNPgLECXddEk/Qs/5U8/j/cbCD/4aZj4QxWR4TgrZQQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+100127+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1676316008397198.21670954289505; Mon, 13 Feb 2023 11:20:08 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id zQvmYY1788612xfJKw0Sq44U; Mon, 13 Feb 2023 11:20:08 -0800 X-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.web11.24584.1676316007500659141 for ; Mon, 13 Feb 2023 11:20:07 -0800 X-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-487-uLpOGi5YMyGn7jQLlK5nxQ-1; Mon, 13 Feb 2023 14:19:59 -0500 X-MC-Unique: uLpOGi5YMyGn7jQLlK5nxQ-1 X-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 9FF5585CCE0 for ; Mon, 13 Feb 2023 19:19:59 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6D1C32026D4B; Mon, 13 Feb 2023 19:19:59 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 142461800084; 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: [edk2-devel] [PATCH 1/4] CryptoPkg/BaseCryptLib: avoid using SHA1() Date: Mon, 13 Feb 2023 20:19:55 +0100 Message-Id: <20230213191958.913689-2-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 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: rovj7BChz13BnBexGTJgZnfQx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1676316008; bh=UkWjI212mTpVDs16wNRWMBXlH3T9kiDOmYNVvnU8pVk=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=t97ky6qS8wEn6xFFrdkdOk9EKnQcVuZ85iVMPr7aLF2FeLGEVhCiI3JOxqaWGmWGOS0 2OE1T/RSKv1MiY8uHt1UVDRxnS0wtXgOfisngbGG2YL+ugWfm2TtM+vuTHyVd+wBApXoH E82Ct7S+gkvpHM/+uHAMqsOIRnrImr5Xh8E= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1676316010270100022 Content-Type: text/plain; charset="utf-8"; x-default="true" In openssl 3.0 SHA1() 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 Reviewed-by: Jiewen Yao --- CryptoPkg/Library/BaseCryptLib/Hash/CryptSha1.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha1.c b/CryptoPkg/Li= brary/BaseCryptLib/Hash/CryptSha1.c index 1e071ce2b325..cfe1f4bc44c9 100644 --- a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha1.c +++ b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha1.c @@ -204,6 +204,8 @@ Sha1HashAll ( OUT UINT8 *HashValue ) { + SHA_CTX Context; + // // Check input parameters. // @@ -218,11 +220,19 @@ Sha1HashAll ( // // OpenSSL SHA-1 Hash Computation. // - if (SHA1 (Data, DataSize, HashValue) =3D=3D NULL) { + if (!SHA1_Init (&Context)) { return FALSE; - } else { - return TRUE; } + + if (!SHA1_Update (&Context, Data, DataSize)) { + return FALSE; + } + + if (!SHA1_Final (HashValue, &Context)) { + return FALSE; + } + + return TRUE; } =20 #endif --=20 2.39.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#100127): https://edk2.groups.io/g/devel/message/100127 Mute This Topic: https://groups.io/mt/96943603/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sun May 19 03:38:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+100125+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+100125+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1676316004; cv=none; d=zohomail.com; s=zohoarc; b=l1k/39EhuXsQh54Jkm9dqpXoxMvguIqIdsM7sMJpWTajakOJfNM9HR8NQvJXzLQmN0KZnM7zHA0/AT6/GA4DV78aGpgj1qzyagpDlKKoCqMTMo07o2bcNdILxF4NLDhGJ8Td/38oXDosyKHkeksVU0mw1+rPuoVE3c+sGEHGuhM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676316004; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=nxJwk4+E9nZ5noIRGBbCZrNyGjhLyoH2H9z9oLUCZwI=; b=VRj7Qaz4/OZp73/8YV4X+dkxHDKt8h2eXp1qRNYEXWFooWTMS3RTGwzWosfTgfUanoamo2R+L74ZSu6MkwX8F8JhEO4poD8srXtH0GnWSqb10Le7J6iB07ndqV31hrkOyszF43NIKUiwsU+KF4WqWS8+XG1C345dWsDKRTUNpWU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+100125+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1676316004851527.6921091799397; Mon, 13 Feb 2023 11:20:04 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id o618YY1788612x23x2FxfOlY; Mon, 13 Feb 2023 11:20:04 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.24582.1676316003987385945 for ; Mon, 13 Feb 2023 11:20:04 -0800 X-Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-76-6GjJDboPNHKK0RlHSoskYg-1; Mon, 13 Feb 2023 14:20:01 -0500 X-MC-Unique: 6GjJDboPNHKK0RlHSoskYg-1 X-Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3AD9E1C09041 for ; Mon, 13 Feb 2023 19:20:01 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 08B191121318; Mon, 13 Feb 2023 19:20:01 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 198F9180039F; 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: [edk2-devel] [PATCH 2/4] CryptoPkg/BaseCryptLib: avoid using SHA256() Date: Mon, 13 Feb 2023 20:19:56 +0100 Message-Id: <20230213191958.913689-3-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.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: GeXvtNn83L3xG9f0G74radA4x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1676316004; bh=qWKoOUE38C/m0TdYNhpUlQcjRdLUZ9SqbGwfH2z5qrk=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=HRHkJmewF91TebjUA5gRCgKmr6LxSyKepD6L4WNpSUWxEFtcW9dXS1l2opa6WZuVbF5 RsbOd5Z7DWO+MmuCiCCvqGsI9Cu5AAN+/HM8BiCitUg/JtANDGdJ7mN+xhwHaG2o31D/R nxtkpMoaL45Cxd0p0BI9XYxJwFcFo3ZsdlM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1676316006253100010 Content-Type: text/plain; charset="utf-8"; x-default="true" In openssl 3.0 SHA256() 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 Reviewed-by: Jiewen Yao --- .../Library/BaseCryptLib/Hash/CryptSha256.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha256.c b/CryptoPkg/= Library/BaseCryptLib/Hash/CryptSha256.c index f105e6e57708..4d7d92812c4d 100644 --- a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha256.c +++ b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha256.c @@ -202,6 +202,8 @@ Sha256HashAll ( OUT UINT8 *HashValue ) { + SHA256_CTX Context; + // // Check input parameters. // @@ -216,9 +218,17 @@ Sha256HashAll ( // // OpenSSL SHA-256 Hash Computation. // - if (SHA256 (Data, DataSize, HashValue) =3D=3D NULL) { + if (!SHA256_Init (&Context)) { return FALSE; - } else { - return TRUE; } + + if (!SHA256_Update (&Context, Data, DataSize)) { + return FALSE; + } + + if (!SHA256_Final (HashValue, &Context)) { + return FALSE; + } + + return TRUE; } --=20 2.39.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#100125): https://edk2.groups.io/g/devel/message/100125 Mute This Topic: https://groups.io/mt/96943601/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sun May 19 03:38:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+100124+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+100124+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1676316005; cv=none; d=zohomail.com; s=zohoarc; b=QbVOdG/3nRPOzjqIay3gtH034a/+M/MeV46s5Xooylr9jaC6jQ3yMLAY64MAs4NA7mtrEQRHRTjEZEsTZiyLWbrMaoMBpoOHulnQ972NPT5Ii8KexAGGSC3952cGJMyEojnFdsZ8hR8WE6fBtUQq7P+DtCRPoJ+0f4SOxaxZb+s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676316005; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=FWJVUmo+bZuJ0RmhegoLtmR3aRkCU834Ivq0rIQnx2Q=; b=JTO1reqSnvNwxn6O14N9TSom1hVbCqcADq6PYRFClDW3eGaAsleaRLG9ovnJwZvvRIhJ17iRn6LFwzl7gfg46jMOmiQR6+3Mw2ylm5nnu6xqGBTjW9g/xQzv9D10TuthsNkBcufJD+BzpLwReie6MOT5T3i50AlgE4BAiWSKoH0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+100124+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1676316005226333.86292839659257; Mon, 13 Feb 2023 11:20:05 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id pedZYY1788612xapDRBZDNxD; Mon, 13 Feb 2023 11:20:04 -0800 X-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 X-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 X-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) X-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) X-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: [edk2-devel] [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 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: V5BzAnx0ZqRx10q1Qm3rAdOKx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1676316004; bh=CWdT9+QGUYBOIecT968f/cLxHBDaGC90uKQ5gvfpgRM=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=RTsya1FMQ6GQD/ReuvyCGiEYEzpFgfUCk8selW0FArhZ0OVvqXGFxj/iAw1qdKvFBUE 3RHbjLKSbspW7kTCVoEGngw6QITgCruu5VoFPcNHmA7q44haEduJ292SeXYsGuz/yNX6j Sqxq0cytazFEz4E67NFvOyC0eGeiGNltxOU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1676316006253100011 Content-Type: text/plain; charset="utf-8"; 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 Reviewed-by: Jiewen Yao --- .../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) =3D=3D 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; } =20 /** --=20 2.39.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#100124): https://edk2.groups.io/g/devel/message/100124 Mute This Topic: https://groups.io/mt/96943600/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sun May 19 03:38:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+100126+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+100126+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1676316006; cv=none; d=zohomail.com; s=zohoarc; b=IF1ej397Fv3q3ohycQ5LxMtF22RfM77LevuH66BlmjEGUmcJvBpXgfI8PQ90MEeqBg0VdbMTgr1Q9GCUh7lZCdYDsrEKNzX5MHbQLmZWBajIH0ouDziomnmKaKiSZlTKqe8ifHc8pwcPjaSnSnskejsR6h08svk0GKxTLR9ToJo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676316006; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=bxG/HdIr+r1vydgy6+iIoI31MYgzfnK+b8RHL4d1K6I=; b=bRTbCHXgylVNsEG8bRsvzGhc43fsmqLnuddpw6mxIGmySJcoOu5n6LUAFHjfbtBlz8tMPLjXJv4wFH9GkgBGHOoy549Ydh0WRVIjUUVUIJ98tyWiKcyPXtZCG5kSibGQ5qKkkrINmiIGNEOtWWNXbEv4AcLI/kucwi0xGyGf+GU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+100126+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1676316006192275.44466422283335; Mon, 13 Feb 2023 11:20:06 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id gxAdYY1788612xsMiugux2WX; Mon, 13 Feb 2023 11:20:05 -0800 X-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.web11.24583.1676316005176050179 for ; Mon, 13 Feb 2023 11:20:05 -0800 X-Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-5-cHbQG_iSOPK-dm-E0MSjEA-1; Mon, 13 Feb 2023 14:20:03 -0500 X-MC-Unique: cHbQG_iSOPK-dm-E0MSjEA-1 X-Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CD2621C09044 for ; Mon, 13 Feb 2023 19:20:02 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 95255C16023; Mon, 13 Feb 2023 19:20:02 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 208DD180061A; 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: [edk2-devel] [PATCH 4/4] CryptoPkg/BaseCryptLib: avoid using SHA512() Date: Mon, 13 Feb 2023 20:19:58 +0100 Message-Id: <20230213191958.913689-5-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.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: 1Bkvaae50P8nXT0w6CntHirWx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1676316005; bh=r7cOgZxriFplJKYsjI5Eu1CEiGjzIgHcI8BD7CDF4Mc=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=DFjvT8b6+RWC2b+KZ97NHkwEcXBVLbBY5WdyTMTdhDzaP52XGR9Q8rqKAonG9kbQB8v QF2jxs26y5CPcV9k3nc72WuYnjjrkjNeqI+zgIQDsluHv6qrOBRM3+26pLVb/wKbRaR2w WeaMy1jUKIEcFb9wUgApECMJoau3BVDgPnA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1676316008252100018 Content-Type: text/plain; charset="utf-8"; x-default="true" In openssl 3.0 SHA512() 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 Reviewed-by: Jiewen Yao --- .../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 2ab7188035e8..dee8f35c41ad 100644 --- a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c +++ b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c @@ -430,6 +430,8 @@ Sha512HashAll ( OUT UINT8 *HashValue ) { + SHA512_CTX Context; + // // Check input parameters. // @@ -444,9 +446,17 @@ Sha512HashAll ( // // OpenSSL SHA-512 Hash Computation. // - if (SHA512 (Data, DataSize, HashValue) =3D=3D NULL) { + if (!SHA512_Init (&Context)) { return FALSE; - } else { - return TRUE; } + + if (!SHA512_Update (&Context, Data, DataSize)) { + return FALSE; + } + + if (!SHA512_Final (HashValue, &Context)) { + return FALSE; + } + + return TRUE; } --=20 2.39.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#100126): https://edk2.groups.io/g/devel/message/100126 Mute This Topic: https://groups.io/mt/96943602/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-