From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web11.49534.1686534762257504713 for ; Sun, 11 Jun 2023 18:52:43 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=D++nCppd; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: yi1.li@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686534762; x=1718070762; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=VXVyjI27Y3HgARDQi4HlEmdkEqOK6lMHyhInoKptxx0=; b=D++nCppdT3CUqG4alLyoGlSFQLFEQlNlGldK47fvGVdNmg65yN/pQIuD 26sIXGB7rrm3SILaMJpozYV52zsZj3Y+WO0/Fg1djTByIh+g8x5KLu2VU unYpyfPvzTN/l65Y/NMlCVwiVEAmU+A7o/ifTd34hEGbzUJ0SuXxaoQTz TjXwGJegHJGy3j1WTqeGEGeD1X7TAl7fYJcYEk9woMuZP6DFv0rv40Xon q8fgCo5b+P4PSqYdVYuHfbG3uHprFf1mry6nq0XhpoH9EH/qHiJ9GHJP+ IaO2OHX3KI4X1NgrFZueHO6179OuZHBbY5J1/MhOghpC05i0ROE7zTwZA Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="355417993" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="355417993" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2023 18:52:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="835294658" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="835294658" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga004.jf.intel.com with ESMTP; 11 Jun 2023 18:52:41 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Sun, 11 Jun 2023 18:52:40 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Sun, 11 Jun 2023 18:52:40 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Sun, 11 Jun 2023 18:52:40 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.173) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Sun, 11 Jun 2023 18:52:40 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oHA23a8hixuR5rMdfcWR+P8MZVECr/1C/oDfLrG+Kvt8nBAhBUNxv13vFlKnsFzc6bHtIa6KTwURtLB3Ymxeq55Lt3dHmyccgDRYiv5+da0CTLD2A/8W0GGQx7VZ/mA6DrTq26WRUIq0YB063zmQK9fOvpHSTUFPOOGTorop2neQezS8GkwP4hPDqs9KgIj0FrS/GG3n0sD75P5uzBynlTEqFucUgLoYCFbxceiqE+4ySvhdKXpmkv+L1jZbcTgYFtrAk+Lz19i0BkdzW1q+W+4K+O9JT+lLP8IyWM8s/H+ZB7OZSWToqOZUwTKcB/cY7cKfovmdlVTjnwSxUbeMGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=a7DOYoQWwL6km+uy1YTrRWN4Xe2yQNFgCgiKDtRsGvk=; b=cxOHJAylcGFOyYq7iDw58tz9HPjxTRUGnlL88K5tJsosi2Hz5IE17vXavR4fganrMsHMkq+sSM1FONhhCNvWw2f1M38NZiUfKDDu3GzKmRlvKgszUNf6alxYx4gPgwLOKTVZDnEZOKl8LTf2f3EMderFTsubK3DhNh+2E/KXdk/0pnBaKm57CA4YCN2yXNq07n5LspmsvHv3cpI+2bjF6z9GxM1SrF9hB6MD16wZoLlq1OAdEcfihhGESD+c9h8ioHcuci3oS7pVwUHRjMJN3wK7ukh0z8b2YNtXV+ekM9qZileuyRyZhanyOvw2/beCx2Gsn5tqDdcv2ZisvcCf9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from SJ1PR11MB6227.namprd11.prod.outlook.com (2603:10b6:a03:45a::10) by SJ2PR11MB7646.namprd11.prod.outlook.com (2603:10b6:a03:4c3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.24; Mon, 12 Jun 2023 01:52:34 +0000 Received: from SJ1PR11MB6227.namprd11.prod.outlook.com ([fe80::75de:e3b8:28f8:e70]) by SJ1PR11MB6227.namprd11.prod.outlook.com ([fe80::75de:e3b8:28f8:e70%6]) with mapi id 15.20.6455.034; Mon, 12 Jun 2023 01:52:33 +0000 From: "Li, Yi" To: "devel@edk2.groups.io" , "Li, Yi1" CC: Maciej Rabeda , Siyuan Fu Subject: Re: [edk2-devel] [PATCH] NetworkPkg: Correct the length of EAP Identity when in ASCII format Thread-Topic: [edk2-devel] [PATCH] NetworkPkg: Correct the length of EAP Identity when in ASCII format Thread-Index: AQHZl3enK6k/+RS350et/JRJeWpI2q+GcYWw Date: Mon, 12 Jun 2023 01:52:33 +0000 Message-ID: References: <1765AF83686A77A3.7352@groups.io> In-Reply-To: <1765AF83686A77A3.7352@groups.io> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SJ1PR11MB6227:EE_|SJ2PR11MB7646:EE_ x-ms-office365-filtering-correlation-id: af6c658d-bb79-44ef-b10e-08db6ae7b0b1 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: XmyabtglmyfGyXwTr9eKLVhFZ0xKQacnGvjZlq+niJ1zIsEqkoXQ9qDnYbQ7PHzbKKakQgtbMzHAYPLrv0bfzuKIzv5V80G9oWOZO5bvgFdRj52nZ0eq7sh8jsCac0ICoqdxrvh6kMVfAdgDWTuqSUDGrKYVb8eIT7OEOD5KmMH+c5cQZcrQIfAcYcUAjoUUg/DryL5r+cCVCQXyx/1T2xVNXOROQ5hOgDykdbTusbE1pZY0UXULrzXvNUkzyEfyDgBUCE3GoGDSoE9q5xVk8MiHMuU2OxZcl9Adi+bR+DmOYW1J9He7wX/HoNy8AggtY5VZRd7XlkcpqBHy2d+k3/2tbFdUGqNda2oAdV7r2SIGe5Fm+tHXKAWC7WnjWiTu5ZarVmeatW4qo1+0k4qpI81qkDgZJPgDWcpEsQn1jJPA/MW2fLdZI3SFm9XWDdsZwDYrhwOzbG4RtOsQdyXMPjlPiuBRP5FEWgectlA3I0wXGvct/UDUwMreSLJZQZ8TaykP5cPTyqHYzxXdSjFuiUSM7tofMoMP+eSqxuukYh9SkbjkyvpH8x4oUWG5WJZvcUN7XLvUSc0cIX+Sb9gLFZgbXxLyyE/d9Rmwe29Rx6yuzkyHvy3nuii5Tu/A8D+VJFgjIXqn1TLjXiCW4y7kbA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ1PR11MB6227.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(376002)(396003)(39860400002)(346002)(136003)(451199021)(8936002)(8676002)(52536014)(5660300002)(4326008)(66556008)(76116006)(66946007)(64756008)(66446008)(66476007)(316002)(54906003)(110136005)(66899021)(2906002)(41300700001)(966005)(71200400001)(478600001)(7696005)(122000001)(55016003)(26005)(53546011)(6506007)(9686003)(83380400001)(186003)(33656002)(82960400001)(86362001)(38070700005)(38100700002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Z4mtAI/mjLBMvamD1TExHLnAb+0vlEdg65qJrJTqhRxFLXLlwqcJyXqzIZWP?= =?us-ascii?Q?O16W/MROuy+fyHJ14XEnO1c2VmwELcrSbE8ahivk+4Bt6Q3CYO6T+AU8sZ36?= =?us-ascii?Q?Yfr7MWSKrU8Xwm03oHR45o5tovmwhK23hQm1AQoZvY2CLAVG6RQAuGr1FwYy?= =?us-ascii?Q?GwgRaB/FFytKjvg/yY35hGmhbd9VGrFXAg26R4KnpzxG8u9d4jDhWBrVxJME?= =?us-ascii?Q?RYVnbw9wz9cRfRFa/vS4ag5qupvrVNllRU0DHfxKMv4tM21XtwW+9gIf9/v8?= =?us-ascii?Q?LP5yBRI8dGyYWBf8ens2xZtnAtfozbSB+QWmlmt9P6mJaD98KcaRjzEK0eYH?= =?us-ascii?Q?TT9Sl3vmxeUmd6fTOvvLYtkMPD88Jbe26wiGce3rcXYxvPr64/S2V5/xn/AK?= =?us-ascii?Q?F37unZ63JOc/Vclde4FhtZhlnsVYlqT/7aIynzq0Mhz26vumH0H+5Cwm2HbZ?= =?us-ascii?Q?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FdT7pEh9c/oHWsODgJjWbMPA?= =?us-ascii?Q?1Ill2ASXVrIgzHWVTUI3tCXMXrX0JhtAswfB0CAxpE60gynQw6dBNPdKiEWY?= =?us-ascii?Q?4ULBDbWXWUW9a7DEeh1jYWbBtG4RwxBmC5VLoudbL8xcTOie5p+llZOHCT/Q?= =?us-ascii?Q?+NdDbTyPAIKj6PA8+8igW0BeAyYFIU2MpCdExIhXX7S73wSMy20+l4JaEUGO?= =?us-ascii?Q?S03K0JMqhjShKN9GHfk=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: af6c658d-bb79-44ef-b10e-08db6ae7b0b1 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jun 2023 01:52:33.7463 (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: C41JcVtn4FMy/UuHzGBsEZbbeZ5aHmaGchIkyQFJJbUoyurGWMaGrTaVVSxF+rL0D0qQpqiYm7ViX7iQ6SSGeQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR11MB7646 Return-Path: yi1.li@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable ++visibility=20 Hello, any feedback here? -----Original Message----- From: devel@edk2.groups.io On Behalf Of Li, Yi Sent: Monday, June 5, 2023 2:30 PM To: devel@edk2.groups.io Cc: Li, Yi1 ; Maciej Rabeda ; Siyuan Fu Subject: [edk2-devel] [PATCH] NetworkPkg: Correct the length of EAP Identit= y when in ASCII format FIX: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4477 Tls connection fail over WiFi in AMT OCR flow due to invalid identity. This was due to missing conversion between unicode and ascii string which r= esulted in invalid strlen. Cc: Maciej Rabeda Cc: Siyuan Fu Signed-off-by: Yi Li --- .../WifiConnectionMgrImpl.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c b/= NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c index 2e596c1981..e1430251c8 100644 --- a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c +++ b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c @@ -572,7 +572,14 @@ WifiMgrConfigEap ( // Set Identity to Eap peer, Mandatory field for PEAP and TTLS // if (StrLen (Profile->EapIdentity) > 0) { - IdentitySize =3D sizeof (CHAR8) * (StrLen (Profile->EapIdentity) + 1); + Status =3D gBS->LocateProtocol (&gWiFiProfileSyncProtocolGuid, NULL, (= VOID **) &WiFiProfileSyncProtocol); + if (!EFI_ERROR (Status) && WiFiProfileSyncProtocol !=3D NULL) { + /* Max size of EapIdentity ::=3D sizeof (CHAR16) * sizeof (Profile->= EapIdentity) ::=3D 2 * EAP_IDENTITY_SIZE */ + IdentitySize =3D sizeof (CHAR8) * (AsciiStrnLenS ((CHAR8 *) Profile-= >EapIdentity, sizeof (CHAR16) * sizeof (Profile->EapIdentity)) + 1); + } else { + IdentitySize =3D sizeof (CHAR8) * (StrLen(Profile->EapIdentity) + 1)= ; + } + Identity =3D AllocateZeroPool (IdentitySize); if (Identity =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; @@ -580,7 +587,10 @@ WifiMgrConfigEap ( =20 Status =3D gBS->LocateProtocol (&gEdkiiWiFiProfileSyncProtocolGuid, NU= LL, (VOID **)&WiFiProfileSyncProtocol); if (!EFI_ERROR (Status)) { - CopyMem (Identity, &Profile->EapIdentity, IdentitySize); + /* The size of Identity from Username may equal + to the max size of EapIdentity(EAP_IDENTITY_SIZE*2=3D128 bytes), + so here only valid characters except NULL characters are copied. = */ + CopyMem (Identity, &Profile->EapIdentity, IdentitySize - 1); } else { UnicodeStrToAsciiStrS (Profile->EapIdentity, Identity, IdentitySize)= ; } -- 2.31.1.windows.1