From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.5736.1687913378058421035 for ; Tue, 27 Jun 2023 17:49:39 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=LjadKfAm; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: michael.d.kinney@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687913378; x=1719449378; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=zGPKGxwMsogdNFT5T/76o6GJ/rrVvzazpXru2X6rXRM=; b=LjadKfAmxQX+aadBhrKRMeAn2+ASHgF88JvYyutQtgJx+ux18MmvqVc6 HFjc60UFjJWVVyRPqilFKcpz9PdLeHgms1kfRZcDUNSY44W4Bi6TT+p7r iHQVOrw/NxCkCXVRi4iBRPdAE+dOUUfbrdmALhbRcTA0k8gpdCaGKwfNt EdOWZAWZtVYBklGTOAVKpVIJ13m9jr3qmkAVLHbI0QXbix50u9DcrvGX8 nGPtv4gD59va7gb8oUHb4p3bxMBxQ1rtuhJHwWSuaASaMAVT8vZ9Sb+6P hqK3+U+jGsM9Rqu350Yjps/CD2hxJM9JMHxHic8FDpiiGuwDhVNWNysG1 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10754"; a="392389993" X-IronPort-AV: E=Sophos;i="6.01,163,1684825200"; d="scan'208";a="392389993" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2023 17:49:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10754"; a="806695393" X-IronPort-AV: E=Sophos;i="6.01,163,1684825200"; d="scan'208";a="806695393" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by FMSMGA003.fm.intel.com with ESMTP; 27 Jun 2023 17:49:37 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 27 Jun 2023 17:49:36 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27 via Frontend Transport; Tue, 27 Jun 2023 17:49:36 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Tue, 27 Jun 2023 17:49:36 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hllNB1rKr1XpvyyFhEbdiiod46Jq6Q9wxNQPwFIzwuWBMWs7m6+QwgxFcXS2/uD4fSviuaHhP1Wiu8ffUUD0xkwWYDoENZ5+C+a1pT1lGO8EOchg2/vYdckx+D7AO4/GCKyiUWEc2Qoq2dMVFfYLRF/TzqzV6mWrkR5OWG4hQNsPsivI/N5B61SklV2eEvcqTkZRJvTHgYhuhuuUbwkJ7F3xrxbjVUVitnzUFNs6X+ACPiAEo1zb6K1A4vh88WurlxH/8ZIwt5SKJlaI0HX2y8UfOVsQ4LcTmo8zdckMiGUY9HMJpBm00hTMWaBQDAQdAD8GOYa20WiNiqnVWURt5w== 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=ii+PsBLZCfBfv4luuzDzPS86lE7QOgV4IYcXTPkQWr4=; b=igFsasWP6eLMxf9Yz4lRBzByqLiztnOgnh3i+Dy17sJ8jIj44QHGP884i0bskOEp24AFQy7b9MP7F/8QoRYPrXEueoWs2DotCvHateW1aCbGMTGQEcVfbraSnYw/DWF0qk75dLliXgqeyzHo23InrAUk4l7nvMWo0wvhVe6dOIq4SsjLX8yG4+an8j1pyEqQamNThVGSgsc5olBnIQG6f4axta3hBhGlhUXKj7rrA7ZpO423LY6e9CBfUgBfn1MAUTd9nichZ1avScbn2CAbRgbGCWEdcbCuwYv8ogPrq/NFWy9zgfWbkIKMXR72zdWXDMuZB/MnIjN/ICP/YrBMIQ== 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 SA2PR11MB4938.namprd11.prod.outlook.com (2603:10b6:806:fb::14) by PH7PR11MB5887.namprd11.prod.outlook.com (2603:10b6:510:136::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.23; Wed, 28 Jun 2023 00:49:33 +0000 Received: from SA2PR11MB4938.namprd11.prod.outlook.com ([fe80::f7a7:8a51:7ca5:4784]) by SA2PR11MB4938.namprd11.prod.outlook.com ([fe80::f7a7:8a51:7ca5:4784%7]) with mapi id 15.20.6521.024; Wed, 28 Jun 2023 00:49:33 +0000 From: "Michael D Kinney" To: "Clark-williams, Zachary" , "Li, Yi1" , "devel@edk2.groups.io" , "Andrew Fish" , Leif Lindholm CC: Maciej Rabeda , "Kinney, Michael D" Subject: Re: [PATCH V3] NetworkPkg: Correct the length of EAP Identity when in ASCII format Thread-Topic: [PATCH V3] NetworkPkg: Correct the length of EAP Identity when in ASCII format Thread-Index: AQHZqUDHyHkbnSnXiEOiYGrAr5ZJ4a+fYkGw Date: Wed, 28 Jun 2023 00:49:33 +0000 Message-ID: References: <20230626054034.2346-1-yi1.li@intel.com> In-Reply-To: Accept-Language: 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: SA2PR11MB4938:EE_|PH7PR11MB5887:EE_ x-ms-office365-filtering-correlation-id: 32749790-5a99-43ae-96b2-08db77718a3d x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: X/+/7pVCB8JCs2pgJzfVSS8nopw3dCMWuOLoN8CXcR03nEdYwC9w6d2jBIyWv8ds+Wg6byoH6mYxIYKgVKCVxlFp4wvOkKeH9jzjz+p2mwuNtLDENedShpklNZATVsr/M/M4yWngODkamwTrR4COz914E727Tf9vic6Wzioem8mXCwBtqbxWb7Wru6oUN7yw10UwZD4bty4ruzTITe9ylPJsctZUokXCCHDP2iLaASFv1FW/UROq/a8qbhe3NpWpmmT6rDoB3TtLFQJndR0KvDR9zlG/vxMTcDLKWtfUXlvPyN3GklDHqRjZ7L4kTwIIMZtjvH+270tDISz36bl6pb3NpVHkmBqVWUU9fPBroTbMCLLMMaMaCiytdG+SLaXWeAGVQLGZj2vMGtgE6z3W3Est6bOu5QSj3PeXs1rBSKm0aKwAlrMYTulnInLAnuTu7THFhPY4pX8s2TKa9tpjb3g30wc3npD0KHz+tBLp9aWyeefR1+Hi+v3sbfOtWAe/5rOf4s6yhVNeauue0dsEduJJOqKv34QmtiBo6RBWNwHXVZRa/WofDNHMOJ/MRc0pmXhhSQn425ywtwBosPiVGRVpUYuUQsUmoDsDboJBHMQzcugknyYE7EhQOivIPRecTBJ/in6CiC7fYXjIln1OOQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA2PR11MB4938.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(346002)(376002)(396003)(39860400002)(366004)(84040400005)(451199021)(52536014)(478600001)(966005)(110136005)(54906003)(2906002)(26005)(7696005)(83380400001)(9686003)(53546011)(186003)(6506007)(71200400001)(86362001)(41300700001)(33656002)(5660300002)(38100700002)(4326008)(122000001)(66946007)(316002)(66556008)(55016003)(82960400001)(76116006)(64756008)(8936002)(66476007)(38070700005)(66446008)(8676002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?wH7qLwr3VdN80uKS3PxtUUb0wLjQ92tHUq3XzvE3u8iiT0J2orVEaYkLGMNh?= =?us-ascii?Q?xcZCIyjGI1+lbCB0AHrovX9ahe8+ix6AGRPEjiK+QajVfxdw/ZSHrYKIup+Y?= =?us-ascii?Q?D/YPFDF4tBAmMEIsB76nS3V5m4UuFZLUwTG+UwewbiudebAKEMUiRsWnl1Me?= =?us-ascii?Q?PfD73q+wgM7p3v/r+mM9TQ6v0jtFjkSc/zSMd8hBy+DkebeFIEYzj8JKB0ac?= =?us-ascii?Q?Ji7miikqTe0ZsVWW9Hz1NL3epHEh/ktvd1b4lDgXHAPGUQnIyBffrgAY32cJ?= =?us-ascii?Q?3iiHIx6U0Ie9pvYdzMYZ6lDl3lnDoK+rLEvRuU3nPUCwQuhAvQrrM1IoGrfD?= =?us-ascii?Q?JWSaYz99n63PiHvfcVtmY1dX9nRrABRKSNS1Jw7LSHDbjJHzSVX06cXf2IMI?= =?us-ascii?Q?onM/5ZY/3sdmpje7tF7Tir/QIudKL9FSqSLa8RYQE8JVSlF8lpX0Ky+lscdL?= =?us-ascii?Q?/Djl/sYw23JjcUDuK6dTmZxV7zJHjD8Vuu3T/Qu5imPS+KdNKhl1NRv4yqwP?= =?us-ascii?Q?Ttn2JO2gKrlOfukJqk0ueXSPbC/yv1FR0v/dxyOXVIFMZKzF7bzH4hcv9xFW?= =?us-ascii?Q?wS6PV9nlr7//NngfNFAokGD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?o5+M2oZtIKlDMEhLsJa7GoAZs+OcwvbSL16UvUqDKgPofeOWrJ0iCtukxUBD?= =?us-ascii?Q?SMp+JfZritv196dURFVv//wpBswYlHo7ztPSZTtyp4gWq3QA3FUwryOZULB+?= =?us-ascii?Q?Pg=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SA2PR11MB4938.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 32749790-5a99-43ae-96b2-08db77718a3d X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jun 2023 00:49:33.6759 (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: SKQ19oqknu+Vag4UyvaGc+K1lDP8AAlEbKHGPL1BDMAkUR3Tk8ac/MEb3JJx2AmuX215NNSKv71nvOTgpk/m3Ri1wgbMXwwugtFFymo7wW8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB5887 Return-Path: michael.d.kinney@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Working on it: https://github.com/tianocore/edk2/pull/4584 > -----Original Message----- > From: Clark-williams, Zachary > Sent: Tuesday, June 27, 2023 2:46 PM > To: Li, Yi1 ; devel@edk2.groups.io; Kinney, Michael D > ; Andrew Fish ; Leif Lindhol= m > > Cc: Maciej Rabeda > Subject: RE: [PATCH V3] NetworkPkg: Correct the length of EAP Identity wh= en > in ASCII format >=20 > Reviewed-by: Zachary Clark-Williams >=20 > Hey Michael, > Can you help with this change merge? >=20 > Thanks, > Zack >=20 >=20 > -----Original Message----- > From: Li, Yi1 > Sent: Sunday, June 25, 2023 10:41 PM > To: devel@edk2.groups.io > Cc: Li, Yi1 ; Maciej Rabeda > ; Clark-williams, Zachary williams@intel.com> > Subject: [PATCH V3] NetworkPkg: Correct the length of EAP Identity when i= n > ASCII format >=20 > FIX: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4477 >=20 > Tls connection fail over WiFi in AMT OCR flow due to invalid identity. >=20 > This was due to missing conversion between unicode and ascii string which > resulted in invalid strlen. >=20 > Cc: Maciej Rabeda > Cc: Zachary Clark-Williams > Signed-off-by: Yi Li > --- > .../WifiConnectionMgrImpl.c | 21 +++++++++++++++---- > 1 file changed, 17 insertions(+), 4 deletions(-) >=20 > diff --git a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c > index 2e596c1981..d1182e52bd 100644 > --- a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c > +++ b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c > @@ -572,15 +572,28 @@ 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= ); > - Identity =3D AllocateZeroPool (IdentitySize); > + Status =3D gBS->LocateProtocol (&gEdkiiWiFiProfileSyncProtocolGuid, > NULL, (VOID **)&WiFiProfileSyncProtocol); > + if (!EFI_ERROR (Status)) { > + // > + // 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; > } >=20 > - Status =3D gBS->LocateProtocol (&gEdkiiWiFiProfileSyncProtocolGuid, > NULL, (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