From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from webbox1416.server-home.net ([77.236.96.61]) by merlin.infradead.org with esmtp (Exim 4.85 #2 (Red Hat Linux)) id 1agUng-0003in-RP for barebox@lists.infradead.org; Thu, 17 Mar 2016 10:05:19 +0000 Received: from imapserver.systec-electronic.com (unknown [212.185.67.146]) by webbox1416.server-home.net (Postfix) with ESMTPA id B7F3427A709 for ; Thu, 17 Mar 2016 11:01:41 +0100 (CET) From: Alexander Stein Subject: [PATCH 13/13] ubifs: update implementation from u-boot v2016.03 Date: Thu, 17 Mar 2016 11:00:29 +0100 Message-Id: <1458208829-25570-14-git-send-email-alexander.stein@systec-electronic.com> In-Reply-To: <1458208829-25570-1-git-send-email-alexander.stein@systec-electronic.com> References: <1458208829-25570-1-git-send-email-alexander.stein@systec-electronic.com> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org To: barebox@lists.infradead.org Cc: Daniel Krueger , Alexander Stein VGhpcyB1cGRhdGVkIGNvZGUgc3VwcG9ydHMgcmVjb3ZlcmluZyBmcm9tIHVuY2xlYW4gdW5tb3Vu dHMgd2hlbiB3cml0ZQpidWZmZXIgc2l6ZSBpcyBsYXJnZXIgdGhhbiA4LiBMaW51eCB1c2VzIHRh a2VzIGluZm9ybWF0aW9uIGludG8KY29uc2lkZXJhdGlvbiB3aGVuIGNoZWNraW5nIGZvciB3cml0 ZXMuClRoZSBmb2xsb3dpbmcgbGlzdCBzaG93cyB0aGUgY2hhbmdlcyBmb3IgZWFjaCBmaWxlIGRv bmUgY29tcGFyZWQgdG8KdS1ib290IHYyMDE2LjAzIGNvZGUuCgpNYWtlZmlsZQoqIEFkZCBnYy5v LCBkbyBub3QgaW5jbHVkZSBoZWFkZXIgYXMgaW4gdS1ib290CgpidWRnZXQu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S0tLQogZnMvdWJpZnMv Z2MuYyAgICAgICAgICB8ICA5NzYgKysrKysrKysrKysrKysrCiBmcy91Ymlmcy9pby5jICAgICAg ICAgIHwgIDkyOSArKysrKysrKysrKysrLQogZnMvdWJpZnMva2V5LmggICAgICAgICB8ICAgNjgg Ky0KIGZzL3ViaWZzL2xvZy5jICAgICAgICAgfCAgNjcxICsrKysrKysrKystCiBmcy91Ymlmcy9s cHJvcHMuYyAgICAgIHwgIDUzNyArKysrKysrKy0KIGZzL3ViaWZzL2xwdC5jICAgICAgICAgfCAx Mjc1ICsrKysrKysrKysrKysrKysrKystCiBmcy91Ymlmcy9scHRfY29tbWl0LmMgIHwgMTkwNCAr KysrKysrKysrKysrKysrKysrKysrKysrKysrLQogZnMvdWJpZnMvbWFzdGVyLmMgICAgICB8ICAx MDIgKy0KIGZzL3ViaWZzL21pc2MuaCAgICAgICAgfCAgMTY0ICsrLQogZnMvdWJpZnMvb3JwaGFu LmMgICAgICB8ICA2NzIgKysrKysrKysrKy0KIGZzL3ViaWZzL3JlY292ZXJ5LmMgICAgfCAgNzU1 ICsrKysrKysrLS0tLQogZnMvdWJpZnMvcmVwbGF5LmMgICAgICB8ICA2MDMgKysrKystLS0tLQog ZnMvdWJpZnMvc2IuYyAgICAgICAgICB8ICA1NTggKysrKysrKystCiBmcy91Ymlmcy9zY2FuLmMg ICAgICAgIHwgIDExNiArLQogZnMvdWJpZnMvc3VwZXIuYyAgICAgICB8IDIzNjAgKysrKysrKysr KysrKysrKysrKysrKysrKysrKysrKy0tLS0tCiBmcy91Ymlmcy90bmMuYyAgICAgICAgIHwgIDc1 NiArKysrKysrKysrLS0KIGZzL3ViaWZzL3RuY19taXNjLmMgICAgfCAgMTI3ICstCiBmcy91Ymlm cy91Ymlmcy1tZWRpYS5oIHwgICA2MiArLQogZnMvdWJpZnMvdWJpZnMuYyAgICAgICB8ICA4Mjgg KysrKysrKysrKystLQogZnMvdWJpZnMvdWJpZnMuaCAgICAgICB8ICA5NjYg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dGNoIChoYXNoKSB7CisJY2FzZSBVQklGU19LRVlfSEFTSF9SNToKKwkJcmV0dXJuICJSNSI7 CisJY2FzZSBVQklGU19LRVlfSEFTSF9URVNUOgorCQlyZXR1cm4gInRlc3QiOworCWRlZmF1bHQ6 CisJCXJldHVybiAidW5rbm93bi9pbnZhbGlkIG5hbWUgaGFzaCI7CisJfQorfQogCiBzdGF0aWMg Y29uc3QgY2hhciAqZ2V0X2tleV90eXBlKGludCB0eXBlKQogewpAQCAtNjgsOCArNzEsMzIgQEAg c3RhdGljIGNvbnN0IGNoYXIgKmdldF9rZXlfdHlwZShpbnQgdHlwZSkKIAl9CiB9CiAKLXN0YXRp YyB2b2lkIHNwcmludGZfa2V5KGNvbnN0IHN0cnVjdCB1Ymlmc19pbmZvICpjLCBjb25zdCB1bmlv biB1Ymlmc19rZXkgKmtleSwKLQkJCWNoYXIgKmJ1ZmZlcikKKyNpZm5kZWYgX19CQVJFQk9YX18K K3N0YXRpYyBjb25zdCBjaGFyICpnZXRfZGVudF90eXBlKGludCB0eXBlKQoreworCXN3aXRjaCAo dHlwZSkgeworCWNhc2UgVUJJRlNfSVRZUEVfUkVHOgorCQlyZXR1cm4gImZpbGUiOworCWNhc2Ug VUJJRlNfSVRZUEVfRElSOgorCQlyZXR1cm4gImRpciI7CisJY2FzZSBVQklGU19JVFlQRV9MTks6 CisJCXJldHVybiAic3ltbGluayI7CisJY2FzZSBVQklGU19JVFlQRV9CTEs6CisJCXJldHVybiAi YmxrZGV2IjsKKwljYXNlIFVCSUZTX0lUWVBFX0NIUjoKKwkJcmV0dXJuICJjaGFyIGRldiI7CisJ Y2FzZSBVQklGU19JVFlQRV9GSUZPOgorCQlyZXR1cm4gImZpZm8iOworCWNhc2UgVUJJRlNfSVRZ UEVfU09DSzoKKwkJcmV0dXJuICJzb2NrZXQiOworCWRlZmF1bHQ6CisJCXJldHVybiAidW5rbm93 bi9pbnZhbGlkIHR5cGUiOworCX0KK30KKyNlbmRpZgorCitjb25zd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KKwkJbGVuIC09IHNucHJpbnRmKHAsIGxlbiwgImJhZCBrZXkg Zm9ybWF0ICVkIiwgYy0+a2V5X2ZtdCk7CisJdWJpZnNfYXNzZXJ0KGxlbiA+IDApOworCXJldHVy biBwOworfQorCitjb25zdCBjaGFyICpkYmdfbnR5cGUoaW50IHR5cGUpCit7CisJc3dpdGNoICh0 eXBlKSB7CisJY2FzZSBVQklGU19QQURfTk9ERToKKwkJcmV0dXJuICJwYWRkaW5nIG5vZGUiOwor CWNhc2UgVUJJRlNfU0JfTk9ERToKKwkJcmV0dXJuICJzdXBlcmJsb2NrIG5vZGUiOworCWNhc2Ug VUJJRlNfTVNUX05PREU6CisJCXJldHVybiAibWFzdGVyIG5vZGUiOworCWNhc2UgVUJJRlNfUkVG X05PREU6CisJCXJldHVybiAicmVmZXJlbmNlIG5vZGUiOworCWNhc2UgVUJJRlNfSU5PX05PREU6 CisJCXJldHVybiAiaW5vZGUgbm9kZSI7CisJY2FzZSBVQklGU19ERU5UX05PREU6CisJCXJldHVy biAiZGlyZW50cnkgbm9kZSI7CisJY2FzZSBVQklGU19YRU5UX05PREU6CisJCXJldHVybiAieGVu dHJ5IG5vZGUiOworCWNhc2UgVUJJRlNfREFUQV9OT0RFOgorCQlyZXR1cm4gImRhdGEgbm9kZSI7 CisJY2FzZSBVQklGU19UUlVOX05PREU6CisJCXJldHVybiAidHJ1bmNhdGUgbm9kZSI7CisJY2Fz ZSBVQklGU19JRFhfTk9ERToKKwkJcmV0dXJuICJpbmRleGluZyBub2RlIjsKKwljYXNlIFVCSUZT X0NTX05PREU6CisJCXJldHVybiAiY29tbWl0IHN0YXJ0IG5vZGUiOworCWNhc2UgVUJJRlNfT1JQ SF9OT0RFOgorCQlyZXR1cm4gIm9ycGhhbiBub2RlIjsKKwlkZWZhdWx0OgorCQlyZXR1cm4gInVu a25vd24gbm9kZSI7CisJfQorfQorCitzdGF0aWMgY29uc3QgY2hhciAqZGJnX2d0eXBlKGludCB0 eXBlKQoreworCXN3aXRjaCAodHlwZSkgeworCWNhc2UgVUJJRlNfTk9fTk9ERV9HUk9VUDoKKwkJ cmV0dXJuICJubyBub2RlIGdyb3VwIjsKKwljYXNlIFVCSUZTX0lOX05PREVfR1JPVVA6CisJCXJl dHVybiAiaW4gbm9kZSBncm91cCI7CisJY2FzZSBVQklGU19MQVNUX09GX05PREVfR1JPVVA6CisJ CXJldHVybiAibGFzdCBvZiBub2RlIGdyb3VwIjsKKwlkZWZhdWx0OgorCQlyZXR1cm4gInVua25v d24iOworCX0KK30KKworY29uc3QgY2hhciAqZGJnX2NzdGF0ZShpbnQgY210X3N0YXRlKQorewor CXN3aXRjaCAoY210X3N0YXRlKSB7CisJY2FzZSBDT01NSVRfUkVTVElORzoKKwkJcmV0dXJuICJj b21taXQgcmVzdGluZyI7CisJY2FzZSBDT01NSVRfQkFDS0dST1VORDoKKwkJcmV0dXJuICJiYWNr Z3JvdW5kIGNvbW1pdCByZXF1ZXN0ZWQiOworCWNhc2UgQ09NTUlUX1JFUVVJUkVEOgorCQlyZXR1 cm4gImNvbW1pdCByZXF1aXJlZCI7CisJY2FzZSBDT01NSVRfUlVOTklOR19CQUNLR1JPVU5EOgor CQlyZXR1cm4gIkJBQ0tHUk9VTkQgY29tbWl0IHJ1bm5pbmciOworCWNhc2UgQ09NTUlUX1JVTk5J TkdfUkVRVUlSRUQ6CisJCXJldHVybiAiY29tbWl0IHJ1bm5pbmcgYW5kIHJlcXVpcmVkIjsKKwlj YXNlIENPTU1JVF9CUk9LRU46CisJCXJldHVybiAiYnJva2VuIGNvbW1pdCI7CisJZGVmYXVsdDoK KwkJcmV0dXJuICJ1bmtub3duIGNvbW1pdCBzdGF0ZSI7CisJfQorfQorCitjb25zdCBjaGFyICpk YmdfamhlYWQoaW50IGpoZWFkKQoreworCXN3aXRjaCAoamhlYWQpIHsKKwljYXNlIEdDSEQ6CisJ CXJldHVybiAiMCAoR0MpIjsKKwljYXNlIEJBU0VIRDoKKwkJcmV0dXJuICIxIChi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lICpkZW50LCAqcGRlbnQgPSBOVUxMOworCWludCBj b3VudCA9IDI7CisKKwlwcl9lcnIoIkR1bXAgaW4tbWVtb3J5IGlub2RlOiIpOworCXByX2Vycigi XHRpbm9kZSAgICAgICAgICAlbHVcbiIsIGlub2RlLT5pX2lubyk7CisJcHJfZXJyKCJcdHNpemUg ICAgICAgICAgICVsbHVcbiIsCisJICAgICAgICh1bnNpZ25lZCBsb25nIGxvbmcpaV9zaXplX3Jl YWQoaW5vZGUpKTsKKwlwcl9lcnIoIlx0bmxpbmsgICAgICAgICAgJXVcbiIsIGlub2RlLT5pX25s aW5rKTsKKwlwcl9lcnIoIlx0dWlkICAgICAgICAgICAgJXVcbiIsICh1bnNpZ25lZCBpbnQpaV91 aWRfcmVhZChpbm9kZSkpOworCXByX2VycigiXHRnaWQgICAgICAgICAgICAldVxuIiwgKHVuc2ln bmVkIGludClpX2dpZF9yZWFkKGlub2RlKSk7CisJcHJfZXJyKCJcdGF0aW1lICAgICAgICAgICV1 LiV1XG4iLAorCSAgICAgICAodW5zaWduZWQgaW50KWlub2RlLT5pX2F0aW1lLnR2X3NlYywKKwkg ICAgICAgKHVuc2lnbmVkIGludClpbm9kZS0+aV9hdGltZS50dl9uc2VjKTsKKwlwcl9lcnIoIlx0 bXRpbWUgICAgICAgICAgJXUuJXVcbiIsCisJICAgICAgICh1bnNpZ25lZCBpbnQpaW5vZGUtPmlf bXRpbWUudHZfc2VjLAorCSAgICAgICAodW5zaWduZWQgaW50KWlub2RlLT5pX210aW1lLnR2X25z ZWMpOworCXByX2VycigiXHRjdGltZSAgICAgICAgICAldS4ldVxuIiwKKwkgICAgICAgKHVuc2ln bmVkIGludClpbm9kZS0+aV9jdGltZS50dl9zZWMsCisJICAgICAgICh1bnNpZ25lZCBpbnQpaW5v ZGUtPmlfY3RpbWUudHZfbnNlYyk7CisJcHJfZXJyKCJcdGNyZWF0X3NxbnVtICAgICVsbHVcbiIs IHVpLT5jcmVhdF9zcW51bSk7CisJcHJf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yKCJcdGRlZmF1bHRfY29tcHIgICV1XG4iLAorCQkgICAgICAgKGludClsZTE2 X3RvX2NwdShzdXAtPmRlZmF1bHRfY29tcHIpKTsKKwkJcHJfZXJyKCJcdHJwX3NpemUgICAgICAg ICVsbHVcbiIsCisJCSAgICAgICAodW5zaWduZWQgbG9uZyBsb25nKWxlNjRfdG9fY3B1KHN1cC0+ cnBfc2l6ZSkpOworCQlwcl9lcnIoIlx0cnBfdWlkICAgICAgICAgJXVcbiIsIGxlMzJfdG9fY3B1 KHN1cC0+cnBfdWlkKSk7CisJCXByX2VycigiXHRycF9naWQgICAgICAgICAldVxuIiwgbGUzMl90 b19jcHUoc3VwLT5ycF9naWQpKTsKKwkJcHJfZXJyKCJcdGZtdF92ZXJzaW9uICAgICV1XG4iLCBs ZTMyX3RvX2NwdShzdXAtPmZtdF92ZXJzaW9uKSk7CisJCXByX2VycigiXHR0aW1lX2dyYW4gICAg ICAldVxuIiwgbGUzMl90b19jcHUoc3VwLT50aW1lX2dyYW4pKTsKKwkJcHJfZXJyKCJcdFVVSUQg ICAgICAgICAgICVwVUJcbiIsIHN1cC0+dXVpZCk7CisJCWJyZWFrOworCX0KKwljYXNlIFVCSUZT X01TVF9OT0RFOgorCXsKKwkJY29uc3Qgc3RydWN0IHViaWZzX21zdF9ub2RlICptc3QgPSBub2Rl OworCisJCXByX2VycigiXHRoaWdoZXN0X2ludW0gICAlbGx1XG4iLAorCQkgICAgICAgKHVuc2ln bmVkIGxvbmcgbG9uZylsZTY0X3RvX2NwdShtc3QtPmhpZ2hlc3RfaW51bSkpOworCQlwcl9lcnIo Ilx0Y29tbWl0IG51bWJlciAgJWxsdVxuIiwKKwkJICAgICAgICh1bnNpZ25lZCBsb25nIGxvbmcp bGU2NF90b19jcHUobXN0LT5jbXRfbm8pKTsKKwkJcHJfZXJyKCJcdGZsYWdzICAgICAgICAgICUj eFxuIiwgbGUzMl90b19jcHUobXN0LT5mbGFncykpOworCQlwcl9lcnIoIlx0bG9nX2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G4iLCBsZTMyX3RvX2NwdShtc3QtPmx0YWJfbG51bSkpOworCQlw cl9lcnIoIlx0bHRhYl9vZmZzICAgICAgJXVcbiIsIGxlMzJfdG9fY3B1KG1zdC0+bHRhYl9vZmZz KSk7CisJCXByX2VycigiXHRsc2F2ZV9sbnVtICAgICAldVxuIiwgbGUzMl90b19jcHUobXN0LT5s c2F2ZV9sbnVtKSk7CisJCXByX2VycigiXHRsc2F2ZV9vZmZzICAgICAldVxuIiwgbGUzMl90b19j cHUobXN0LT5sc2F2ZV9vZmZzKSk7CisJCXByX2VycigiXHRsc2Nhbl9sbnVtICAgICAldVxuIiwg bGUzMl90b19jcHUobXN0LT5sc2Nhbl9sbnVtKSk7CisJCXByX2VycigiXHRsZWJfY250ICAgICAg ICAldVxuIiwgbGUzMl90b19jcHUobXN0LT5sZWJfY250KSk7CisJCXByX2VycigiXHRlbXB0eV9s ZWJzICAgICAldVxuIiwgbGUzMl90b19jcHUobXN0LT5lbXB0eV9sZWJzKSk7CisJCXByX2Vycigi XHRpZHhfbGVicyAgICAgICAldVxuIiwgbGUzMl90b19jcHUobXN0LT5pZHhfbGVicykpOworCQlw cl9lcnIoIlx0dG90YWxfZnJlZSAgICAgJWxsdVxuIiwKKwkJICAgICAgICh1bnNpZ25lZCBsb25n IGxvbmcpbGU2NF90b19jcHUobXN0LT50b3RhbF9mcmVlKSk7CisJCXByX2VycigiXHR0b3RhbF9k aXJ0eSAgICAlbGx1XG4iLAorCQkgICAgICAgKHVuc2lnbmVkIGxvbmcgbG9uZylsZTY0X3RvX2Nw dShtc3QtPnRvdGFsX2RpcnR5KSk7CisJCXByX2VycigiXHR0b3RhbF91c2VkICAgICAlbGx1XG4i LAorCQkgICAgICAgKHVuc2lnbmVkIGxvbmcgbG9uZylsZTY0X3RvX2NwdShtc3QtPnRvdGFsX3Vz ZWQpKTsKKwkJcHJfZXJyKCJcdHRvdGFsX2RlYWQgICAgICVsbHVcbiIsCisJCSAgICAgICAodW5z aWduZWQgbG9uZyBsb25nKWxlNjRfdG9fY3B1KG1zdC0+dG90YWxfZGVhZCkpOworCQlwcl9lcnIo Ilx0dG90YWxfZGFyayAgICAgJWxsdVxuIiwKKwkJICAgICAgICh1bnNpZ25lZCBsb25nIGxvbmcp bGU2NF90b19jcHUobXN0LT50b3RhbF9kYXJrKSk7CisJCWJyZWFrOworCX0KKwljYXNlIFVCSUZT X1JFRl9OT0RFOgorCXsKKwkJY29uc3Qgc3RydWN0IHViaWZzX3JlZl9ub2RlICpyZWYgPSBub2Rl OworCisJCXByX2VycigiXHRsbnVtICAgICAgICAgICAldVxuIiwgbGUzMl90b19jcHUocmVmLT5s bnVtKSk7CisJCXByX2VycigiXHRvZmZzICAgICAgICAgICAldVxuIiwgbGUzMl90b19jcHUocmVm LT5vZmZzKSk7CisJCXByX2VycigiXHRqaGVhZCAgICAgICAgICAldVxuIiwgbGUzMl90b19jcHUo cmVmLT5qaGVhZCkpOworCQlicmVhazsKKwl9CisJY2FzZSBVQklGU19JTk9fTk9ERToKKwl7CisJ CWNvbnN0IHN0cnVjdCB1Ymlmc19pbm9fbm9kZSAqaW5vID0gbm9kZTsKKworCQlrZXlfcmVhZChj LCAmaW5vLT5rZXksICZrZXkpOworCQlwcl9lcnIoIlx0a2V5ICAgICAgICAgICAgJXNcbiIsCisJ CSAgICAgICBkYmdfc25wcmludGZfa2V5KGMsICZrZXksIGtleV9idWYsIERCR19LRVlfQlVGX0xF TikpOworCQlwcl9lcnIoIlx0Y3JlYXRfc3FudW0gICAgJWxsdVxuIiwKKwkJICAgICAgICh1bnNp Z25lZCBsb25nIGxvbmcpbGU2NF90b19jcHUoaW5vLT5jcmVhdF9zcW51bSkpOworCQlwcl9lcnIo Ilx0c2l6ZSAgICAgICAgICAgJWxsdVxuIiwKKwkJICAgICAgICh1bnNpZ25lZCBsb25nIGxvbmcp bGU2NF90b19jcHUoaW5vLT5zaXplKSk7CisJCXByX2VycigiXHRubGluayAgICAgICAgICAldVxu IiwgbGUzMl90b19jcHUoaW5vLT5ubGluaykpOworCQlwcl9lcnIoIlx0YXRpbWUgICAgICAgICAg JWxsZC4ldVxuIiwKKwkJICAgICAgIChsb25nIGxvbmcpbGU2NF90b19jcHUoaW5vLT5hdGltZV9z ZWMpLAorCQkgICAgICAgbGUzMl90b19jcHUoaW5vLT5hdGltZV9uc2VjKSk7CisJCXByX2Vycigi XHRtdGltZSAgICAgICAgICAlbGxkLiV1XG4iLAorCQkgICAgICAgKGxvbmcgbG9uZylsZTY0X3Rv X2NwdShpbm8tPm10aW1lX3NlYyksCisJCSAgICAgICBsZTMyX3RvX2NwdShpbm8tPm10aW1lX25z ZWMpKTsKKwkJcHJfZXJyKCJcdGN0aW1lICAgICAgICAgICVsbGQuJXVcbiIsCisJCSAgICAgICAo bG9uZyBsb25nKWxlNjRfdG9fY3B1KGluby0+Y3RpbWVfc2VjKSwKKwkJICAgICAgIGxlMzJfdG9f Y3B1KGluby0+Y3RpbWVfbnNlYykpOworCQlwcl9lcnIoIlx0dWlkICAgICAgICAgICAgJXVcbiIs IGxlMzJfdG9fY3B1KGluby0+dWlkKSk7CisJCXByX2VycigiXHRnaWQgICAgICAgICAgICAldVxu IiwgbGUzMl90b19jcHUoaW5vLT5naWQpKTsKKwkJcHJfZXJyKCJcdG1vZGUgICAgICAgICAgICV1 XG4iLCBsZTMyX3RvX2NwdShpbm8tPm1vZGUpKTsKKwkJcHJfZXJyKCJcdGZsYWdzICAgICAgICAg ICUjeFxuIiwgbGUzMl90b19jcHUoaW5vLT5mbGFncykpOworCQlwcl9lcnIoIlx0eGF0dHJfY250 ICAgICAgJXVcbiIsIGxlMzJfdG9fY3B1KGluby0+eGF0dHJfY250KSk7CisJCXByX2VycigiXHR4 YXR0cl9zaXplICAgICAldVxuIiwgbGUzMl90b19jcHUoaW5vLT54YXR0cl9zaXplKSk7CisJCXBy X2VycigiXHR4YXR0cl9uYW1lcyAgICAldVxuIiwgbGUzMl90b19jcHUoaW5vLT54YXR0cl9uYW1l cykpOworCQlwcl9lcnIoIlx0Y29tcHJfdHlwZSAgICAgJSN4XG4iLAorCQkgICAgICAgKGludCls ZTE2X3RvX2NwdShpbm8tPmNvbXByX3R5cGUpKTsKKwkJcHJfZXJyKCJcdGRhdGEgbGVuICAgICAg ICV1XG4iLCBsZTMyX3RvX2NwdShpbm8tPmRhdGFfbGVuKSk7CisJCWJyZWFrOworCX0KKwljYXNl IFVCSUZTX0RFTlRfTk9ERToKKwljYXNlIFVCSUZTX1hFTlRfTk9ERToKKwl7CisJCWNvbnN0IHN0 cnVjdCB1Ymlmc19kZW50X25vZGUgKmRlbnQgPSBub2RlOworCQlpbnQgbmxlbiA9IGxlMTZfdG9f Y3B1KGRlbnQtPm5sZW4pOworCisJCWtleV9yZWFkKGMsICZkZW50LT5rZXksICZrZXkpOworCQlw cl9lcnIoIlx0a2V5ICAgICAgICAgICAgJXNcbiIsCisJCSAgICAgICBkYmdfc25wcmludGZfa2V5 KGMsICZrZXksIGtleV9idWYsIERCR19LRVlfQlVGX0xFTikpOworCQlwcl9lcnIoIlx0aW51bSAg ICAgICAgICAgJWxsdVxuIiwKKwkJICAgICAgICh1bnNpZ25lZCBsb25nIGxvbmcpbGU2NF90b19j cHUoZGVudC0+aW51bSkpOworCQlwcl9lcnIoIlx0dHlwZSAgICAgICAgICAgJWRcbiIsIChpbnQp ZGVudC0+dHlwZSk7CisJCXByX2VycigiXHRubGVuICAgICAgICAgICAlZFxuIiwgbmxlbik7CisJ CXByX2VycigiXHRuYW1lICAgICAgICAgICAiKTsKKworCQlpZiAobmxlbiA+IFVCSUZTX01BWF9O TEVOKQorCQkJcHJfZXJyKCIoYmFkIG5hbWUgbGVuZ3RoLCBub3QgcHJpbnRpbmcsIGJhZCBvciBj b3JydXB0ZWQgbm9kZSkiKTsKKwkJZWxzZSB7CisJCQlmb3IgKGkgPSAwOyBpIDwgbmxlbiAmJiBk ZW50LT5uYW1lW2ldOyBpKyspCisJCQkJcHJfY29udCgiJWMiLCBkZW50LT5uYW1lW2ldKTsKKwkJ fQorCQlwcl9jb250KCJcbiIpOworCisJCWJyZWFrOworCX0KKwljYXNlIFVCSUZTX0RBVEFfTk9E RToKKwl7CisJCWNvbnN0IHN0cnVjdCB1Ymlmc19kYXRhX25vZGUgKmRuID0gbm9kZTsKKwkJaW50 IGRsZW4gPSBsZTMyX3RvX2NwdShjaC0+bGVuKSAtIFVCSUZTX0RBVEFfTk9ERV9TWjsKKworCQlr ZXlfcmVhZChjLCAmZG4tPmtleSwgJmtleSk7CisJCXByX2VycigiXHRrZXkgICAgICAgICAgICAl c1xuIiwKKwkJICAgICAgIGRiZ19zbnByaW50Zl9rZXkoYywgJmtleSwga2V5X2J1ZiwgREJHX0tF WV9CVUZfTEVOKSk7CisJCXByX2VycigiXHRzaXplICAgICAgICAgICAldVxuIiwgbGUzMl90b19j cHUoZG4tPnNpemUpKTsKKwkJcHJfZXJyKCJcdGNvbXByX3R5cCAgICAgICVkXG4iLAorCQkgICAg ICAgKGludClsZTE2X3RvX2NwdShkbi0+Y29tcHJfdHlwZSkpOworCQlwcl9lcnIoIlx0ZGF0YSBz aXplICAgICAgJWRcbiIsIGRsZW4pOworCQlwcl9lcnIoIlx0ZGF0YTpcbiIpOworCQlwcmludF9o ZXhfZHVtcChLRVJOX0VSUiwgIlx0IiwgRFVNUF9QUkVGSVhfT0ZGU0VULCAzMiwgMSwKKwkJCSAg ICAgICAodm9pZCAqKSZkbi0+ZGF0YSwgZGxlbiwgMCk7CisJCWJyZWFrOworCX0KKwljYXNlIFVC SUZTX1RSVU5fTk9ERToKKwl7CisJCWNvbnN0IHN0cnVjdCB1Ymlmc190cnVuX25vZGUgKnRydW4g PSBub2RlOworCisJCXByX2VycigiXHRpbnVtICAgICAgICAgICAldVxuIiwgbGUzMl90b19jcHUo dHJ1bi0+aW51bSkpOworCQlwcl9lcnIoIlx0b2xkX3NpemUgICAgICAgJWxsdVxuIiwKKwkJICAg ICAgICh1bnNpZ25lZCBsb25nIGxvbmcpbGU2NF90b19jcHUodHJ1bi0+b2xkX3NpemUpKTsKKwkJ cHJfZXJyKCJcdG5ld19zaXplICAgICAgICVsbHVcbiIsCisJCSAgICAgICAodW5zaWduZWQgbG9u ZyBsb25nKWxlNjRfdG9fY3B1KHRydW4tPm5ld19zaXplKSk7CisJCWJyZWFrOworCX0KKwljYXNl IFVCSUZTX0lEWF9OT0RFOgorCXsKKwkJY29uc3Qgc3RydWN0IHViaWZzX2lkeF9ub2RlICppZHgg PSBub2RlOworCisJCW4gPSBsZTE2X3RvX2NwdShpZHgtPmNoaWxkX2NudCk7CisJCXByX2Vycigi XHRjaGlsZF9jbnQgICAgICAlZFxuIiwgbik7CisJCXByX2VycigiXHRsZXZlbCAgICAgICAgICAl ZFxuIiwgKGludClsZTE2X3RvX2NwdShpZHgtPmxldmVsKSk7CisJCXByX2VycigiXHRCcmFuY2hl czpcbiIpOworCisJCWZvciAoaSA9IDA7IGkgPCBuICYmIGkgPCBjLT5mYW5vdXQgLSAxOyBpKysp IHsKKwkJCWNvbnN0IHN0cnVjdCB1Ymlmc19icmFuY2ggKmJyOworCisJCQliciA9IHViaWZzX2lk eF9icmFuY2goYywgaWR4LCBpKTsKKwkJCWtleV9yZWFkKGMsICZici0+a2V5LCAma2V5KTsKKwkJ CXByX2VycigiXHQlZDogTEVCICVkOiVkIGxlbiAlZCBrZXkgJXNcbiIsCisJCQkgICAgICAgaSwg bGUzMl90b19jcHUoYnItPmxudW0pLCBsZTMyX3RvX2NwdShici0+b2ZmcyksCisJCQkgICAgICAg bGUzMl90b19jcHUoYnItPmxlbiksCisJCQkgICAgICAgZGJnX3NucHJpbnRmX2tleShjLCAma2V5 LCBrZXlfYnVmLAorCQkJCQkJREJHX0tFWV9CVUZfTEVOKSk7CisJCX0KKwkJYnJlYWs7CisJfQor CWNhc2UgVUJJRlNfQ1NfTk9ERToKKwkJYnJlYWs7CisJY2FzZSBVQklGU19PUlBIX05PREU6CisJ eworCQljb25zdCBzdHJ1Y3QgdWJpZnNfb3JwaF9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KwkgICAgICAgem5vZGUsIHpici0+bG51bSwgemJyLT5vZmZzLCB6YnItPmxlbiwgem5v ZGUtPnBhcmVudCwgem5vZGUtPmlpcCwKKwkgICAgICAgem5vZGUtPmxldmVsLCB6bm9kZS0+Y2hp bGRfY250LCB6bm9kZS0+ZmxhZ3MpOworCisJaWYgKHpub2RlLT5jaGlsZF9jbnQgPD0gMCB8fCB6 bm9kZS0+Y2hpbGRfY250ID4gYy0+ZmFub3V0KSB7CisJCXNwaW5fdW5sb2NrKCZkYmdfbG9jayk7 CisJCXJldHVybjsKKwl9CisKKwlwcl9lcnIoInpicmFuY2hlczpcbiIpOworCWZvciAobiA9IDA7 IG4gPCB6bm9kZS0+Y2hpbGRfY250OyBuKyspIHsKKwkJemJyID0gJnpub2RlLT56YnJhbmNoW25d OworCQlpZiAoem5vZGUtPmxldmVsID4gMCkKKwkJCXByX2VycigiXHQlZDogem5vZGUgJXAgTEVC ICVkOiVkIGxlbiAlZCBrZXkgJXNcbiIsCisJCQkgICAgICAgbiwgemJyLT56bm9kZSwgemJyLT5s bnVtLCB6YnItPm9mZnMsIHpici0+bGVuLAorCQkJICAgICAgIGRiZ19zbnByaW50Zl9rZXkoYywg Jnpici0+a2V5LCBrZXlfYnVmLAorCQkJCQkJREJHX0tFWV9CVUZfTEVOKSk7CisJCWVsc2UKKwkJ CXByX2VycigiXHQlZDogTE5DICVwIExFQiAlZDolZCBsZW4gJWQga2V5ICVzXG4iLAorCQkJICAg ICAgIG4sIHpici0+em5vZGUsIHpici0+bG51bSwgemJyLT5vZmZzLCB6YnItPmxlbiwKKwkJCSAg ICAgICBkYmdfc25wcmludGZfa2V5KGMsICZ6YnItPmtleSwga2V5X2J1ZiwKKwkJCQkJCURCR19L RVlfQlVGX0xFTikpOworCX0KKwlzcGluX3VubG9jaygmZGJnX2xvY2spOworfQorCit2b2lkIHVi aWZzX2R1bXBfaGVhcChzdHJ1Y3QgdWJpZnNfaW5mbyAqYywgc3RydWN0IHViaWZzX2xwd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WlmICghU19JU0RJUihkaXItPmlfbW9kZSkpCisJ CXJldHVybiAwOworCisJbG93ZXN0X2RlbnRfa2V5KGMsICZrZXksIGRpci0+aV9pbm8pOworCXdo aWxlICgxKSB7CisJCWludCBlcnI7CisKKwkJZGVudCA9IHViaWZzX3RuY19uZXh0X2VudChjLCAm a2V5LCAmbm0pOworCQlpZiAoSVNfRVJSKGRlbnQpKSB7CisJCQllcnIgPSBQVFJfRVJSKGRlbnQp OworCQkJaWYgKGVyciA9PSAtRU5PRU5UKQorCQkJCWJyZWFrOworCQkJcmV0dXJuIGVycjsKKwkJ fQorCisJCW5tLm5hbWUgPSBkZW50LT5uYW1lOworCQlubS5sZW4gPSBsZTE2X3RvX2NwdShkZW50 LT5ubGVuKTsKKwkJc2l6ZSArPSBDQUxDX0RFTlRfU0laRShubS5sZW4pOworCQlpZiAoZGVudC0+ dHlwZSA9PSBVQklGU19JVFlQRV9ESVIpCisJCQlubGluayArPSAxOworCQlrZnJlZShwZGVudCk7 CisJCXBkZW50ID0gZGVudDsKKwkJa2V5X3JlYWQoYywgJmRlbnQtPmtleSwgJmtleSk7CisJfQor CWtmcmVlKHBkZW50KTsKKworCWlmIChpX3NpemVfcmVhZChkaXIpICE9IHNpemUpIHsKKwkJdWJp ZnNfZXJyKGMsICJkaXJlY3RvcnkgaW5vZGUgJWx1IGhhcyBzaXplICVsbHUsIGJ1dCBjYWxjdWxh dGVkIHNpemUgaXMgJWxsdSIsCisJCQkgIGRpci0+aV9pbm8sICh1bnNpZ25lZCBsb25nIGxvbmcp aV9zaXplX3JlYWQoZGlyKSwKKwkJCSAgKHVuc2lnbmVkIGxvbmcgbG9uZylzaXplKTsKKwkJdWJp ZnNfZHVtcF9pbm9kZShjLCBkaXIpOworCQlkdW1wX3N0YWNrKCk7CisJCXJldHVybiAtRUlOVkFM OworCX0KKwlpZiAoZGlyLT5pX25saW5rICE9IG5saW5rKSB7CisJCXViaWZzX2VycihjLCAiZGly ZWN0b3J5IGlub2RlICVs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fb3JkZXIoc3RydWN0IHViaWZzX2lu Zm8gKmMsIHN0cnVjdCB1Ymlmc196YnJhbmNoICp6YnIxLAorCQkJICAgICAgIHN0cnVjdCB1Ymlm c196YnJhbmNoICp6YnIyKQoreworCWludCBlcnIsIG5sZW4xLCBubGVuMiwgY21wOworCXN0cnVj dCB1Ymlmc19kZW50X25vZGUgKmRlbnQxLCAqZGVudDI7CisJdW5pb24gdWJpZnNfa2V5IGtleTsK KwljaGFyIGtleV9idWZbREJHX0tFWV9CVUZfTEVOXTsKKworCXViaWZzX2Fzc2VydCgha2V5c19j bXAoYywgJnpicjEtPmtleSwgJnpicjItPmtleSkpOworCWRlbnQxID0ga21hbGxvYyhVQklGU19N QVhfREVOVF9OT0RFX1NaLCBHRlBfTk9GUyk7CisJaWYgKCFkZW50MSkKKwkJcmV0dXJuIC1FTk9N RU07CisJZGVudDIgPSBrbWFsbG9jKFVCSUZTX01BWF9ERU5UX05PREVfU1osIEdGUF9OT0ZTKTsK KwlpZiAoIWRlbnQyKSB7CisJCWVyciA9IC1FTk9NRU07CisJCWdvdG8gb3V0X2ZyZWU7CisJfQor CisJZXJyID0gdWJpZnNfdG5jX3JlYWRfbm9kZShjLCB6YnIxLCBkZW50MSk7CisJaWYgKGVycikK KwkJZ290byBvdXRfZnJlZTsKKwllcnIgPSB1Ymlmc192YWxpZGF0ZV9lbnRyeShjLCBkZW50MSk7 CisJaWYgKGVycikKKwkJZ290byBvdXRfZnJlZTsKKworCWVyciA9IHViaWZzX3RuY19yZWFkX25v ZGUoYywgemJyMiwgZGVudDIpOworCWlmIChlcnIpCisJCWdvdG8gb3V0X2ZyZWU7CisJZXJyID0g dWJpZnNfdmFsaWRhdGVfZW50cnkoYywgZGVudDIpOworCWlmIChlcnIpCisJCWdvdG8gb3V0X2Zy ZWU7CisKKwkvKiBNYWtlIHN1cmUgbm9kZSBrZXlzIGFyZSB0aGUgc2FtZSBhcyBpbiB6YnJhbmNo ICovCisJZXJyID0gMTsKKwlrZXl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Z6bm9kZS0+emJyYW5jaFtuIC0gMV0sCisJCQkJCQkgICZ6bm9k ZS0+emJyYW5jaFtuXSk7CisJCQlpZiAoZXJyIDwgMCkKKwkJCQlyZXR1cm4gZXJyOworCQkJaWYg KGVycikgeworCQkJCWVyciA9IDE1OworCQkJCWdvdG8gb3V0OworCQkJfQorCQl9CisJfQorCisJ Zm9yIChuID0gMDsgbiA8IHpub2RlLT5jaGlsZF9jbnQ7IG4rKykgeworCQlpZiAoIXpub2RlLT56 YnJhbmNoW25dLnpub2RlICYmCisJCSAgICAoem5vZGUtPnpicmFuY2hbbl0ubG51bSA9PSAwIHx8 CisJCSAgICAgem5vZGUtPnpicmFuY2hbbl0ubGVuID09IDApKSB7CisJCQllcnIgPSAxNjsKKwkJ CWdvdG8gb3V0OworCQl9CisKKwkJaWYgKHpub2RlLT56YnJhbmNoW25dLmxudW0gIT0gMCAmJgor CQkgICAgem5vZGUtPnpicmFuY2hbbl0ubGVuID09IDApIHsKKwkJCWVyciA9IDE3OworCQkJZ290 byBvdXQ7CisJCX0KKworCQlpZiAoem5vZGUtPnpicmFuY2hbbl0ubG51bSA9PSAwICYmCisJCSAg ICB6bm9kZS0+emJyYW5jaFtuXS5sZW4gIT0gMCkgeworCQkJZXJyID0gMTg7CisJCQlnb3RvIG91 dDsKKwkJfQorCisJCWlmICh6bm9kZS0+emJyYW5jaFtuXS5sbnVtID09IDAgJiYKKwkJICAgIHpu b2RlLT56YnJhbmNoW25dLm9mZnMgIT0gMCkgeworCQkJZXJyID0gMTk7CisJCQlnb3RvIG91dDsK KwkJfQorCisJCWlmICh6bm9kZS0+bGV2ZWwgIT0gMCAmJiB6bm9kZS0+emJyYW5jaFtuXS56bm9k ZSkKKwkJCWlmICh6bm9kZS0+emJyYW5jaFtuXS56bm9kZS0+cGFyZW50ICE9IHpub2RlKSB7CisJ CQkJZXJyID0gMjA7CisJCQkJZ290byBvdXQ7CisJCQl9CisJfQorCisJcmV0dXJuIDA7CisKK291 dDoKKwl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OworCisJCWlmIChzYS0+ dHlwZSAhPSBVQklGU19EQVRBX05PREUpIHsKKwkJCXViaWZzX2VycihjLCAiYmFkIG5vZGUgdHlw ZSAlZCIsIHNhLT50eXBlKTsKKwkJCXViaWZzX2R1bXBfbm9kZShjLCBzYS0+bm9kZSk7CisJCQly ZXR1cm4gLUVJTlZBTDsKKwkJfQorCQlpZiAoc2ItPnR5cGUgIT0gVUJJRlNfREFUQV9OT0RFKSB7 CisJCQl1Ymlmc19lcnIoYywgImJhZCBub2RlIHR5cGUgJWQiLCBzYi0+dHlwZSk7CisJCQl1Ymlm c19kdW1wX25vZGUoYywgc2ItPm5vZGUpOworCQkJcmV0dXJuIC1FSU5WQUw7CisJCX0KKworCQlp bnVtYSA9IGtleV9pbnVtKGMsICZzYS0+a2V5KTsKKwkJaW51bWIgPSBrZXlfaW51bShjLCAmc2It PmtleSk7CisKKwkJaWYgKGludW1hIDwgaW51bWIpCisJCQljb250aW51ZTsKKwkJaWYgKGludW1h ID4gaW51bWIpIHsKKwkJCXViaWZzX2VycihjLCAibGFyZ2VyIGludW0gJWx1IGdvZXMgYmVmb3Jl IGludW0gJWx1IiwKKwkJCQkgICh1bnNpZ25lZCBsb25nKWludW1hLCAodW5zaWduZWQgbG9uZylp bnVtYik7CisJCQlnb3RvIGVycm9yX2R1bXA7CisJCX0KKworCQlibGthID0ga2V5X2Jsb2NrKGMs ICZzYS0+a2V5KTsKKwkJYmxrYiA9IGtleV9ibG9jayhjLCAmc2ItPmtleSk7CisKKwkJaWYgKGJs a2EgPiBibGtiKSB7CisJCQl1Ymlmc19lcnIoYywgImxhcmdlciBibG9jayAldSBnb2VzIGJlZm9y ZSAldSIsIGJsa2EsIGJsa2IpOworCQkJZ290byBlcnJvcl9kdW1wOworCQl9CisJCWlmIChibGth ID09IGJsa2IpIHsKKwkJCXViaWZzX2VycihjLCAidHdvIGRhdGEgbm9kZXMgZm9yIHRoZSBzYW1l IGJsb2NrIik7CisJCQlnb3RvIGVycm9yX2R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lkICpidWYsCisJCSAgIGludCBs ZW4pCit7CisJaW50IGVycjsKKworCWlmIChjLT5kYmctPnBjX2hhcHBlbmVkKQorCQlyZXR1cm4g LUVST0ZTOworCWlmIChwb3dlcl9jdXRfZW11bGF0ZWQoYywgbG51bSwgMSkpCisJCXJldHVybiAt RVJPRlM7CisJZXJyID0gdWJpX2xlYl9jaGFuZ2UoYy0+dWJpLCBsbnVtLCBidWYsIGxlbik7CisJ aWYgKGVycikKKwkJcmV0dXJuIGVycjsKKwlpZiAocG93ZXJfY3V0X2VtdWxhdGVkKGMsIGxudW0s IDEpKQorCQlyZXR1cm4gLUVST0ZTOworCXJldHVybiAwOworfQorCitpbnQgZGJnX2xlYl91bm1h cChzdHJ1Y3QgdWJpZnNfaW5mbyAqYywgaW50IGxudW0pCit7CisJaW50IGVycjsKKworCWlmIChj LT5kYmctPnBjX2hhcHBlbmVkKQorCQlyZXR1cm4gLUVST0ZTOworCWlmIChwb3dlcl9jdXRfZW11 bGF0ZWQoYywgbG51bSwgMCkpCisJCXJldHVybiAtRVJPRlM7CisJZXJyID0gdWJpX2xlYl91bm1h cChjLT51YmksIGxudW0pOworCWlmIChlcnIpCisJCXJldHVybiBlcnI7CisJaWYgKHBvd2VyX2N1 dF9lbXVsYXRlZChjLCBsbnVtLCAwKSkKKwkJcmV0dXJuIC1FUk9GUzsKKwlyZXR1cm4gMDsKK30K KworaW50IGRiZ19sZWJfbWFwKHN0cnVjdCB1Ymlmc19pbmZvICpjLCBpbnQgbG51bSkKK3sKKwlp bnQgZXJyOworCisJaWYgKGMtPmRiZy0+cGNfaGFwcGVuZWQpCisJCXJldHVybiAtRVJPRlM7CisJ aWYgKHBvd2VyX2N1dF9lbXVsYXRlZChjLCBsbnVtLCAwKSkKKwkJcmV0dXJuIC1FUk9GUzsKKwll cnIgPSB1YmlfbGViX21hcChjLT51YmksIGxudW0pOworCWlmIChlcnIpCisJCXJldHVybiBlcnI7 CisJaWYgKHBvd2VyX2N1dF9lbXVsYXR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yBhcmUgZW5hYmxlZAorICog QGNoa19mczogaWYgVUJJRlMgY29udGVudHMgZXh0cmEgY2hlY2tzIGFyZSBlbmFibGVkCisgKiBA dHN0X3JjdnJ5OiBpZiBVQklGUyByZWNvdmVyeSB0ZXN0aW5nIG1vZGUgZW5hYmxlZAorICovCitz dHJ1Y3QgdWJpZnNfZ2xvYmFsX2RlYnVnX2luZm8geworCXVuc2lnbmVkIGludCBjaGtfZ2VuOjE7 CisJdW5zaWduZWQgaW50IGNoa19pbmRleDoxOworCXVuc2lnbmVkIGludCBjaGtfb3JwaDoxOwor CXVuc2lnbmVkIGludCBjaGtfbHByb3BzOjE7CisJdW5zaWduZWQgaW50IGNoa19mczoxOworCXVu c2lnbmVkIGludCB0c3RfcmN2cnk6MTsKK307CiAKKyNpZm5kZWYgX19CQVJFQk9YX18KICNkZWZp bmUgdWJpZnNfYXNzZXJ0KGV4cHIpIGRvIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBcCiAJaWYgKHVubGlrZWx5KCEoZXhwcikpKSB7ICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0JCXByX2NyaXQoIlVCSUZTIGFz c2VydCBmYWlsZWQgaW4gJXMgYXQgJXUgKHBpZCAlZClcbiIsIFwKLQkJICAgICAgIF9fZnVuY19f LCBfX0xJTkVfXywgMCk7ICAgICAgICAgICAgICAgICAgICAgIFwKLQkJZGJnX2R1bXBfc3RhY2so KTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorCQlwcl9j cml0KCJVQklGUyBhc3NlcnQgZmFpbGVkIGluICVzIGF0ICV1IChwaWQgJWQpXG4iLCAgICAgICAg ICBcCisJCSAgICAgICBfX2Z1bmNfXywgX19MSU5FX18sIGN1cnJlbnQtPnBpZCk7ICAgICAgICAg ICAgICAgICAgICAgIFwKKwkJZHVtcF9zdGFjaygpOyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgXAogCX0gICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogfSB3aGlsZSAoMCkK IAogI2RlZmluZSB1Ymlmc19hc3NlcnRfY210X2xvY2tlZChjKSBkbyB7ICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIFwKIAlpZiAodW5saWtlbHkoZG93bl93cml0ZV90cnls b2NrKCYoYyktPmNvbW1pdF9zZW0pKSkgeyAgICAgICAgICAgICAgICAgIFwKIAkJdXBfd3JpdGUo JihjKS0+Y29tbWl0X3NlbSk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAot CQlwcl9jcml0KCJjb21taXQgbG9jayBpcyBub3QgbG9ja2VkIVxuIik7CQkgICAgICBcCisJCXBy X2NyaXQoImNvbW1pdCBsb2NrIGlzIG5vdCBsb2NrZWQhXG4iKTsgICAgICAgICAgICAgICAgICAg ICAgIFwKIAkJdWJpZnNfYXNzZXJ0KDApOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgXAogCX0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogfSB3aGlsZSAoMCkKIAotI2RlZmlu ZSBkYmdfZHVtcF9zdGFjaygpIGRvIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIFwKLQlpZiAoIWRiZ19mYWlsdXJlX21vZGUpICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyNkZWZpbmUgdWJpZnNfZGJnX21z Zyh0eXBlLCBmbXQsIC4uLikgXAorCXByX2RlYnVnKCJVQklGUyBEQkcgIiB0eXBlICIgKHBpZCAl ZCk6ICIgZm10ICJcbiIsIGN1cnJlbnQtPnBpZCwgICAgICAgXAorCQkgIyNfX1ZBX0FSR1NfXykK KworI2RlZmluZSBEQkdfS0VZX0JVRl9MRU4gNDgKKyNkZWZpbmUgdWJpZnNfZGJnX21zZ19rZXko dHlwZSwga2V5LCBmbXQsIC4uLikgZG8geyAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisJ Y2hhciBfX3RtcF9rZXlfYnVmW0RCR19LRVlfQlVGX0xFTl07ICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBcCisJcHJfZGVidWcoIlVCSUZTIERCRyAiIHR5cGUgIiAocGlkICVkKTog IiBmbXQgIiVzXG4iLCBjdXJyZW50LT5waWQsICAgICBcCisJCSAjI19fVkFfQVJHU19fLCAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKwkJIGRiZ19zbnBy aW50Zl9rZXkoYywga2V5LCBfX3RtcF9rZXlfYnVmLCBEQkdfS0VZX0JVRl9MRU4pKTsgICAgXAor fSB3aGlsZSAoMCkKKyNlbHNlCisjZGVmaW5lIHViaWZzX2Fzc2VydChleHByKSBkbyB7ICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorCWlmICgwICYmIHVu bGlrZWx5KCEoZXhwcikpKSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICBcCisJCXByX2NyaXQoIlVCSUZTIGFzc2VydCBmYWlsZWQgaW4gJXMgYXQgJXVcbiIs ICAgICAgICAgICAgICAgICAgIFwKKwkJICAgICAgIF9fZnVuY19fLCBfX0xJTkVfXyk7ICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogCQlkdW1wX3N0YWNrKCk7ICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisJfSAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBcCiB9IHdoaWxlICgwKQogCi0vKiBHZW5lcmljIGRlYnVnZ2luZyBtZXNzYWdlcyAqLwotI2Rl ZmluZSBkYmdfbXNnKGZtdCwgLi4uKSBkbyB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIFwKLQlzcGluX2xvY2soJmRiZ19sb2NrKTsgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLQlwcl9kZWJ1ZygiVUJJRlMg REJHIChwaWQgJWQpOiAlczogIiBmbXQgIlxuIiwgMCwgICBcCi0JICAgICAgIF9fZnVuY19fLCAj I19fVkFfQVJHU19fKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0J c3Bpbl91bmxvY2soJmRiZ19sb2NrKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBcCisjZGVmaW5lIHViaWZzX2Fzc2VydF9jbXRfbG9ja2VkKGMpIGRvIHsg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorCWlmICh1bmxpa2VseShk b3duX3dyaXRlX3RyeWxvY2soJihjKS0+Y29tbWl0X3NlbSkpKSB7ICAgICAgICAgICAgICAgICAg XAorCQl1cF93cml0ZSgmKGMpLT5jb21taXRfc2VtKTsgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICBcCisJCXByX2NyaXQoImNvbW1pdCBsb2NrIGlzIG5vdCBsb2NrZWQhXG4iKTsg ICAgICAgICAgICAgICAgICAgICAgIFwKKwkJdWJpZnNfYXNzZXJ0KDApOyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorCX0gICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogfSB3 aGlsZSAoMCkKIAotI2RlZmluZSBkYmdfZG9fbXNnKHR5cCwgZm10LCAuLi4pIGRvIHsgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLQlpZiAodWJpZnNfbXNnX2ZsYWdz ICYgdHlwKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLQkJ ZGJnX21zZyhmbXQsICMjX19WQV9BUkdTX18pOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgXAorI2RlZmluZSB1Ymlmc19kYmdfbXNnKHR5cGUsIGZtdCwgLi4uKSBcCisJcHJfZGVi dWcoIlVCSUZTIERCRyAiIHR5cGUgIjogIiBmbXQgIlxuIiwgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICBcCisJCSAjI19fVkFfQVJHU19fKQorCisjZGVmaW5lIERCR19LRVlfQlVGX0xFTiA0 OAorI2lmIGRlZmluZWQgQ09ORklHX01URF9ERUJVRworI2RlZmluZSB1Ymlmc19kYmdfbXNnX2tl eSh0eXBlLCBrZXksIGZtdCwgLi4uKSBkbyB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwK KwljaGFyIF9fdG1wX2tleV9idWZbREJHX0tFWV9CVUZfTEVOXTsgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIFwKKwlwcl9kZWJ1ZygiVUJJRlMgREJHICIgdHlwZSAiOiAiIGZtdCAi JXNcbiIsICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKwkJICMjX19WQV9BUkdTX18sICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorCQkgZGJnX3Nu cHJpbnRmX2tleShjLCBrZXksIF9fdG1wX2tleV9idWYsIERCR19LRVlfQlVGX0xFTikpOyAgICBc CiB9IHdoaWxlICgwKQotCi0jZGVmaW5lIGRiZ19lcnIoZm10LCAuLi4pIGRvIHsgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotCXNwaW5fbG9jaygmZGJn X2xvY2spOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg XAotCXViaWZzX2VycihmbXQsICMjX19WQV9BUkdTX18pOyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgXAotCXNwaW5fdW5sb2NrKCZkYmdfbG9jayk7ICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorI2Vsc2UKKyNkZWZpbmUgdWJp ZnNfZGJnX21zZ19rZXkodHlwZSwga2V5LCBmbXQsIC4uLikgZG8geyAgICAgICAgICAgICAgICAg ICAgICAgICAgICBcCisJcHJfZGVidWcoIlVCSUZTIERCR1xuIik7ICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCiB9IHdoaWxlICgwKQogCi1jb25zdCBjaGFy ICpkYmdfa2V5X3N0cjAoY29uc3Qgc3RydWN0IHViaWZzX2luZm8gKmMsCi0JCQkgY29uc3QgdW5p b24gdWJpZnNfa2V5ICprZXkpOwotY29uc3QgY2hhciAqZGJnX2tleV9zdHIxKGNvbnN0IHN0cnVj dCB1Ymlmc19pbmZvICpjLAotCQkJIGNvbnN0IHVuaW9uIHViaWZzX2tleSAqa2V5KTsKKyNlbmRp ZgogCi0vKgotICogREJHS0VZIG1hY3JvcyByZXF1aXJlIEBkYmdfbG9jayB0byBiZSBoZWxkLCB3 aGljaCBpdCBpcyBpbiB0aGUgZGJnIG1lc3NhZ2UKLSAqIG1hY3Jvcy4KLSAqLwotI2RlZmluZSBE QkdLRVkoa2V5KQlkYmdfa2V5X3N0cjAoYywgKGtleSkpCi0jZGVmaW5lIERCR0tFWTEoa2V5KQlk Ymdfa2V5X3N0cjEoYywgKGtleSkpCisjZW5kaWYKIAogLyogR2VuZXJhbCBtZXNzYWdlcyAqLwot I2RlZmluZSBkYmdfZ2VuKGZtdCwgLi4uKSAgIGRiZ19kb19tc2coVUJJRlNfTVNHX0dFTiwgZm10 LCAjI19fVkFfQVJHU19fKQotCisjZGVmaW5lIGRiZ19nZW4oZm10LCAuLi4pICAgdWJpZnNfZGJn X21zZygiZ2VuIiwgZm10LCAjI19fVkFfQVJHU19fKQogLyogQWRkaXRpb25hbCBqb3VybmFsIG1l c3NhZ2VzICovCi0jZGVmaW5lIGRiZ19qbmwoZm10LCAuLi4pICAgZGJnX2RvX21zZyhVQklGU19N U0dfSk5MLCBmbXQsICMjX19WQV9BUkdTX18pCi0KKyNkZWZpbmUgZGJnX2pubChmbXQsIC4uLikg ICB1Ymlmc19kYmdfbXNnKCJqbmwiLCBmbXQsICMjX19WQV9BUkdTX18pCisjZGVmaW5lIGRiZ19q bmxrKGtleSwgZm10LCAuLi4pIFwKKwl1Ymlmc19kYmdfbXNnX2tleSgiam5sIiwga2V5LCBmbXQs ICMjX19WQV9BUkdTX18pCiAvKiBBZGRpdGlvbmFsIFROQyBtZXNzYWdlcyAqLwotI2RlZmluZSBk YmdfdG5jKGZtdCwgLi4uKSAgIGRiZ19kb19tc2coVUJJRlNfTVNHX1ROQywgZm10LCAjI19fVkFf QVJHU19fKQotCisjZGVmaW5lIGRiZ190bmMoZm10LCAuLi4pICAgdWJpZnNfZGJnX21zZygidG5j IiwgZm10LCAjI19fVkFfQVJHU19fKQorI2RlZmluZSBkYmdfdG5jayhrZXksIGZtdCwgLi4uKSBc CisJdWJpZnNfZGJnX21zZ19rZXkoInRuYyIsIGtleSwgZm10LCAjI19fVkFfQVJHU19fKQogLyog QWRkaXRpb25hbCBscHJvcHMgbWVzc2FnZXMgKi8KLSNkZWZpbmUgZGJnX2xwKGZtdCwgLi4uKSAg ICBkYmdfZG9fbXNnKFVCSUZTX01TR19MUCwgZm10LCAjI19fVkFfQVJHU19fKQotCisjZGVmaW5l IGRiZ19scChmbXQsIC4uLikgICAgdWJpZnNfZGJnX21zZygibHAiLCBmbXQsICMjX19WQV9BUkdT X18pCiAvKiBBZGRpdGlvbmFsIExFQiBmaW5kIG1lc3NhZ2VzICovCi0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QUdTX0RFRkFVTFQgMHhm ZmZmZmZmZgoraW50IHViaWZzX2RlYnVnZ2luZ19pbml0KHN0cnVjdCB1Ymlmc19pbmZvICpjKTsK K3ZvaWQgdWJpZnNfZGVidWdnaW5nX2V4aXQoc3RydWN0IHViaWZzX2luZm8gKmMpOwogI2Vsc2UK LSNkZWZpbmUgVUJJRlNfQ0hLX0ZMQUdTX0RFRkFVTFQgMAotI2VuZGlmCi0KLSNkZWZpbmUgZGJn X250eXBlKHR5cGUpICAgICAgICAgICAgICAgICAgICAgICAiIgotI2RlZmluZSBkYmdfY3N0YXRl KGNtdF9zdGF0ZSkgICAgICAgICAgICAgICAgICIiCi0jZGVmaW5lIGRiZ19nZXRfa2V5X2R1bXAo Yywga2V5KSAgICAgICAgICAgICAgKHt9KQotI2RlZmluZSBkYmdfZHVtcF9pbm9kZShjLCBpbm9k ZSkgICAgICAgICAgICAgICh7fSkKLSNkZWZpbmUgZGJnX2R1bXBfbm9kZShjLCBub2RlKSAgICAg ICAgICAgICAgICAoe30pCi0jZGVmaW5lIGRiZ19kdW1wX2J1ZGdldF9yZXEocmVxKSAgICAgICAg ICAgICAgKHt9KQotI2RlZmluZSBkYmdfZHVtcF9sc3RhdHMobHN0KSAgICAgICAgICAgICAgICAg ICh7fSkKLSNkZWZpbmUgZGJnX2R1bXBfYnVkZyhjKSAgICAgICAgICAgICAgICAgICAgICAoe30p Ci0jZGVmaW5lIGRiZ19kdW1wX2xwcm9wKGMsIGxwKSAgICAgICAgICAgICAgICAgKHt9KQotI2Rl ZmluZSBkYmdfZHVtcF9scHJvcHMoYykgICAgICAgICAgICAgICAgICAgICh7fSkKLSNkZWZpbmUg ZGJnX2R1bXBfbHB0X2luZm8oYykgICAgICAgICAgICAgICAgICAoe30pCi0jZGVmaW5lIGRiZ19k dW1wX2xlYihjLCBsbnVtKSAgICAgICAgICAgICAgICAgKHt9KQotI2RlZmluZSBkYmdfZHVtcF96 bm9kZShjLCB6bm9kZSkgICAgICAgICAgICAgICh7fSkKLSNkZWZpbmUgZGJnX2R1bXBfaGVhcChj LCBoZWFwLCBjYXQpICAgICAgICAgICAoe30pCi0jZGVmaW5lIGRiZ19kdW1wX3Bub2RlKGMsIHBu b2RlLCBwYXJlbnQsIGlpcCkgKHt9KQotI2RlZmluZSBkYmdfZHVtcF90bmMoYykgICAgICAgICAg ICAgICAgICAgICAgICh7fSkKLSNkZWZpbmUgZGJnX2R1bXBfaW5kZXgoYykgICAgICAgICAgICAg ICAgICAgICAoe30pCi0KLSNkZWZpbmUgZGJnX3dhbGtfaW5kZXgoYywgbGVhZl9jYiwgem5vZGVf Y2IsIHByaXYpIDAKLSNkZWZpbmUgZGJnX29sZF9pbmRleF9jaGVja19pbml0KGMsIHpyb290KSAg ICAgICAgIDAKLSNkZWZpbmUgZGJnX2NoZWNrX29sZF9pbmRleChjLCB6cm9vdCkgICAgICAgICAg ICAgIDAKLSNkZWZpbmUgZGJnX2NoZWNrX2NhdHMoYykgICAgICAgICAgICAgICAgICAgICAgICAg IDAKLSNkZWZpbmUgZGJnX2NoZWNrX2x0YWIoYykgICAgICAgICAgICAgICAgICAgICAgICAgIDAK LSNkZWZpbmUgZGJnX2Noa19scHRfZnJlZV9zcGMoYykgICAgICAgICAgICAgICAgICAgIDAKLSNk ZWZpbmUgZGJnX2Noa19scHRfc3ooYywgYWN0aW9uLCBsZW4pICAgICAgICAgICAgIDAKLSNkZWZp bmUgZGJnX2NoZWNrX3N5bmNlZF9pX3NpemUoaW5vZGUpICAgICAgICAgICAgIDAKLSNkZWZpbmUg ZGJnX2NoZWNrX2Rpcl9zaXplKGMsIGRpcikgICAgICAgICAgICAgICAgIDAKLSNkZWZpbmUgZGJn X2NoZWNrX3RuYyhjLCB4KSAgICAgICAgICAgICAgICAgICAgICAgIDAKLSNkZWZpbmUgZGJnX2No ZWNrX2lkeF9zaXplKGMsIGlkeF9zaXplKSAgICAgICAgICAgIDAKLSNkZWZpbmUgZGJnX2NoZWNr X2ZpbGVzeXN0ZW0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jb25zdCBzdHJ1Y3QgdWJpZnNf aW5mbyAqYykKK3sKKwlyZXR1cm4gMDsKK30KK3N0YXRpYyBpbmxpbmUgaW50IGRiZ19pc190c3Rf cmN2cnkoY29uc3Qgc3RydWN0IHViaWZzX2luZm8gKmMpCit7CisJcmV0dXJuIDA7Cit9CitzdGF0 aWMgaW5saW5lIGludCBkYmdfaXNfcG93ZXJfY3V0KGNvbnN0IHN0cnVjdCB1Ymlmc19pbmZvICpj KQoreworCXJldHVybiAwOworfQogCiBpbnQgdWJpZnNfZGVidWdnaW5nX2luaXQoc3RydWN0IHVi aWZzX2luZm8gKmMpOwogdm9pZCB1Ymlmc19kZWJ1Z2dpbmdfZXhpdChzdHJ1Y3QgdWJpZnNfaW5m byAqYyk7CiAKLSNlbHNlIC8qICFDT05GSUdfVUJJRlNfRlNfREVCVUcgKi8KLQotI2RlZmluZSBV QklGU19EQkcob3ApCi0KLS8qIFVzZSAiaWYgKDApIiB0byBtYWtlIGNvbXBpbGVyIGNoZWNrIGFy Z3VtZW50cyBldmVuIGlmIGRlYnVnZ2luZyBpcyBvZmYgKi8KLSNkZWZpbmUgdWJpZnNfYXNzZXJ0 KGV4cHIpICBkbyB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBcCi0JaWYgKDAgJiYgKGV4cHIpKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBcCi0JCXByX2NyaXQoIlVCSUZTIGFzc2VydCBmYWlsZWQgaW4g JXMgYXQgJXUgKHBpZCAlZClcbiIsIFwKLQkJICAgICAgIF9fZnVuY19fLCBfX0xJTkVfXywgMCk7 ICAgICAgICAgICAgICAgICAgICAgIFwKLX0gd2hpbGUgKDApCi0KLSNkZWZpbmUgZGJnX2Vycihm bXQsIC4uLikgICBkbyB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICBcCi0JaWYgKDApICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBcCi0JCXViaWZzX2VycihmbXQsICMjX19WQV9BUkdTX18p OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLX0gd2hpbGUgKDApCi0KLSNkZWZp bmUgZGJnX21zZyhmbXQsIC4uLikgZG8geyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBcCi0JaWYgKDApICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0JCXByX2RlYnVnKCJVQklGUyBE QkcgKHBpZCAlZCk6ICVzOiAiIGZtdCAiXG4iLCAgICAgICAgIFwKLQkJICAgICAgIDAsIF9fZnVu Y19fLCAjI19fVkFfQVJHU19fKTsgICAgICAgICAgICAgICAgIFwKLX0gd2hpbGUgKDApCi0KLSNk ZWZpbmUgZGJnX2R1bXBfc3RhY2soKQotI2RlZmluZSB1Ymlmc19hc3NlcnRfY210X2xvY2tlZChj KQotCi0jZGVmaW5lIGRiZ19nZW4oZm10LCAuLi4pICAgZGJnX21zZyhmbXQsICMjX19WQV9BUkdT X18pCi0jZGVmaW5lIGRiZ19qbmwoZm10LCAuLi4pICAgZGJnX21zZyhmbXQsICMjX19WQV9BUkdT X18pCi0jZGVmaW5lIGRiZ190bmMoZm10LCAuLi4pICAgZGJnX21zZyhmbXQsICMjX19WQV9BUkdT X18pCi0jZGVmaW5lIGRiZ19scChmbXQsIC4uLikgICAgZGJnX21zZyhmbXQsICMjX19WQV9BUkdT X18pCi0jZGVmaW5lIGRiZ19maW5kKGZtdCwgLi4uKSAgZGJnX21zZyhmbXQsICMjX19WQV9BUkdT X18pCi0jZGVmaW5lIGRiZ19tbnQoZm10LCAuLi4pICAgZGJnX21zZyhmbXQsICMjX19WQV9BUkdT X18pCi0jZGVmaW5lIGRiZ19pbyhmbXQsIC4uLikgICAgZGJnX21zZyhmbXQsICMjX19WQV9BUkdT X18pCi0jZGVmaW5lIGRiZ19jbXQoZm10LCAuLi4pICAgZGJnX21zZyhmbXQsICMjX19WQV9BUkdT X18pCi0jZGVmaW5lIGRiZ19idWRnKGZtdCwgLi4uKSAgZGJnX21zZyhmbXQsICMjX19WQV9BUkdT X18pCi0jZGVmaW5lIGRiZ19sb2coZm10LCAuLi4pICAgZGJnX21zZyhmbXQsICMjX19WQV9BUkdT X18pCi0jZGVmaW5lIGRiZ19nYyhmbXQsIC4uLikgICAgZGJnX21zZyhmbXQsICMjX19WQV9BUkdT X18pCi0jZGVmaW5lIGRiZ19zY2FuKGZtdCwgLi4uKSAgZGJnX21zZyhmbXQsICMjX19WQV9BUkdT X18pCi0jZGVmaW5lIGRiZ19yY3ZyeShmbXQsIC4uLikgZGJnX21zZyhmbXQsICMjX19WQV9BUkdT X18pCi0KLSNkZWZpbmUgREJHS0VZKGtleSkgICgoY2hhciAqKShrZXkpKQotI2RlZmluZSBEQkdL RVkxKGtleSkgKChjaGFyICopKGtleSkpCi0KLSNkZWZpbmUgdWJpZnNfZGVidWdnaW5nX2luaXQo YykgICAgICAgICAgICAgICAgMAotI2RlZmluZSB1Ymlmc19kZWJ1Z2dpbmdfZXhpdChjKSAgICAg ICAgICAgICAgICAoe30pCi0KLSNkZWZpbmUgZGJnX250eXBlKHR5cGUpICAgICAgICAgICAgICAg ICAgICAgICAiIgotI2RlZmluZSBkYmdfY3N0YXRlKGNtdF9zdGF0ZSkgICAgICAgICAgICAgICAg ICIiCi0jZGVmaW5lIGRiZ19nZXRfa2V5X2R1bXAoYywga2V5KSAgICAgICAgICAgICAgKHt9KQot I2RlZmluZSBkYmdfZHVtcF9pbm9kZShjLCBpbm9kZSkgICAgICAgICAgICAgICh7fSkKLSNkZWZp bmUgZGJnX2R1bXBfbm9kZShjLCBub2RlKSAgICAgICAgICAgICAgICAoe30pCi0jZGVmaW5lIGRi Z19kdW1wX2J1ZGdldF9yZXEocmVxKSAgICAgICAgICAgICAgKHt9KQotI2RlZmluZSBkYmdfZHVt cF9sc3RhdHMobHN0KSAgICAgICAgICAgICAgICAgICh7fSkKLSNkZWZpbmUgZGJnX2R1bXBfYnVk ZyhjKSAgICAgICAgICAgICAgICAgICAgICAoe30pCi0jZGVmaW5lIGRiZ19kdW1wX2xwcm9wKGMs IGxwKSAgICAgICAgICAgICAgICAgKHt9KQotI2RlZmluZSBkYmdfZHVtcF9scHJvcHMoYykgICAg ICAgICAgICAgICAgICAgICh7fSkKLSNkZWZpbmUgZGJnX2R1bXBfbHB0X2luZm8oYykgICAgICAg ICAgICAgICAgICAoe30pCi0jZGVmaW5lIGRiZ19kdW1wX2xlYihjLCBsbnVtKSAgICAgICAgICAg ICAgICAgKHt9KQotI2RlZmluZSBkYmdfZHVtcF96bm9kZShjLCB6bm9kZSkgICAgICAgICAgICAg ICh7fSkKLSNkZWZpbmUgZGJnX2R1bXBfaGVhcChjLCBoZWFwLCBjYXQpICAgICAgICAgICAoe30p Ci0jZGVmaW5lIGRiZ19kdW1wX3Bub2RlKGMsIHBub2RlLCBwYXJlbnQsIGlpcCkgKHt9KQotI2Rl ZmluZSBkYmdfZHVtcF90bmMoYykgICAgICAgICAgICAgICAgICAgICAgICh7fSkKLSNkZWZpbmUg ZGJnX2R1bXBfaW5kZXgoYykgICAgICAgICAgICAgICAgICAgICAoe30pCi0KLSNkZWZpbmUgZGJn X3dhbGtfaW5kZXgoYywgbGVhZl9jYiwgem5vZGVfY2IsIHByaXYpIDAKLSNkZWZpbmUgZGJnX29s ZF9pbmRleF9jaGVja19pbml0KGMsIHpyb290KSAgICAgICAgIDAKLSNkZWZpbmUgZGJnX2NoZWNr X29sZF9pbmRleChjLCB6cm9vdCkgICAgICAgICAgICAgIDAKLSNkZWZpbmUgZGJnX2NoZWNrX2Nh dHMoYykgICAgICAgICAgICAgICAgICAgICAgICAgIDAKLSNkZWZpbmUgZGJnX2NoZWNrX2x0YWIo YykgICAgICAgICAgICAgICAgICAgICAgICAg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VzICovCisJbGlzdF9mb3JfZWFjaF9lbnRyeV9zYWZlKHNub2QsIHRtcCwgJnNsZWItPm5vZGVz LCBsaXN0KSB7CisJCXViaWZzX2Fzc2VydChzbm9kLT50eXBlID09IFVCSUZTX0lOT19OT0RFICB8 fAorCQkJICAgICBzbm9kLT50eXBlID09IFVCSUZTX0RBVEFfTk9ERSB8fAorCQkJICAgICBzbm9k LT50eXBlID09IFVCSUZTX0RFTlRfTk9ERSB8fAorCQkJICAgICBzbm9kLT50eXBlID09IFVCSUZT X1hFTlRfTk9ERSB8fAorCQkJICAgICBzbm9kLT50eXBlID09IFVCSUZTX1RSVU5fTk9ERSk7CisK KwkJaWYgKHNub2QtPnR5cGUgIT0gVUJJRlNfSU5PX05PREUgICYmCisJCSAgICBzbm9kLT50eXBl ICE9IFVCSUZTX0RBVEFfTk9ERSAmJgorCQkgICAgc25vZC0+dHlwZSAhPSBVQklGU19ERU5UX05P REUgJiYKKwkJICAgIHNub2QtPnR5cGUgIT0gVUJJRlNfWEVOVF9OT0RFKSB7CisJCQkvKiBQcm9i YWJseSB0cnVuY2F0aW9uIG5vZGUsIHphcCBpdCAqLworCQkJbGlzdF9kZWwoJnNub2QtPmxpc3Qp OworCQkJa2ZyZWUoc25vZCk7CisJCQljb250aW51ZTsKKwkJfQorCisJCXViaWZzX2Fzc2VydChr ZXlfdHlwZShjLCAmc25vZC0+a2V5KSA9PSBVQklGU19EQVRBX0tFWSB8fAorCQkJICAgICBrZXlf dHlwZShjLCAmc25vZC0+a2V5KSA9PSBVQklGU19JTk9fS0VZICB8fAorCQkJICAgICBrZXlfdHlw ZShjLCAmc25vZC0+a2V5KSA9PSBVQklGU19ERU5UX0tFWSB8fAorCQkJICAgICBrZXlfdHlwZShj LCAmc25vZC0+a2V5KSA9PSBVQklGU19YRU5UX0tFWSk7CisKKwkJZXJyID0gdWJpZnNfdG5jX2hh c19ub2RlKGMsICZzbm9kLT5rZXksIDAsIHNsZWItPmxudW0sCisJCQkJCSBzbm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IGNvbnRhaW4gZGF0YQorCQkJICogd2hpY2gg b2Jzb2xldGVzIHNvbWV0aGluZyBpbiAnbHAtPnBudW0nLgorCQkJICovCisJCQllcnIgPSBnY19z eW5jX3didWZzKGMpOworCQkJaWYgKGVycikKKwkJCQlyZXR1cm4gZXJyOworCQkJZXJyID0gdWJp ZnNfY2hhbmdlX29uZV9scChjLCBscC0+bG51bSwgYy0+bGViX3NpemUsCisJCQkJCQkgIDAsIDAs IDAsIDApOworCQkJaWYgKGVycikKKwkJCQlyZXR1cm4gZXJyOworCQl9CisJCWVyciA9IHViaWZz X2xlYl91bm1hcChjLCBscC0+bG51bSk7CisJCWlmIChlcnIpCisJCQlyZXR1cm4gZXJyOworCisJ CWlmIChjLT5nY19sbnVtID09IC0xKSB7CisJCQljLT5nY19sbnVtID0gbG51bTsKKwkJCXJldHVy biBMRUJfUkVUQUlORUQ7CisJCX0KKworCQlyZXR1cm4gTEVCX0ZSRUVEOworCX0KKworCS8qCisJ ICogV2Ugc2NhbiB0aGUgZW50aXJlIExFQiBldmVuIHRob3VnaCB3ZSBvbmx5IHJlYWxseSBuZWVk IHRvIHNjYW4gdXAgdG8KKwkgKiAoYy0+bGViX3NpemUgLSBscC0+ZnJlZSkuCisJICovCisJc2xl YiA9IHViaWZzX3NjYW4oYywgbG51bSwgMCwgYy0+c2J1ZiwgMCk7CisJaWYgKElTX0VSUihzbGVi KSkKKwkJcmV0dXJuIFBUUl9FUlIoc2xlYik7CisKKwl1Ymlmc19hc3NlcnQoIWxpc3RfZW1wdHko JnNsZWItPm5vZGVzKSk7CisJc25vZCA9IGxpc3RfZW50cnkoc2xlYi0+bm9kZXMubmV4dCwgc3Ry dWN0IHViaWZzX3NjYW5fbm9kZSwgbGlzdCk7CisKKwlpZiAoc25vZC0+dHlwZSA9PSBVQklGU19J RFhfTk9ERSkgeworCQlzdHJ1Y3QgdWJpZnNfZ2NlZF9pZHhfbGViICppZHhfZ2M7CisKKwkJZGJn X2djKCJpbmRleGluZyB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TsKKyNlbmRpZgorCWlmIChlcnIpIHsKKwkJdWJpZnNfZXJyKGMsICJ1bm1hcCBMRUIgJWQgZmFp bGVkLCBlcnJvciAlZCIsIGxudW0sIGVycik7CisJCXViaWZzX3JvX21vZGUoYywgZXJyKTsKKwkJ ZHVtcF9zdGFjaygpOworCX0KKwlyZXR1cm4gZXJyOworfQorCitpbnQgdWJpZnNfbGViX21hcChz dHJ1Y3QgdWJpZnNfaW5mbyAqYywgaW50IGxudW0pCit7CisJaW50IGVycjsKKworCXViaWZzX2Fz c2VydCghYy0+cm9fbWVkaWEgJiYgIWMtPnJvX21vdW50KTsKKwlpZiAoYy0+cm9fZXJyb3IpCisJ CXJldHVybiAtRVJPRlM7CisJaWYgKCFkYmdfaXNfdHN0X3JjdnJ5KGMpKQorCQllcnIgPSB1Ymlf bGViX21hcChjLT51YmksIGxudW0pOworI2lmbmRlZiBfX0JBUkVCT1hfXworCWVsc2UKKwkJZXJy ID0gZGJnX2xlYl9tYXAoYywgbG51bSk7CisjZW5kaWYKKwlpZiAoZXJyKSB7CisJCXViaWZzX2Vy cihjLCAibWFwcGluZyBMRUIgJWQgZmFpbGVkLCBlcnJvciAlZCIsIGxudW0sIGVycik7CisJCXVi aWZzX3JvX21vZGUoYywgZXJyKTsKKwkJZHVtcF9zdGFjaygpOworCX0KKwlyZXR1cm4gZXJyOwor fQorCitpbnQgdWJpZnNfaXNfbWFwcGVkKGNvbnN0IHN0cnVjdCB1Ymlmc19pbmZvICpjLCBpbnQg bG51bSkKK3sKKwlpbnQgZXJyOworCisJZXJyID0gdWJpX2lzX21hcHBlZChjLT51YmksIGxudW0p OworCWlmIChlcnIgPCAwKSB7CisJCXViaWZzX2VycihjLCAidWJpX2lzX21hcHBlZCBmYWlsZWQg Zm9yIExFQiAlZCwgZXJyb3IgJWQiLAorCQkJICBsbnVtLCBlcnIpOworCQlkdW1wX3N0YWNrKCk7 CiAJfQorCXJldHVybiBlcnI7CiB9CiAKIC8qKgpAQCAtODUsOC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ZTIGZpbGUtc3lzdGVtIGRlc2NyaXB0aW9uIG9iamVjdAotICog QGs6IGtleSB0byBpbml0aWFsaXplCisgKiBAa2V5OiBrZXkgdG8gaW5pdGlhbGl6ZQogICogQGlu dW06IGlub2RlIG51bWJlcgotICogQGJsb2NrOiBibG9jayBudW1iZXIKICAqLwotc3RhdGljIGlu bGluZSB2b2lkIGRhdGFfa2V5X2luaXRfZmxhc2goY29uc3Qgc3RydWN0IHViaWZzX2luZm8gKmMs IHZvaWQgKmssCi0JCQkJICAgICAgIGlub190IGludW0sIHVuc2lnbmVkIGludCBibG9jaykKK3N0 YXRpYyBpbmxpbmUgdm9pZCBoaWdoZXN0X2RhdGFfa2V5KGNvbnN0IHN0cnVjdCB1Ymlmc19pbmZv ICpjLAorCQkJCSAgIHVuaW9uIHViaWZzX2tleSAqa2V5LCBpbm9fdCBpbnVtKQogewotCXVuaW9u IHViaWZzX2tleSAqa2V5ID0gazsKLQotCXViaWZzX2Fzc2VydCghKGJsb2NrICYgflVCSUZTX1Nf S0VZX0JMT0NLX01BU0spKTsKLQlrZXktPmozMlswXSA9IGNwdV90b19sZTMyKGludW0pOwotCWtl eS0+ajMyWzFdID0gY3B1X3RvX2xlMzIoYmxvY2sgfAotCQkJCSAgKFVCSUZTX0RBVEFfS0VZIDw8 IFVCSUZTX1NfS0VZX0JMT0NLX0JJVFMpKTsKLQltZW1zZXQoayArIDgsIDAsIFVCSUZTX01BWF9L RVlfTEVOIC0gOCk7CisJZGF0YV9rZXlfaW5pdChjLCBrZXksIGludW0sIFVCSUZTX1NfS0VZX0JM T0NLX01BU0spOwogfQogCiAvKioKQEAgLTMzMCw2ICsyOTUsMjAgQEAgc3RhdGljIGlubGluZSB2 b2lkIHRydW5fa2V5X2luaXQoY29uc3Qgc3RydWN0IHViaWZzX2luZm8gKmMsCiB9CiAKIC8qKgor ICogaW52YWxpZF9rZXlfaW5pdCAtIGluaXRpYWxpemUgaW52YWxpZCBub2RlIGtleS4KKyAqIEBj OiB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s9 IFVCSUZTX1JFRl9OT0RFX1NaOworCX0KKworCXViaWZzX3BhZChjLCBidWYgKyBsZW4sIEFMSUdO KGxlbiwgYy0+bWluX2lvX3NpemUpIC0gbGVuKTsKKworCS8qIFN3aXRjaCB0byB0aGUgbmV4dCBs b2cgTEVCICovCisJaWYgKGMtPmxoZWFkX29mZnMpIHsKKwkJYy0+bGhlYWRfbG51bSA9IHViaWZz X25leHRfbG9nX2xudW0oYywgYy0+bGhlYWRfbG51bSk7CisJCXViaWZzX2Fzc2VydChjLT5saGVh ZF9sbnVtICE9IGMtPmx0YWlsX2xudW0pOworCQljLT5saGVhZF9vZmZzID0gMDsKKwl9CisKKwkv KiBNdXN0IGVuc3VyZSBuZXh0IExFQiBoYXMgYmVlbiB1bm1hcHBlZCAqLworCWVyciA9IHViaWZz X2xlYl91bm1hcChjLCBjLT5saGVhZF9sbnVtKTsKKwlpZiAoZXJyKQorCQlnb3RvIG91dDsKKwor CWxlbiA9IEFMSUdOKGxlbiwgYy0+bWluX2lvX3NpemUpOworCWRiZ19sb2coIndyaXRpbmcgY29t bWl0IHN0YXJ0IGF0IExFQiAlZDowLCBsZW4gJWQiLCBjLT5saGVhZF9sbnVtLCBsZW4pOworCWVy ciA9IHViaWZzX2xlYl93cml0ZShjLCBjLT5saGVhZF9sbnVtLCBjcywgMCwgbGVuKTsKKwlpZiAo ZXJyKQorCQlnb3RvIG91dDsKKworCSpsdGFpbF9sbnVtID0gYy0+bGhlYWRfbG51bTsKKworCWMt PmxoZWFkX29mZnMgKz0gbGVuOworCWlmIChjLT5saGVhZF9vZmZzID09IGMtPmxlYl9zaXplKSB7 CisJCWMtPmxoZWFkX2xudW0gPSB1Ymlmc19uZXh0X2xvZ19sbnVtKGMsIGMtPmxoZWFkX2xudW0p OworCQljLT5saGVhZF9vZmZzID0gMDsKKwl9CisKKwlyZW1vdmVfYnVkcyhjKTsKKworCS8qCisJ ICogV2UgaGF2ZSBzdGFydGVkIHRoZSBjb21taXQgYW5kIG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OworCXJldHVybiBlcnI7Cit9CisKKy8qKgorICogc3RydWN0IGRvbmVfcmVm IC0gcmVmZXJlbmNlcyB0aGF0IGhhdmUgYmVlbiBkb25lLgorICogQHJiOiByYi10cmVlIG5vZGUK KyAqIEBsbnVtOiBMRUIgbnVtYmVyCisgKi8KK3N0cnVjdCBkb25lX3JlZiB7CisJc3RydWN0IHJi X25vZGUgcmI7CisJaW50IGxudW07Cit9OworCisvKioKKyAqIGRvbmVfYWxyZWFkeSAtIGRldGVy bWluZSBpZiBhIHJlZmVyZW5jZSBoYXMgYmVlbiBkb25lIGFscmVhZHkuCisgKiBAZG9uZV90cmVl OiByYi10cmVlIHRvIHN0b3JlIHJlZmVyZW5jZXMgdGhhdCBoYXZlIGJlZW4gZG9uZQorICogQGxu dW06IExFQiBudW1iZXIgb2YgcmVmZXJlbmNlCisgKgorICogVGhpcyBmdW5jdGlvbiByZXR1cm5z ICUxIGlmIHRoZSByZWZlcmVuY2UgaGFzIGJlZW4gZG9uZSwgJTAgaWYgbm90LCBvdGhlcndpc2UK KyAqIGEgbmVnYXRpdmUgZXJyb3IgY29kZSBpcyByZXR1cm5lZC4KKyAqLworc3RhdGljIGludCBk b25lX2FscmVhZHkoc3RydWN0IHJiX3Jvb3QgKmRvbmVfdHJlZSwgaW50IGxudW0pCit7CisJc3Ry dWN0IHJiX25vZGUgKipwID0gJmRvbmVfdHJlZS0+cmJfbm9kZSwgKnBhcmVudCA9IE5VTEw7CisJ c3RydWN0IGRvbmVfcmVmICpkcjsKKworCXdoaWxlICgqcCkgeworCQlwYXJlbnQgPSAqcDsKKwkJ ZHIgPSByYl9lbnRyeShwYXJlbnQsIHN0cnVjdCBkb25lX3JlZiwgcmIpOworCQlpZiAobG51bSA8 IGRyLT5sbnVtKQorCQkJcCA9ICYoKnApLT5yYl9sZWZ0OworCQllbHNlIGlmIChsbnVtID4gZHIt PmxudW0pCisJCQlwID0gJigqcCktPnJiX3JpZ2h0OworCQllbHNlCisJCQlyZXR1cm4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HJ1Y3QgdWJpZnNfaW5mbyAqYywgc3RydWN0IHVi aWZzX2xwdF9oZWFwICpoZWFwLCBpbnQgY2F0LAorCQkgICAgaW50IGFkZF9wb3MpCit7CisJaW50 IGkgPSAwLCBqLCBlcnIgPSAwOworCisJaWYgKCFkYmdfaXNfY2hrX2dlbihjKSAmJiAhZGJnX2lz X2Noa19scHJvcHMoYykpCisJCXJldHVybjsKKworCWZvciAoaSA9IDA7IGkgPCBoZWFwLT5jbnQ7 IGkrKykgeworCQlzdHJ1Y3QgdWJpZnNfbHByb3BzICpscHJvcHMgPSBoZWFwLT5hcnJbaV07CisJ CXN0cnVjdCB1Ymlmc19scHJvcHMgKmxwOworCisJCWlmIChpICE9IGFkZF9wb3MpCisJCQlpZiAo KGxwcm9wcy0+ZmxhZ3MgJiBMUFJPUFNfQ0FUX01BU0spICE9IGNhdCkgeworCQkJCWVyciA9IDE7 CisJCQkJZ290byBvdXQ7CisJCQl9CisJCWlmIChscHJvcHMtPmhwb3MgIT0gaSkgeworCQkJZXJy ID0gMjsKKwkJCWdvdG8gb3V0OworCQl9CisJCWxwID0gdWJpZnNfbHB0X2xvb2t1cChjLCBscHJv cHMtPmxudW0pOworCQlpZiAoSVNfRVJSKGxwKSkgeworCQkJZXJyID0gMzsKKwkJCWdvdG8gb3V0 OworCQl9CisJCWlmIChscHJvcHMgIT0gbHApIHsKKwkJCXViaWZzX2VycihjLCAibHByb3BzICV6 eCBscCAlenggbHByb3BzLT5sbnVtICVkIGxwLT5sbnVtICVkIiwKKwkJCQkgIChzaXplX3QpbHBy b3BzLCAoc2l6ZV90KWxwLCBscHJvcHMtPmxudW0sCisJCQkJICBscC0+bG51bSk7CisJCQllcnIg PSA0OworCQkJZ290byBvdXQ7CisJCX0KKwkJZm9yIChqID0gMDsgaiA8IGk7IGorKykgeworCQkJ bHAgPSBoZWFwLT5hcnJbal07CisJCQlpZiAobHAgPT0gbHByb3BzKSB7CisJCQkJZXJyID0gNTsK KwkJCQlnb3RvIG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lYnNfbmVlZGVkID0gZGl2X3U2NChzeiArIGMtPmxlYl9zaXplIC0gMSwg Yy0+bGViX3NpemUpOworCQlpZiAobGVic19uZWVkZWQgPiBjLT5scHRfbGVicykgeworCQkJLyog Tm90IGVub3VnaCBMUFQgTEVCcyBzbyB0cnkgYWdhaW4gd2l0aCBtb3JlICovCisJCQljLT5scHRf bGVicyA9IGxlYnNfbmVlZGVkOworCQkJYy0+bWFpbl9sZWJzID0gKm1haW5fbGVicyAtIGMtPmxw dF9sZWJzOworCQkJaWYgKGMtPm1haW5fbGVicyA8PSAwKQorCQkJCXJldHVybiAtRUlOVkFMOwor CQkJZG9fY2FsY19scHRfZ2VvbShjKTsKKwkJCWNvbnRpbnVlOworCQl9CisJCWlmIChjLT5sdGFi X3N6ID4gYy0+bGViX3NpemUpIHsKKwkJCXViaWZzX2VycihjLCAiTFBUIGx0YWIgdG9vIGJpZyIp OworCQkJcmV0dXJuIC1FSU5WQUw7CisJCX0KKwkJKm1haW5fbGVicyA9IGMtPm1haW5fbGViczsK KwkJKmJpZ19scHQgPSBjLT5iaWdfbHB0OworCQlyZXR1cm4gMDsKKwl9CisJcmV0dXJuIC1FSU5W QUw7Cit9CisKKy8qKgorICogcGFja19iaXRzIC0gcGFjayBiaXQgZmllbGRzIGVuZC10by1lbmQu CisgKiBAYWRkcjogYWRkcmVzcyBhdCB3aGljaCB0byBwYWNrIChwYXNzZWQgYW5kIG5leHQgYWRk cmVzcyByZXR1cm5lZCkKKyAqIEBwb3M6IGJpdCBwb3NpdGlvbiBhdCB3aGljaCB0byBwYWNrIChw YXNzZWQgYW5kIG5leHQgcG9zaXRpb24gcmV0dXJuZWQpCisgKiBAdmFsOiB2YWx1ZSB0byBwYWNr CisgKiBAbnJiaXRzOiBudW1iZXIgb2YgYml0cyBvZiB2YWx1ZSB0byBwYWNrICgxLTMyKQorICov CitzdGF0aWMgdm9pZCBwYWNrX2JpdHModWludDhfdCAqKmFkZHIsIGludCAqcG9zLCB1aW50MzJf dCB2YWwsIGludCBucmJpdHMpCit7CisJdWludDhfdCAqcCA9ICphZGRyOworCWludCBiID0gKnBv czsKKworCXViaWZzX2Fzc2VydChucmJpdHMgPiAwKTsKKwl1Ymlmc19hc3NlcnQobnJiaXRzIDw9 IDMyKTsKKwl1Ymlmc19hc3NlcnQoKnBvcyA+PSAwKTsKKwl1Ymlmc19hc3NlcnQoKnBvcyA8IDgp OworCXViaWZzX2Fzc2VydCgodmFsID4+IG5yYml0cykgPT0gMCB8fCBucmJpdHMgPT0gMzIpOwor CWlmIChiKSB7CisJCSpwIHw9ICgodWludDhfdCl2YWwpIDw8IGI7CisJCW5yYml0cyArPSBiOwor CQlpZiAobnJiaXRzID4gOCkgeworCQkJKisrcCA9ICh1aW50OF90KSh2YWwgPj49ICg4IC0gYikp OworCQkJaWYgKG5yYml0cyA+IDE2KSB7CisJCQkJKisrcCA9ICh1aW50OF90KSh2YWwgPj49IDgp OworCQkJCWlmIChucmJpdHMgPiAyNCkgeworCQkJCQkqKytwID0gKHVpbnQ4X3QpKHZhbCA+Pj0g OCk7CisJCQkJCWlmIChucmJpdHMgPiAzMikKKwkJCQkJCSorK3AgPSAodWludDhfdCkodmFsID4+ PSA4KTsKKwkJCQl9CisJCQl9CisJCX0KKwl9IGVsc2UgeworCQkqcCA9ICh1aW50OF90KXZhbDsK KwkJaWYgKG5yYml0cyA+IDgpIHsKKwkJCSorK3AgPSAodWludDhfdCkodmFsID4+PSA4KTsKKwkJ CWlmIChucmJpdHMgPiAxNikgeworCQkJCSorK3AgPSAodWludDhfdCkodmFsID4+PSA4KTsKKwkJ CQlpZiAobnJiaXRzID4gMjQpCisJCQkJCSorK3AgPSAodWludDhfdCkodmFsID4+PSA4KTsKKwkJ CX0KKwkJfQorCX0KKwliID0gbnJiaXRzICYgNzsKKwlpZiAoYiA9PSAwKQorCQlwKys7CisJKmFk ZHIgPSBwOworCSpwb3MgPSBiOworfQorCisvKioKICAqIHViaWZzX3VucGFja19iaXRzIC0gdW5w Y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jk5 LDggKzcwMCw2IEBAIGludCB1Ymlmc19tb3VudF9vcnBoYW5zKHN0cnVjdCB1Ymlmc19pbmZvICpj LCBpbnQgdW5jbGVhbiwgaW50IHJlYWRfb25seSkKIHsKIAlpbnQgZXJyID0gMDsKIAotCXJlYWRf b25seSA9IHViaWZzX3JlYWRvbmx5KGMpIHx8IHJlYWRfb25seTsKLQogCWMtPm1heF9vcnBoYW5z ID0gdG90X2F2YWlsX29ycGhzKGMpOwogCiAJaWYgKCFyZWFkX29ubHkpIHsKQEAgLTMxNiwzICs3 MTUsMjMyIEBAIGludCB1Ymlmc19tb3VudF9vcnBoYW5zKHN0cnVjdCB1Ymlmc19pbmZvICpjLCBp bnQgdW5jbGVhbiwgaW50IHJlYWRfb25seSkKIAogCXJldHVybiBlcnI7CiB9CisKKy8qCisgKiBF dmVyeXRoaW5nIGJlbG93IGlzIHJlbGF0ZWQgdG8gZGVidWdnaW5nLgorICovCisKK3N0cnVjdCBj aGVja19vcnBoYW4geworCXN0cnVjdCByYl9ub2RlIHJiOworCWlub190IGludW07Cit9OworCitz dHJ1Y3QgY2hlY2tfaW5mbyB7CisJdW5zaWduZWQgbG9uZyBsYXN0X2lubzsKKwl1bnNpZ25lZCBs b25nIHRvdF9pbm9zOworCXVuc2lnbmVkIGxvbmcgbWlzc2luZzsKKwl1bnNpZ25lZCBsb25nIGxv bmcgbGVhZl9jbnQ7CisJc3RydWN0IHViaWZzX2lub19ub2RlICpub2RlOworCXN0cnVjdCByYl9y b290IHJvb3Q7Cit9OworCitzdGF0aWMgaW50IGRiZ19maW5kX29ycGhhbihzdHJ1Y3QgdWJpZnNf aW5mbyAqYywgaW5vX3QgaW51bSkKK3sKKwlzdHJ1Y3QgdWJpZnNfb3JwaGFuICpvOworCXN0cnVj dCByYl9ub2RlICpwOworCisJc3Bpbl9sb2NrKCZjLT5vcnBoYW5fbG9jayk7CisJcCA9IGMtPm9y cGhfdHJlZS5yYl9ub2RlOworCXdoaWxlIChwKSB7CisJC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0 aW9ucyBhbmQgd291bGQgYmUgc3RyZXNzZWQgbW9yZS4KKwkJICovCisJCW9ycGhfbGVicyArPSAx OworCisJbWFpbl9sZWJzID0gYy0+bGViX2NudCAtIFVCSUZTX1NCX0xFQlMgLSBVQklGU19NU1Rf TEVCUyAtIGxvZ19sZWJzOworCW1haW5fbGVicyAtPSBvcnBoX2xlYnM7CisKKwlscHRfZmlyc3Qg PSBVQklGU19MT0dfTE5VTSArIGxvZ19sZWJzOworCWMtPmxzYXZlX2NudCA9IERFRkFVTFRfTFNB VkVfQ05UOworCWMtPm1heF9sZWJfY250ID0gYy0+bGViX2NudDsKKwllcnIgPSB1Ymlmc19jcmVh dGVfZGZsdF9scHQoYywgJm1haW5fbGVicywgbHB0X2ZpcnN0LCAmbHB0X2xlYnMsCisJCQkJICAg ICZiaWdfbHB0KTsKKwlpZiAoZXJyKQorCQlyZXR1cm4gZXJyOworCisJZGJnX2dlbigiTEVCIFBy b3BlcnRpZXMgVHJlZSBjcmVhdGVkIChMRUJzICVkLSVkKSIsIGxwdF9maXJzdCwKKwkJbHB0X2Zp cnN0ICsgbHB0X2xlYnMgLSAxKTsKKworCW1haW5fZmlyc3QgPSBjLT5sZWJfY250IC0gbWFpbl9s ZWJzOworCisJLyogQ3JlYXRlIGRlZmF1bHQgc3VwZXJibG9jayAqLworCXRtcCA9IEFMSUdOKFVC SUZTX1NCX05PREVfU1osIGMtPm1pbl9pb19zaXplKTsKKwlzdXAgPSBremFsbG9jKHRtcCwgR0ZQ X0tFUk5FTCk7CisJaWYgKCFzdXApCisJCXJldHVybiAtRU5PTUVNOworCisJdG1wNjQgPSAobG9u ZyBsb25nKW1heF9idWRzICogYy0+bGViX3NpemU7CisJaWYgKGJpZ19scHQpCisJCXN1cF9mbGFn cyB8PSBVQklGU19GTEdfQklHTFBUOworCisJc3VwLT5jaC5ub2RlX3R5cGUgID0gVUJJRlNfU0Jf Tk9ERTsKKwlzdXAtPmtleV9oYXNoICAgICAgPSBVQklGU19LR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KTsK Kwltc3QtPmVtcHR5X2xlYnMgICA9IGNwdV90b19sZTMyKG1haW5fbGVicyAtIDIpOworCW1zdC0+ aWR4X2xlYnMgICAgID0gY3B1X3RvX2xlMzIoMSk7CisJbXN0LT5sZWJfY250ICAgICAgPSBjcHVf dG9fbGUzMihjLT5sZWJfY250KTsKKworCS8qIENhbGN1bGF0ZSBscHJvcHMgc3RhdGlzdGljcyAq LworCXRtcDY0ID0gbWFpbl9ieXRlczsKKwl0bXA2NCAtPSBBTElHTih1Ymlmc19pZHhfbm9kZV9z eihjLCAxKSwgYy0+bWluX2lvX3NpemUpOworCXRtcDY0IC09IEFMSUdOKFVCSUZTX0lOT19OT0RF X1NaLCBjLT5taW5faW9fc2l6ZSk7CisJbXN0LT50b3RhbF9mcmVlID0gY3B1X3RvX2xlNjQodG1w NjQpOworCisJdG1wNjQgPSBBTElHTih1Ymlmc19pZHhfbm9kZV9zeihjLCAxKSwgYy0+bWluX2lv X3NpemUpOworCWlub193YXN0ZSA9IEFMSUdOKFVCSUZTX0lOT19OT0RFX1NaLCBjLT5taW5faW9f c2l6ZSkgLQorCQkJICBVQklGU19JTk9fTk9ERV9TWjsKKwl0bXA2NCArPSBpbm9fd2FzdGU7CisJ dG1wNjQgLT0gQUxJR04odWJpZnNfaWR4X25vZGVfc3ooYywgMSksIDgpOworCW1zdC0+dG90YWxf ZGlydHkgPSBjcHVfdG9fbGU2NCh0bXA2NCk7CisKKwkvKiAgVGhlIGluZGV4aW5nIExFQiBkb2Vz IG5vdCBjb250cmlidXRlIHRvIGRhcmsgc3BhY2UgKi8KKwl0bXA2NCA9ICgobG9uZyBsb25nKShj LT5tYWluX2xlYnMgLSAxKSAqIGMtPmRhcmtfd20pOworCW1zdC0+dG90YWxfZGFyayA9IGNwdV90 b19sZTY0KHRtcDY0KTsKKworCW1zdC0+dG90YWxfdXNlZCA9IGNwdV90b19sZTY0KFVCSUZTX0lO T19OT0RFX1NaKTsKKworCWVyciA9IHViaWZzX3dyaXRl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zLCAi LG5vX2J1bGtfcmVhZCIpOworCisJaWYgKGMtPm1vdW50X29wdHMuY2hrX2RhdGFfY3JjID09IDIp CisJCXNlcV9wdXRzKHMsICIsY2hrX2RhdGFfY3JjIik7CisJZWxzZSBpZiAoYy0+bW91bnRfb3B0 cy5jaGtfZGF0YV9jcmMgPT0gMSkKKwkJc2VxX3B1dHMocywgIixub19jaGtfZGF0YV9jcmMiKTsK KworCWlmIChjLT5tb3VudF9vcHRzLm92ZXJyaWRlX2NvbXByKSB7CisJCXNlcV9wcmludGYocywg Iixjb21wcj0lcyIsCisJCQkgICB1Ymlmc19jb21wcl9uYW1lKGMtPm1vdW50X29wdHMuY29tcHJf dHlwZSkpOworCX0KKworCXJldHVybiAwOworfQorCitzdGF0aWMgaW50IHViaWZzX3N5bmNfZnMo c3RydWN0IHN1cGVyX2Jsb2NrICpzYiwgaW50IHdhaXQpCit7CisJaW50IGksIGVycjsKKwlzdHJ1 Y3QgdWJpZnNfaW5mbyAqYyA9IHNiLT5zX2ZzX2luZm87CisKKwkvKgorCSAqIFplcm8gQHdhaXQg aXMganVzdCBhbiBhZHZpc29yeSB0aGluZyB0byBoZWxwIHRoZSBmaWxlIHN5c3RlbSBzaG92ZQor CSAqIGxvdHMgb2YgZGF0YSBpbnRvIHRoZSBxdWV1ZXMsIGFuZCB0aGVyZSB3aWxsIGJlIHRoZSBz ZWNvbmQKKwkgKiAnLT5zeW5jX2ZzKCknIGNhbGwsIHdpdGggbm9uLXplcm8gQHdhaXQuCisJICov CisJaWYgKCF3YWl0KQorCQlyZXR1cm4gMDsKKworCS8qCisJICogU3luY2hyb25pemUgd3JpdGUg YnVmZmVycywgYmVjYXVzZSAndWJpZnNfcnVuX2NvbW1pdCgpJyBkb2VzIG5vdAorCSAqIGRvIHRo aXMgaWYgaXQgd2FpdHMgZm9yIGFuIGFscmVhZHkgcnVubmluZyBjb21taXQuCisJICovCisJZm9y IChpID0gMDsgaSA8IGMtPmpoZWFkX2NudDsgaSsrKSB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AtRU5PTUVNOworCQkJaWYgKCFz dHJjbXAobmFtZSwgIm5vbmUiKSkKKwkJCQljLT5tb3VudF9vcHRzLmNvbXByX3R5cGUgPSBVQklG U19DT01QUl9OT05FOworCQkJZWxzZSBpZiAoIXN0cmNtcChuYW1lLCAibHpvIikpCisJCQkJYy0+ bW91bnRfb3B0cy5jb21wcl90eXBlID0gVUJJRlNfQ09NUFJfTFpPOworCQkJZWxzZSBpZiAoIXN0 cmNtcChuYW1lLCAiemxpYiIpKQorCQkJCWMtPm1vdW50X29wdHMuY29tcHJfdHlwZSA9IFVCSUZT X0NPTVBSX1pMSUI7CisJCQllbHNlIHsKKwkJCQl1Ymlmc19lcnIoYywgInVua25vd24gY29tcHJl c3NvciBcIiVzXCIiLCBuYW1lKTsgLy9GSVhNRTogaXMgYyByZWFkeT8KKwkJCQlrZnJlZShuYW1l KTsKKwkJCQlyZXR1cm4gLUVJTlZBTDsKKwkJCX0KKwkJCWtmcmVlKG5hbWUpOworCQkJYy0+bW91 bnRfb3B0cy5vdmVycmlkZV9jb21wciA9IDE7CisJCQljLT5kZWZhdWx0X2NvbXByID0gYy0+bW91 bnRfb3B0cy5jb21wcl90eXBlOworCQkJYnJlYWs7CisJCX0KKwkJZGVmYXVsdDoKKwkJeworCQkJ dW5zaWduZWQgbG9uZyBmbGFnOworCQkJc3RydWN0IHN1cGVyX2Jsb2NrICpzYiA9IGMtPnZmc19z YjsKKworCQkJZmxhZyA9IHBhcnNlX3N0YW5kYXJkX29wdGlvbihwKTsKKwkJCWlmICghZmxhZykg eworCQkJCXViaWZzX2VycihjLCAidW5yZWNvZ25pemVkIG1vdW50IG9wdGlvbiBcIiVzXCIgb3Ig bWlzc2luZyB2YWx1ZSIsCisJCQkJCSAgcCk7CisJCQkJcmV0dXJuIC1FSU5WQUw7CisJCQl9CisJ CQlzYi0+c19mbGFncyB8PSBmbGFnOworCQkJYnJlYWs7CisJCX0KKwkJfQorCX0KKworCXJldHVy biAwOworfQorI2VuZGlmCis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OworCUJVSUxEX0JV R19PTihVQklGU19EQVRBX05PREVfU1ogJiA3KTsKKwlCVUlMRF9CVUdfT04oVUJJRlNfVFJVTl9O T0RFX1NaICYgNyk7CisJQlVJTERfQlVHX09OKFVCSUZTX1NCX05PREVfU1ogICAmIDcpOworCUJV SUxEX0JVR19PTihVQklGU19NU1RfTk9ERV9TWiAgJiA3KTsKKwlCVUlMRF9CVUdfT04oVUJJRlNf UkVGX05PREVfU1ogICYgNyk7CisJQlVJTERfQlVHX09OKFVCSUZTX0NTX05PREVfU1ogICAmIDcp OworCUJVSUxEX0JVR19PTihVQklGU19PUlBIX05PREVfU1ogJiA3KTsKKworCUJVSUxEX0JVR19P TihVQklGU19NQVhfREVOVF9OT0RFX1NaICYgNyk7CisJQlVJTERfQlVHX09OKFVCSUZTX01BWF9Y RU5UX05PREVfU1ogJiA3KTsKKwlCVUlMRF9CVUdfT04oVUJJRlNfTUFYX0RBVEFfTk9ERV9TWiAm IDcpOworCUJVSUxEX0JVR19PTihVQklGU19NQVhfSU5PX05PREVfU1ogICYgNyk7CisJQlVJTERf QlVHX09OKFVCSUZTX01BWF9OT0RFX1NaICAgICAgJiA3KTsKKwlCVUlMRF9CVUdfT04oTUlOX1dS SVRFX1NaICAgICAgICAgICAmIDcpOworCisJLyogQ2hlY2sgbWluLiBub2RlIHNpemUgKi8KKwlC VUlMRF9CVUdfT04oVUJJRlNfSU5PX05PREVfU1ogIDwgTUlOX1dSSVRFX1NaKTsKKwlCVUlMRF9C VUdfT04oVUJJRlNfREVOVF9OT0RFX1NaIDwgTUlOX1dSSVRFX1NaKTsKKwlCVUlMRF9CVUdfT04o VUJJRlNfWEVOVF9OT0RFX1NaIDwgTUlOX1dSSVRFX1NaKTsKKwlCVUlMRF9CVUdfT04oVUJJRlNf VFJVTl9OT0RFX1NaIDwgTUlOX1dSSVRFX1NaKTsKKworCUJVSUxEX0JVR19PTihVQklGU19NQVhf REVOVF9OT0RFX1NaID4gVUJJRlNfTUFYX05PREVfU1opOworCUJVSUxEX0JVR19PTihVQklGU19N QVhfWEVOVF9OT0RFX1NaID4gVUJJRlNfTUFYX05PREVfU1opOworCUJVSUxEX0JVR19PTihVQklG U19NQVhfREFUQV9OT0RFX1NaID4gVUJJRlNfTUFYX05PREVfU1opOworCUJVSUxEX0JVR19PTihV QklGU19NQVhfSU5PX05PREVfU1ogID4gVUJJRlNfTUFYX05PREVfU1opOworCisJLyogRGVmaW5l ZCBub2RlIHNpemVzICovCisJQlVJTERfQlVHX09OKFVCSUZTX1NCX05PREVfU1ogICE9IDQwOTYp OworCUJVSUxEX0JVR19PTihVQklGU19NU1RfTk9ERV9TWiAhPSA1MTIpOworCUJVSUxEX0JVR19P TihVQklGU19JTk9fTk9ERV9TWiAhPSAxNjApOworCUJVSUxEX0JVR19PTihVQklGU19SRUZfTk9E RV9TWiAhPSA2NCk7CisKKwkvKgorCSAqIFdlIHVzZSAyIGJpdCB3aWRlIGJpdC1maWVsZHMgdG8g c3RvcmUgY29tcHJlc3Npb24gdHlwZSwgd2hpY2ggc2hvdWxkCisJICogYmUgYW1lbmRlZCBpZiBt b3JlIGNvbXByZXNzb3JzIGFyZSBhZGRlZC4gVGhlIGJpdC1maWVsZHMgYXJlOgorCSAqIEBjb21w cl90eXBlIGluICdzdHJ1Y3QgdWJpZnNfaW5vZGUnLCBAZGVmYXVsdF9jb21wciBpbgorCSAqICdz dHJ1Y3QgdWJpZnNfaW5mbycgYW5kIEBjb21wcl90eXBlIGluICdzdHJ1Y3QgdWJpZnNfbW91bnRf b3B0cycuCisJICovCisJQlVJTERfQlVHX09OKFVCSUZTX0NPTVBSX1RZUEVTX0NOVCA+IDQpOwor CisJLyoKKwkgKiBXZSByZXF1aXJlIHRoYXQgUEFHRV9DQUNIRV9TSVpFIGlzIGdyZWF0ZXItdGhh bi1vci1lcXVhbC10bworCSAqIFVCSUZTX0JMT0NLX1NJWkUuIEl0IGlzIGFzc3VtZWQgdGhhdCBi b3RoIGFyZSBwb3dlcnMgb2Yg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kZS0+emJyYW5jaFtuXS5rZXksIGtleSkgPCAwKQorCQkJYnJl YWs7CisJfQorCS8qIEJhY2sgdG8gdGhlIG1pZGRsZSAqLworCXpub2RlID0gem47CisJbiA9IG5u OworCS8qIExvb2sgcmlnaHQgKi8KKwl3aGlsZSAoMSkgeworCQkvKiBNb3ZlIG9uZSBicmFuY2gg dG8gdGhlIHJpZ2h0ICovCisJCWlmICgrK24gPj0gem5vZGUtPmNoaWxkX2NudCkgeworCQkJem5v ZGUgPSByaWdodF96bm9kZShjLCB6bm9kZSk7CisJCQlpZiAoIXpub2RlKQorCQkJCWJyZWFrOwor CQkJaWYgKElTX0VSUih6bm9kZSkpCisJCQkJcmV0dXJuIHpub2RlOworCQkJbiA9IDA7CisJCX0K KwkJLyogQ2hlY2sgaXQgKi8KKwkJaWYgKHpub2RlLT56YnJhbmNoW25dLmxudW0gPT0gbG51bSAm JgorCQkgICAgem5vZGUtPnpicmFuY2hbbl0ub2ZmcyA9PSBvZmZzKQorCQkJcmV0dXJuIGdldF96 bm9kZShjLCB6bm9kZSwgbik7CisJCS8qIFN0b3AgaWYgdGhlIGtleSBpcyBncmVhdGVyIHRoYW4g dGhlIG9uZSB3ZSBhcmUgbG9va2luZyBmb3IgKi8KKwkJaWYgKGtleXNfY21wKGMsICZ6bm9kZS0+ emJyYW5jaFtuXS5rZXksIGtleSkgPiAwKQorCQkJYnJlYWs7CisJfQorCXJldHVybiBOVUxMOwor fQorCisvKioKKyAqIGlzX2lkeF9ub2RlX2luX3RuYyAtIGRldGVybWluZSBpZiBhbiBpbmRleCBu b2RlIGlzIGluIHRoZSBUTkMuCisgKiBAYzogVUJJRlMgZmlsZS1zeXN0ZW0gZGVzY3JpcHRpb24g b2JqZWN0CisgKiBAa2V5OiBrZXkgb2YgaW5kZXggbm9kZQorICogQGxldmVsOiBpbmRleCBub2Rl IGxldmVsCisgKiBAbG51bTogTEVCIG51bWJlciBvZiBpbmRleCBub2RlCisgKiBAb2Zmczogb2Zm c2V0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ZGUgKi8KKwlpZiAoIWZvdW5k KQorCQlyZXR1cm4gMDsKKwl6YnIgPSAmem5vZGUtPnpicmFuY2hbbl07CisJaWYgKGxudW0gPT0g emJyLT5sbnVtICYmIG9mZnMgPT0gemJyLT5vZmZzKQorCQlyZXR1cm4gMTsgLyogRm91bmQgaXQg Ki8KKwlpZiAodW5pcXVlKQorCQlyZXR1cm4gMDsKKwkvKgorCSAqIEJlY2F1c2UgdGhlIGtleSBp cyBub3QgdW5pcXVlLCB3ZSBoYXZlIHRvIGxvb2sgbGVmdAorCSAqIGFuZCByaWdodCBhcyB3ZWxs CisJICovCisJem4gPSB6bm9kZTsKKwlubiA9IG47CisJLyogTG9vayBsZWZ0ICovCisJd2hpbGUg KDEpIHsKKwkJZXJyID0gdG5jX3ByZXYoYywgJnpub2RlLCAmbik7CisJCWlmIChlcnIgPT0gLUVO T0VOVCkKKwkJCWJyZWFrOworCQlpZiAoZXJyKQorCQkJcmV0dXJuIGVycjsKKwkJaWYgKGtleXNf Y21wKGMsIGtleSwgJnpub2RlLT56YnJhbmNoW25dLmtleSkpCisJCQlicmVhazsKKwkJemJyID0g Jnpub2RlLT56YnJhbmNoW25dOworCQlpZiAobG51bSA9PSB6YnItPmxudW0gJiYgb2ZmcyA9PSB6 YnItPm9mZnMpCisJCQlyZXR1cm4gMTsgLyogRm91bmQgaXQgKi8KKwl9CisJLyogTG9vayByaWdo dCAqLworCXpub2RlID0gem47CisJbiA9IG5uOworCXdoaWxlICgxKSB7CisJCWVyciA9IHRuY19u ZXh0KGMsICZ6bm9kZSwgJm4pOworCQlpZiAoZXJyKSB7CisJCQlpZiAoZXJyID09IC1FTk9FTlQp CisJCQkJcmV0dXJuIDA7CisJCQlyZXR1cm4gZXJyOworCQl9CisJCWlmIChrZXlzX2NtcChjLCBr ZXksICZ6bm9kZS0+emJyYW5jaFtuXS5rZXkpKQorCQkJYnJlYWs7CisJCXpiciA9ICZ6bm9kZS0+ emJyYW5jaFtuXTsKKwkJaWYgKG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SwgJnpub2RlLCAmbik7CisJaWYgKGVyciA8IDApCisJCWdvdG8gb3V0X3VubG9jazsK KworCWlmIChlcnIpIHsKKwkJa2V5ID0gJmZyb21fa2V5OworCQlnb3RvIG91dF9kdW1wOworCX0K KworCWVyciA9IHRuY19uZXh0KGMsICZ6bm9kZSwgJm4pOworCWlmIChlcnIgPT0gLUVOT0VOVCkg eworCQllcnIgPSAwOworCQlnb3RvIG91dF91bmxvY2s7CisJfQorCWlmIChlcnIgPCAwKQorCQln b3RvIG91dF91bmxvY2s7CisKKwl1Ymlmc19hc3NlcnQoZXJyID09IDApOworCWtleSA9ICZ6bm9k ZS0+emJyYW5jaFtuXS5rZXk7CisJaWYgKCFrZXlfaW5fcmFuZ2UoYywga2V5LCAmZnJvbV9rZXks ICZ0b19rZXkpKQorCQlnb3RvIG91dF91bmxvY2s7CisKK291dF9kdW1wOgorCWJsb2NrID0ga2V5 X2Jsb2NrKGMsIGtleSk7CisJdWJpZnNfZXJyKGMsICJpbm9kZSAlbHUgaGFzIHNpemUgJWxsZCwg YnV0IHRoZXJlIGFyZSBkYXRhIGF0IG9mZnNldCAlbGxkIiwKKwkJICAodW5zaWduZWQgbG9uZylp bm9kZS0+aV9pbm8sIHNpemUsCisJCSAgKChsb2ZmX3QpYmxvY2spIDw8IFVCSUZTX0JMT0NLX1NI SUZUKTsKKwltdXRleF91bmxvY2soJmMtPnRuY19tdXRleCk7CisJdWJpZnNfZHVtcF9pbm9kZShj LCBpbm9kZSk7CisJZHVtcF9zdGFjaygpOworCXJldHVybiAtRUlOVkFMOworCitvdXRfdW5sb2Nr OgorCW11dGV4X3VubG9jaygmYy0+dG5jX211dGV4KTsKKwlyZXR1cm4gZXJyOworfQpkaWZmIC0t Z2l0IGEvZnMvdWJpZnMvdG5jX21pc2MuYyBiL2ZzL3ViaWZzL3RuY19taXNjLmMKaW5kZXggOTU1 MjE5Zi4uMjFkYTcwOSAxMDA2NDQKLS0tIGEvZnMvdWJpZnMvdG5jX21pc2M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fb2ZmOworCXViaWZzX2NvbXByZXNzb3JzW2Nv bXByLT5jb21wcl90eXBlXS0+ZGVjb21wcmVzcyArPSBnZC0+cmVsb2Nfb2ZmOworI2VuZGlmCisK KwlpZiAoY29tcHItPmNhcGlfbmFtZSkgeworCQljb21wci0+Y2MgPSBjcnlwdG9fYWxsb2NfY29t cChjb21wci0+Y2FwaV9uYW1lLCAwLCAwKTsKKwkJaWYgKElTX0VSUihjb21wci0+Y2MpKSB7CisJ CQlkYmdfZ2VuKCJjYW5ub3QgaW5pdGlhbGl6ZSBjb21wcmVzc29yICVzLCIKKwkJCQkgICIgZXJy b3IgJWxkIiwgY29tcHItPm5hbWUsCisJCQkJICBQVFJfRVJSKGNvbXByLT5jYykpOworCQkJcmV0 dXJuIFBUUl9FUlIoY29tcHItPmNjKTsKKwkJfQorCX0KKworCXJldHVybiAwOworfQorCisvKioK KyAqIHViaWZzX2NvbXByZXNzb3JzX2luaXQgLSBpbml0aWFsaXplIFVCSUZTIGNvbXByZXNzb3Jz LgorICoKKyAqIFRoaXMgZnVuY3Rpb24gaW5pdGlhbGl6ZXMgdGhlIGNvbXByZXNzb3Igd2hpY2gg d2VyZSBjb21waWxlZCBpbi4gUmV0dXJucworICogemVybyBpbiBjYXNlIG9mIHN1Y2Nlc3MgYW5k IGEgbmVnYXRpdmUgZXJyb3IgY29kZSBpbiBjYXNlIG9mIGZhaWx1cmUuCisgKi8KK2ludCBfX2lu aXQgdWJpZnNfY29tcHJlc3NvcnNfaW5pdCh2b2lkKQoreworCWludCBlcnI7CisKKwllcnIgPSBj b21wcl9pbml0KCZsem9fY29tcHIpOworCWlmIChlcnIpCisJCXJldHVybiBlcnI7CisKKwllcnIg PSBjb21wcl9pbml0KCZ6bGliX2NvbXByKTsKKwlpZiAoZXJyKQorCQlyZXR1cm4gZXJyOworCisJ ZXJyID0gY29tcHJfaW5pdCgmbm9uZV9jb21wcik7CisJaWYgKGVycikKKwkJcmV0dXJuIGVycjsK KworCXJldHVybiAwO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KQogI2Rl ZmluZSBtdXRleF9pc19sb2NrZWQoLi4uKQkwCisjZW5kaWYKIAogLyogVmVyc2lvbiBvZiB0aGlz IFVCSUZTIGltcGxlbWVudGF0aW9uICovCiAjZGVmaW5lIFVCSUZTX1ZFUlNJT04gMQogCiAvKiBO b3JtYWwgVUJJRlMgbWVzc2FnZXMgKi8KLSNkZWZpbmUgdWJpZnNfbXNnKGZtdCwgLi4uKSBcCi0J CXByX2luZm8oIlVCSUZTOiAiIGZtdCAiXG4iLCAjI19fVkFfQVJHU19fKQorI2RlZmluZSB1Ymlm c19tc2coYywgZm10LCAuLi4pICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBc CisJcHJfbm90aWNlKCJVQklGUyAodWJpJWQ6JWQpOiAiIGZtdCAiXG4iLCAgICAgICAgICAgICAg ICAgICAgXAorCQkgIChjKS0+dmkudWJpX251bSwgKGMpLT52aS52b2xfaWQsICMjX19WQV9BUkdT X18pCiAvKiBVQklGUyBlcnJvciBtZXNzYWdlcyAqLwotI2RlZmluZSB1Ymlmc19lcnIoZm10LCAu Li4pICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0J cHJfZXJyKCJVQklGUyBlcnJvciAocGlkICVkKTogJXM6ICIgZm10ICJcbiIsIDAsIFwKKyNpZm5k ZWYgX19CQVJFQk9YX18KKyNkZWZpbmUgdWJpZnNfZXJyKGMsIGZtdCwgLi4uKSAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorCXByX2VycigiVUJJRlMgZXJyb3IgKHViaSVk OiVkIHBpZCAlZCk6ICVzOiAiIGZtdCAiXG4iLCAgICAgIFwKKwkgICAgICAgKGMpLT52aS51Ymlf bnVtLCAoYyktPnZpLnZvbF9pZCwgY3VycmVudC0+cGlkLCAgICAgICBcCisJICAgICAgIF9fZnVu Y19fLCAjI19fVkFfQVJHU19fKQorLyogVUJJRlMgd2FybmluZyBtZXNzYWdlcyAqLworI2RlZmlu ZSB1Ymlmc193YXJuKGMsIGZtdCwgLi4uKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICBcCisJcHJfd2FybigiVUJJRlMgd2FybmluZyAodWJpJWQ6JWQgcGlkICVkKTogJXM6ICIg Zm10ICJcbiIsICAgXAorCQkoYyktPnZpLnViaV9udW0sIChjKS0+dmkudm9sX2lkLCBjdXJyZW50 LT5waWQsICAgICAgXAorCQlfX2Z1bmNfXywgIyNfX1ZBX0FSR1NfXykKKyNlbHNlCisjZGVmaW5l IHViaWZzX2VycihjLCBmbXQsIC4uLikgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIFwKKwlwcl9lcnIoIlVCSUZTIGVycm9yICh1YmklZDolZCBwaWQgJWQpOiAlczogIiBmbXQg IlxuIiwgICAgICBcCisJICAgICAgIChjKS0+dmkudWJpX251bSwgKGMpLT52aS52b2xfaWQsIDAs ICAgICAgICAgICAgICAgICAgXAogCSAgICAgICBfX2Z1bmNfXywgIyNfX1ZBX0FSR1NfXykKIC8q IFVCSUZTIHdhcm5pbmcgbWVzc2FnZXMgKi8KLSNkZWZpbmUgdWJpZnNfd2FybihmbXQsIC4uLikg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLQlwcl93YXJuKCJVQklG UyB3YXJuaW5nIChwaWQgJWQpOiAlczogIiBmbXQgIlxuIiwgXAotCSAgICAgICAwLCBfX2Z1bmNf XywgIyNfX1ZBX0FSR1NfXykKKyNkZWZpbmUgdWJpZnNfd2FybihjLCBmbXQsIC4uLikgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorCXByX3dhcm4oIlVCSUZTIHdhcm5pbmcg KHViaSVkOiVkIHBpZCAlZCk6ICVzOiAiIGZtdCAiXG4iLCAgIFwKKwkJKGMpLT52aS51YmlfbnVt LCAoYyktPnZpLnZvbF9pZCwgMCwgICAgICAgICAgICAgICAgIFwKKwkJX19mdW5jX18sICMj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W9kZShzdHJ1Y3QgdWJpZnNfaW5mbyAqYywgaW50IGVy cik7CitpbnQgdWJpZnNfbGViX3JlYWQoY29uc3Qgc3RydWN0IHViaWZzX2luZm8gKmMsIGludCBs bnVtLCB2b2lkICpidWYsIGludCBvZmZzLAorCQkgICBpbnQgbGVuLCBpbnQgZXZlbl9lYmFkbXNn KTsKK2ludCB1Ymlmc19sZWJfd3JpdGUoc3RydWN0IHViaWZzX2luZm8gKmMsIGludCBsbnVtLCBj b25zdCB2b2lkICpidWYsIGludCBvZmZzLAorCQkgICAgaW50IGxlbik7CitpbnQgdWJpZnNfbGVi X2NoYW5nZShzdHJ1Y3QgdWJpZnNfaW5mbyAqYywgaW50IGxudW0sIGNvbnN0IHZvaWQgKmJ1Ziwg aW50IGxlbik7CitpbnQgdWJpZnNfbGViX3VubWFwKHN0cnVjdCB1Ymlmc19pbmZvICpjLCBpbnQg bG51bSk7CitpbnQgdWJpZnNfbGViX21hcChzdHJ1Y3QgdWJpZnNfaW5mbyAqYywgaW50IGxudW0p OworaW50IHViaWZzX2lzX21hcHBlZChjb25zdCBzdHJ1Y3QgdWJpZnNfaW5mbyAqYywgaW50IGxu dW0pOwogaW50IHViaWZzX3didWZfd3JpdGVfbm9sb2NrKHN0cnVjdCB1Ymlmc193YnVmICp3YnVm LCB2b2lkICpidWYsIGludCBsZW4pOwotaW50IHViaWZzX3didWZfc2Vla19ub2xvY2soc3RydWN0 IHViaWZzX3didWYgKndidWYsIGludCBsbnVtLCBpbnQgb2ZmcywKLQkJCSAgIGludCBkdHlwZSk7 CitpbnQgdWJpZnNfd2J1Zl9zZWVrX25vbG9jayhzdHJ1Y3QgdWJpZnNfd2J1ZiAqd2J1ZiwgaW50 IGxudW0sIGludCBvZmZzKTsKIGludCB1Ymlmc193YnVmX2luaXQoc3RydWN0IHViaWZzX2luZm8g KmMsIHN0cnVjdCB1Ymlmc193YnVmICp3YnVmKTsKIGludCB1Ymlmc19yZWFkX25vZGUoY29uc3Qg c3RydWN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