From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web11.1849.1687902372455910559 for ; Tue, 27 Jun 2023 14:46:12 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=HJ+kDKgl; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: zachary.clark-williams@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687902372; x=1719438372; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=6yVIQyy9kgfUw1gxgrLuUYbOKjhVFtYxmI0egi+JcxY=; b=HJ+kDKgltfwK3B2Ul9x/b6txjyIInfA1/Ii3cN47cy/ZMI79RJw1pd2j ST4dyi9C+pLBBUMpJsbwaEsMexo//aRyUJpjr4ap/Z9gmP0byNj0fZO9I WUyaIsXoOWgE6fctmHZeMtxZIR3YpldQhx3gJr86853NiIoc3XWrfQ8FP hSJxAAGOM9s6/F5QYQlUK5QZ21pwZ89T7lzmAprKQnN2IdTPpMpd4p2Tw 3lsTOAvmse8p78WTDCIHe0ItRE15u+IO+1wwwbMjNBkvB7vHKe4C+EHgl DZADvlDGSji0QJITYuig66YzPjQ9knH/+dqZXt5HZHpEdwkssz3ozuBXV A==; X-IronPort-AV: E=McAfee;i="6600,9927,10754"; a="346449639" X-IronPort-AV: E=Sophos;i="6.01,163,1684825200"; d="scan'208";a="346449639" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2023 14:46:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10754"; a="806658835" X-IronPort-AV: E=Sophos;i="6.01,163,1684825200"; d="scan'208";a="806658835" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by FMSMGA003.fm.intel.com with ESMTP; 27 Jun 2023 14:46:11 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX603.amr.corp.intel.com (10.22.229.16) 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 14:46:10 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) 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 via Frontend Transport; Tue, 27 Jun 2023 14:46:10 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.103) by edgegateway.intel.com (134.134.137.100) 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 14:46:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FQiSHyg2SUiVN2U06y7oAv9U9V9jVfG5Ij6u9GCgk1wmrDaj/k3Us64os1Ih1DTfpd3HtR7nSM4NPLZS5GyWcxk/09lNxI0xUU8a77LOsXqXdYacQt82hJfECj49mPNnBXbc1QEJSzUGPjZMd4JLmX+5sZrnmvRIb5nzNfQroxn61zRfZFmOeHj0UOM0Skyg55bCcnx/6lBzmP9YRV3Z1exFLjx/tcFiebdIMoWZKOFhsI+V4iYklSj/q4EbE1qSOrPuQWh6wmp4w4zb+VdpuZ3Zv++hoQkFz5PCrTD3HisH/r5wcvLzyJY31Ks99pjmo4sJ48j8vERSrQW97NIn+Q== 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=U24shfg1rn6XiBIyCOIKkGlRwPV3fPuY8Ne95iCSfBk=; b=c/4X1C8M7puk2avTFX2ymIXzKsP4Gc9Rjc7w7LaXyezDiw8LjYQAIQ47qNR2mwVi+qEUcU09eToXOafTy9yBY9+rk+GsAh4iZWr42WBx9PGlXNQFrMQ0mxc85ln0QVWjqxMqHDLSuaMXwJcjBf+sbz/HgQCDET+eGaCPK6RhXPeo4Qj07HBSijNvLIQsNEpG0WLwmKAhZPmCgp+LRR4EQexHbYfx4CF+GDA0HVa4hpO+pG769Gczq4+XT15ANSxsiHRBOvffHXCvtXQE4NWa/W/JiWFiXiDfC4MV+1CzUbrVqT5KxjopX2HPhmFRiFsKT+iZXub1yDh3Fr6MiFmPQQ== 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 CO6PR11MB5601.namprd11.prod.outlook.com (2603:10b6:303:13d::7) by IA0PR11MB7185.namprd11.prod.outlook.com (2603:10b6:208:432::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Tue, 27 Jun 2023 21:46:04 +0000 Received: from CO6PR11MB5601.namprd11.prod.outlook.com ([fe80::e54e:e0ec:31be:721]) by CO6PR11MB5601.namprd11.prod.outlook.com ([fe80::e54e:e0ec:31be:721%4]) with mapi id 15.20.6544.012; Tue, 27 Jun 2023 21:46:04 +0000 From: "Clark-williams, Zachary" To: "Li, Yi1" , "devel@edk2.groups.io" , "Kinney, Michael D" , Andrew Fish , Leif Lindholm CC: Maciej Rabeda 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: AQHZp/DFjdPf/Fy0pki79IVuaLm4ta+fMFTw Date: Tue, 27 Jun 2023 21:46:04 +0000 Message-ID: References: <20230626054034.2346-1-yi1.li@intel.com> In-Reply-To: <20230626054034.2346-1-yi1.li@intel.com> 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: CO6PR11MB5601:EE_|IA0PR11MB7185:EE_ x-ms-office365-filtering-correlation-id: 1372e5a6-8578-400a-3539-08db7757e83e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: tWmAddnWCH9lFtFwGuE7/nUxKloJGMkAdku6bGwJuBb2/ArEMpGdSzg1J01imuRktXcCWbvZwKZAfYSD+ksFbDUgZ6Bw39oPkl4mhT+1gBpUfevHsDYmPoG43XaCnlpJQH/U9ZycfJWa9FCaHiLgPIiMTm6fRFMlZNtPthD8eLOj/9CYOnYyikFxdjIAJe2ksmj5SHrveJKjeTMBR09T2xXuZnfpqiBczq0mN5eeNasGTL1F+PnFQ51OVkgAvMu5lglKKFk5uETXO2E/us6gUsvtSsE+GSpGK35i58dvzfLxvd6twW0Zt1lEILqEDkx59Qf5TB9UD4DLO/ZI/G+L2DqthhOk2C05+X7aA3h32RajDheOusl0cGjYCoilfguQo9xi/UgYw7W+zBlJuZgDipCtfBK34Ku93RweEfjwDBsfL86xFrYfacBvk+r9il9ftEjzDljWrZj4EJxYa2I2JH8WGWfu/JRu/O6NVrzooKZCF6Tf/U/1Xvm23F5CemPldA242FJCrwn4vBY/l6eU6IhftOgOCAKKk8dL7ctkloAJoBy/p27YjeAyNMqLOXRa3nFCh9AlhjZPLuFCT5k3qg9HBFjpne4QdH8XrBe53KQ= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO6PR11MB5601.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(346002)(39860400002)(376002)(396003)(136003)(84040400005)(451199021)(66446008)(38070700005)(66556008)(66476007)(122000001)(5660300002)(52536014)(86362001)(8676002)(33656002)(8936002)(41300700001)(4326008)(316002)(82960400001)(66946007)(76116006)(55016003)(64756008)(38100700002)(966005)(110136005)(6506007)(53546011)(26005)(9686003)(186003)(2906002)(71200400001)(7696005)(83380400001)(478600001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?/o6C7Ac9IeeYTisBGnpHC0IiBaX8XcuKkkpdqdGjJxTzO/GrO21jL/hXVDwU?= =?us-ascii?Q?PC45O8p0RvGhu7ZgTdEbfe6hJNhCelgeTIOwUkpgmzGtwxEjoepYIrfjbUPM?= =?us-ascii?Q?i1l+wzerhyDCcNEY12mZ4rlZ/PXyh/feKhYRVEz2FYXPtn0diGXFIxaOP7QQ?= =?us-ascii?Q?V/tL9OIo8kHVqOg5lbKq3xslt44aaC3HwSnsGnnseAMRVQbgWsXMM8Fose1Z?= =?us-ascii?Q?Hnjk2niuU2rsRwGjCgUcR7PSUebDmIcI86zpJJvoZQ5ZfnFx/yBXYtW6rOGw?= =?us-ascii?Q?K1ZOn1EmAabAgCEhErT5jpoXwgfBy+MqCgdVrt8Or4OGmaLvmg0Z9/PLYxH4?= =?us-ascii?Q?p3vR8v1qkdyC975zfOyrp7mQFyUsU3VfC0YjoIQU7mAI9sjw1U/QMLiyLVBy?= =?us-ascii?Q?+mLNjJHdiH76pTJ53tV9GCd95Zn+4jT0qdYnzdkTeUDZ6DT5w+glsg5Ac89J?= =?us-ascii?Q?wAIavxr55oaWR4lZSDdiGDrtM/+Vjg9HKZTtFjwp4kIAlOMt/iQE8gxhp5XW?= =?us-ascii?Q?85UZo3By4+LlcIgAJMd/bNzk+DWndIOraZkxd7I7l2O5hvowKrl5SZ2ACZqk?= =?us-ascii?Q?4eJ/4oPNYDdYzEAolEqFwtoa1V2q/Jhp3YVKGha98tzJmf/+qQ+0dRL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OC2j1JuArzaD+PoQcW7GfBcw8XIy?= =?us-ascii?Q?+rcDd4XXCCy5xlILkkfEgRJbPEk5Rzieybsus1mpy6QhEHC6YxEbLuAMvLd8?= =?us-ascii?Q?fw=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO6PR11MB5601.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1372e5a6-8578-400a-3539-08db7757e83e X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Jun 2023 21:46:04.4842 (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: pdVsm1GjypT1qp8DhbA7MGXh32r9O8C2XTMXoSE/PdaOc7aLQBVky0BClptcnTKZqxGVh1Vso5xwgIbf1SyIMbB83JNg/8QevA5vQra/8MYKMxFPRKuY3OzEAqrOH5a4 X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR11MB7185 Return-Path: zachary.clark-williams@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Zachary Clark-Williams Hey Michael,=20 Can you help with this change merge? Thanks, Zack -----Original Message----- From: Li, Yi1 =20 Sent: Sunday, June 25, 2023 10:41 PM To: devel@edk2.groups.io Cc: Li, Yi1 ; Maciej Rabeda ; Clark-williams, Zachary Subject: [PATCH V3] NetworkPkg: Correct the length of EAP Identity 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: Zachary Clark-Williams Signed-off-by: Yi Li --- .../WifiConnectionMgrImpl.c | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) 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, NU= LL, (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, 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