From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 5CD259419DD for ; Wed, 15 May 2024 15:32:11 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=JXyWeeU1zYZ7NOdg3QJmcZOTj+RLXHhtItbzxuWNKnc=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240206; t=1715787129; v=1; b=WhgTjdCtglP+vBgOsdO6oPgOp8rvtXZ4zL6BXvdS9xcgX7n3Zw3j7U3m6iMiwHfCxnGp/mWu Iy/sjAyMn/p4yYiihshPLE1pN/U7rZUmXlfjUnfFXckYGPXwO8S4g2fJ3bRxIO3CE+fJVVrDn25 Bup3NzO3Pf1S7nOhOB7D5Bzkx8nl5A3rrPdfQWQNpSD325BozgF7pYZObL1prV+BOUET5d22hl6 AePm70UoQn1lBj4slJJzkB271vc4J81oALci4ou/IuT7bk8ujRr8z64FSCQrJC4PU4HNeK+FtM9 /Ks9i0q0ozvBEPyljPAUwUK1QWeAwoJZgQNG4XnrPnrAw== X-Received: by 127.0.0.2 with SMTP id zrVKYY7687511xicrllrl128; Wed, 15 May 2024 08:32:09 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by mx.groups.io with SMTP id smtpd.web11.19344.1715787124123463012 for ; Wed, 15 May 2024 08:32:04 -0700 X-CSE-ConnectionGUID: vBueliTqRiKRSX0bLTgeWQ== X-CSE-MsgGUID: 7doXVUMoTc+EcgY7hEa++Q== X-IronPort-AV: E=McAfee;i="6600,9927,11074"; a="14795440" X-IronPort-AV: E=Sophos;i="6.08,162,1712646000"; d="scan'208";a="14795440" X-Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 May 2024 08:32:03 -0700 X-CSE-ConnectionGUID: diTDUjh7R7GPT3sFSB96HQ== X-CSE-MsgGUID: z5HJitS5RnG857918L9Blw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,162,1712646000"; d="scan'208";a="30923315" X-Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orviesa010.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 15 May 2024 08:32:03 -0700 X-Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 15 May 2024 08:32:02 -0700 X-Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 15 May 2024 08:32:02 -0700 X-Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.41) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 15 May 2024 08:32:02 -0700 X-Received: from SJ1PR11MB6227.namprd11.prod.outlook.com (2603:10b6:a03:45a::10) by SA1PR11MB6893.namprd11.prod.outlook.com (2603:10b6:806:2b4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.27; Wed, 15 May 2024 15:31:59 +0000 X-Received: from SJ1PR11MB6227.namprd11.prod.outlook.com ([fe80::c4da:83f1:f7be:e307]) by SJ1PR11MB6227.namprd11.prod.outlook.com ([fe80::c4da:83f1:f7be:e307%4]) with mapi id 15.20.7587.028; Wed, 15 May 2024 15:31:59 +0000 From: "Li, Yi" To: "devel@edk2.groups.io" , "Shang, Qingyu" CC: "Yao, Jiewen" Subject: Re: [edk2-devel] [PATCH 1/1] CryptoPkg: Fix bug for correct return value checking when get X509Cert Thread-Topic: [edk2-devel] [PATCH 1/1] CryptoPkg: Fix bug for correct return value checking when get X509Cert Thread-Index: AQHapsejtmk4AM/ZD0GN4AeS5h36ObGYa9og Date: Wed, 15 May 2024 15:31:59 +0000 Message-ID: References: In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SJ1PR11MB6227:EE_|SA1PR11MB6893:EE_ x-ms-office365-filtering-correlation-id: b0d76d3b-8f26-4ce1-5205-08dc74f4296c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?us-ascii?Q?D50Kk9t1Y2sRGcRXjMIdftEmtHJgm57b9WbhdBP2z0B2W5z8DDXJy/op82xX?= =?us-ascii?Q?MIl1LI8+blz9JwhT/ZYPA39XEVD/Vv69HsSxCP7Ucvs8ZkIsz6D7/ejinfJ0?= =?us-ascii?Q?nOe+gkhOKGtHUoUKlKD+LL/EFRq4U1cACzdOrfSnk0F8B78R6Bk0iuRguzWU?= =?us-ascii?Q?ZB+fAJu8boQIclxZazNDTYci2yRilsdxFj0nblNfZctqJcZah13JbBTLM8+1?= =?us-ascii?Q?kYhqLr+5wZ+/HQrlZLRaI9jFe6L0bUML+l+mmk71ID7Vck2a1jvQGuaB6HG4?= =?us-ascii?Q?jhqBwSasAr5yRJxS2A/MDT6rFJmkQN68kglTBqbje2Q5gv5xV7ND05rAQdvp?= =?us-ascii?Q?yNVmWCCdAM1Fv5NCKtkCocz6dQ8kLtU7nX+E/r8m7vOYaGoFwS69tp5GFrVC?= =?us-ascii?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D4sUHVmqqG11lNVSQqzuwHKA?= =?us-ascii?Q?N0Q=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?gliRfiwCL6O4BRrXV/to3znXBpvi120fLtwsYnjmNjbW9ycbamBEmpE70uK1?= =?us-ascii?Q?nKP4XTuCgNRwXY0FXtHkRf4Xhaki5MlaTpUgg8do6g8jDypzbsfDBFQ2Ui+o?= =?us-ascii?Q?ddZvhJ6SVwNkdpZe30BfIP+NhkE7uZeMmoT7mIstul30MTRlEnTnJZ7jRnpK?= =?us-ascii?Q?5xwic3ZVzlH9SUTYqw+r8CYjFSedheFoRFBDfEbO0dQwUkfy0iYPFYdLkISb?= =?us-ascii?Q?NOi2MEPwdVtn3zZC5anZmb3+JFanSYqBqI3zv7gMhHV4UvXqnXvZWS2+SGvJ?= =?us-ascii?Q?UPO6xvgtyG4m7pUAKY7Z7qJ5sPNRxYf7StCFUMyIx6HgmNEPs/O/2cWihN5q?= =?us-ascii?Q?MOAuih5SCpbzqeaEWZWrbPgl6APnJIEwgGTj8h+CSPfHyodR11DTk8VL8HjC?= =?us-ascii?Q?Oij177M3rIXRAwIGnCJ+mZHLn9CpiUfYq+TKpdqq13DU8ZstHi0o3S9PeSbc?= =?us-ascii?Q?6L0yN/csUR7+OuCCCOB9+OxFUrjWy5mwVjinNXW2pAOaAVTd0PytJjtBfKuo?= =?us-ascii?Q?2Th9zaiqdF9yK0nnNqWIjgMfuU64i4/cS1DNIWUCPbZUkVk2wUitKA4HXIp9?= =?us-ascii?Q?CzNYwkt+mV/IgHBlKPI69ZClUfx3wNx83d94jG5pm7aptTOvOD4qdwlLKQks?= =?us-ascii?Q?WcYMIyylI+3mc2JM9AAhmQku6mKTADdZGa5z3fvvEmykKtInvIfpFDJ/lCz1?= =?us-ascii?Q?PW1F0nTEN3QPTcXE+KiSGrOWLBx4TuyZ8120ONCz14sjAVDeOFXc6uueSXEB?= =?us-ascii?Q?HoEFg5Fd9vs7UWfvvZHcQWI3HtVmkUwC+Ohkw13IiNCaAvykJETMUzDM2W9I?= =?us-ascii?Q?GPR/sGoyweHrElj7DVFvPfrdeCp1BuwEuJG+mBrS+sOZWOeT+9wNUv3un6eS?= =?us-ascii?Q?I0Ngh4eDqWaGDzjoEDZa6gu5VsjwLBebCyg6biLoDAKAQPn2cyPa6pBoGkR1?= =?us-ascii?Q?WifIh89s8F4g5YcQyNkyT2a7AJufDRjtA8rByna6OLBu2wpFlpyhW+LOGyAF?= =?us-ascii?Q?CsLEUXv/JQEwlyYI2EsgPBN8wxrcw2pEs3aNBFgOl/SjUXPNrQNK53B7ZLeO?= =?us-ascii?Q?+xGZ3f9c6HkcCmYa8xhXbvQb5RaT8k1fy0oJ1Cv3MUzBmZ/dNy1ii23EoS32?= =?us-ascii?Q?4qwf2n0j+2i7YTERAp8STKUlY/TkY5q7enrzwzf7Xf50c8t0QL0XUNUUsEwz?= =?us-ascii?Q?MA6mlPzN/hnJD26sSqoACe7YF7AcMnNErnZx0r7ory0t6lT1z6dp7eF2BJuv?= =?us-ascii?Q?wpWkODdE05zI1t36EUBY1qE7jeKEC+N5VRkIXyTSialLOiMo2rXNxq+BtfpL?= =?us-ascii?Q?a8h1j6M3hEFiFrlmncpdO5H5aIb3B6A/nV8x8r6dc+SAWl9I16HaatnVPJCh?= =?us-ascii?Q?7Np0zgKSLiMlHpCs08kChJOvOTCcUKtXaGVCBPe6Z+yhSP9pSkE+n1E7EG6n?= =?us-ascii?Q?G8t4dNYyCkjSuo30KHPXPrB+FG00KOdEZWnWb63RH26gC/U+WPb/hCe7jxLI?= =?us-ascii?Q?3ZKplG/YtX83j+eXqJ7nA+riZHuppim+a9nHb2wg6LuhNsRjtjhyW6M1ee4z?= =?us-ascii?Q?e4C4h9fp8/pD47Hl0Go=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ1PR11MB6227.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b0d76d3b-8f26-4ce1-5205-08dc74f4296c X-MS-Exchange-CrossTenant-originalarrivaltime: 15 May 2024 15:31:59.5237 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: hCp1fhPAzLcMy+z/zOF2GxxrCbJUtpD5/YXI5sitMN2i+simxP2o6XB4GJeuv1LoJn8k+s7bwpX/N58TTGkk/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB6893 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Wed, 15 May 2024 08:32:04 -0700 Resent-From: yi1.li@intel.com Reply-To: devel@edk2.groups.io,yi1.li@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: cSWXLd4GJpTuBvCQTTzPxxwVx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=WhgTjdCt; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io Looks good to me. Reviewed-by: Yi Li We are in Hard Freeze phase, will push it after freeze. Thanks. -----Original Message----- From: devel@edk2.groups.io On Behalf Of Qingyu Sent: Wednesday, May 15, 2024 8:58 PM To: devel@edk2.groups.io Cc: Shang, Qingyu ; Yao, Jiewen ; Li, Yi1 Subject: [edk2-devel] [PATCH 1/1] CryptoPkg: Fix bug for correct return val= ue checking when get X509Cert From: Qingyu REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4509 CryptX509.c file has X509GetTBSCert() funtion and it is added Inf variable = to collect the return value of ASN1_get_object(), which return 0x80 in erro= r case. Supplement the return value check during the second function call a= nd correct the check logic. Signed-off-by: Qingyu Cc: Jiewen Yao Cc: Yi Li --- CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c b/CryptoPkg/Libr= ary/BaseCryptLib/Pk/CryptX509.c index 1182323b63ee..7ebec9dbad5b 100644 --- a/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c +++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c @@ -839,17 +839,17 @@ X509GetTBSCert ( Length =3D 0; Inf =3D ASN1_get_object (&Temp, (long *)&Length, (int *)&Asn1Tag, (in= t *)&ObjClass, (long)CertSize); =20 - if (((Inf & 0x80) =3D=3D 0x00) && (Asn1Tag !=3D V_ASN1_SEQUENCE)) { + if (((Inf & 0x80) =3D=3D 0x80) && (Asn1Tag !=3D V_ASN1_SEQUENCE)) { return FALSE; } =20 *TBSCert =3D (UINT8 *)Temp; =20 - ASN1_get_object (&Temp, (long *)&Length, (int *)&Asn1Tag, (int *)&ObjCla= ss, (long)Length); + Inf =3D ASN1_get_object (&Temp, (long *)&Length, (int *)&Asn1Tag, (int= =20 + *)&ObjClass, (long)Length); // // Verify the parsed TBSCertificate is one correct SEQUENCE data. // - if (((Inf & 0x80) =3D=3D 0x00) && (Asn1Tag !=3D V_ASN1_SEQUENCE)) { + if (((Inf & 0x80) =3D=3D 0x80) && (Asn1Tag !=3D V_ASN1_SEQUENCE)) { return FALSE; } =20 -- 2.44.0.windows.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 (#118924): https://edk2.groups.io/g/devel/message/118924 Mute This Topic: https://groups.io/mt/106113214/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-