From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V6gz9-0005cN-1o for barebox@lists.infradead.org; Tue, 06 Aug 2013 13:08:14 +0000 From: Sascha Hauer Subject: [PATCH 8/8] fs: Add ubifs support Date: Tue, 6 Aug 2013 15:07:08 +0200 Message-Id: <1375794428-29577-9-git-send-email-s.hauer@pengutronix.de> In-Reply-To: <1375794428-29577-1-git-send-email-s.hauer@pengutronix.de> References: <1375794428-29577-1-git-send-email-s.hauer@pengutronix.de> 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 VGhpcyBhZGRzIHViaWZzIHN1cHBvcnQgZnJvbSB1LWJvb3QtMjAxMy4wNy4gVGhpcyBpcyB0YWtl bgptb3N0bHkgYXMtaXMsIG9ubHkgdGhlIG5lY2Vzc2FyeSBhZGp1c3RtZW50cyB0byBhdHRhY2gg dG8gdGhlCmJhcmVib3ggZnMgbGF5ZXIgaGF2ZSBiZWVuIG1hZGUuCgpTaWduZWQtb2ZmLWJ5OiBT YXNjaGEgSGF1ZXIgPHMuaGF1ZXJAcGVuZ3V0cm9uaXguZGU+Ci0tLQogZnMvS2NvbmZpZyAgICAg ICAgICAgICB8ICAgIDEgKwogZnMvTWFrZWZpbGUgICAgICAgICAgICB8ICAgIDEgKwogZnMvdWJp ZnMvS2NvbmZpZyAgICAgICB8ICAgMTcgKwogZnMvdWJpZnMvTWFrZWZpbGUgICAgICB8ICAgIDQg KwogZnMvdWJpZnMvYnVkZ2V0LmMgICAgICB8ICAxMTMgKysKIGZzL3ViaWZzL2NyYzE2LmMgICAg ICAgfCAgIDYwICsrCiBmcy91Ymlmcy9jcmMxNi5oICAgICAgIHwgICAyOSArCiBmcy91Ymlmcy9k ZWJ1Zy5jICAgICAgIHwgIDE1NiArKysKIGZzL3ViaWZzL2RlYnVnLmggICAgICAgfCAgMzkyICsr KysrKysKIGZzL3ViaWZzL2lvLmMgICAgICAgICAgfCAgMzE2ICsrKysrKwogZnMvdWJpZnMva2V5 LmggICAgICAgICB8ICA1NTcgKysrKysrKysrKwogZnMvdWJpZnMvbG9nLmMgICAgICAgICB8ICAx MDQgKysKIGZzL3ViaWZzL2xwcm9wcy5jICAgICAgfCAgODQyICsrKysrKysrKysrKysrKwogZnMv dWJpZnMvbHB0LmMgICAgICAgICB8IDExMDUgKysrKysrKysrKysrKysrKysrKwogZnMvdWJpZnMv bHB0X2NvbW1pdC5jICB8ICAxNzEgKysrCiBmcy91Ymlmcy9tYXN0ZXIuYyAgICAgIHwgIDM0MSAr KysrKysKIGZzL3ViaWZzL21pc2MuaCAgICAgICAgfCAgMzExICsrKysrKwogZnMvdWJpZnMvb3Jw aGFuLmMgICAgICB8ICAzMTggKysrKysrCiBmcy91Ymlmcy9yZWNvdmVyeS5jICAgIHwgMTIyNSAr KysrKysrKysrKysrKysrKysrKysKIGZzL3ViaWZzL3JlcGxheS5jICAgICAgfCAxMDcwICsrKysr KysrKysrKysrKysrKysKIGZzL3ViaWZzL3NiLmMgICAgICAgICAgfCAgMzQ2ICsrKysrKwogZnMv dWJpZnMvc2Nhbi5jICAgICAgICB8ICAzNjIgKysrKysrKwogZnMvdWJpZnMvc3VwZXIuYyAgICAg ICB8ICA5MDcgKysrKysrKysrKysrKysrKwogZnMvdWJpZnMvdG5jLmMgICAgICAgICB8IDI3Njcg KysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrCiBmcy91Ymlm cy90bmNfbWlzYy5jICAgIHwgIDQzNSArKysrKysrKwogZnMvdWJpZnMvdWJpZnMtbWVkaWEuaCB8 ICA3NzUgKysrKysrKysrKysrK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F90bmM6ICJkdW1wIFROQyIgZGVidWdmcyBrbm9iCisgKi8KK3N0 cnVjdCB1Ymlmc19kZWJ1Z19pbmZvIHsKKwl2b2lkICpidWY7CisJc3RydWN0IHViaWZzX3picmFu Y2ggb2xkX3pyb290OworCWludCBvbGRfenJvb3RfbGV2ZWw7CisJdW5zaWduZWQgbG9uZyBsb25n IG9sZF96cm9vdF9zcW51bTsKKwlpbnQgZmFpbHVyZV9tb2RlOworCWludCBmYWlsX2RlbGF5Owor CXVuc2lnbmVkIGxvbmcgZmFpbF90aW1lb3V0OworCXVuc2lnbmVkIGludCBmYWlsX2NudDsKKwl1 bnNpZ25lZCBpbnQgZmFpbF9jbnRfbWF4OworCWxvbmcgbG9uZyBjaGtfbHB0X3N6OworCWxvbmcg bG9uZyBjaGtfbHB0X3N6MjsKKwlsb25nIGxvbmcgY2hrX2xwdF93YXN0YWdlOworCWludCBjaGtf bHB0X2xlYnM7CisJaW50IG5ld19uaGVhZF9vZmZzOworCWludCBuZXdfaWhlYWRfbG51bTsKKwlp bnQgbmV3X2loZWFkX29mZnM7CisKKwlzdHJ1Y3QgdWJpZnNfbHBfc3RhdHMgc2F2ZWRfbHN0Owor CWxvbmcgbG9uZyBzYXZlZF9mcmVlOworCisJY2hhciBkZnNfZGlyX25hbWVbMTAwXTsKKwlzdHJ1 Y3QgZGVudHJ5ICpkZnNfZGlyOworCXN0cnVjdCBkZW50cnkgKmRmc19kdW1wX2xwcm9wczsKKwlz dHJ1Y3QgZGVudHJ5ICpkZnNfZHVtcF9idWRnOworCXN0cnVjdCBkZW50cnkgKmRmc19kdW1wX3Ru YzsKK307CisKKyNkZWZpbmUgVUJJRlNfREJHKG9wKSBvcAorCisjZGVmaW5lIHViaWZzX2Fzc2Vy dChleHByKSBkbyB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgXAorCWlmICh1bmxpa2VseSghKGV4cHIpKSkgeyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgXAorCQlwcmludGsoS0VSTl9DUklUICJVQklGUyBhc3NlcnQg ZmFpbGVkIGluICVzIGF0ICV1IChwaWQgJWQpXG4iLCBcCisJCSAgICAgICBfX2Z1bmNfXywgX19M SU5FX18sIDApOyAgICAgICAgICAgICAgICAgICAgICBcCisJCWRiZ19kdW1wX3N0YWNrKCk7ICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKwl9ICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIFwKK30gd2hpbGUgKDApCisKKyNkZWZpbmUgdWJpZnNfYXNzZXJ0X2NtdF9sb2NrZWQoYykg ZG8geyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisJaWYgKHVubGlr ZWx5KGRvd25fd3JpdGVfdHJ5bG9jaygmKGMpLT5jb21taXRfc2VtKSkpIHsgICAgICAgICAgICAg ICAgICBcCisJCXVwX3dyaXRlKCYoYyktPmNvbW1pdF9zZW0pOyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIFwKKwkJcHJpbnRrKEtFUk5fQ1JJVCAiY29tbWl0IGxvY2sgaXMgbm90 IGxvY2tlZCFcbiIpOyAgICAgICAgICAgICAgXAorCQl1Ymlmc19hc3NlcnQoMCk7ICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisJfSAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBc Cit9IHdoaWxlICgwKQorCisjZGVmaW5lIGRiZ19kdW1wX3N0YWNrKCkgZG8geyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorCWlmICghZGJnX2ZhaWx1 cmVfbW9kZSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg XAorCQlkdW1wX3N0YWNrKCk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICBcCit9IHdoaWxlICgwKQorCisvKiBHZW5lcmljIGRlYnVnZ2luZyBtZXNzYWdl cyAqLworI2RlZmluZSBkYmdfbXNnKGZtdCwgLi4uKSBkbyB7ICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKwlzcGluX2xvY2soJmRiZ19sb2NrKTsgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKwlwcmludGso S0VSTl9ERUJVRyAiVUJJRlMgREJHIChwaWQgJWQpOiAlczogIiBmbXQgIlxuIiwgMCwgICBcCisJ ICAgICAgIF9fZnVuY19fLCAjI19fVkFfQVJHU19fKTsgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBcCisJc3Bpbl91bmxvY2soJmRiZ19sb2NrKTsgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCit9IHdoaWxlICgwKQorCisjZGVmaW5l IGRiZ19kb19tc2codHlwLCBmbXQsIC4uLikgZG8geyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgXAorCWlmICh1Ymlmc19tc2dfZmxhZ3MgJiB0eXApICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorCQlkYmdfbXNnKGZtdCwgIyNfX1ZB X0FSR1NfXyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCit9IHdoaWxlICgw KQorCisjZGVmaW5lIGRiZ19lcnIoZm10LCAuLi4pIGRvIHsgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorCXNwaW5fbG9jaygmZGJnX2xvY2spOyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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Bt ZXNzYWdlcworICogVUJJRlNfTVNHX1JDVlJZOiByZWNvdmVyeSBtZXNzYWdlcworICovCitlbnVt IHsKKwlVQklGU19NU0dfR0VOICAgPSAweDEsCisJVUJJRlNfTVNHX0pOTCAgID0gMHgyLAorCVVC SUZTX01TR19NTlQgICA9IDB4NCwKKwlVQklGU19NU0dfQ01UICAgPSAweDgsCisJVUJJRlNfTVNH X0ZJTkQgID0gMHgxMCwKKwlVQklGU19NU0dfQlVERyAgPSAweDIwLAorCVVCSUZTX01TR19HQyAg ICA9IDB4NDAsCisJVUJJRlNfTVNHX1ROQyAgID0gMHg4MCwKKwlVQklGU19NU0dfTFAgICAgPSAw eDEwMCwKKwlVQklGU19NU0dfSU8gICAgPSAweDIwMCwKKwlVQklGU19NU0dfTE9HICAgPSAweDQw MCwKKwlVQklGU19NU0dfU0NBTiAgPSAweDgwMCwKKwlVQklGU19NU0dfUkNWUlkgPSAweDEwMDAs Cit9OworCisvKiBEZWJ1Z2dpbmcgbWVzc2FnZSB0eXBlIGZsYWdzIGZvciBlYWNoIGRlZmF1bHQg ZGVidWcgbWVzc2FnZSBsZXZlbCAqLworI2RlZmluZSBVQklGU19NU0dfTFZMXzAgMAorI2RlZmlu ZSBVQklGU19NU0dfTFZMXzEgMHgxCisjZGVmaW5lIFVCSUZTX01TR19MVkxfMiAweDdmCisjZGVm aW5lIFVCSUZTX01TR19MVkxfMyAweGZmZmYKKworLyoKKyAqIERlYnVnZ2luZyBjaGVjayBmbGFn cyAobXVzdCBtYXRjaCBjaGtfbmFtZXMgaW4gZGVidWcuYykuCisgKgorICogVUJJRlNfQ0hLX0dF TjogZ2VuZXJhbCBjaGVja3MKKyAqIFVCSUZTX0NIS19UTkM6IGNoZWNrIFROQworICogVUJJRlNf Q0hLX0lEWF9TWjogY2hlY2sgaW5kZXggc2l6ZQorICogVUJJRlNfQ0hLX09SUEg6IGNoZWNrIG9y cGhhbnMKKyAqIFVCSUZTX0NIS19PTERfSURYOiBjaGVjayB0a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RFRkFVTFQgVUJJRlNfTVNHX0xWTF8zCisjZWxzZQorI2RlZmluZSBVQklG U19NU0dfRkxBR1NfREVGQVVMVCBVQklGU19NU0dfTFZMXzAKKyNlbmRpZgorCisjaWZkZWYgQ09O RklHX1VCSUZTX0ZTX0RFQlVHX0NIS1MKKyNkZWZpbmUgVUJJRlNfQ0hLX0ZMQUdTX0RFRkFVTFQg MHhmZmZmZmZmZgorI2Vsc2UKKyNkZWZpbmUgVUJJRlNfQ0hLX0ZMQUdTX0RFRkFVTFQgMAorI2Vu ZGlmCisKKyNkZWZpbmUgZGJnX250eXBlKHR5cGUpICAgICAgICAgICAgICAgICAgICAgICAiIgor I2RlZmluZSBkYmdfY3N0YXRlKGNtdF9zdGF0ZSkgICAgICAgICAgICAgICAgICIiCisjZGVmaW5l IGRiZ19nZXRfa2V5X2R1bXAoYywga2V5KSAgICAgICAgICAgICAgKHt9KQorI2RlZmluZSBkYmdf ZHVtcF9pbm9kZShjLCBpbm9kZSkgICAgICAgICAgICAgICh7fSkKKyNkZWZpbmUgZGJnX2R1bXBf bm9kZShjLCBub2RlKSAgICAgICAgICAgICAgICAoe30pCisjZGVmaW5lIGRiZ19kdW1wX2J1ZGdl dF9yZXEocmVxKSAgICAgICAgICAgICAgKHt9KQorI2RlZmluZSBkYmdfZHVtcF9sc3RhdHMobHN0 KSAgICAgICAgICAgICAgICAgICh7fSkKKyNkZWZpbmUgZGJnX2R1bXBfYnVkZyhjKSAgICAgICAg ICAgICAgICAgICAgICAoe30pCisjZGVmaW5lIGRiZ19kdW1wX2xwcm9wKGMsIGxwKSAgICAgICAg ICAgICAgICAgKHt9KQorI2RlZmluZSBkYmdfZHVtcF9scHJvcHMoYykgICAgICAgICAgICAgICAg ICAgICh7fSkKKyNkZWZpbmUgZGJnX2R1bXBfbHB0X2luZm8oYykgICAgICAgICAgICAgICAgICAo e30pCisjZGVmaW5lIGRiZ19kdW1wX2xlYihjLCBsbnVtKSAgICAgICAgICAgICAgICAgKHt9KQor I2RlZmluZSBkYmdfZHVtcF96bm9kZShjLCB6bm9kZSkgICAgICAgICAgICAgICh7fSkKKyNkZWZp bmUgZGJnX2R1bXBfaGVhcChjLCBoZWFwLCBjYXQpICAgICAgICAgICAoe30pCisjZGVmaW5lIGRi Z19kdW1wX3Bub2RlKGMsIHBub2RlLCBwYXJlbnQsIGlpcCkgKHt9KQorI2RlZmluZSBkYmdfZHVt cF90bmMoYykgICAgICAgICAgICAgICAgICAgICAgICh7fSkKKyNkZWZpbmUgZGJnX2R1bXBfaW5k ZXgoYykgICAgICAgICAgICAgICAgICAgICAoe30pCisKKyNkZWZpbmUgZGJnX3dhbGtfaW5kZXgo YywgbGVhZl9jYiwgem5vZGVfY2IsIHByaXYpIDAKKyNkZWZpbmUgZGJnX29sZF9pbmRleF9jaGVj a19pbml0KGMsIHpyb290KSAgICAgICAgIDAKKyNkZWZpbmUgZGJnX2NoZWNrX29sZF9pbmRleChj LCB6cm9vdCkgICAgICAgICAgICAgIDAKKyNkZWZpbmUgZGJnX2NoZWNrX2NhdHMoYykgICAgICAg ICAgICAgICAgICAgICAgICAgIDAKKyNkZWZpbmUgZGJnX2NoZWNrX2x0YWIoYykgICAgICAgICAg ICAgICAgICAgICAgICAgIDAKKyNkZWZpbmUgZGJnX2Noa19scHRfZnJlZV9zcGMoYykgICAgICAg ICAgICAgICAgICAgIDAKKyNkZWZpbmUgZGJnX2Noa19scHRfc3ooYywgYWN0aW9uLCBsZW4pICAg ICAgICAgICAgIDAKKyNkZWZpbmUgZGJnX2NoZWNrX3N5bmNlZF9pX3NpemUoaW5vZGUpICAgICAg ICAgICAgIDAKKyNkZWZpbmUgZGJnX2NoZWNrX2Rpcl9zaXplKGMsIGRpcikgICAgICAgICAgICAg ICAgIDAKKyNkZWZpbmUgZGJnX2NoZWNrX3RuYyhjLCB4KSAgICAgICAgICAgICAgICAgICAgICAg IDAKKyNkZWZpbmUgZGJnX2NoZWNrX2lkeF9zaXplKGMsIGlkeF9zaXplKSAgICA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AgXAorCWlmICgwICYmIChleHByKSkgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorCQlwcmludGsoS0VSTl9D UklUICJVQklGUyBhc3NlcnQgZmFpbGVkIGluICVzIGF0ICV1IChwaWQgJWQpXG4iLCBcCisJCSAg ICAgICBfX2Z1bmNfXywgX19MSU5FX18sIDApOyAgICAgICAgICAgICAgICAgICAgICBcCit9IHdo aWxlICgwKQorCisjZGVmaW5lIGRiZ19lcnIoZm10LCAuLi4pICAgZG8geyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorCWlmICgwKSAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorCQl1 Ymlmc19lcnIoZm10LCAjI19fVkFfQVJHU19fKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICBcCit9IHdoaWxlICgwKQorCisjZGVmaW5lIGRiZ19tc2coZm10LCAuLi4pIGRvIHsgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorCWlmICgwKSAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgXAorCQlwcmludGsoS0VSTl9ERUJVRyAiVUJJRlMgREJHIChwaWQgJWQpOiAlczogIiBm bXQgIlxuIiwgICAgICAgICBcCisJCSAgICAgICAwLCBfX2Z1bmNfXywgIyNfX1ZBX0FSR1NfXyk7 ICAgICAgICAgICAgICAgICBcCit9IHdoaWxlICgwKQorCisjZGVmaW5lIGRiZ19kdW1wX3N0YWNr KCkKKyNkZWZpbmUgdWJpZnNfYXNzZXJ0X2NtdF9sb2NrZWQoYykKKworI2RlZmluZSBkYmdfZ2Vu KGZtdCwgLi4uKSAgIGRiZ19tc2coZm10LCAjI19fVkFfQVJHU19fKQorI2RlZmluZSBkYmdfam5s KGZtdCwgLi4uKSAgIGRiZ19tc2coZm10LCAjI19fVkFfQVJHU19fKQorI2RlZmluZSBkYmdfdG5j KGZtdCwgLi4uKSAgIGRiZ19tc2coZm10LCAjI19fVkFfQVJHU19fKQorI2RlZmluZSBkYmdfbHAo Zm10LCAuLi4pICAgIGRiZ19tc2coZm10LCAjI19fVkFfQVJHU19fKQorI2RlZmluZSBkYmdfZmlu ZChmbXQsIC4uLikgIGRiZ19tc2coZm10LCAjI19fVkFfQVJHU19fKQorI2RlZmluZSBkYmdfbW50 KGZtdCwgLi4uKSAgIGRiZ19tc2coZm10LCAjI19fVkFfQVJHU19fKQorI2RlZmluZSBkYmdfaW8o Zm10LCAuLi4pICAgIGRiZ19tc2coZm10LCAjI19fVkFfQVJHU19fKQorI2RlZmluZSBkYmdfY210 KGZtdCwgLi4uKSAgIGRiZ19tc2coZm10LCAjI19fVkFfQVJHU19fKQorI2RlZmluZSBkYmdfYnVk ZyhmbXQsIC4uLikgIGRiZ19tc2coZm10LCAjI19fVkFfQVJHU19fKQorI2RlZmluZSBkYmdfbG9n KGZtdCwgLi4uKSAgIGRiZ19tc2coZm10LCAjI19fVkFfQVJHU19fKQorI2RlZmluZSBkYmdfZ2Mo Zm10LCAuLi4pICAgIGRiZ19tc2coZm10LCAjI19fVkFfQVJHU19fKQorI2RlZmluZSBkYmdfc2Nh bihmbXQsIC4uLikgIGRiZ19tc2coZm10LCAjI19fVkFfQVJHU19fKQorI2RlZmluZSBkYmdfcmN2 cnkoZm10LCAuLi4pIGRiZ19tc2coZm10LCAjI19fVkFfQVJHU19fKQorCisjZGVmaW5lIERCR0tF WShrZXkpICAoKGNoYXIgKikoa2V5KSkKKyNkZWZpbmUgREJHS0VZMShrZXkpICgoY2hhciAqKShr ZXkpKQorCisjZGVmaW5lIHViaWZzX2RlYnVnZ2luZ19pbml0KGMpICAgICAgICAgICAgICAgIDAK KyNkZWZpbmUgdWJpZnNfZGVidWdnaW5nX2V4aXQoYykgICAgICAgICAgICAgICAgKHt9KQorCisj ZGVmaW5lIGRiZ19udHlwZSh0eXBlKSAgICAgICAgICAgICAgICAgICAgICAgIiIKKyNkZWZpbmUg ZGJnX2NzdGF0ZShjbXRfc3RhdGUpICAgICAgICAgICAgICAgICAiIgorI2RlZmluZSBkYmdfZ2V0 X2tleV9kdW1wKGMsIGtleSkgICAgICAgICAgICAgICh7fSkKKyNkZWZpbmUgZGJnX2R1bXBfaW5v ZGUoYywgaW5vZGUpICAgICAgICAgICAgICAoe30pCisjZGVmaW5lIGRiZ19kdW1wX25vZGUoYywg bm9kZSkgICAgICAgICAgICAgICAgKHt9KQorI2RlZmluZSBkYmdfZHVtcF9idWRnZXRfcmVxKHJl cSkgICAgICAgICAgICAgICh7fSkKKyNkZWZpbmUgZGJnX2R1bXBfbHN0YXRzKGxzdCkgICAgICAg ICAgICAgICAgICAoe30pCisjZGVmaW5lIGRiZ19kdW1wX2J1ZGcoYykgICAgICAgICAgICAgICAg ICAgICAgKHt9KQorI2RlZmluZSBkYmdfZHVtcF9scHJvcChjLCBscCkgICAgICAgICAgICAgICAg ICh7fSkKKyNkZWZpbmUgZGJnX2R1bXBfbHByb3BzKGMpICAgICAgICAgICAgICAgICAgICAoe30p CisjZGVmaW5lIGRiZ19kdW1wX2xwdF9pbmZvKGMpICAgICAgICAgICAgICAgICAgKHt9KQorI2Rl ZmluZSBkYmdfZHVtcF9sZWIoYywgbG51bSkgICAgICAgICAgICAgICAgICh7fSkKKyNkZWZpbmUg ZGJnX2R1bXBfem5vZGUoYywgem5vZGUpICAgICAgICAgICAgICAoe30pCisjZGVmaW5lIGRiZ19k dW1wX2hlYXAoYywgaGVhcCwgY2F0KSAgICAgICAgICAgKHt9KQorI2RlZmluZSBkYmdfZHVtcF9w bm9kZShjLCBwbm9kZSwgcGFyZW50LCBpaXApICh7fSkKKyNkZWZpbmUgZGJnX2R1bXBfdG5jKGMp ICAgICAgICAgICAgICAgICAgICAgICAoe30pCisjZGVmaW5lIGRiZ19kdW1wX2luZGV4KGMpICAg ICAgICAgICAgICAgICAgICAgKHt9KQorCisjZGVmaW5lIGRiZ193YWxrX2luZGV4KGMsIGxlYWZf Y2IsIHpub2RlX2NiLCBwcml2KSAwCisjZGVmaW5lIGRiZ19vbGRfaW5kZXhfY2hlY2tfaW5pdChj LCB6cm9vdCkgICAgICAgICAwCisjZGVmaW5lIGRiZ19jaGVja19vbGRfaW5kZXgoYywgenJvb3Qp ICAgICAgICAgICAgICAwCisjZGVmaW5lIGRiZ19jaGVja19jYXRzKGMpICAgICAgICAgICAgICAg ICAgICAgICAgICAwCisjZGVmaW5lIGRiZ19jaGVja19sdGFiKGMpICAgICAgICAgICAgICAgICAg ICAgICAgICAwCisjZGVmaW5lIGRiZ19jaGtfbHB0X2ZyZWVfc3BjKGMpICAgICAgICAgICAgICAg ICAgICAwCisjZGVmaW5lIGRiZ19jaGtfbHB0X3N6KGMsIGFjdGlvbiwgbGVuKSAgICAgICAgICAg ICAwCisjZGVmaW5lIGRiZ19jaGVja19zeW5jZWRfaV9zaXplKGlub2RlKSAgICAgICAgICAgICAw CisjZGVmaW5lIGRiZ19jaGVja19kaXJfc2l6ZShjLCBkaXIpICAgICAgICAgICAgICAgICAwCisj ZGVmaW5lIGRiZ19jaGVja190bmMoYywgeCkgICAgICAgICAgICAgICAgICAgICAgICAwCisjZGVm aW5lIGRiZ19jaGVja19pZHhfc2l6ZShjLCBpZHhfc2l6ZSkgICAgICAgICAgICAwCisjZGVmaW5l IGRiZ19jaGVja19maWxlc3lzdGVtKGMpICAgICAgICAgICAgICAgICAgICAwCisjZGVmaW5lIGRi Z19jaGVja19oZWFwKGMsIGhlYXAsIGNhdCwgYWRkX3BvcykgICAgICAoe30pCisjZGVmaW5lIGRi Z19jaGVja19scHJvcHMoYykgICAgICAgICAgICAgICAgICAgICAgICAwCisjZGVmaW5lIGRiZ19j aGVja19scHRfbm9kZXMoYywgY25vZGUsIHJvdywgY29sKSAgICAwCisjZGVmaW5lIGRiZ19mb3Jj ZV9pbl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ZXlfaW5pdF9mbGFzaCAtIGluaXRpYWxpemUgb24tZmxhc2ggaW5vZGUga2V5 LgorICogQGM6IFVCSUZTIGZpbGUtc3lzdGVtIGRlc2NyaXB0aW9uIG9iamVjdAorICogQGs6IGtl eSB0byBpbml0aWFsaXplCisgKiBAaW51bTogaW5vZGUgbnVtYmVyCisgKi8KK3N0YXRpYyBpbmxp bmUgdm9pZCBpbm9fa2V5X2luaXRfZmxhc2goY29uc3Qgc3RydWN0IHViaWZzX2luZm8gKmMsIHZv aWQgKmssCisJCQkJICAgICAgaW5vX3QgaW51bSkKK3sKKwl1bmlvbiB1Ymlmc19rZXkgKmtleSA9 IGs7CisKKwlrZXktPmozMlswXSA9IGNwdV90b19sZTMyKGludW0pOworCWtleS0+ajMyWzFdID0g Y3B1X3RvX2xlMzIoVUJJRlNfSU5PX0tFWSA8PCBVQklGU19TX0tFWV9CTE9DS19CSVRTKTsKKwlt ZW1zZXQoayArIDgsIDAsIFVCSUZTX01BWF9LRVlfTEVOIC0gOCk7Cit9CisKKy8qKgorICogbG93 ZXN0X2lub19rZXkgLSBnZXQgdGhlIGxvd2VzdCBwb3NzaWJsZSBpbm9kZSBrZXkuCisgKiBAYzog VUJJRlMgZmlsZS1zeXN0ZW0gZGVzY3JpcHRpb24gb2JqZWN0CisgKiBAa2V5OiBrZXkgdG8gaW5p dGlhbGl6ZQorICogQGludW06IGlub2RlIG51bWJlcgorICovCitzdGF0aWMgaW5saW5lIHZvaWQg bG93ZXN0X2lub19rZXkoY29uc3Qgc3RydWN0IHViaWZzX2luZm8gKmMsCisJCQkJdW5pb24gdWJp ZnNfa2V5ICprZXksIGlub190IGludW0pCit7CisJa2V5LT51MzJbMF0gPSBpbnVtOworCWtleS0+ dTMyWzFdID0gMDsKK30KKworLyoqCisgKiBoaWdoZXN0X2lub19rZXkgLSBnZXQgdGhlIGhpZ2hl c3QgcG9zc2libGUgaW5vZGUga2V5LgorICogQGM6IFVCSUZTIGZpbGUtc3lzdGVtIGRlc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sKK30KKwor LyoqCisgKiBkYXRhX2tleV9pbml0X2ZsYXNoIC0gaW5pdGlhbGl6ZSBvbi1mbGFzaCBkYXRhIGtl eS4KKyAqIEBjOiBVQklGUyBmaWxlLXN5c3RlbSBkZXNjcmlwdGlvbiBvYmplY3QKKyAqIEBrOiBr ZXkgdG8gaW5pdGlhbGl6ZQorICogQGludW06IGlub2RlIG51bWJlcgorICogQGJsb2NrOiBibG9j ayBudW1iZXIKKyAqLworc3RhdGljIGlubGluZSB2b2lkIGRhdGFfa2V5X2luaXRfZmxhc2goY29u c3Qgc3RydWN0IHViaWZzX2luZm8gKmMsIHZvaWQgKmssCisJCQkJICAgICAgIGlub190IGludW0s IHVuc2lnbmVkIGludCBibG9jaykKK3sKKwl1bmlvbiB1Ymlmc19rZXkgKmtleSA9IGs7CisKKwl1 Ymlmc19hc3NlcnQoIShibG9jayAmIH5VQklGU19TX0tFWV9CTE9DS19NQVNLKSk7CisJa2V5LT5q MzJbMF0gPSBjcHVfdG9fbGUzMihpbnVtKTsKKwlrZXktPmozMlsxXSA9IGNwdV90b19sZTMyKGJs b2NrIHwKKwkJCQkgIChVQklGU19EQVRBX0tFWSA8PCBVQklGU19TX0tFWV9CTE9DS19CSVRTKSk7 CisJbWVtc2V0KGsgKyA4LCAwLCBVQklGU19NQVhfS0VZX0xFTiAtIDgpOworfQorCisvKioKKyAq IHRydW5fa2V5X2luaXQgLSBpbml0aWFsaXplIHRydW5jYXRpb24gbm9kZSBrZXkuCisgKiBAYzog VUJJRlMgZmlsZS1zeXN0ZW0gZGVzY3JpcHRpb24gb2JqZWN0CisgKiBAa2V5OiBrZXkgdG8gaW5p dGlhbGl6ZQorICogQGludW06IGlub2RlIG51bWJlcgorICoKKyAqIE5vdGUsIFVCSUZTIGRvZXMg bm90IGhhdmUgdHJ1bmNhdGlvbiBrZXlzIG9uIHRoZSBtZWRpYSBhbmQgdGhpcyBmdW5jdGlvbiBp cworICogb25seSB1c2VkIGZvciBwdXJwb3NlcyBv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9IGZscyhjLT5scHRfbGVi cyk7CisJYy0+bHB0X29mZnNfYml0cyA9IGZscyhjLT5sZWJfc2l6ZSAtIDEpOworCWMtPmxwdF9z cGNfYml0cyA9IGZscyhjLT5sZWJfc2l6ZSk7CisKKwluID0gRElWX1JPVU5EX1VQKGMtPm1heF9s ZWJfY250LCBVQklGU19MUFRfRkFOT1VUKTsKKwljLT5wY250X2JpdHMgPSBmbHMobiAtIDEpOwor CisJYy0+bG51bV9iaXRzID0gZmxzKGMtPm1heF9sZWJfY250IC0gMSk7CisKKwliaXRzID0gVUJJ RlNfTFBUX0NSQ19CSVRTICsgVUJJRlNfTFBUX1RZUEVfQklUUyArCisJICAgICAgIChjLT5iaWdf bHB0ID8gYy0+cGNudF9iaXRzIDogMCkgKworCSAgICAgICAoYy0+c3BhY2VfYml0cyAqIDIgKyAx KSAqIFVCSUZTX0xQVF9GQU5PVVQ7CisJYy0+cG5vZGVfc3ogPSAoYml0cyArIDcpIC8gODsKKwor CWJpdHMgPSBVQklGU19MUFRfQ1JDX0JJVFMgKyBVQklGU19MUFRfVFlQRV9CSVRTICsKKwkgICAg ICAgKGMtPmJpZ19scHQgPyBjLT5wY250X2JpdHMgOiAwKSArCisJICAgICAgIChjLT5scHRfbG51 bV9iaXRzICsgYy0+bHB0X29mZnNfYml0cykgKiBVQklGU19MUFRfRkFOT1VUOworCWMtPm5ub2Rl X3N6ID0gKGJpdHMgKyA3KSAvIDg7CisKKwliaXRzID0gVUJJRlNfTFBUX0NSQ19CSVRTICsgVUJJ RlNfTFBUX1RZUEVfQklUUyArCisJICAgICAgIGMtPmxwdF9sZWJzICogYy0+bHB0X3NwY19iaXRz ICogMjsKKwljLT5sdGFiX3N6ID0gKGJpdHMgKyA3KSAvIDg7CisKKwliaXRzID0gVUJJRlNfTFBU X0NSQ19CSVRTICsgVUJJRlNfTFBUX1RZUEVfQklUUyArCisJICAgICAgIGMtPmxudW1fYml0cyAq IGMtPmxzYXZlX2NudDsKKwljLT5sc2F2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sdWUgdG8gdW5wYWNrICgxLTMyKQorICoKKyAqIFRoaXMgZnVuY3Rpb25zIHJldHVybnMg dGhlIHZhbHVlIHVucGFja2VkLgorICovCit1aW50MzJfdCB1Ymlmc191bnBhY2tfYml0cyh1aW50 OF90ICoqYWRkciwgaW50ICpwb3MsIGludCBucmJpdHMpCit7CisJY29uc3QgaW50IGsgPSAzMiAt IG5yYml0czsKKwl1aW50OF90ICpwID0gKmFkZHI7CisJaW50IGIgPSAqcG9zOworCXVpbnQzMl90 IHVuaW5pdGlhbGl6ZWRfdmFyKHZhbCk7CisJY29uc3QgaW50IGJ5dGVzID0gKG5yYml0cyArIGIg KyA3KSA+PiAzOworCisJdWJpZnNfYXNzZXJ0KG5yYml0cyA+IDApOworCXViaWZzX2Fzc2VydChu cmJpdHMgPD0gMzIpOworCXViaWZzX2Fzc2VydCgqcG9zID49IDApOworCXViaWZzX2Fzc2VydCgq cG9zIDwgOCk7CisJaWYgKGIpIHsKKwkJc3dpdGNoIChieXRlcykgeworCQljYXNlIDI6CisJCQl2 YWwgPSBwWzFdOworCQkJYnJlYWs7CisJCWNhc2UgMzoKKwkJCXZhbCA9IHBbMV0gfCAoKHVpbnQz Ml90KXBbMl0gPDwgOCk7CisJCQlicmVhazsKKwkJY2FzZSA0OgorCQkJdmFsID0gcFsxXSB8ICgo dWludDMyX3QpcFsyXSA8PCA4KSB8CisJCQkJICAgICAoKHVpbnQzMl90KXBbM10gPDwgMTYpOwor CQkJYnJlYWs7CisJCWNhc2UgNToKKwkJCXZhbCA9IHBbMV0gfCAoKHVpbnQzMl90KXBbMl0gPDwg OCkgfAorCQkJCSAgICAgKCh1aW50MzJfdClwWzNdIDw8IDE2KSB8CisJCQkJICAgICAoKHVpbnQz Ml90KXBbNF0gPDwgMjQpOworCQl9CisJCXZhbCA8PD0gKDggLSBiKTsKKwkJdmFsIHw9ICpwID4+ IGI7CisJCW5yYml0cyArPSBiOworCX0gZWxzZSB7CisJCXN3aXRjaCAoYnl0ZXM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zcW51bSA8IHItPnNxbnVtKSB7CisJCQlwID0gJigqcCktPnJiX2xlZnQ7CisJCQlj b250aW51ZTsKKwkJfQorCQlpZiAoc3FudW0gPiByLT5zcW51bSkgeworCQkJcCA9ICYoKnApLT5y Yl9yaWdodDsKKwkJCWNvbnRpbnVlOworCQl9CisJCXViaWZzX2VycigiZHVwbGljYXRlIHNxbnVt IGluIHJlcGxheSIpOworCQlyZXR1cm4gLUVJTlZBTDsKKwl9CisKKwlyID0ga3phbGxvYyhzaXpl b2Yoc3RydWN0IHJlcGxheV9lbnRyeSksIEdGUF9LRVJORUwpOworCWlmICghcikKKwkJcmV0dXJu IC1FTk9NRU07CisJbmJ1ZiA9IGttYWxsb2MobmxlbiArIDEsIEdGUF9LRVJORUwpOworCWlmICgh bmJ1ZikgeworCQlrZnJlZShyKTsKKwkJcmV0dXJuIC1FTk9NRU07CisJfQorCisJaWYgKCFkZWxl dGlvbikKKwkJKnVzZWQgKz0gQUxJR04obGVuLCA4KTsKKwlyLT5sbnVtID0gbG51bTsKKwlyLT5v ZmZzID0gb2ZmczsKKwlyLT5sZW4gPSBsZW47CisJci0+c3FudW0gPSBzcW51bTsKKwlyLT5ubS5s ZW4gPSBubGVuOworCW1lbWNweShuYnVmLCBuYW1lLCBubGVuKTsKKwluYnVmW25sZW5dID0gJ1ww JzsKKwlyLT5ubS5uYW1lID0gbmJ1ZjsKKwlyLT5mbGFncyA9IChkZWxldGlvbiA/IFJFUExBWV9E RUxFVElPTiA6IDApOworCWtleV9jb3B5KGMsIGtleSwgJnItPmtleSk7CisKKwl1Ymlmc19hc3Nl cnQoISpwKTsKKwlyYl9saW5rX25vZGUoJnItPnJiLCBwYXJlbnQsIHApOworCXJiX2luc2VydF9j b2xvcigmci0+cmIsICZjLT5yZXBsYXlfdHJlZSk7CisJcmV0dXJuIDA7Cit9CisKKy8qKgorICog dWJpZnNfdmFsaWRhdGVfZW50cnkgLSB2YWxpZGF0ZSBkaXJlY3Rvcnkgb3IgZXh0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7CisJCXJldHVybiAtRUlOVkFMOwor CX0KKworCXNidWYgPSB2bWFsbG9jKGMtPmxlYl9zaXplKTsKKwlpZiAoIXNidWYpCisJCXJldHVy biAtRU5PTUVNOworCisJZGJnX21udCgic3RhcnQgcmVwbGF5aW5nIHRoZSBqb3VybmFsIik7CisK KwljLT5yZXBsYXlpbmcgPSAxOworCisJbG51bSA9IGMtPmx0YWlsX2xudW0gPSBjLT5saGVhZF9s bnVtOworCW9mZnMgPSBjLT5saGVhZF9vZmZzOworCisJZm9yIChpID0gMDsgaSA8IGMtPmxvZ19s ZWJzOyBpKyssIGxudW0rKykgeworCQlpZiAobG51bSA+PSBVQklGU19MT0dfTE5VTSArIGMtPmxv Z19sZWJzKSB7CisJCQkvKgorCQkJICogVGhlIGxvZyBpcyBsb2dpY2FsbHkgY2lyY3VsYXIsIHdl IHJlYWNoZWQgdGhlIGxhc3QKKwkJCSAqIExFQiwgc3dpdGNoIHRvIHRoZSBmaXJzdCBvbmUuCisJ CQkgKi8KKwkJCWxudW0gPSBVQklGU19MT0dfTE5VTTsKKwkJCW9mZnMgPSAwOworCQl9CisJCWVy ciA9IHJlcGxheV9sb2dfbGViKGMsIGxudW0sIG9mZnMsIHNidWYpOworCQlpZiAoZXJyID09IDEp CisJCQkvKiBXZSBoaXQgdGhlIGVuZCBvZiB0aGUgbG9nICovCisJCQlicmVhazsKKwkJaWYgKGVy cikKKwkJCWdvdG8gb3V0OworCQlvZmZzID0gMDsKKwl9CisKKwllcnIgPSByZXBsYXlfYnVkcyhj KTsKKwlpZiAoZXJyKQorCQlnb3RvIG91dDsKKworCWVyciA9IGFwcGx5X3JlcGxheV90cmVlKGMp OworCWlmIChlcnIpCisJCWdvdG8gb3V0OworCisJdWJpZnNfYXNzZXJ0KGMtPmJ1ZF9ieXRlcyA8 PSBjLT5tYXhfYnVkX2J5dGVzIHx8IGMtPm5lZWRfcmVjb3ZlcnkpOworCWRiZ19tbnQoImZpbmlz aGVkLCBsb2cgaGVhZCBM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ZSwgIgorCQkJICAiJWQgbWluaW11bSByZXF1aXJlZCIsIGMtPmxl Yl9jbnQsIGMtPnZpLnNpemUsCisJCQkgIG1pbl9sZWJfY250KTsKKwkJZ290byBmYWlsZWQ7CisJ fQorCisJaWYgKGMtPm1heF9sZWJfY250IDwgYy0+bGViX2NudCkgeworCQl1Ymlmc19lcnIoIm1h eC4gTEVCIGNvdW50ICVkIGxlc3MgdGhhbiBMRUIgY291bnQgJWQiLAorCQkJICBjLT5tYXhfbGVi X2NudCwgYy0+bGViX2NudCk7CisJCWdvdG8gZmFpbGVkOworCX0KKworCWlmIChjLT5tYWluX2xl YnMgPCBVQklGU19NSU5fTUFJTl9MRUJTKSB7CisJCWVyciA9IDc7CisJCWdvdG8gZmFpbGVkOwor CX0KKworCWlmIChjLT5tYXhfYnVkX2J5dGVzIDwgKGxvbmcgbG9uZyljLT5sZWJfc2l6ZSAqIFVC SUZTX01JTl9CVURfTEVCUyB8fAorCSAgICBjLT5tYXhfYnVkX2J5dGVzID4gKGxvbmcgbG9uZylj LT5sZWJfc2l6ZSAqIGMtPm1haW5fbGVicykgeworCQllcnIgPSA4OworCQlnb3RvIGZhaWxlZDsK Kwl9CisKKwlpZiAoYy0+amhlYWRfY250IDwgTk9OREFUQV9KSEVBRFNfQ05UICsgMSB8fAorCSAg ICBjLT5qaGVhZF9jbnQgPiBOT05EQVRBX0pIRUFEU19DTlQgKyBVQklGU19NQVhfSkhFQURTKSB7 CisJCWVyciA9IDk7CisJCWdvdG8gZmFpbGVkOworCX0KKworCWlmIChjLT5mYW5vdXQgPCBVQklG U19NSU5fRkFOT1VUIHx8CisJICAgIHViaWZzX2lkeF9ub2RlX3N6KGMsIGMtPmZhbm91dCkgPiBj LT5sZWJfc2l6ZSkgeworCQllcnIgPSAxMDsKKwkJZ290byBmYWlsZWQ7CisJfQorCisJaWYgKGMt PmxzYXZlX2NudCA8IDAgfHwgKGMtPmxzYXZlX2NudCA+IERFRkFVTFRfTFNBVkVfQ05UICYmC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ubzsKK30KKworc3RydWN0IGlub2RlICp1Ymlmc19pZ2V0KHN0 cnVjdCBzdXBlcl9ibG9jayAqc2IsIHVuc2lnbmVkIGxvbmcgaW51bSkKK3sKKwlpbnQgZXJyOwor CXVuaW9uIHViaWZzX2tleSBrZXk7CisJc3RydWN0IHViaWZzX2lub19ub2RlICppbm87CisJc3Ry dWN0IHViaWZzX2luZm8gKmMgPSBzYi0+c19mc19pbmZvOworCXN0cnVjdCBpbm9kZSAqaW5vZGU7 CisJc3RydWN0IHViaWZzX2lub2RlICp1aTsKKwlpbnQgaTsKKworCWRiZ19nZW4oImlub2RlICVs dSIsIGludW0pOworCisJLyoKKwkgKiBVLUJvb3Qgc3BlY2lhbCBoYW5kbGluZyBvZiBsb2NrZWQg ZG93biBpbm9kZXMgdmlhIHJlY292ZXJ5CisJICogZS5nLiB1Ymlmc19yZWNvdmVyX3NpemUoKQor CSAqLworCWZvciAoaSA9IDA7IGkgPCBJTk9ERV9MT0NLRURfTUFYOyBpKyspIHsKKwkJLyoKKwkJ ICogRXhpdCBvbiBsYXN0IGVudHJ5IChOVUxMKSwgaW5vZGUgbm90IGZvdW5kIGluIGxpc3QKKwkJ ICovCisJCWlmIChpbm9kZXNfbG9ja2VkX2Rvd25baV0gPT0gTlVMTCkKKwkJCWJyZWFrOworCisJ CWlmIChpbm9kZXNfbG9ja2VkX2Rvd25baV0tPmlfaW5vID09IGludW0pIHsKKwkJCS8qCisJCQkg KiBXZSBmb3VuZCB0aGUgbG9ja2VkIGRvd24gaW5vZGUgaW4gb3VyIGFycmF5LAorCQkJICogc28g anVzdCByZXR1cm4gdGhpcyBwb2ludGVyIGluc3RlYWQgb2YgY3JlYXRpbmcKKwkJCSAqIGEgbmV3 IG9uZS4KKwkJCSAqLworCQkJcmV0dXJuIGlub2Rlc19sb2NrZWRfZG93bltpXTsKKwkJfQorCX0K KworCWlub2RlID0gaWdldF9sb2NrZWQoc2IsIGludW0pOworCWlmICghaW5vZGUpCisJCXJldHVy biBFUlJfUFRSKC1FTk9NRU0pOworCWlmICghKGlub2RlLT5pX3N0YXRlICYgSV9ORVcpKQorCQly ZXR1cm4gaW5vZGU7CisJdWkgPSB1Ymlmc19pbm9kZShpbm9kZSk7CisKKwlpbm8gPSBrbWFsbG9j KFVCSUZTX01BWF9JTk9fTk9ERV9TWiwgR0ZQX05PRlMpOworCWlmICghaW5vKSB7CisJCWVyciA9 IC1FTk9NRU07CisJCWdvdG8gb3V0OworCX0KKworCWlub19rZXlfaW5pdChjLCAma2V5LCBpbm9k ZS0+aV9pbm8pOworCisJZXJyID0gdWJpZnNfdG5jX2xvb2t1cChjLCAma2V5LCBpbm8pOworCWlm IChlcnIpCisJCWdvdG8gb3V0X2lubzsKKworCWlub2RlLT5pX2ZsYWdzIHw9IChTX05PQ01USU1F IHwgU19OT0FUSU1FKTsKKwlpbm9kZS0+aV9ubGluayA9IGxlMzJfdG9fY3B1KGluby0+bmxpbmsp OworCWlub2RlLT5pX3VpZCAgID0gbGUzMl90b19jcHUoaW5vLT51aWQpOworCWlub2RlLT5pX2dp ZCAgID0gbGUzMl90b19jcHUoaW5vLT5naWQpOworCWlub2RlLT5pX2F0aW1lLnR2X3NlYyAgPSAo aW50NjRfdClsZTY0X3RvX2NwdShpbm8tPmF0aW1lX3NlYyk7CisJaW5vZGUtPmlfYXRpbWUudHZf bnNlYyA9IGxlMzJfdG9fY3B1KGluby0+YXRpbWVfbnNlYyk7CisJaW5vZGUtPmlfbXRpbWUudHZf c2VjICA9IChpbnQ2NF90KWxlNjRfdG9fY3B1KGluby0+bXRpbWVfc2VjKTsKKwlpbm9kZS0+aV9t dGltZS50dl9uc2VjID0gbGUzMl90b19jcHUoaW5vLT5tdGltZV9uc2VjKTsKKwlpbm9kZS0+aV9j dGltZS50dl9zZWMgID0gKGludDY0X3QpbGU2NF90b19jcHUoaW5vLT5jdGltZV9zZWMpOworCWlu b2RlLT5pX2N0aW1lLnR2X25zZWMgPSBsZTMyX3RvX2NwdShpbm8tPmN0a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QorCQkJCWJyZWFrOworCQkJfQorCQkJZXJyID0gZmFsbGlibGVf bWF0Y2hlc19uYW1lKGMsICYoKnpuKS0+emJyYW5jaFsqbl0sIG5tKTsKKwkJCWlmIChlcnIgPCAw KQorCQkJCXJldHVybiBlcnI7CisJCQlpZiAoZXJyID09IE5BTUVfTUFUQ0hFUykKKwkJCQlyZXR1 cm4gMTsKKwkJCWlmIChlcnIgPT0gTk9UX09OX01FRElBKSB7CisJCQkJb196bm9kZSA9ICp6bjsK KwkJCQlvX24gPSAqbjsKKwkJCQljb250aW51ZTsKKwkJCX0KKwkJCWlmICghYWRkaW5nKQorCQkJ CWNvbnRpbnVlOworCQkJaWYgKGVyciA9PSBOQU1FX0xFU1MpCisJCQkJYnJlYWs7CisJCQllbHNl CisJCQkJdW5zdXJlID0gMDsKKwkJfQorCX0KKworCWlmIChjbXAgPT0gTkFNRV9MRVNTIHx8IHVu c3VyZSkgeworCQkvKiBMb29rIHJpZ2h0ICovCisJCSp6biA9IHpub2RlOworCQkqbiA9IG5uOwor CQl3aGlsZSAoMSkgeworCQkJZXJyID0gdG5jX25leHQoYywgJnpub2RlLCAmbm4pOworCQkJaWYg KGVyciA9PSAtRU5PRU5UKQorCQkJCWJyZWFrOworCQkJaWYgKGVyciA8IDApCisJCQkJcmV0dXJu IGVycjsKKwkJCWlmIChrZXlzX2NtcChjLCAmem5vZGUtPnpicmFuY2hbbm5dLmtleSwga2V5KSkK KwkJCQlicmVhazsKKwkJCWVyciA9IGZhbGxpYmxlX21hdGNoZXNfbmFtZShjLCAmem5vZGUtPnpi cmFuY2hbbm5dLCBubSk7CisJCQlpZiAoZXJyIDwgMCkKKwkJCQlyZXR1cm4gZXJyOworCQkJaWYg KGVyciA9PSBOQU1FX0dSRUFURVIpCisJCQkJYnJlYWs7CisJCQkqem4gPSB6bm9kZTsKKwkJCSpu ID0gbm47CisJCQlpZiAoZXJyID09IE5BTUVfTUFUQ0hFUykKKwkJCQlyZXR1cm4gMTsKKwkJCWlm IChlcnIgPT0gTk9UX09OX01FRElBKSB7CisJCQkJb196bm9kZSA9IHpub2RlOworCQkJCW9fbiA9 IG5uOworCQkJfQorCQl9CisJfQorCisJLyogTmV2ZXIgbWF0Y2ggYSBkYW5nbGluZyBicmFuY2gg d2hlbiBhZGRpbmcgKi8KKwlpZiAoYWRkaW5nIHx8ICFvX3pub2RlKQorCQlyZXR1cm4gMDsKKwor CWRiZ19tbnQoImRhbmdsaW5nIG1hdGNoIExFQiAlZDolZCBsZW4gJWQgJXMiLAorCQlvX3pub2Rl LT56YnJhbmNoW29fbl0ubG51bSwgb196bm9kZS0+emJyYW5jaFtvX25dLm9mZnMsCisJCW9fem5v ZGUtPnpicmFuY2hbb19uXS5sZW4sIERCR0tFWShrZXkpKTsKKwkqem4gPSBvX3pub2RlOworCSpu ID0gb19uOworCXJldHVybiAxOworfQorCisvKioKKyAqIG1hdGNoZXNfcG9zaXRpb24gLSBkZXRl cm1pbmUgaWYgYSB6YnJhbmNoIG1hdGNoZXMgYSBnaXZlbiBwb3NpdGlvbi4KKyAqIEB6YnI6IHpi cmFuY2ggb2YgZGVudAorICogQGxudW06IExFQiBudW1iZXIgb2YgZGVudCB0byBtYXRjaAorICog QG9mZnM6IG9mZnNldCBvZiBkZW50IHRvIG1hdGNoCisgKgorICogVGhpcyBmdW5jdGlvbiByZXR1 cm5zICUxIGlmIEBsbnVtOkBvZmZzIG1hdGNoZXMsIGFuZCAlMCBvdGhlcndpc2UuCisgKi8KK3N0 YXRpYyBpbnQgbWF0Y2hlc19wb3NpdGlvbihzdHJ1Y3QgdWJpZnNfemJyYW5jaCAqemJyLCBpbnQg bG51bSwgaW50IG9mZnMpCit7CisJaWYgKHpici0+bG51bSA9PSBsbnVtICYmIHpici0+b2ZmcyA9 PSBvZmZzKQorCQlyZXR1cm4gMTsKKwllbHNlCisJCXJldHVybiAwOworfQorCisvKioKKyAqIHJl c29sdmVfY29sbGlzaW9uX2RpcmVjdGx5IC0gcmVzb2x2ZSBhIG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HS0VZKGtleSkpOworCisJem5vZGUgPSBjLT56cm9v dC56bm9kZTsKKwlpZiAodW5saWtlbHkoIXpub2RlKSkgeworCQl6bm9kZSA9IHViaWZzX2xvYWRf em5vZGUoYywgJmMtPnpyb290LCBOVUxMLCAwKTsKKwkJaWYgKElTX0VSUih6bm9kZSkpCisJCQly ZXR1cm4gUFRSX0VSUih6bm9kZSk7CisJfQorCisJem5vZGUtPnRpbWUgPSB0aW1lOworCisJd2hp bGUgKDEpIHsKKwkJc3RydWN0IHViaWZzX3picmFuY2ggKnpicjsKKworCQlleGFjdCA9IHViaWZz X3NlYXJjaF96YnJhbmNoKGMsIHpub2RlLCBrZXksIG4pOworCisJCWlmICh6bm9kZS0+bGV2ZWwg PT0gMCkKKwkJCWJyZWFrOworCisJCWlmICgqbiA8IDApCisJCQkqbiA9IDA7CisJCXpiciA9ICZ6 bm9kZS0+emJyYW5jaFsqbl07CisKKwkJaWYgKHpici0+em5vZGUpIHsKKwkJCXpub2RlLT50aW1l ID0gdGltZTsKKwkJCXpub2RlID0gemJyLT56bm9kZTsKKwkJCWNvbnRpbnVlOworCQl9CisKKwkJ Lyogem5vZGUgaXMgbm90IGluIFROQyBjYWNoZSwgbG9hZCBpdCBmcm9tIHRoZSBtZWRpYSAqLwor CQl6bm9kZSA9IHViaWZzX2xvYWRfem5vZGUoYywgemJyLCB6bm9kZSwgKm4pOworCQlpZiAoSVNf RVJSKHpub2RlKSkKKwkJCXJldHVybiBQVFJfRVJSKHpub2RlKTsKKwl9CisKKwkqem4gPSB6bm9k ZTsKKwlpZiAoZXhhY3QgfHwgIWlzX2hhc2hfa2V5KGMsIGtleSkgfHwgKm4gIT0gLTEpIHsKKwkJ ZGJnX3RuYygiZm91bmQgJWQsIGx2bCAlZCwgbiAlZCIsIGV4YWN0LCB6bm9kZS0+bGV2ZWwsICpu KTsKKwkJcmV0dXJuIGV4YWN0OworCX0KKworCS8qCisJICogSGVyZSBpcyBhIHRyaWNreSBwbGFj ZS4gV2U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Hpub2RlLCBrZXksIG4pOworCisJCWlmICh6bm9k ZS0+bGV2ZWwgPT0gMCkKKwkJCWJyZWFrOworCisJCWlmICgqbiA8IDApCisJCQkqbiA9IDA7CisJ CXpiciA9ICZ6bm9kZS0+emJyYW5jaFsqbl07CisKKwkJaWYgKHpici0+em5vZGUpIHsKKwkJCXpu b2RlLT50aW1lID0gdGltZTsKKwkJCXpub2RlID0gZGlydHlfY293X3pub2RlKGMsIHpicik7CisJ CQlpZiAoSVNfRVJSKHpub2RlKSkKKwkJCQlyZXR1cm4gUFRSX0VSUih6bm9kZSk7CisJCQljb250 aW51ZTsKKwkJfQorCisJCS8qIHpub2RlIGlzIG5vdCBpbiBUTkMgY2FjaGUsIGxvYWQgaXQgZnJv bSB0aGUgbWVkaWEgKi8KKwkJem5vZGUgPSB1Ymlmc19sb2FkX3pub2RlKGMsIHpiciwgem5vZGUs ICpuKTsKKwkJaWYgKElTX0VSUih6bm9kZSkpCisJCQlyZXR1cm4gUFRSX0VSUih6bm9kZSk7CisJ CXpub2RlID0gZGlydHlfY293X3pub2RlKGMsIHpicik7CisJCWlmIChJU19FUlIoem5vZGUpKQor CQkJcmV0dXJuIFBUUl9FUlIoem5vZGUpOworCX0KKworCSp6biA9IHpub2RlOworCWlmIChleGFj dCB8fCAhaXNfaGFzaF9rZXkoYywga2V5KSB8fCAqbiAhPSAtMSkgeworCQlkYmdfdG5jKCJmb3Vu ZCAlZCwgbHZsICVkLCBuICVkIiwgZXhhY3QsIHpub2RlLT5sZXZlbCwgKm4pOworCQlyZXR1cm4g ZXhhY3Q7CisJfQorCisJLyoKKwkgKiBTZWUgaHVnZSBjb21tZW50IGF0ICdsb29rdXBfbGV2ZWww X2RpcnR5KCknIHdoYXQgaXMgdGhlIHJlc3Qgb2YgdGhlCisJICogY29kZS4KKwkgKi8KKwllcnIg PSB0bmNfcHJldihjLCAmem5vZGUsIG4pOworCWlmIChlcnIgPT0gLUVOT0VOVCkgeworCQkqbiA9 IC0xOworCQlkY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2Zmcy4KKyAqLworaW50IHViaWZzX3RuY19sb2NhdGUoc3RydWN0IHVi aWZzX2luZm8gKmMsIGNvbnN0IHVuaW9uIHViaWZzX2tleSAqa2V5LAorCQkgICAgIHZvaWQgKm5v ZGUsIGludCAqbG51bSwgaW50ICpvZmZzKQoreworCWludCBmb3VuZCwgbiwgZXJyLCBzYWZlbHkg PSAwLCBnY19zZXExOworCXN0cnVjdCB1Ymlmc196bm9kZSAqem5vZGU7CisJc3RydWN0IHViaWZz X3picmFuY2ggemJyLCAqenQ7CisKK2FnYWluOgorCW11dGV4X2xvY2soJmMtPnRuY19tdXRleCk7 CisJZm91bmQgPSB1Ymlmc19sb29rdXBfbGV2ZWwwKGMsIGtleSwgJnpub2RlLCAmbik7CisJaWYg KCFmb3VuZCkgeworCQllcnIgPSAtRU5PRU5UOworCQlnb3RvIG91dDsKKwl9IGVsc2UgaWYgKGZv dW5kIDwgMCkgeworCQllcnIgPSBmb3VuZDsKKwkJZ290byBvdXQ7CisJfQorCXp0ID0gJnpub2Rl LT56YnJhbmNoW25dOworCWlmIChsbnVtKSB7CisJCSpsbnVtID0genQtPmxudW07CisJCSpvZmZz ID0genQtPm9mZnM7CisJfQorCWlmIChpc19oYXNoX2tleShjLCBrZXkpKSB7CisJCS8qCisJCSAq IEluIHRoaXMgY2FzZSB0aGUgbGVhZiBub2RlIGNhY2hlIGdldHMgdXNlZCwgc28gd2UgcGFzcyB0 aGUKKwkJICogYWRkcmVzcyBvZiB0aGUgemJyYW5jaCBhbmQga2VlcCB0aGUgbXV0ZXggbG9ja2Vk CisJCSAqLworCQllcnIgPSB0bmNfcmVhZF9ub2RlX25tKGMsIHp0LCBub2RlKTsKKwkJZ290byBv dXQ7CisJfQorCWlmIChzYWZlbHkpIHsKKwkJZXJyID0gdWJpZnNfdG5jX3JlYWRfbm9kZShjLCB6 dCwgbm9kZSk7CisJCWdvdG8gb3V0OworCX0KKwkvKiBEcm9wIHRoZSBUTkMgbXV0ZXggcHJlbWF0 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DsKKwkJfQorCQkvKiBBZGQgdGhpcyBr ZXkgKi8KKwkJYnUtPnpicmFuY2hbYnUtPmNudCsrXSA9IHpub2RlLT56YnJhbmNoW25dOworCQli dS0+YmxrX2NudCArPSAxOworCQlsbnVtID0gem5vZGUtPnpicmFuY2hbbl0ubG51bTsKKwkJb2Zm cyA9IEFMSUdOKHpub2RlLT56YnJhbmNoW25dLm9mZnMgKyBsZW4sIDgpOworCX0KKwl3aGlsZSAo MSkgeworCQlzdHJ1Y3QgdWJpZnNfemJyYW5jaCAqemJyOworCQl1bmlvbiB1Ymlmc19rZXkgKmtl eTsKKwkJdW5zaWduZWQgaW50IG5leHRfYmxvY2s7CisKKwkJLyogRmluZCBuZXh0IGtleSAqLwor CQllcnIgPSB0bmNfbmV4dChjLCAmem5vZGUsICZuKTsKKwkJaWYgKGVycikKKwkJCWdvdG8gb3V0 OworCQl6YnIgPSAmem5vZGUtPnpicmFuY2hbbl07CisJCWtleSA9ICZ6YnItPmtleTsKKwkJLyog U2VlIGlmIHRoZXJlIGlzIGFub3RoZXIgZGF0YSBrZXkgZm9yIHRoaXMgZmlsZSAqLworCQlpZiAo a2V5X2ludW0oYywga2V5KSAhPSBrZXlfaW51bShjLCAmYnUtPmtleSkgfHwKKwkJICAgIGtleV90 eXBlKGMsIGtleSkgIT0gVUJJRlNfREFUQV9LRVkpIHsKKwkJCWVyciA9IC1FTk9FTlQ7CisJCQln b3RvIG91dDsKKwkJfQorCQlpZiAobG51bSA8IDApIHsKKwkJCS8qIEZpcnN0IGtleSBmb3VuZCAq LworCQkJbG51bSA9IHpici0+bG51bTsKKwkJCW9mZnMgPSBBTElHTih6YnItPm9mZnMgKyB6YnIt PmxlbiwgOCk7CisJCQlsZW4gPSB6YnItPmxlbjsKKwkJCWlmIChsZW4gPiBidS0+YnVmX2xlbikg eworCQkJCWVyciA9IC1FSU5WQUw7CisJCQkJZ290byBvdXQ7CisJCQl9CisJCX0gZWxzZSB7CisJ CQkvKgorCQkJICogVGhl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JldHVy bnMgemVybyBpbiBjYXNlIG9mIHN1Y2Nlc3MsICUtRU5PRU5UIGlmIHRoZSBub2RlCisgKiB3YXMg bm90IGZvdW5kLCBhbmQgYSBuZWdhdGl2ZSBlcnJvciBjb2RlIGluIGNhc2Ugb2YgZmFpbHVyZS4K KyAqLworc3RhdGljIGludCBkb19sb29rdXBfbm0oc3RydWN0IHViaWZzX2luZm8gKmMsIGNvbnN0 IHVuaW9uIHViaWZzX2tleSAqa2V5LAorCQkJdm9pZCAqbm9kZSwgY29uc3Qgc3RydWN0IHFzdHIg Km5tKQoreworCWludCBmb3VuZCwgbiwgZXJyOworCXN0cnVjdCB1Ymlmc196bm9kZSAqem5vZGU7 CisKKwlkYmdfdG5jKCJuYW1lICclLipzJyBrZXkgJXMiLCBubS0+bGVuLCBubS0+bmFtZSwgREJH S0VZKGtleSkpOworCW11dGV4X2xvY2soJmMtPnRuY19tdXRleCk7CisJZm91bmQgPSB1Ymlmc19s b29rdXBfbGV2ZWwwKGMsIGtleSwgJnpub2RlLCAmbik7CisJaWYgKCFmb3VuZCkgeworCQllcnIg PSAtRU5PRU5UOworCQlnb3RvIG91dF91bmxvY2s7CisJfSBlbHNlIGlmIChmb3VuZCA8IDApIHsK KwkJZXJyID0gZm91bmQ7CisJCWdvdG8gb3V0X3VubG9jazsKKwl9CisKKwl1Ymlmc19hc3NlcnQo biA+PSAwKTsKKworCWVyciA9IHJlc29sdmVfY29sbGlzaW9uKGMsIGtleSwgJnpub2RlLCAmbiwg bm0pOworCWRiZ190bmMoInJjIHJldHVybmVkICVkLCB6bm9kZSAlcCwgbiAlZCIsIGVyciwgem5v ZGUsIG4pOworCWlmICh1bmxpa2VseShlcnIgPCAwKSkKKwkJZ290byBvdXRfdW5sb2NrOworCWlm IChlcnIgPT0gMCkgeworCQllcnIgPSAtRU5PRU5UOworCQlnb3RvIG91dF91bmxvY2s7CisJfQor CisJZXJyID0gdG5jX3JlYWRfbm9kZV9ubShjLCAmem5vZGUtPnpicmF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TTsKKworCXppLT5jaGlsZF9jbnQgPSAyOwor CXppLT5sZXZlbCA9IHpub2RlLT5sZXZlbCArIDE7CisKKwlfX3NldF9iaXQoRElSVFlfWk5PREUs ICZ6aS0+ZmxhZ3MpOworCWF0b21pY19sb25nX2luYygmYy0+ZGlydHlfem5fY250KTsKKworCXpp LT56YnJhbmNoWzBdLmtleSA9IHpub2RlLT56YnJhbmNoWzBdLmtleTsKKwl6aS0+emJyYW5jaFsw XS56bm9kZSA9IHpub2RlOworCXppLT56YnJhbmNoWzBdLmxudW0gPSBjLT56cm9vdC5sbnVtOwor CXppLT56YnJhbmNoWzBdLm9mZnMgPSBjLT56cm9vdC5vZmZzOworCXppLT56YnJhbmNoWzBdLmxl biA9IGMtPnpyb290LmxlbjsKKwl6aS0+emJyYW5jaFsxXS5rZXkgPSB6bi0+emJyYW5jaFswXS5r ZXk7CisJemktPnpicmFuY2hbMV0uem5vZGUgPSB6bjsKKworCWMtPnpyb290LmxudW0gPSAwOwor CWMtPnpyb290Lm9mZnMgPSAwOworCWMtPnpyb290LmxlbiA9IDA7CisJYy0+enJvb3Quem5vZGUg PSB6aTsKKworCXpuLT5wYXJlbnQgPSB6aTsKKwl6bi0+aWlwID0gMTsKKwl6bm9kZS0+cGFyZW50 ID0gemk7CisJem5vZGUtPmlpcCA9IDA7CisKKwlyZXR1cm4gMDsKK30KKworLyoqCisgKiB1Ymlm c190bmNfYWRkIC0gYWRkIGEgbm9kZSB0byBUTkMuCisgKiBAYzogVUJJRlMgZmlsZS1zeXN0ZW0g ZGVzY3JpcHRpb24gb2JqZWN0CisgKiBAa2V5OiBrZXkgdG8gYWRkCisgKiBAbG51bTogTEVCIG51 bWJlciBvZiBub2RlCisgKiBAb2Zmczogbm9kZSBvZmZzZXQKKyAqIEBsZW46IG5vZGUgbGVuZ3Ro CisgKgorICogVGhpcyBmdW5jdGlvbiBhZGRzIGEgbm9kZSB3aXRoIGtleSBAa2V5IHRvIFROQy4g VGhlIG5vZGUgbWF5I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51bSwgb2xkX29mZnMpOworCQkJaWYgKGZv dW5kIDwgMCkgeworCQkJCWVyciA9IGZvdW5kOworCQkJCWdvdG8gb3V0X3VubG9jazsKKwkJCX0K KworCQkJaWYgKGZvdW5kKSB7CisJCQkJLyogRW5zdXJlIHRoZSB6bm9kZSBpcyBkaXJ0aWVkICov CisJCQkJaWYgKHpub2RlLT5jbmV4dCB8fCAhdWJpZnNfem5fZGlydHkoem5vZGUpKSB7CisJCQkJ CXpub2RlID0gZGlydHlfY293X2JvdHRvbV91cChjLCB6bm9kZSk7CisJCQkJCWlmIChJU19FUlIo em5vZGUpKSB7CisJCQkJCQllcnIgPSBQVFJfRVJSKHpub2RlKTsKKwkJCQkJCWdvdG8gb3V0X3Vu bG9jazsKKwkJCQkJfQorCQkJCX0KKwkJCQl6YnIgPSAmem5vZGUtPnpicmFuY2hbbl07CisJCQkJ bG5jX2ZyZWUoemJyKTsKKwkJCQllcnIgPSB1Ymlmc19hZGRfZGlydChjLCB6YnItPmxudW0sCisJ CQkJCQkgICAgIHpici0+bGVuKTsKKwkJCQlpZiAoZXJyKQorCQkJCQlnb3RvIG91dF91bmxvY2s7 CisJCQkJemJyLT5sbnVtID0gbG51bTsKKwkJCQl6YnItPm9mZnMgPSBvZmZzOworCQkJCXpici0+ bGVuID0gbGVuOworCQkJfQorCQl9CisJfQorCisJaWYgKCFmb3VuZCkKKwkJZXJyID0gdWJpZnNf YWRkX2RpcnQoYywgbG51bSwgbGVuKTsKKworCWlmICghZXJyKQorCQllcnIgPSBkYmdfY2hlY2tf dG5jKGMsIDApOworCitvdXRfdW5sb2NrOgorCW11dGV4X3VubG9jaygmYy0+dG5jX211dGV4KTsK KwlyZXR1cm4gZXJyOworfQorCisvKioKKyAqIHViaWZzX3RuY19hZGRfbm0gLSBhZGQgYSAiaGFz aGVkIiBub2RlIHRvIFROQy4KKyAqIEBjOiBVQklGUyBmaWxlLXN5c3RlbSBkZXNjcmlwdGlvbiBv YmplY3QKKyAqIEBrZXk6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jb2xsaXNpb24oYywga2V5LCAmem5v ZGUsICZuLCBubSk7CisJCWRiZ190bmMoInJjIHJldHVybmVkICVkLCB6bm9kZSAlcCwgbiAlZCIs IGZvdW5kLCB6bm9kZSwgbik7CisJCWlmIChmb3VuZCA8IDApIHsKKwkJCWVyciA9IGZvdW5kOwor CQkJZ290byBvdXRfdW5sb2NrOworCQl9CisKKwkJLyogRW5zdXJlIHRoZSB6bm9kZSBpcyBkaXJ0 aWVkICovCisJCWlmICh6bm9kZS0+Y25leHQgfHwgIXViaWZzX3puX2RpcnR5KHpub2RlKSkgewor CQkJem5vZGUgPSBkaXJ0eV9jb3dfYm90dG9tX3VwKGMsIHpub2RlKTsKKwkJCWlmIChJU19FUlIo em5vZGUpKSB7CisJCQkJZXJyID0gUFRSX0VSUih6bm9kZSk7CisJCQkJZ290byBvdXRfdW5sb2Nr OworCQkJfQorCQl9CisKKwkJaWYgKGZvdW5kID09IDEpIHsKKwkJCXN0cnVjdCB1Ymlmc196YnJh bmNoICp6YnIgPSAmem5vZGUtPnpicmFuY2hbbl07CisKKwkJCWxuY19mcmVlKHpicik7CisJCQll cnIgPSB1Ymlmc19hZGRfZGlydChjLCB6YnItPmxudW0sIHpici0+bGVuKTsKKwkJCXpici0+bG51 bSA9IGxudW07CisJCQl6YnItPm9mZnMgPSBvZmZzOworCQkJemJyLT5sZW4gPSBsZW47CisJCQln b3RvIG91dF91bmxvY2s7CisJCX0KKwl9CisKKwlpZiAoIWZvdW5kKSB7CisJCXN0cnVjdCB1Ymlm c196YnJhbmNoIHpicjsKKworCQl6YnIuem5vZGUgPSBOVUxMOworCQl6YnIubG51bSA9IGxudW07 CisJCXpici5vZmZzID0gb2ZmczsKKwkJemJyLmxlbiA9IGxlbjsKKwkJa2V5X2NvcHkoYywga2V5 LCAmemJyLmtleSk7CisJCWVyciA9IHRuY19pbnNlcnQoYywgem5vZGUsICZ6YnIsIG4gKyAxKTsK KwkJaWYgKGVycikKKwkJCWdvdG8gb3V0X3VubG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Y2VzcyBh bmQgYSBuZWdhdGl2ZSBlcnJvciBjb2RlIGluIGNhc2Ugb2YgZmFpbHVyZS4KKyAqLworc3RhdGlj IGludCB0bmNfZGVsZXRlKHN0cnVjdCB1Ymlmc19pbmZvICpjLCBzdHJ1Y3QgdWJpZnNfem5vZGUg Knpub2RlLCBpbnQgbikKK3sKKwlzdHJ1Y3QgdWJpZnNfemJyYW5jaCAqemJyOworCXN0cnVjdCB1 Ymlmc196bm9kZSAqenA7CisJaW50IGksIGVycjsKKworCS8qIERlbGV0ZSB3aXRob3V0IG1lcmdl IGZvciBub3cgKi8KKwl1Ymlmc19hc3NlcnQoem5vZGUtPmxldmVsID09IDApOworCXViaWZzX2Fz c2VydChuID49IDAgJiYgbiA8IGMtPmZhbm91dCk7CisJZGJnX3RuYygiZGVsZXRpbmcgJXMiLCBE QkdLRVkoJnpub2RlLT56YnJhbmNoW25dLmtleSkpOworCisJemJyID0gJnpub2RlLT56YnJhbmNo W25dOworCWxuY19mcmVlKHpicik7CisKKwllcnIgPSB1Ymlmc19hZGRfZGlydChjLCB6YnItPmxu dW0sIHpici0+bGVuKTsKKwlpZiAoZXJyKSB7CisJCWRiZ19kdW1wX3pub2RlKGMsIHpub2RlKTsK KwkJcmV0dXJuIGVycjsKKwl9CisKKwkvKiBXZSBkbyBub3QgImdhcCIgemJyYW5jaCBzbG90cyAq LworCWZvciAoaSA9IG47IGkgPCB6bm9kZS0+Y2hpbGRfY250IC0gMTsgaSsrKQorCQl6bm9kZS0+ emJyYW5jaFtpXSA9IHpub2RlLT56YnJhbmNoW2kgKyAxXTsKKwl6bm9kZS0+Y2hpbGRfY250IC09 IDE7CisKKwlpZiAoem5vZGUtPmNoaWxkX2NudCA+IDApCisJCXJldHVybiAwOworCisJLyoKKwkg KiBUaGlzIHdhcyB0aGUgbGFzdCB6YnJhbmNoLCB3ZSBoYXZlIHRvIGRlbGV0ZSB0aGlzIHpub2Rl IGZyb20gdGhlCisJICogcGFyZW50LgorCSAqLworCisJZG8geworCQl1Ymlmc19hc3NlcnQoIXRl c3RfYml0KE9CU09MRVRFX1pOT0RFLCAmem5vZGUtPmZsYWdzKSk7CisJCXViaWZzX2Fzc2VydCh1 Ymlmc196bl9kaXJ0eSh6bm9kZSkpOworCisJCXpwID0gem5vZGUtPnBhcmVudDsKKwkJbiA9IHpu b2RlLT5paXA7CisKKwkJYXRvbWljX2xvbmdfZGVjKCZjLT5kaXJ0eV96bl9jbnQpOworCisJCWVy ciA9IGluc2VydF9vbGRfaWR4X3pub2RlKGMsIHpub2RlKTsKKwkJaWYgKGVycikKKwkJCXJldHVy biBlcnI7CisKKwkJaWYgKHpub2RlLT5jbmV4dCkgeworCQkJX19zZXRfYml0KE9CU09MRVRFX1pO T0RFLCAmem5vZGUtPmZsYWdzKTsKKwkJCWF0b21pY19sb25nX2luYygmYy0+Y2xlYW5fem5fY250 KTsKKwkJCWF0b21pY19sb25nX2luYygmdWJpZnNfY2xlYW5fem5fY250KTsKKwkJfSBlbHNlCisJ CQlrZnJlZSh6bm9kZSk7CisJCXpub2RlID0genA7CisJfSB3aGlsZSAoem5vZGUtPmNoaWxkX2Nu dCA9PSAxKTsgLyogd2hpbGUgcmVtb3ZpbmcgbGFzdCBjaGlsZCAqLworCisJLyogUmVtb3ZlIGZy b20gem5vZGUsIGVudHJ5IG4gLSAxICovCisJem5vZGUtPmNoaWxkX2NudCAtPSAxOworCXViaWZz X2Fzc2VydCh6bm9kZS0+bGV2ZWwgIT0gMCk7CisJZm9yIChpID0gbjsgaSA8IHpub2RlLT5jaGls ZF9jbnQ7IGkrKykgeworCQl6bm9kZS0+emJyYW5jaFtpXSA9IHpub2RlLT56YnJhbmNoW2kgKyAx XTsKKwkJaWYgKHpub2RlLT56YnJhbmNoW2ldLnpub2RlKQorCQkJem5vZGUtPnpicmFuY2hbaV0u em5vZGUtPmlpcCA9IGk7CisJfQorCisJLyoKKwkgKiBJZiB0aGlzIGlzIHRoZSByb290IGFuZCBp dCBoYXMgb25seSAxIG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c2V0X2JpdChPQlNP TEVURV9aTk9ERSwgJnpwLT5mbGFncyk7CisJCQkJYXRvbWljX2xvbmdfaW5jKCZjLT5jbGVhbl96 bl9jbnQpOworCQkJCWF0b21pY19sb25nX2luYygmdWJpZnNfY2xlYW5fem5fY250KTsKKwkJCX0g ZWxzZQorCQkJCWtmcmVlKHpwKTsKKwkJfQorCX0KKworCXJldHVybiAwOworfQorCisvKioKKyAq IHViaWZzX3RuY19yZW1vdmUgLSByZW1vdmUgYW4gaW5kZXggZW50cnkgb2YgYSBub2RlLgorICog QGM6IFVCSUZTIGZpbGUtc3lzdGVtIGRlc2NyaXB0aW9uIG9iamVjdAorICogQGtleToga2V5IG9m IG5vZGUKKyAqCisgKiBSZXR1cm5zICUwIG9uIHN1Y2Nlc3Mgb3IgbmVnYXRpdmUgZXJyb3IgY29k ZSBvbiBmYWlsdXJlLgorICovCitpbnQgdWJpZnNfdG5jX3JlbW92ZShzdHJ1Y3QgdWJpZnNfaW5m byAqYywgY29uc3QgdW5pb24gdWJpZnNfa2V5ICprZXkpCit7CisJaW50IGZvdW5kLCBuLCBlcnIg PSAwOworCXN0cnVjdCB1Ymlmc196bm9kZSAqem5vZGU7CisKKwltdXRleF9sb2NrKCZjLT50bmNf bXV0ZXgpOworCWRiZ190bmMoImtleSAlcyIsIERCR0tFWShrZXkpKTsKKwlmb3VuZCA9IGxvb2t1 cF9sZXZlbDBfZGlydHkoYywga2V5LCAmem5vZGUsICZuKTsKKwlpZiAoZm91bmQgPCAwKSB7CisJ CWVyciA9IGZvdW5kOworCQlnb3RvIG91dF91bmxvY2s7CisJfQorCWlmIChmb3VuZCA9PSAxKQor CQllcnIgPSB0bmNfZGVsZXRlKGMsIHpub2RlLCBuKTsKKwlpZiAoIWVycikKKwkJZXJyID0gZGJn X2NoZWNrX3RuYyhjLCAwKTsKKworb3V0X3VubG9jazoKKwltdXRleF91bmxvY2soJmMtPnRuY19t dXRleCk7CisJcmV0dXJuIGVycjsKK30KKworLyoqCisg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xldmVsMChjLCBmcm9t X2tleSwgJnpub2RlLCAmbik7CisJCWlmIChlcnIgPCAwKQorCQkJZ290byBvdXRfdW5sb2NrOwor CisJCWlmIChlcnIpCisJCQlrZXkgPSBmcm9tX2tleTsKKwkJZWxzZSB7CisJCQllcnIgPSB0bmNf bmV4dChjLCAmem5vZGUsICZuKTsKKwkJCWlmIChlcnIgPT0gLUVOT0VOVCkgeworCQkJCWVyciA9 IDA7CisJCQkJZ290byBvdXRfdW5sb2NrOworCQkJfQorCQkJaWYgKGVyciA8IDApCisJCQkJZ290 byBvdXRfdW5sb2NrOworCQkJa2V5ID0gJnpub2RlLT56YnJhbmNoW25dLmtleTsKKwkJCWlmICgh a2V5X2luX3JhbmdlKGMsIGtleSwgZnJvbV9rZXksIHRvX2tleSkpIHsKKwkJCQllcnIgPSAwOwor CQkJCWdvdG8gb3V0X3VubG9jazsKKwkJCX0KKwkJfQorCisJCS8qIEVuc3VyZSB0aGUgem5vZGUg aXMgZGlydGllZCAqLworCQlpZiAoem5vZGUtPmNuZXh0IHx8ICF1Ymlmc196bl9kaXJ0eSh6bm9k ZSkpIHsKKwkJCXpub2RlID0gZGlydHlfY293X2JvdHRvbV91cChjLCB6bm9kZSk7CisJCQlpZiAo SVNfRVJSKHpub2RlKSkgeworCQkJCWVyciA9IFBUUl9FUlIoem5vZGUpOworCQkJCWdvdG8gb3V0 X3VubG9jazsKKwkJCX0KKwkJfQorCisJCS8qIFJlbW92ZSBhbGwga2V5cyBpbiByYW5nZSBleGNl cHQgdGhlIGZpcnN0ICovCisJCWZvciAoaSA9IG4gKyAxLCBrID0gMDsgaSA8IHpub2RlLT5jaGls ZF9jbnQ7IGkrKywgaysrKSB7CisJCQlrZXkgPSAmem5vZGUtPnpicmFuY2hbaV0ua2V5OworCQkJ aWYgKCFrZXlfaW5fcmFuZ2UoYywga2V5LCBmcm9tX2tleSwgdG9fa2V5KSkKKwkJCQlicmVhazsK KwkJCWxuY19mcmVlKCZ6bm9kZS0+emJyY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b3RvIG91dF9kdW1wOworCQl9IGVsc2Ug aWYgKGNtcCA9PSAwICYmICFpc19oYXNoX2tleShjLCBrZXkxKSkgeworCQkJLyogVGhlc2UgY2Fu IG9ubHkgYmUga2V5cyB3aXRoIGNvbGxpZGluZyBoYXNoICovCisJCQlkYmdfZXJyKCJrZXlzICVk IGFuZCAlZCBhcmUgbm90IGhhc2hlZCBidXQgZXF1aXZhbGVudCIsCisJCQkJaSwgaSArIDEpOwor CQkJZXJyID0gNzsKKwkJCWdvdG8gb3V0X2R1bXA7CisJCX0KKwl9CisKKwlrZnJlZShpZHgpOwor CXJldHVybiAwOworCitvdXRfZHVtcDoKKwl1Ymlmc19lcnIoImJhZCBpbmRleGluZyBub2RlIGF0 IExFQiAlZDolZCwgZXJyb3IgJWQiLCBsbnVtLCBvZmZzLCBlcnIpOworCWRiZ19kdW1wX25vZGUo YywgaWR4KTsKKwlrZnJlZShpZHgpOworCXJldHVybiAtRUlOVkFMOworfQorCisvKioKKyAqIHVi aWZzX2xvYWRfem5vZGUgLSBsb2FkIHpub2RlIHRvIFROQyBjYWNoZS4KKyAqIEBjOiBVQklGUyBm aWxlLXN5c3RlbSBkZXNjcmlwdGlvbiBvYmplY3QKKyAqIEB6YnI6IHpub2RlIGJyYW5jaAorICog QHBhcmVudDogem5vZGUncyBwYXJlbnQKKyAqIEBpaXA6IGluZGV4IGluIHBhcmVudAorICoKKyAq IFRoaXMgZnVuY3Rpb24gbG9hZHMgem5vZGUgcG9pbnRlZCB0byBieSBAemJyIGludG8gdGhlIFRO QyBjYWNoZSBhbmQKKyAqIHJldHVybnMgcG9pbnRlciB0byBpdCBpbiBjYXNlIG9mIHN1Y2Nlc3Mg YW5kIGEgbmVnYXRpdmUgZXJyb3IgY29kZSBpbiBjYXNlCisgKiBvZiBmYWlsdXJlLgorICovCitz dHJ1Y3QgdWJpZnNfem5vZGUgKnViaWZzX2xvYWRfem5vZGUoc3RydWN0IHViaWZzX2luZm8gKmMs CisJCQkJICAgICBz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GU19YRU5UX05PREUsCisJVUJJRlNfVFJVTl9OT0RFLAorCVVCSUZTX1BBRF9OT0RFLAorCVVC SUZTX1NCX05PREUsCisJVUJJRlNfTVNUX05PREUsCisJVUJJRlNfUkVGX05PREUsCisJVUJJRlNf SURYX05PREUsCisJVUJJRlNfQ1NfTk9ERSwKKwlVQklGU19PUlBIX05PREUsCisJVUJJRlNfTk9E RV9UWVBFU19DTlQsCit9OworCisvKgorICogTWFzdGVyIG5vZGUgZmxhZ3MuCisgKgorICogVUJJ RlNfTVNUX0RJUlRZOiByZWJvb3RlZCB1bmNsZWFubHkgLSBtYXN0ZXIgbm9kZSBpcyBkaXJ0eQor ICogVUJJRlNfTVNUX05PX09SUEhTOiBubyBvcnBoYW4gaW5vZGVzIHByZXNlbnQKKyAqIFVCSUZT X01TVF9SQ1ZSWTogd3JpdHRlbiBieSByZWNvdmVyeQorICovCitlbnVtIHsKKwlVQklGU19NU1Rf RElSVFkgPSAxLAorCVVCSUZTX01TVF9OT19PUlBIUyA9IDIsCisJVUJJRlNfTVNUX1JDVlJZID0g NCwKK307CisKKy8qCisgKiBOb2RlIGdyb3VwIHR5cGUgKHVzZWQgYnkgcmVjb3ZlcnkgdG8gcmVj b3ZlciB3aG9sZSBncm91cCBvciBub25lKS4KKyAqCisgKiBVQklGU19OT19OT0RFX0dST1VQOiB0 aGlzIG5vZGUgaXMgbm90IHBhcnQgb2YgYSBncm91cAorICogVUJJRlNfSU5fTk9ERV9HUk9VUDog dGhpcyBub2RlIGlzIGEgcGFydCBvZiBhIGdyb3VwCisgKiBVQklGU19MQVNUX09GX05PREVfR1JP VVA6IHRoaXMgbm9kZSBpcyB0aGUgbGFzdCBpbiBhIGdyb3VwCisgKi8KK2VudW0geworCVVCSUZT X05PX05PREVfR1JPVVAgPSAwLAorCVVCSUZTX0lOX05PREVfR1JPVVAsCisJVUJJRlNfTEFTVF9P Rl9OT0RFX0dST1VQLAorfTsKKworLyoKKyAqIFN1cGVyYmxvY2sgZmxhZ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N0aW9ucworICogcmV0dXJucyAlMCBvbiBzdWNjZXNzIG9yIGEgbmVnYXRpdmUgZXJy b3IgY29kZSBvbiBmYWlsdXJlLgorICovCitzdGF0aWMgaW50IHViaWZzX2RlY29tcHJlc3MoY29u c3Qgdm9pZCAqaW5fYnVmLCBpbnQgaW5fbGVuLCB2b2lkICpvdXRfYnVmLAorCQkgICAgIGludCAq b3V0X2xlbiwgaW50IGNvbXByX3R5cGUpCit7CisJaW50IGVycjsKKwlzdHJ1Y3QgdWJpZnNfY29t cHJlc3NvciAqY29tcHI7CisKKwlpZiAodW5saWtlbHkoY29tcHJfdHlwZSA8IDAgfHwgY29tcHJf dHlwZSA+PSBVQklGU19DT01QUl9UWVBFU19DTlQpKSB7CisJCXViaWZzX2VycigiaW52YWxpZCBj b21wcmVzc2lvbiB0eXBlICVkIiwgY29tcHJfdHlwZSk7CisJCXJldHVybiAtRUlOVkFMOworCX0K KworCWNvbXByID0gJnViaWZzX2NvbXByZXNzb3JzW2NvbXByX3R5cGVdOworCisJaWYgKHVubGlr ZWx5KCFjb21wci0+Y2FwaV9uYW1lKSkgeworCQl1Ymlmc19lcnIoIiVzIGNvbXByZXNzaW9uIGlz IG5vdCBjb21waWxlZCBpbiIsIGNvbXByLT5uYW1lKTsKKwkJcmV0dXJuIC1FSU5WQUw7CisJfQor CisJaWYgKGNvbXByX3R5cGUgPT0gVUJJRlNfQ09NUFJfTk9ORSkgeworCQltZW1jcHkob3V0X2J1 ZiwgaW5fYnVmLCBpbl9sZW4pOworCQkqb3V0X2xlbiA9IGluX2xlbjsKKwkJcmV0dXJuIDA7CisJ fQorCisJZXJyID0gY29tcHItPmRlY29tcHJlc3MoaW5fYnVmLCBpbl9sZW4sIG91dF9idWYsIChz aXplX3QgKilvdXRfbGVuKTsKKwlpZiAoZXJyKQorCQl1Ymlmc19lcnIoImNhbm5vdCBkZWNvbXBy ZXNzICVkIGJ5dGVzLCBjb21wcmVzc29yICVzLCAiCisJCQkgICJlcnJvciAlZ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wKKwlXQl9NVVRFWF8zID0gMiwKK307CisKKy8qCisgKiBabm9kZSBmbGFncyAoYWN0dWFsbHks IGJpdCBudW1iZXJzIHdoaWNoIHN0b3JlIHRoZSBmbGFncykuCisgKgorICogRElSVFlfWk5PREU6 IHpub2RlIGlzIGRpcnR5CisgKiBDT1dfWk5PREU6IHpub2RlIGlzIGJlaW5nIGNvbW1pdHRlZCBh bmQgYSBuZXcgaW5zdGFuY2Ugb2YgdGhpcyB6bm9kZSBoYXMgdG8KKyAqICAgICAgICAgICAgYmUg Y3JlYXRlZCBiZWZvcmUgY2hhbmdpbmcgdGhpcyB6bm9kZQorICogT0JTT0xFVEVfWk5PREU6IHpu b2RlIGlzIG9ic29sZXRlLCB3aGljaCBtZWFucyBpdCB3YXMgZGVsZXRlZCwgYnV0IGl0IGlzCisg KiAgICAgICAgICAgICAgICAgc3RpbGwgaW4gdGhlIGNvbW1pdCBsaXN0IGFuZCB0aGUgb25nb2lu ZyBjb21taXQgb3BlcmF0aW9uCisgKiAgICAgICAgICAgICAgICAgd2lsbCBjb21taXQgaXQsIGFu ZCBkZWxldGUgdGhpcyB6bm9kZSBhZnRlciBpdCBpcyBkb25lCisgKi8KK2VudW0geworCURJUlRZ X1pOT0RFICAgID0gMCwKKwlDT1dfWk5PREUgICAgICA9IDEsCisJT0JTT0xFVEVfWk5PREUgPSAy LAorfTsKKworLyoKKyAqIENvbW1pdCBzdGF0ZXMuCisgKgorICogQ09NTUlUX1JFU1RJTkc6IGNv bW1pdCBpcyBub3Qgd2FudGVkCisgKiBDT01NSVRfQkFDS0dST1VORDogYmFja2dyb3VuZCBjb21t aXQgaGFzIGJlZW4gcmVxdWVzdGVkCisgKiBDT01NSVRfUkVRVUlSRUQ6IGNvbW1pdCBpcyByZXF1 aXJlZAorICogQ09NTUlUX1JVTk5JTkdfQkFDS0dST1VORDogYmFja2dyb3VuZCBjb21taXQgaXMg cnVubmluZworICogQ09NTUlUX1JVTk5JTkdfUkVRVUlSRUQ6IGN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gZmxhZ3M7CisJ aW50IGlpcDsKKwlpbnQgbGV2ZWw7CisJaW50IG51bTsKKwlzdHJ1Y3QgdWJpZnNfbHByb3BzIGxw cm9wc1tVQklGU19MUFRfRkFOT1VUXTsKK307CisKKy8qKgorICogc3RydWN0IHViaWZzX25icmFu Y2ggLSBMRUIgUHJvcGVydGllcyBUcmVlIGludGVybmFsIG5vZGUgYnJhbmNoLgorICogQGxudW06 IExFQiBudW1iZXIgb2YgY2hpbGQKKyAqIEBvZmZzOiBvZmZzZXQgb2YgY2hpbGQKKyAqIEBubm9k ZTogbm5vZGUgY2hpbGQKKyAqIEBwbm9kZTogcG5vZGUgY2hpbGQKKyAqIEBjbm9kZTogY25vZGUg Y2hpbGQKKyAqLworc3RydWN0IHViaWZzX25icmFuY2ggeworCWludCBsbnVtOworCWludCBvZmZz OworCXVuaW9uIHsKKwkJc3RydWN0IHViaWZzX25ub2RlICpubm9kZTsKKwkJc3RydWN0IHViaWZz X3Bub2RlICpwbm9kZTsKKwkJc3RydWN0IHViaWZzX2Nub2RlICpjbm9kZTsKKwl9OworfTsKKwor LyoqCisgKiBzdHJ1Y3QgdWJpZnNfbm5vZGUgLSBMRUIgUHJvcGVydGllcyBUcmVlIGludGVybmFs IG5vZGUuCisgKiBAcGFyZW50OiBwYXJlbnQgbm5vZGUKKyAqIEBjbmV4dDogbmV4dCBjbm9kZSB0 byBjb21taXQKKyAqIEBmbGFnczogZmxhZ3MgKCVESVJUWV9MUFRfTk9ERSBvciAlT0JTT0xFVEVf TFBUX05PREUpCisgKiBAaWlwOiBpbmRleCBpbiBwYXJlbnQKKyAqIEBsZXZlbDogbGV2ZWwgaW4g dGhlIHRyZWUgKGFsd2F5cyBncmVhdGVyIHRoYW4gemVybyBmb3Igbm5vZGVzKQorICogQG51bTog bm9kZSBudW1iZXIKKyAqIEBuYnJhbmNoOiBicmFuY2hlcyB0byBjaGlsZCBub2RlcworICovCitz dHJ1Y3QgdWJpZnNfbm5vZGUgeworCXN0cnVjdCB1Ymlmc19ubm9kZSAqcGFyZW50OworCXN0cnVj dCB1Ymlmc19jbm9kZSAqY25leHQ7CisJdW5zaWduZWQgbG9uZyBmbGFnczsKKwlpbnQgaWlwOwor CWludCBsZXZlbDsKKwlpbnQgbnVtOworCXN0cnVjdCB1Ymlmc19uYnJhbmNoIG5icmFuY2hbVUJJ RlNfTFBUX0ZBTk9VVF07Cit9OworCisvKioKKyAqIHN0cnVjdCB1Ymlmc19scHRfaGVhcCAtIGhl YXAgb2YgY2F0ZWdvcml6ZWQgbHByb3BzLgorICogQGFycjogaGVhcCBhcnJheQorICogQGNudDog bnVtYmVyIGluIGhlYXAKKyAqIEBtYXhfY250OiBtYXhpbXVtIG51bWJlciBhbGxvd2VkIGluIGhl YXAKKyAqCisgKiBUaGVyZSBhcmUgJUxQUk9QU19IRUFQX0NOVCBoZWFwcy4KKyAqLworc3RydWN0 IHViaWZzX2xwdF9oZWFwIHsKKwlzdHJ1Y3QgdWJpZnNfbHByb3BzICoqYXJyOworCWludCBjbnQ7 CisJaW50IG1heF9jbnQ7Cit9OworCisvKgorICogUmV0dXJuIGNvZGVzIGZvciBMUFQgc2NhbiBj YWxsYmFjayBmdW5jdGlvbi4KKyAqCisgKiBMUFRfU0NBTl9DT05USU5VRTogY29udGludWUgc2Nh bm5pbmcKKyAqIExQVF9TQ0FOX0FERDogYWRkIHRoZSBMRUIgcHJvcGVydGllcyBzY2FubmVkIHRv IHRoZSB0cmVlIGluIG1lbW9yeQorICogTFBUX1NDQU5fU1RPUDogc3RvcCBzY2FubmluZworICov CitlbnVtIHsKKwlMUFRfU0NBTl9DT05USU5VRSA9IDAsCisJTFBUX1NDQU5fQUREID0gMSwKKwlM UFRfU0NBTl9TVE9QID0gMiwKK307CisKK3N0cnVjdCB1Ymlmc19pbmZvOworCisvKiBDYWxsYmFj ayB1c2VkIGJ5IHRoZSAndWJpZnNfbHB0X3NjYW5fbm9sb2NrKCknIGZ1bmN0aW9uICovCit0eXBl ZGVmIGludCA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sbnVtOworCWludCBpaGVhZF9vZmZzOworCWludCAqaWxlYnM7CisJaW50IGlsZWJf Y250OworCWludCBpbGViX254dDsKKwlzdHJ1Y3QgcmJfcm9vdCBvbGRfaWR4OworCWludCAqYm90 dG9tX3VwX2J1ZjsKKworCXN0cnVjdCB1Ymlmc19tc3Rfbm9kZSAqbXN0X25vZGU7CisJaW50IG1z dF9vZmZzOworCXN0cnVjdCBtdXRleCBtc3RfbXV0ZXg7CisKKwlpbnQgbWF4X2J1X2J1Zl9sZW47 CisJc3RydWN0IG11dGV4IGJ1X211dGV4OworCXN0cnVjdCBidV9pbmZvIGJ1OworCisJaW50IGxv Z19sZWJzOworCWxvbmcgbG9uZyBsb2dfYnl0ZXM7CisJaW50IGxvZ19sYXN0OworCWludCBscHRf bGViczsKKwlpbnQgbHB0X2ZpcnN0OworCWludCBscHRfbGFzdDsKKwlpbnQgb3JwaF9sZWJzOwor CWludCBvcnBoX2ZpcnN0OworCWludCBvcnBoX2xhc3Q7CisJaW50IG1haW5fbGViczsKKwlpbnQg bWFpbl9maXJzdDsKKwlsb25nIGxvbmcgbWFpbl9ieXRlczsKKworCXVpbnQ4X3Qga2V5X2hhc2hf dHlwZTsKKwl1aW50MzJfdCAoKmtleV9oYXNoKShjb25zdCBjaGFyICpzdHIsIGludCBsZW4pOwor CWludCBrZXlfZm10OworCWludCBrZXlfbGVuOworCWludCBmYW5vdXQ7CisKKwlpbnQgbWluX2lv X3NpemU7CisJaW50IG1pbl9pb19zaGlmdDsKKwlpbnQgbGViX3NpemU7CisJaW50IGhhbGZfbGVi X3NpemU7CisJaW50IGxlYl9jbnQ7CisJaW50IG1heF9sZWJfY250OworCWludCBvbGRfbGViX2Nu dDsKKwlpbnQgcm9fbWVkaWE7CisKKwlsb25nIGxvbmcgYnVkZ19pZHhfZ3Jvd3RoOworCWxvbmcg bG9uZyBidWRnX2RhdGFfZ3Jvd3RoOworCWxvbmcgbG9uZyBidWRnX2RkX2dyb3d0aDsKKwlsb25n IG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XZvaWQgKm9ycGhfYnVmOworCWludCBuZXdfb3JwaGFu czsKKwlpbnQgY210X29ycGhhbnM7CisJaW50IHRvdF9vcnBoYW5zOworCWludCBtYXhfb3JwaGFu czsKKwlpbnQgb2hlYWRfbG51bTsKKwlpbnQgb2hlYWRfb2ZmczsKKwlpbnQgbm9fb3JwaHM7CisK KwlzdHJ1Y3QgdGFza19zdHJ1Y3QgKmJndDsKKwljaGFyIGJndF9uYW1lW3NpemVvZihCR1RfTkFN RV9QQVRURVJOKSArIDldOworCWludCBuZWVkX2JndDsKKwlpbnQgbmVlZF93YnVmX3N5bmM7CisK KwlpbnQgZ2NfbG51bTsKKwl2b2lkICpzYnVmOworCXN0cnVjdCBsaXN0X2hlYWQgaWR4X2djOwor CWludCBpZHhfZ2NfY250OworCWludCBnY19zZXE7CisJaW50IGdjZWRfbG51bTsKKworCXN0cnVj dCBsaXN0X2hlYWQgaW5mb3NfbGlzdDsKKwlzdHJ1Y3QgbXV0ZXggdW1vdW50X211dGV4OworCXVu c2lnbmVkIGludCBzaHJpbmtlcl9ydW5fbm87CisKKwlpbnQgc3BhY2VfYml0czsKKwlpbnQgbHB0 X2xudW1fYml0czsKKwlpbnQgbHB0X29mZnNfYml0czsKKwlpbnQgbHB0X3NwY19iaXRzOworCWlu dCBwY250X2JpdHM7CisJaW50IGxudW1fYml0czsKKwlpbnQgbm5vZGVfc3o7CisJaW50IHBub2Rl X3N6OworCWludCBsdGFiX3N6OworCWludCBsc2F2ZV9zejsKKwlpbnQgcG5vZGVfY250OworCWlu dCBubm9kZV9jbnQ7CisJaW50IGxwdF9oZ2h0OworCWludCBwbm9kZXNfaGF2ZTsKKworCXN0cnVj dCBtdXRleCBscF9tdXRleDsKKwlpbnQgbHB0X2xudW07CisJaW50IGxwdF9vZmZzOworCWludCBu aGVhZF9sbnVtOworCWludCBuaGVhZF9vZmZzOworCWludCBscHRfZHJ0eV9mbGdzOworCWludCBk aXJ0eV9ubl9jbnQ7CisJaW50IGRpcnR5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