From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 67EB1941EED for ; Fri, 10 Nov 2023 23:59:13 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=uI1IQ2UIR+IeTjTpKMwRFeg6M54WgiSIEKeWOHTB3q0=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1699660752; v=1; b=qWrnRSzv0iyLKYG2jSqJwAXOktz74oLvZ6s5wjCsZV03twQbND4JipCYF/ui63yKo0E82riY /+mvm9tk2tzij3qiGfQj9hP7wGXaU9KYNaatYhw1iyhCxkRP8rusgPikkXLffaaIeNs7P6+Jbe5 F+jVSNYiEYJpl6nlU+iFuM7A= X-Received: by 127.0.0.2 with SMTP id 3hEYYY7687511xYTUyBX0rwx; Fri, 10 Nov 2023 15:59:12 -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.42818.1699660751331225384 for ; Fri, 10 Nov 2023 15:59:11 -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.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-623-Wyh2dqDaOLiln6syNkALcw-1; Fri, 10 Nov 2023 18:59:06 -0500 X-MC-Unique: Wyh2dqDaOLiln6syNkALcw-1 X-Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 90364811E7B; Fri, 10 Nov 2023 23:59:06 +0000 (UTC) X-Received: from lacos-laptop-9.usersys.redhat.com (unknown [10.39.192.173]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7422BC1596F; Fri, 10 Nov 2023 23:59:05 +0000 (UTC) From: "Laszlo Ersek" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Gerd Hoffmann , Jiewen Yao Subject: [edk2-devel] [PATCH 04/37] OvmfPkg: remove LegacyBootManagerLib Date: Sat, 11 Nov 2023 00:57:47 +0100 Message-Id: <20231110235820.644381-5-lersek@redhat.com> In-Reply-To: <20231110235820.644381-1-lersek@redhat.com> References: <20231110235820.644381-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.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 Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: miRDZsrBj6HgImQZo8UH9x1wx7686176AA= Content-Transfer-Encoding: base64 Content-Type: text/plain; charset="US-ASCII"; x-default=true X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=qWrnRSzv; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io TGVnYWN5Qm9vdE1hbmFnZXJMaWIgaXMgbm90IHVzZWQgYnkgYW55IHBsYXRmb3JtIGF0IHRoaXMg cG9pbnQsIHJlbW92ZSBpdC4KClRoaXMgcGF0Y2ggcmVtb3ZlcyBtZW50aW9ucyBvZiB0aGUg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iAoQkJT X1RZUEUpICsgRW50cnktPkxlbmd0aCkNCi0gICAgICAgKQ0KLSAgew0KLSAgICBpZiAoRW50cnkt PkJic1R5cGUgPT0gRGV2aWNlVHlwZSkgew0KLSAgICAgIGZvciAoSW5kZXggPSAwOyBJbmRleCA8 IEVudHJ5LT5MZW5ndGggLyBzaXplb2YgKFVJTlQxNikgLSAxOyBJbmRleCsrKSB7DQotICAgICAg ICBpZiAoRW50cnktPkRhdGFbSW5kZXhdID09IE9sZEJic0luZGV4KSB7DQotICAgICAgICAgIGlm IChOZXdCYnNJbmRleCA9PSAoVUlOVDE2KS0xKSB7DQotICAgICAgICAgICAgLy8NCi0gICAgICAg ICAgICAvLyBEZWxldGUgdGhlIG9sZCBlbnRyeQ0KLSAgICAgICAgICAgIC8vDQotICAgICAgICAg ICAgQ29weU1lbSAoDQotICAgICAgICAgICAgICAmRW50cnktPkRhdGFbSW5kZXhdLA0KLSAgICAg ICAgICAgICAgJkVudHJ5LT5EYXRhW0luZGV4ICsgMV0sDQotICAgICAgICAgICAgICAoVUlOVDgg KilMZWdhY3lEZXZPcmRlciArICpMZWdhY3lEZXZPcmRlclNpemUgLSAoVUlOVDggKikmRW50cnkt PkRhdGFbSW5kZXggKyAxXQ0KLSAgICAgICAgICAgICAgKTsNCi0gICAgICAgICAgICBFbnRyeS0+ TGVuZ3RoICAgICAgIC09IHNpemVvZiAoVUlOVDE2KTsNCi0gICAgICAgICAgICAqTGVnYWN5RGV2 T3JkZXJTaXplIC09IHNpemVvZiAoVUlOVDE2KTsNCi0gICAgICAgICAgfSBlbHNlIHsNCi0gICAg ICAgICAgICBFbnRyeS0+RGF0YVtJbmRleF0gPSBOZXdCYnNJbmRleDsNCi0gICAgICAgICAgfQ0K LQ0KLSAgICAgICAgICBicmVhazsNCi0gICAgICAgIH0NCi0gICAgICB9DQotDQotICAgICAgYnJl YWs7DQotICAgIH0NCi0gIH0NCi19DQotDQotLyoqDQotICBEZWxldGUgYWxsIHRoZSBsZWdhY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Rl QWxsSW52YWxpZEJvb3RPcHRpb25zICgNCi0gIFZPSUQNCi0gICkNCi17DQotICBFRklfU1RBVFVT ICAgICAgICAgICAgICAgICAgICBTdGF0dXM7DQotICBVSU5UMTYgICAgICAgICAgICAgICAgICAg ICAgICBIZGRDb3VudDsNCi0gIFVJTlQxNiAgICAgICAgICAgICAgICAgICAgICAgIEJic0NvdW50 Ow0KLSAgSEREX0lORk8gICAgICAgICAgICAgICAgICAgICAgKkhkZEluZm87DQotICBCQlNfVEFC TEUgICAgICAgICAgICAgICAgICAgICAqQmJzVGFibGU7DQotICBVSU5UMTYgICAgICAgICAgICAg ICAgICAgICAgICBCYnNJbmRleDsNCi0gIEVGSV9MRUdBQ1lfQklPU19QUk9UT0NPTCAgICAgICpM ZWdhY3lCaW9zOw0KLSAgVUlOVE4gICAgICAgICAgICAgICAgICAgICAgICAgSW5kZXg7DQotICBF RklfQk9PVF9NQU5BR0VSX0xPQURfT1BUSU9OICAqQm9vdE9wdGlvbjsNCi0gIFVJTlROICAgICAg ICAgICAgICAgICAgICAgICAgIEJvb3RPcHRpb25Db3VudDsNCi0gIExFR0FDWV9ERVZfT1JERVJf RU5UUlkgICAgICAgICpMZWdhY3lEZXZPcmRlcjsNCi0gIFVJTlROICAgICAgICAgICAgICAgICAg ICAgICAgIExlZ2FjeURldk9yZGVyU2l6ZTsNCi0gIEJPT0xFQU4gICAgICAgICAgICAgICAgICAg ICAgICpCYnNJbmRleFVzZWQ7DQotDQotICBIZGRDb3VudCA9IDA7DQotICBCYnNDb3VudCA9IDA7 DQotICBIZGRJbmZvICA9IE5VTEw7DQotICBCYnNUYWJsZSA9IE5VTEw7DQotDQotICBTdGF0dXMg PSBnQlMtPkxvY2F0ZVByb3RvY29sICgmZ0VmaUxlZ2FjeUJpb3NQcm90b2NvbEd1aWQsIE5VTEws IChWT0lEICoqKSZMZWdhY3lCaW9zKTsNCi0gIGlmIChFRklfRVJST1IgKFN0YXR1cykpIHsNCi0g ICAgcmV0dXJuIFN0YXR1czsNCi0gIH0NCi0NCi0gIFN0YXR1cyA9IExlZ2FjeUJpb3MtPkdldEJi c0luZm8gKA0KLSAgICAgICAgICAgICAgICAgICAgICAgICBMZWdhY3lCaW9zLA0KLSAgICAgICAg ICAgICAgICAgICAgICAgICAmSGRkQ291bnQsDQotICAgICAgICAgICAgICAgICAgICAgICAgICZI ZGRJbmZvLA0KLSAgICAgICAgICAgICAgICAgICAgICAgICAmQmJzQ291bnQsDQotICAgICAgICAg ICAgICAgICAgICAgICAgICZCYnNUYWJsZQ0KLSAgICAgICAgICAgICAgICAgICAgICAgICApOw0K LSAgaWYgKEVGSV9FUlJPUiAoU3RhdHVzKSkgew0KLSAgICByZXR1cm4gU3RhdHVzOw0KLSAgfQ0K LQ0KLSAgR2V0VmFyaWFibGUyIChWQVJfTEVHQUNZX0RFVl9PUkRFUiwgJmdFZmlMZWdhY3lEZXZP cmRlclZhcmlhYmxlR3VpZCwgKFZPSUQgKiopJkxlZ2FjeURldk9yZGVyLCAmTGVnYWN5RGV2T3Jk ZXJTaXplKTsNCi0NCi0gIEJvb3RPcHRpb24gPSBFZmlCb290TWFuYWdlckdldExvYWRPcHRpb25z ICgmQm9vdE9wdGlvbkNvdW50LCBMb2FkT3B0aW9uVHlwZUJvb3QpOw0KLQ0KLSAgQmJzSW5kZXhV c2VkID0gQWxsb2NhdGVaZXJvUG9vbCAoQmJzQ291bnQgKiBzaXplb2YgKEJPT0xFQU4pKTsNCi0g IEFTU0VSVCAoQmJzSW5kZXhVc2VkICE9IE5VTEwpOw0KLQ0KLSAgZm9yIChJbmRleCA9IDA7IElu ZGV4IDwgQm9vdE9wdGlvbkNvdW50OyBJbmRleCsrKSB7DQotICAgIC8vDQotICAgIC8vIFNraXAg bm9uIGxlZ2FjeSBib290IG9wdGlvbg0KLSAgICAvLw0KLSAgICBpZiAoKERldmljZVBhdGhUeXBl IChCb290T3B0aW9uW0luZGV4XS5GaWxlUGF0aCkgIT0gQkJTX0RFVklDRV9QQVRIKSB8fA0KLSAg ICAgICAgKERldmljZVBhdGhTdWJUeXBlIChCb290T3B0aW9uW0luZGV4XS5GaWxlUGF0aCkgIT0g QkJTX0JCU19EUCkpDQotICAgIHsNCi0gICAgICBjb250aW51ZTsNCi0gICAgfQ0KLQ0KLSAgICBC YnNJbmRleCA9IExlZ2FjeUJtRnV6enlNYXRjaCAoJkJvb3RPcHRpb25bSW5kZXhdLCBCYnNUYWJs ZSwgQmJzQ291bnQsIEJic0luZGV4VXNlZCk7DQotICAgIGlmIChCYnNJbmRleCA9PSBCYnNDb3Vu dCkgew0KLSAgICAgIERFQlVHICgoREVCVUdfSU5GTywgIltMZWdhY3lCZHNdIERlbGV0ZSBCb290 IE9wdGlvbiBCb290JTA0eDogJXNcbiIsIChVSU5UTilCb290T3B0aW9uW0luZGV4XS5PcHRpb25O dW1iZXIsIEJvb3RPcHRpb25bSW5kZXhdLkRlc2NyaXB0aW9uKSk7DQotICAgICAgLy8NCi0gICAg ICAvLyBEZWxldGUgZW50cnkgZnJvbSBMZWdhY3lEZXZPcmRlcg0KLSAgICAgIC8vDQotICAgICAg TGVnYWN5Qm1VcGRhdGVCYnNJbmRleCAoDQotICAgICAgICBMZWdhY3lEZXZPcmRlciwNCi0gICAg ICAgICZMZWdhY3lEZXZPcmRlclNpemUsDQotICAgICAgICBMZWdhY3lCbURldmljZVR5cGUgKEJv b3RPcHRpb25bSW5kZXhdLkZpbGVQYXRoKSwNCi0gICAgICAgICgoTEVHQUNZX0JNX0JPT1RfT1BU SU9OX0JCU19EQVRBICopQm9vdE9wdGlvbltJbmRleF0uT3B0aW9uYWxEYXRhKS0+QmJzSW5kZXgs DQotICAgICAgICAoVUlOVDE2KS0xDQotICAgICAgICApOw0KLSAgICAgIEVmaUJvb3RNYW5hZ2Vy RGVsZXRlTG9hZE9wdGlvblZhcmlhYmxlIChCb290T3B0aW9uW0luZGV4XS5PcHRpb25OdW1iZXIs IEJvb3RPcHRpb25bSW5kZXhdLk9wdGlvblR5cGUpOw0KLSAgICB9IGVsc2Ugew0KLSAgICAgIGlm ICgoKExFR0FDWV9CTV9CT09UX09QVElPTl9CQlNfREFUQSAqKUJvb3RPcHRpb25bSW5kZXhdLk9w dGlvbmFsRGF0YSktPkJic0luZGV4ICE9IEJic0luZGV4KSB7DQotICAgICAgICBERUJVRyAoKA0K LSAgICAgICAgICBERUJVR19JTkZPLA0KLSAgICAgICAgICAiW0xlZ2FjeUJkc10gVXBkYXRlIEJv b3QgT3B0aW9uIEJvb3QlMDR4OiAlcyBCYnMweCUwNHgtPkJiczB4JTA0eFxuIiwNCi0gICAgICAg ICAgKFVJTlROKUJvb3RPcHRpb25bSW5kZXhdLk9wdGlvbk51bWJlciwNCi0gICAgICAgICAgQm9v dE9wdGlvbltJbmRleF0uRGVzY3JpcHRpb24sDQotICAgICAgICAgIChVSU5UTikoKExFR0FDWV9C TV9CT09UX09QVElPTl9CQlNfREFUQSAqKUJvb3RPcHRpb25bSW5kZXhdLk9wdGlvbmFsRGF0YSkt PkJic0luZGV4LA0KLSAgICAgICAgICAoVUlOVE4pQmJzSW5kZXgNCi0gICAgICAgICAgKSk7DQot ICAgICAgICAvLw0KLSAgICAgICAgLy8gVXBkYXRlIHRoZSBCQlMgaW5kZXggaW4gTGVnYWN5RGV2 T3JkZXINCi0gICAgICAgIC8vDQotICAgICAgICBMZWdhY3lCbVVwZGF0ZUJic0luZGV4ICgNCi0g ICAgICAgICAgTGVnYWN5RGV2T3JkZXIsDQotICAgICAgICAgICZMZWdhY3lEZXZPcmRlclNpemUs DQotICAgICAgICAgIExlZ2FjeUJtRGV2aWNlVHlwZSAoQm9vdE9wdGlvbltJbmRleF0uRmlsZVBh dGgpLA0KLSAgICAgICAgICAoKExFR0FDWV9CTV9CT09UX09QVElPTl9CQlNfREFUQSAqKUJvb3RP cHRpb25bSW5kZXhdLk9wdGlvbmFsRGF0YSktPkJic0luZGV4LA0KLSAgICAgICAgICBCYnNJbmRl eA0KLSAgICAgICAgICApOw0KLQ0K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kZXIgKA0KLSAgSU4gQkJTX1RBQkxFICAqQmJzVGFibGUsDQotICBJTiBVSU5U MTYgICAgIEJic0NvdW50DQotICApDQotew0KLSAgVUlOVE4gICAgICAgICAgICAgICAgICAgSW5k ZXg7DQotICBVSU5UTiAgICAgICAgICAgICAgICAgICBGRENvdW50Ow0KLSAgVUlOVE4gICAgICAg ICAgICAgICAgICAgSERDb3VudDsNCi0gIFVJTlROICAgICAgICAgICAgICAgICAgIENEQ291bnQ7 DQotICBVSU5UTiAgICAgICAgICAgICAgICAgICBORVRDb3VudDsNCi0gIFVJTlROICAgICAgICAg ICAgICAgICAgIEJFVkNvdW50Ow0KLSAgVUlOVE4gICAgICAgICAgICAgICAgICAgVG90YWxTaXpl Ow0KLSAgVUlOVE4gICAgICAgICAgICAgICAgICAgSGVhZGVyU2l6ZTsNCi0gIExFR0FDWV9ERVZf T1JERVJfRU5UUlkgICpEZXZPcmRlcjsNCi0gIExFR0FDWV9ERVZfT1JERVJfRU5UUlkgICpEZXZP cmRlclB0cjsNCi0gIEVGSV9TVEFUVVMgICAgICAgICAgICAgIFN0YXR1czsNCi0NCi0gIEZEQ291 bnQgICAgPSAwOw0KLSAgSERDb3VudCAgICA9IDA7DQotICBDRENvdW50ICAgID0gMDsNCi0gIE5F VENvdW50ICAgPSAwOw0KLSAgQkVWQ291bnQgICA9IDA7DQotICBUb3RhbFNpemUgID0gMDsNCi0g IEhlYWRlclNpemUgPSBzaXplb2YgKEJCU19UWVBFKSArIHNpemVvZiAoVUlOVDE2KTsNCi0gIERl dk9yZGVyICAgPSBOVUxMOw0KLSAgU3RhdHVzICAgICA9IEVGSV9TVUNDRVNTOw0KLQ0KLSAgLy8N Ci0gIC8vIENvdW50IGFsbCBib290IGRldmljZXMNCi0gIC8vDQotICBmb3IgKEluZGV4ID0gMDsg SW5kZXggPCBCYnNDb3VudDsgSW5kZXgrKykgew0KLSAgICBpZiAoIUxlZ2FjeUJtVmFsaWRCYnNF bnRyeSAoJkJic1RhYmxlW0luZGV4XSkpIHsNCi0gICAgICBjb250aW51ZTsNCi0gICAgfQ0KLQ0K LSAgICBzd2l0Y2ggKEJic1RhYmxlW0luZGV4XS5EZXZpY2VUeXBlKSB7DQotICAgICAgY2FzZSBC QlNfRkxPUFBZOg0KLSAgICAgICAgRkRDb3VudCsrOw0KLSAgICAgICAgYnJlYWs7DQotDQotICAg ICAgY2FzZSBCQlNfSEFSRERJU0s6DQotICAgICAgICBIRENvdW50Kys7DQotICAgICAgICBicmVh azsNCi0NCi0gICAgICBjYXNlIEJCU19DRFJPTToNCi0gICAgICAgIENEQ291bnQrKzsNCi0gICAg ICAgIGJyZWFrOw0KLQ0KLSAgICAgIGNhc2UgQkJTX0VNQkVEX05FVFdPUks6DQotICAgICAgICBO RVRDb3VudCsrOw0KLSAgICAgICAgYnJlYWs7DQotDQotICAgICAgY2FzZSBCQlNfQkVWX0RFVklD RToNCi0gICAgICAgIEJFVkNvdW50Kys7DQotICAgICAgICBicmVhazsNCi0NCi0gICAgICBkZWZh dWx0Og0KLSAgICAgICAgYnJlYWs7DQotICAgIH0NCi0gIH0NCi0NCi0gIFRvdGFsU2l6ZSArPSAo SGVhZGVyU2l6ZSArIHNpemVvZiAoVUlOVDE2KSAqIEZEQ291bnQpOw0KLSAgVG90YWxTaXplICs9 IChIZWFkZXJTaXplICsgc2l6ZW9mIChVSU5UMTYpICogSERDb3VudCk7DQotICBUb3RhbFNpemUg Kz0gKEhlYWRlclNpemUgKyBzaXplb2YgKFVJTlQxNikgKiBDRENvdW50KTsNCi0gIFRvdGFsU2l6 ZSArPSAoSGVhZGVyU2l6ZSArIHNpemVvZiAoVUlOVDE2KSAqIE5FVENvdW50KTsNCi0gIFRvdGFs U2l6ZSArPSAoSGVhZGVyU2l6ZSArIHNpemVvZiAoVUlOVDE2KSAqIEJFVkNvdW50KTsNCi0NCi0g IC8vDQotICAvLyBDcmVhdGUgYnVmZmVyIHRvIGhvbGQgYWxsIGJvb3QgZGV2aWNlIG9yZGVy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5Qm1VcGRhdGVE ZXZPcmRlciAoDQotICBWT0lEDQotICApDQotew0KLSAgTEVHQUNZX0RFVl9PUkRFUl9FTlRSWSAg ICAqRGV2T3JkZXI7DQotICBMRUdBQ1lfREVWX09SREVSX0VOVFJZICAgICpOZXdEZXZPcmRlcjsN Ci0gIExFR0FDWV9ERVZfT1JERVJfRU5UUlkgICAgKlB0cjsNCi0gIExFR0FDWV9ERVZfT1JERVJf RU5UUlkgICAgKk5ld1B0cjsNCi0gIEVGSV9MRUdBQ1lfQklPU19QUk9UT0NPTCAgKkxlZ2FjeUJp b3M7DQotICBFRklfU1RBVFVTICAgICAgICAgICAgICAgIFN0YXR1czsNCi0gIFVJTlQxNiAgICAg ICAgICAgICAgICAgICAgSGRkQ291bnQ7DQotICBVSU5UMTYgICAgICAgICAgICAgICAgICAgIEJi c0NvdW50Ow0KLSAgSEREX0lORk8gICAgICAgICAgICAgICAgICAqTG9jYWxIZGRJbmZvOw0KLSAg QkJTX1RBQkxFICAgICAgICAgICAgICAgICAqTG9jYWxCYnNUYWJsZTsNCi0gIFVJTlROICAgICAg ICAgICAgICAgICAgICAgSW5kZXg7DQotICBVSU5UTiAgICAgICAgICAgICAgICAgICAgIEluZGV4 MjsNCi0gIFVJTlROICAgICAgICAgICAgICAgICAgICAgKklkeDsNCi0gIFVJTlROICAgICAgICAg ICAgICAgICAgICAgRkRDb3VudDsNCi0gIFVJTlROICAgICAgICAgICAgICAgICAgICAgSERDb3Vu dDsNCi0gIFVJTlROICAgICAgICAgICAgICAgICAgICAgQ0RDb3VudDsNCi0gIFVJTlROICAgICAg ICAgICAgICAgICAgICAgTkVUQ291bnQ7DQotICBVSU5UTiAgICAgICAgICAgICAgICAgICAgIEJF VkNvdW50Ow0KLSAgVUlOVE4gICAgICAgICAgICAgICAgICAgICBUb3RhbFNpemU7DQotICBVSU5U TiAgICAgICAgICAgICAgICAgICAgIEhlYWRlclNpemU7DQotICBVSU5UMTYgICAgICAgICAgICAg ICAgICAgICpOZXdGRFB0cjsNCi0gIFVJTlQxNiAgICAgICAgICAgICAgICAgICAgKk5ld0hEUHRy Ow0KLSAgVUlOVDE2ICAgICAgICAgICAgICAgICAgICAqTmV3Q0RQdHI7DQotICBVSU5UMTYgICAg ICAgICAgICAgICAgICAgICpOZXdORVRQdHI7DQotICBVSU5UMTYgICAgICAgICAgICAgICAgICAg ICpOZXdCRVZQdHI7DQotICBVSU5UMTYgICAgICAgICAgICAgICAgICAgICpOZXdEZXZQdHI7DQot ICBVSU5UTiAgICAgICAgICAgICAgICAgICAgIEZESW5kZXg7DQotICBVSU5UTiAgICAgICAgICAg ICAgICAgICAgIEhESW5kZXg7DQotICBVSU5UTiAgICAgICAgICAgICAgICAgICAgIENESW5kZXg7 DQotICBVSU5UTiAgICAgICAgICAgICAgICAgICAgIE5FVEluZGV4Ow0KLSAgVUlOVE4gICAgICAg ICAgICAgICAgICAgICBCRVZJbmRleDsNCi0NCi0gIElkeCAgICAgICAgPSBOVUxMOw0KLSAgRkRD b3VudCAgICA9IDA7DQotICBIRENvdW50ICAgID0gMDsNCi0gIENEQ291bnQgICAgPSAwOw0KLSAg TkVUQ291bnQgICA9IDA7DQotICBCRVZDb3VudCAgID0gMDsNCi0gIFRvdGFsU2l6ZSAgPSAwOw0K LSAgSGVhZGVyU2l6ZSA9IHNpemVvZiAoQkJTX1RZUEUpICsgc2l6ZW9mIChVSU5UMTYpOw0KLSAg RkRJbmRleCAgICA9IDA7DQotICBIREluZGV4ICAgID0gMDsNCi0gIENESW5kZXggICAgPSAwOw0K LSAgTkVUSW5kZXggICA9IDA7DQotICBCRVZJbmRleCAgID0gMDsNCi0gIE5ld0RldlB0ciAgPSBO VUxMOw0KLQ0KLSAgU3RhdHVzID0gZ0JTLT5Mb2NhdGVQcm90b2NvbCAoJmdFZmlMZWdhY3lCaW9z UHJvdG9jb2xHdWlkLCBOVUxMLCAoVk9JRCAqKikmTGVnYWN5Qmlvcyk7DQotICBpZiAoRUZJX0VS Uk9SIChTdGF0dXMpKSB7DQotICAgIHJldHVybiBTdGF0dXM7DQotICB9DQotDQotICBTdGF0dXMg PSBMZWdhY3lCaW9zLT5HZXRCYnNJbmZvICgNCi0gICAgICAgICAgICAgICAgICAgICAgICAgTGVn YWN5QmlvcywNCi0gICAgICAgICAgICAgICAgICAgICAgICAgJkhkZENvdW50LA0KLSAgICAgICAg ICAgICAgICAgICAgICAgICAmTG9jYWxIZGRJbmZvLA0KLSAgICAgICAgICAgICAgICAgICAgICAg ICAmQmJzQ291bnQsDQotICAgICAgICAgICAgICAgICAgICAgICAgICZMb2NhbEJic1RhYmxlDQot ICAgICAgICAgICAgICAgICAgICAgICAgICk7DQotICBpZiAoRUZJX0VSUk9SIChTdGF0dXMpKSB7 DQotICAgIHJldHVybiBTdGF0dXM7DQotICB9DQotDQotICBHZXRWYXJpYWJsZTIgKFZBUl9MRUdB Q1lfREVWX09SREVSLCAmZ0VmaUxlZ2FjeURldk9yZGVyVmFyaWFibGVHdWlkLCAoVk9JRCAqKikm RGV2T3JkZXIsIE5VTEwpOw0KLSAgaWYgKE5VTEwgPT0gRGV2T3JkZXIpIHsNCi0gICAgcmV0dXJu IExlZ2FjeUJtQ3JlYXRlRGV2T3JkZXIgKExvY2FsQmJzVGFibGUsIEJic0NvdW50KTsNCi0gIH0N Ci0NCi0gIC8vDQotICAvLyBGaXJzdCB3ZSBmaWd1cmUgb3V0IGhvdyBtYW55IGJvb3QgZGV2aWNl cyB3aXRoIHNhbWUgZGV2aWNlIHR5cGUgcmVzcGVjdGl2ZWx5DQotICAvLw0KLSAgZm9yIChJbmRl eCA9IDA7IEluZGV4IDwgQmJzQ291bnQ7IEluZGV4KyspIHsNCi0gICAgaWYgKCFMZWdhY3lCbVZh bGlkQmJzRW50cnkgKCZMb2NhbEJic1RhYmxlW0luZGV4XSkpIHsNCi0gICAgICBjb250aW51ZTsN Ci0gICAgfQ0KLQ0KLSAgICBzd2l0Y2ggKExvY2FsQmJzVGFibGVbSW5kZXhdLkRldmljZVR5cGUp IHsNCi0gICAgICBjYXNlIEJCU19GTE9QUFk6DQotICAgICAgICBGRENvdW50Kys7DQotICAgICAg ICBicmVhazsNCi0NCi0gICAgICBjYXNlIEJCU19IQVJERElTSzoNCi0gICAgICAgIEhEQ291bnQr KzsNCi0gICAgICAgIGJyZWFrOw0KLQ0KLSAgICAgIGNhc2UgQkJTX0NEUk9NOg0KLSAgICAgICAg Q0RDb3VudCsrOw0KLSAgICAgICAgYnJlYWs7DQotDQotICAgICAgY2FzZSBCQlNfRU1CRURfTkVU V09SSzoNCi0gICAgICAgIE5FVENvdW50Kys7DQotICAgICAgICBicmVhazsNCi0NCi0gICAgICBj YXNlIEJCU19CRVZfREVWSUNFOg0KLSAgICAgICAgQkVWQ291bnQrKzsNCi0gICAgICAgIGJyZWFr Ow0KLQ0KLSAgICAgIGRlZmF1bHQ6DQotICAgICAgICBicmVhazsNCi0gICAgfQ0KLSAgfQ0KLQ0K LSAgVG90YWxTaXplICs9IChIZWFkZXJTaXplICsgRkRDb3VudCAqIHNpemVvZiAoVUlOVDE2KSk7 DQotICBUb3RhbFNpemUgKz0gKEhlYWRlclNpemUgKyBIRENvdW50ICogc2l6ZW9mIChVSU5UMTYp KTsNCi0gIFRvdGFsU2l6ZSArPSAoSGVhZGVyU2l6ZSArIENEQ291bnQgKiBzaXplb2YgKFVJTlQx NikpOw0KLSAgVG90YWxTaXplICs9IChIZWFkZXJTaXplICsgTkVUQ291bnQgKiBzaXplb2YgKFVJ TlQxNikpOw0KLSAgVG90YWxTaXplICs9IChIZWFkZXJTaXplICsgQkVWQ291bnQgKiBzaXplb2Yg KFVJTlQxNikpOw0KLQ0KLSAgTmV3RGV2T3JkZXIgPSBBbGxvY2F0ZVplcm9Qb29sIChUb3RhbFNp emUpOw0KLSAgaWYgKE5VTEwgPT0gTmV3RGV2T3JkZXIpIHsNCi0gICAgcmV0dXJuIEVGSV9PVVRf T0ZfUkVTT1VSQ0VTOw0KLSAgfQ0KLQ0KLSAgLy8NCi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hdGFbSW5kZXhdICYgMHhGRl0uRGV2aWNlVHlwZSAhPSBCQlNf QkVWX0RFVklDRSkNCi0gICAgICAgICkNCi0gICAgew0KLSAgICAgIGNvbnRpbnVlOw0KLSAgICB9 DQotDQotICAgIE5ld1B0ci0+RGF0YVtCRVZJbmRleF0gPSBQdHItPkRhdGFbSW5kZXhdOw0KLSAg ICBCRVZJbmRleCsrOw0KLSAgfQ0KLQ0KLSAgTmV3QkVWUHRyID0gTmV3UHRyLT5EYXRhOw0KLQ0K LSAgZm9yIChJbmRleCA9IDA7IEluZGV4IDwgQmJzQ291bnQ7IEluZGV4KyspIHsNCi0gICAgaWYg KCFMZWdhY3lCbVZhbGlkQmJzRW50cnkgKCZMb2NhbEJic1RhYmxlW0luZGV4XSkpIHsNCi0gICAg ICBjb250aW51ZTsNCi0gICAgfQ0KLQ0KLSAgICBzd2l0Y2ggKExvY2FsQmJzVGFibGVbSW5kZXhd LkRldmljZVR5cGUpIHsNCi0gICAgICBjYXNlIEJCU19GTE9QUFk6DQotICAgICAgICBJZHggICAg ICAgPSAmRkRJbmRleDsNCi0gICAgICAgIE5ld0RldlB0ciA9IE5ld0ZEUHRyOw0KLSAgICAgICAg YnJlYWs7DQotDQotICAgICAgY2FzZSBCQlNfSEFSRERJU0s6DQotICAgICAgICBJZHggICAgICAg PSAmSERJbmRleDsNCi0gICAgICAgIE5ld0RldlB0ciA9IE5ld0hEUHRyOw0KLSAgICAgICAgYnJl YWs7DQotDQotICAgICAgY2FzZSBCQlNfQ0RST006DQotICAgICAgICBJZHggICAgICAgPSAmQ0RJ bmRleDsNCi0gICAgICAgIE5ld0RldlB0ciA9IE5ld0NEUHRyOw0KLSAgICAgICAgYnJlYWs7DQot DQotICAgICAgY2FzZSBCQlNfRU1CRURfTkVUV09SSzoNCi0gICAgICAgIElkeCAgICAgICA9ICZO RVRJbmRleDsNCi0gICAgICAgIE5ld0RldlB0ciA9IE5ld05FVFB0cjsNCi0gICAgICAgIGJyZWFr Ow0KLQ0KLSAgICAgIGNhc2UgQkJTX0JFVl9ERVZJQ0U6DQotICAgICAgICBJZHggICAgICAgPSAm QkVWSW5kZXg7DQotICAgICAgICBOZXdEZXZQdHIgPSBOZXdCRVZQdHI7DQotICAgICAgICBicmVh azsNCi0NCi0gICAgICBkZWZhdWx0Og0KLSAgICAgICAgSWR4ID0gTlVMTDsNCi0gICAgICAgIGJy ZWFrOw0KLSAgICB9DQotDQotICAgIC8vDQotICAgIC8vIGF0IHRoaXMgcG9pbnQgd2UgaGF2ZSBj b3BpZWQgdGhvc2UgdmFsaWQgaW5kZXhlcyB0byBuZXcgYnVmZmVyDQotICAgIC8vIGFuZCB3ZSBz aG91bGQgY2hlY2sgaWYgdGhlcmUgaXMgYW55IG5ldyBhcHBlYXJlZCBib290IGRldmljZQ0KLSAg ICAvLw0KLSAgICBpZiAoSWR4ICE9IE5VTEwpIHsNCi0gICAgICBmb3IgKEluZGV4MiA9IDA7IElu ZGV4MiA8ICpJZHg7IEluZGV4MisrKSB7DQotICAgICAgICBpZiAoKE5ld0RldlB0cltJbmRleDJd ICYgMHhGRikgPT0gKFVJTlQxNilJbmRleCkgew0KLSAgICAgICAgICBicmVhazsNCi0gICAgICAg IH0NCi0gICAgICB9DQotDQotICAgICAgaWYgKEluZGV4MiA9PSAqSWR4KSB7DQotICAgICAgICAv Lw0KLSAgICAgICAgLy8gSW5kZXgyID09ICpJZHggbWVhbnMgd2UgZGlkbid0IGZpbmQgSW5kZXgN Ci0gICAgICAgIC8vIHNvIEluZGV4IGlzIGEgbmV3IGFwcGVhcmVkIGRldmljZSdzIGluZGV4IGlu IEJCUyB0YWJsZQ0KLSAgICAgICAgLy8gaW5zZXJ0IGl0IGJlZm9yZSBkaXNhYmxlZCBpbmRleGVz Lg0KLSAgICAgICAgLy8NCi0gICAgICAgIGZvciAoSW5kZXgyID0gMDsgSW5kZXgyIDwgKklkeDsg SW5kZXgyKyspIHsNCi0gICAgICAgICAgaWYgKChOZXdEZXZQdHJbSW5kZXgyXSAmIDB4RkYwMCkg PT0gMHhGRjAwKSB7DQotICAgICAgICAgICAgYnJlYWs7DQotICAgICAgICAgIH0NCi0gICAgICAg IH0NCi0NCi0gICAgICAgIENvcHlNZW0gKCZOZXdEZXZQdHJbSW5kZXgyICsgMV0sICZOZXdEZXZQ dHJbSW5kZXgyXSwgKCpJZHggLSBJbmRleDIpICogc2l6ZW9mIChVSU5UMTYpKTsNCi0gICAgICAg IE5ld0RldlB0cltJbmRleDJdID0gKFVJTlQxNikoSW5kZXggJiAweEZGKTsNCi0gICAgICAgICgq SWR4KSsrOw0KLSAgICAgIH0NCi0gICAgfQ0KLSAgfQ0KLQ0KLSAgRnJlZVBvb2wgKERldk9yZGVy KTsNCi0NCi0gIFN0YXR1cyA9IGdSVC0+U2V0VmFyaWFibGUgKA0KLSAgICAgICAgICAgICAgICAg IFZBUl9MRUdBQ1lfREVWX09SREVSLA0KLSAgICAgICAgICAgICAgICAgICZnRWZpTGVnYWN5RGV2 T3JkZXJWYXJpYWJsZUd1aWQsDQotICAgICAgICAgICAgICAgICAgRUZJX1ZBUklBQkxFX0JPT1RT RVJWSUNFX0FDQ0VTUyB8IEVGSV9WQVJJQUJMRV9OT05fVk9MQVRJTEUsDQotICAgICAgICAgICAg ICAgICAgVG90YWxTaXplLA0KLSAgICAgICAgICAgICAgICAgIE5ld0Rldk9yZGVyDQotICAgICAg ICAgICAgICAgICAgKTsNCi0gIEZyZWVQb29sIChOZXdEZXZPcmRlcik7DQotDQotICByZXR1cm4g U3RhdHVzOw0KLX0NCi0NCi0vKioNCi0gIFNldCBCb290IFByaW9yaXR5IGZvciBzcGVjaWZpZWQg ZGV2aWNlIHR5cGUuDQotDQotICBAcGFyYW0gRGV2aWNlVHlwZSAgICAgIFRoZSBkZXZpY2UgdHlw ZS4NCi0gIEBwYXJhbSBCYnNJbmRleCAgICAgICAgVGhlIEJCUyBpbmRleCB0byBzZXQgdGhlIGhp Z2hlc3QgcHJpb3JpdHkuIElnbm9yZSB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LSAgSU4gQkJTX1RBQkxFICAqTG9jYWxCYnNUYWJsZSwN Ci0gIElOIFVJTlQxNiAgICAgQmJzQ291bnQNCi0gICkNCi17DQotICBVSU5UMTYgIEluZGV4Ow0K LQ0KLSAgREVCVUcgKChERUJVR19JTkZPLCAiXG4iKSk7DQotICBERUJVRyAoKERFQlVHX0lORk8s ICIgTk8gIFByaW8gYmIvZGQvZmYgY2wvc2MgVHlwZSBTdGF0IHNlZ206b2ZmcyBtc2VnIGRzZWdc biIpKTsNCi0gIERFQlVHICgoREVCVUdfSU5GTywgIj09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuIikpOw0KLSAgZm9yIChJbmRleCA9IDA7IElu ZGV4IDwgQmJzQ291bnQ7IEluZGV4KyspIHsNCi0gICAgaWYgKCFMZWdhY3lCbVZhbGlkQmJzRW50 cnkgKCZMb2NhbEJic1RhYmxlW0luZGV4XSkpIHsNCi0gICAgICBjb250aW51ZTsNCi0gICAgfQ0K LQ0KLSAgICBERUJVRyAoDQotICAgICAgKERFQlVHX0lORk8sDQotICAgICAgICIgJTAyeDogJTA0 eCAlMDJ4LyUwMngvJTAyeCAlMDJ4LyUwMnggJTA0eCAlMDR4ICUwNHg6JTA0eCAlMDR4ICUwNHhc biIsDQotICAgICAgIChVSU5UTilJbmRleCwNCi0gICAgICAgKFVJTlROKUxvY2FsQmJzVGFibGVb SW5kZXhdLkJvb3RQcmlvcml0eSwNCi0gICAgICAgKFVJTlROKUxvY2FsQmJzVGFibGVbSW5kZXhd LkJ1cywNCi0gICAgICAgKFVJTlROKUxvY2FsQmJzVGFibGVbSW5kZXhdLkRldmljZSwNCi0gICAg ICAgKFVJTlROKUxvY2FsQmJzVGFibGVbSW5kZXhdLkZ1bmN0aW9uLA0KLSAgICAgICAoVUlOVE4p TG9jYWxCYnNUYWJsZVtJbmRleF0uQ2xhc3MsDQotICAgICAgIChVSU5UTilMb2NhbEJic1RhYmxl W0luZGV4X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ICAgQkJTIGVudHJpZXMgY2FuJ3QgYmUgZm91bmQuDQot ICBAcmV0dmFsIEVGSV9PVVRfT0ZfUkVTT1VSQ0VTICBGYWlsZWQgdG8gZ2V0IHRoZSBsZWdhY3kg ZGV2aWNlIGJvb3Qgb3JkZXIuDQotKiovDQotRUZJX1NUQVRVUw0KLUxlZ2FjeUJtUmVmcmVzaEJi c1RhYmxlRm9yQm9vdCAoDQotICBJTiBFRklfQk9PVF9NQU5BR0VSX0xPQURfT1BUSU9OICAqQm9v dE9wdGlvbg0KLSAgKQ0KLXsNCi0gIEVGSV9TVEFUVVMgICAgICAgICAgICAgICAgICAgIFN0YXR1 czsNCi0gIFVJTlQxNiAgICAgICAgICAgICAgICAgICAgICAgIEJic0luZGV4Ow0KLSAgVUlOVDE2 ICAgICAgICAgICAgICAgICAgICAgICAgSGRkQ291bnQ7DQotICBVSU5UMTYgICAgICAgICAgICAg ICAgICAgICAgICBCYnNDb3VudDsNCi0gIEhERF9JTkZPICAgICAgICAgICAgICAgICAgICAgICpM b2NhbEhkZEluZm87DQotICBCQlNfVEFCTEUgICAgICAgICAgICAgICAgICAgICAqTG9jYWxCYnNU YWJsZTsNCi0gIFVJTlQxNiAgICAgICAgICAgICAgICAgICAgICAgIERldlR5cGU7DQotICBFRklf TEVHQUNZX0JJT1NfUFJPVE9DT0wgICAgICAqTGVnYWN5QmlvczsNCi0gIFVJTlROICAgICAgICAg ICAgICAgICAgICAgICAgIEluZGV4Ow0KLSAgVUlOVDE2ICAgICAgICAgICAgICAgICAgICAgICAg UHJpb3JpdHk7DQotICBVSU5UMTYgICAgICAgICAgICAgICAgICAgICAgICAqRGV2aWNlVHlwZTsN Ci0gIFVJTlROICAgICAgICAgICAgICAgICAgICAgICAgIERldmljZVR5cGVDb3VudDsNCi0gIFVJ TlROICAgICAgICAgICAgICAgICAgICAgICAgIERldmljZVR5cGVJbmRleDsNCi0gIEVGSV9CT09U X01BTkFHRVJfTE9BRF9PUFRJT04gICpPcHRpb247DQotICBVSU5UTiAgICAgICAgICAgICAgICAg ICAgICAgICBPcHRpb25Db3VudDsNCi0NCi0gIEhkZENvdW50ICAgICAgPSAwOw0KLSAgQmJzQ291 bnQgICAgICA9IDA7DQotICBMb2NhbEhkZEluZm8gID0gTlVMTDsNCi0gIExvY2FsQmJzVGFibGUg PSBOVUxMOw0KLSAgRGV2VHlwZSAgICAgICA9IEJCU19VTktOT1dOOw0KLQ0KLSAgU3RhdHVzID0g Z0JTLT5Mb2NhdGVQcm90b2NvbCAoJmdFZmlMZWdhY3lCaW9zUHJvdG9jb2xHdWlkLCBOVUxMLCAo Vk9JRCAqKikmTGVnYWN5Qmlvcyk7DQotICBpZiAoRUZJX0VSUk9SIChTdGF0dXMpKSB7DQotICAg IHJldHVybiBTdGF0dXM7DQotICB9DQotDQotICBTdGF0dXMgPSBMZWdhY3lCaW9zLT5HZXRCYnNJ bmZvICgNCi0gICAgICAgICAgICAgICAgICAgICAgICAgTGVnYWN5QmlvcywNCi0gICAgICAgICAg ICAgICAgICAgICAgICAgJkhkZENvdW50LA0KLSAgICAgICAgICAgICAgICAgICAgICAgICAmTG9j YWxIZGRJbmZvLA0KLSAgICAgICAgICAgICAgICAgICAgICAgICAmQmJzQ291bnQsDQotICAgICAg ICAgICAgICAgICAgICAgICAgICZMb2NhbEJic1RhYmxlDQotICAgICAgICAgICAgICAgICAgICAg ICAgICk7DQotICBpZiAoRUZJX0VSUk9SIChTdGF0dXMpKSB7DQotICAgIHJldHVybiBTdGF0dXM7 DQotICB9DQotDQotICAvLw0KLSAgLy8gRmlyc3QsIHNldCBhbGwgdGhlIHByZXNlbnQgZGV2aWNl cycgYm9vdCBwcmlvcml0eSB0byBCQlNfVU5QUklPUklUSVpFRF9FTlRSWQ0KLSAgLy8gV2Ugd2ls bCBzZXQgdGhlbSBhY2NvcmRpbmcgdG8gdGhlIHNldHRpbmdzIHNldHVwIGJ5IHVzZXINCi0gIC8v DQotICBmb3IgKEluZGV4ID0gMDsgSW5kZXggP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HJlZnJlc2ggQkJTDQotICAvLw0KLSAg U3RhdHVzID0gTGVnYWN5Qm1SZWZyZXNoQmJzVGFibGVGb3JCb290IChCb290T3B0aW9uKTsNCi0g IGlmIChFRklfRVJST1IgKFN0YXR1cykpIHsNCi0gICAgQm9vdE9wdGlvbi0+U3RhdHVzID0gU3Rh dHVzOw0KLSAgICByZXR1cm47DQotICB9DQotDQotICBCb290T3B0aW9uLT5TdGF0dXMgPSBMZWdh Y3lCaW9zLT5MZWdhY3lCb290ICgNCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgTGVnYWN5QmlvcywNCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKEJC U19CQlNfREVWSUNFX1BBVEggKilCb290T3B0aW9uLT5GaWxlUGF0aCwNCi0gICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgQm9vdE9wdGlvbi0+T3B0aW9uYWxEYXRhU2l6ZSwNCi0g ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQm9vdE9wdGlvbi0+T3B0aW9uYWxE YXRhDQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICk7DQotfQ0KLQ0KLS8q Kg0KLSAgVGhpcyBmdW5jdGlvbiBlbnVtZXJhdGVzIGFsbCB0aGUgbGVnYWN5IGJvb3Qgb3B0aW9u cy4NCi0NCi0gIEBwYXJhbSBCb290T3B0aW9uQ291bnQgICBSZXR1cm4gdGhlIGxlZ2FjeSBib290 IG9wdGlvbiBjb3VudC4NCi0NCi0gIEByZXR2YWwgICAgUG9pbnRlciB0byB0aGUgbGVnYWN5IGJv b3Qgb3B0aW9uIGJ1ZmZlci4NCi0qKi8NCi1FRklfQk9PVF9NQU5BR0VSX0xPQURfT1BUSU9OICoN Ci1MZWdhY3lCbUVudW1lcmF0ZUFsbEJvb3RPcHRpb25zICgNCi0gIFVJTlROICAqQm9vdE9wdGlv bkNvdW50DQotICApDQotew0KLSAgRUZJX1NUQVRVUyAgICAgICAgICAgICAgICAgICAgU3RhdHVz Ow0KLSAgVUlOVDE2ICAgICAgICAgICAgICAgICAgICAgICAgSGRkQ291bnQ7DQotICBVSU5UMTYg ICAgICAgICAgICAgICAgICAgICAgICBCYnNDb3VudDsNCi0gIEhERF9JTkZPICAgICAgICAgICAg ICAgICAgICAgICpIZGRJbmZvOw0KLSAgQkJTX1RBQkxFICAgICAgICAgICAgICAgICAgICAgKkJi c1RhYmxlOw0KLSAgRUZJX0xFR0FDWV9CSU9TX1BST1RPQ09MICAgICAgKkxlZ2FjeUJpb3M7DQot ICBVSU5UMTYgICAgICAgICAgICAgICAgICAgICAgICBJbmRleDsNCi0gIEVGSV9CT09UX01BTkFH RVJfTE9BRF9PUFRJT04gICpCb290T3B0aW9uczsNCi0NCi0gIEFTU0VSVCAoQm9vdE9wdGlvbkNv dW50ICE9IE5VTEwpOw0KLQ0KLSAgQm9vdE9wdGlvbnMgICAgICA9IE5VTEw7DQotICAqQm9vdE9w dGlvbkNvdW50ID0gMDsNCi0gIEJic0NvdW50ICAgICAgICAgPSAwOw0KLQ0KLSAgU3RhdHVzID0g Z0JTLT5Mb2NhdGVQcm90b2NvbCAoJmdFZmlMZWdhY3lCaW9zUHJvdG9jb2xHdWlkLCBOVUxMLCAo Vk9JRCAqKikmTGVnYWN5Qmlvcyk7DQotICBpZiAoRUZJX0VSUk9SIChTdGF0dXMpKSB7DQotICAg IHJldHVybiBOVUxMOw0KLSAgfQ0KLQ0KLSAgU3RhdHVzID0gTGVnYWN5Qmlvcy0+R2V0QmJzSW5m byAoDQotICAgICAgICAgICAgICAgICAgICAgICAgIExlZ2FjeUJpb3MsDQotICAgICAgICAgICAg ICAgICAgICAgICAgICZIZGRDb3VudCwNCi0gICAgICAgICAgICAgICAgICAgICAgICAgJkhkZElu Zm8sDQotICAgICAgICAgICAgICAgICAgICAgICAgICZCYnNDb3VudCwNCi0gICAgICAgICAgICAg ICAgICAgICAgICAgJkJic1RhYmxlDQotICAg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lbSW5kZXhdLk9wdGlvbmFsRGF0YSwgS2V5LT5P cHRpb25hbERhdGFTaXplKSA9PSAwKSkNCi0gICAgew0KLSAgICAgIHJldHVybiAoSU5UTilJbmRl eDsNCi0gICAgfQ0KLSAgfQ0KLQ0KLSAgcmV0dXJuIC0xOw0KLX0NCi0NCi0vKioNCi0gIFJlZnJl c2ggYWxsIGxlZ2FjeSBib290IG9wdGlvbnMuDQotDQotKiovDQotVk9JRA0KLUVGSUFQSQ0KLUxl Z2FjeUJtUmVmcmVzaEFsbEJvb3RPcHRpb24gKA0KLSAgVk9JRA0KLSAgKQ0KLXsNCi0gIEVGSV9T VEFUVVMgICAgICAgICAgICAgICAgICAgIFN0YXR1czsNCi0gIEVGSV9MRUdBQ1lfQklPU19QUk9U T0NPTCAgICAgICpMZWdhY3lCaW9zOw0KLSAgVUlOVE4gICAgICAgICAgICAgICAgICAgICAgICAg Um9vdEJyaWRnZUhhbmRsZUNvdW50Ow0KLSAgRUZJX0hBTkRMRSAgICAgICAgICAgICAgICAgICAg KlJvb3RCcmlkZ2VIYW5kbGVCdWZmZXI7DQotICBVSU5UTiAgICAgICAgICAgICAgICAgICAgICAg ICBIYW5kbGVDb3VudDsNCi0gIEVGSV9IQU5ETEUgICAgICAgICAgICAgICAgICAgICpIYW5kbGVC dWZmZXI7DQotICBVSU5UTiAgICAgICAgICAgICAgICAgICAgICAgICBSb290QnJpZGdlSW5kZXg7 DQotICBVSU5UTiAgICAgICAgICAgICAgICAgICAgICAgICBJbmRleDsNCi0gIFVJTlROICAgICAg ICAgICAgICAgICAgICAgICAgIEZsYWdzOw0KLSAgRUZJX0JPT1RfTUFOQUdFUl9MT0FEX09QVElP TiAgKkJvb3RPcHRpb25zOw0KLSAgVUlOVE4gICAgICAgICAgICAgICAgICAgICAgICAgQm9vdE9w dGlvbkNvdW50Ow0KLSAgRUZJX0JPT1RfTUFOQUdFUl9MT0FEX09QVElPTiAgKkV4aXN0aW5nQm9v dE9wdGlvbnM7DQotICB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yaWRnZUhhbmRsZUJ1ZmZlcltSb290QnJpZGdlSW5kZXhdLCBO VUxMLCBOVUxMLCBGQUxTRSk7DQotICAgIGdCUy0+TG9jYXRlSGFuZGxlQnVmZmVyICgNCi0gICAg ICAgICAgIEJ5UHJvdG9jb2wsDQotICAgICAgICAgICAmZ0VmaVBjaUlvUHJvdG9jb2xHdWlkLA0K LSAgICAgICAgICAgTlVMTCwNCi0gICAgICAgICAgICZIYW5kbGVDb3VudCwNCi0gICAgICAgICAg ICZIYW5kbGVCdWZmZXINCi0gICAgICAgICAgICk7DQotICAgIGZvciAoSW5kZXggPSAwOyBJbmRl eCA8IEhhbmRsZUNvdW50OyBJbmRleCsrKSB7DQotICAgICAgLy8NCi0gICAgICAvLyBTdGFydCB0 aGUgdGh1bmsgZHJpdmVyIHNvIHRoYXQgdGhlIGxlZ2FjeSBvcHRpb24gcm9tIGdldHMgZGlzcGF0 Y2hlZC4NCi0gICAgICAvLyBOb3RlOiBXZSBkb24ndCBkaXJlY3RseSBjYWxsIEluc3RhbGxQY2lS b20gYmVjYXVzZSBzb21lIHRodW5rIGRyaXZlcnMNCi0gICAgICAvLyAoZS5nLiBCbG9ja0lvIHRo dW5rIGRyaXZlcikgZGVwZW5kIG9uIHRoZSBpbW1lZGlhdGUgcmVzdWx0IGFmdGVyIGRpc3BhdGNo aW5nDQotICAgICAgLy8NCi0gICAgICBTdGF0dXMgPSBMZWdhY3lCaW9zLT5DaGVja1BjaVJvbSAo DQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMZWdhY3lCaW9zLA0KLSAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgSGFuZGxlQnVmZmVyW0luZGV4XSwNCi0gICAgICAgICAgICAgICAg ICAgICAgICAgICAgIE5VTEwsDQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMLA0K LSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJkZsYWdzDQotICAgICAgICAgICAgICAgICAg ICAgICAgICAgICApOw0KLS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