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30nOworICAgICAgICAgICAgICAgICpwKysgPSAnICc7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzdHJjcHkocCwgYXJndltpXSk7CisgICAgICAgICAgICBwKz0gc3RybGVuKGFyZ3ZbaV0pOworICAgICAgICAgICAgaWYgKGkgIT0gKGFyZ2MgLTEpKSB7CisgICAgICAgICAgICAgICAgKnArKyA9ICcgJzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICBMT0dEKCIlcyIsIGJ1ZmZlcik7Cit9CisKK0NvbW1hbmRMaXN0ZW5lcjo6RHVtcENtZDo6RHVtcENtZCgpIDoKKyAgICAgICAgICAgICAgICAgVm9sZENvbW1hbmQoImR1bXAiKSB7Cit9CisKK2ludCBDb21tYW5kTGlzdGVuZXI6OkR1bXBDbWQ6OnJ1bkNvbW1hbmQoU29ja2V0Q2xpZW50ICpjbGksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBhcmdjLCBjaGFyICoqYXJndikgeworICAgIGNsaS0+c2VuZE1zZygwLCAiRHVtcGluZyBsb29wIHN0YXR1cyIsIGZhbHNlKTsKKyAgICBpZiAoTG9vcDo6ZHVtcFN0YXRlKGNsaSkpIHsKKyAgICAgICAgY2xpLT5zZW5kTXNnKFJlc3BvbnNlQ29kZTo6Q29tbWFuZE9rYXksICJMb29wIGR1bXAgZmFpbGVkIiwgdHJ1ZSk7CisgICAgfQorICAgIGNsaS0+c2VuZE1zZygwLCAiRHVtcGluZyBETSBzdGF0dXMiLCBmYWxzZSk7CisgICAgaWYgKERldm1hcHBlcjo6ZHVtcFN0YXRlKGNsaSkpIHsKKyAgICAgICAgY2xpLT5zZW5kTXNnKFJlc3BvbnNlQ29kZTo6Q29tbWFuZE9rYXksICJEZXZtYXBwZXIgZHVtcCBmYWlsZWQiLCB0cnVlKTsKKyAgICB9CisKKyAgICBjbGktPnNlbmRNc2coUmVzcG9uc2VDb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CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgYXJnYywgY2hhciAqKmFyZ3YpIHsKKyAgICBkdW1wQXJncyhhcmdjLCBhcmd2LCAtMSk7CisKICAgICBpZiAoYXJnYyA8IDIpIHsKICAgICAgICAgY2xpLT5zZW5kTXNnKFJlc3BvbnNlQ29kZTo6Q29tbWFuZFN5bnRheEVycm9yLCAiTWlzc2luZyBBcmd1bWVudCIsIGZhbHNlKTsKICAgICAgICAgcmV0dXJuIDA7CkBAIC0xMzYsNiArMTkzLDggQEAKIAogaW50IENvbW1hbmRMaXN0ZW5lcjo6U3RvcmFnZUNtZDo6cnVuQ29tbWFuZChTb2NrZXRDbGllbnQgKmNsaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBhcmdjLCBjaGFyICoqYXJndikgeworICAgIGR1bXBBcmdzKGFyZ2MsIGFyZ3YsIC0xKTsKKwogICAgIGlmIChhcmdjIDwgMikgewogICAgICAgICBjbGktPnNlbmRNc2coUmVzcG9uc2VDb2RlOjpDb21tYW5kU3ludGF4RXJyb3IsICJNaXNzaW5nIEFyZ3VtZW50IiwgZmFsc2UpOwogICAgICAgICByZXR1cm4gMDsKQEAgLTE5NCw2ICsyNTMsNyBAQAogICAgIGludCByYyA9IDA7CiAKICAgICBpZiAoIXN0cmNtcChhcmd2WzFdLCAibGlzdCIpKSB7CisgICAgICAgIGR1bXBBcmdzKGFyZ2MsIGFyZ3YsIC0xKTsKICAgICAgICAgRElSICpkID0gb3BlbmRpcihWb2x1bWU6OlNFQ19BU0VDRElSKTsKIAogICAgICAgICBpZiAoIWQpIHsKQEAgLTIxNCw2ICsyNzQsNyBAQAogICAgICAgICB9CiAgICAgICAgIGNsb3NlZGlyKGQpOwogICAgIH0gZWxzZSBpZiAoIXN0cmNtcChhcmd2WzFdLCAiY3JlYXRlIikpIHsKKyAgICAgICAgZHVtcEFyZ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7CisgICAgfQorCisgICAgc3RydWN0IGRtX25hbWVfbGlzdCAqbiA9IChzdHJ1Y3QgZG1fbmFtZV9saXN0ICopICgoKGNoYXIgKikgYnVmZmVyKSArIGlvLT5kYXRhX3N0YXJ0KTsKKyAgICBpZiAoIW4tPmRldikgeworICAgICAgICBmcmVlKGJ1ZmZlcik7CisgICAgICAgIGZyZWUoYnVmZmVyMik7CisgICAgICAgIGNsb3NlKGZkKTsKKyAgICAgICAgcmV0dXJuIDA7CisgICAgfQorCisgICAgdW5zaWduZWQgbnh0ID0gMDsKKyAgICBkbyB7CisgICAgICAgIG4gPSAoc3RydWN0IGRtX25hbWVfbGlzdCAqKSAoKChjaGFyICopIG4pICsgbnh0KTsKKworICAgICAgICBtZW1zZXQoYnVmZmVyMiwgMCwgNDA5Nik7CisgICAgICAgIHN0cnVjdCBkbV9pb2N0bCAqaW8yID0gKHN0cnVjdCBkbV9pb2N0bCAqKSBidWZmZXIyOworICAgICAgICBpb2N0bEluaXQoaW8yLCA0MDk2LCBuLT5uYW1lLCAwKTsKKyAgICAgICAgaWYgKGlvY3RsKGZkLCBETV9ERVZfU1RBVFVTLCBpbzIpKSB7CisgICAgICAgICAgICBpZiAoZXJybm8gIT0gRU5YSU8pIHsKKyAgICAgICAgICAgICAgICBMT0dFKCJETV9ERVZfU1RBVFVTIGlvY3RsIGZhaWxlZCAoJXMpIiwgc3RyZXJyb3IoZXJybm8pKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlvMiA9IE5VTEw7CisgICAgICAgIH0KKworICAgICAgICBjaGFyICp0bXA7CisgICAgICAgIGlmICghaW8yKSB7CisgICAgICAgICAgICBhc3ByaW50ZigmdG1wLCAiJXMgJWxsdTolbGx1IChubyBzdGF0dXMgYXZhaWxhYmxlKSIsIG4tPm5hbWUsIE1BSk9SKG4tPmRldiksIE1JTk9SKG4tPmRldikpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgYXNwcmludGYoJnRtcCwgIiVzICVsbHU6JWxsdSAlZCAlZCAweCUuOHggJWxsdTolbGx1Iiwgbi0+bmFtZSwgTUFKT1Iobi0+ZGV2KSwKKyAgICAgICAgICAgICAgICAgICAgTUlOT1Iobi0+ZGV2KSwgaW8yLT50YXJnZXRfY291bnQsIGlvMi0+b3Blbl9jb3VudCwgaW8yLT5mbGFncywgTUFKT1IoaW8yLT5kZXYpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1JTk9SKGlvMi0+ZGV2KSk7CisgICAgICAgIH0KKyAgICAgICAgYy0+c2VuZE1zZygwLCB0bXAsIGZhbHNlKTsKKyAgICAgICAgZnJlZSh0bXApOworICAgICAgICBueHQgPSBuLT5uZXh0OworICAgIH0gd2hpbGUgKG54dCk7CisKKyAgICBmcmVlKGJ1ZmZlcik7CisgICAgZnJlZShidWZmZXIyKTsKKyAgICBjbG9zZShmZCk7CisgICAgcmV0dXJuIDA7Cit9CisKIHZvaWQgRGV2bWFwcGVyOjppb2N0bEluaXQoc3RydWN0IGRtX2lvY3RsICppbywgc2l6ZV90IGRhdGFTaXplLAogICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICpuYW1lLCB1bnNpZ25lZCBmbGFncykgewogICAgIG1lbXNldChpbywgMCwgZGF0YVNpemUpOwpAQCAtMzksNyArMTE5LDkgQEAKICAgICBpby0+dmVyc2lvblsxXSA9IDA7CiAgICAgaW8tPnZlcnNpb25bMl0gPSAwOwogICAgIGlvLT5mbGFncyA9IGZsYWdzOwotICAgIHN0cm5jcHkoaW8tPm5hbWUsIG5hbWUsIHNpemVvZihpby0+bmFtZSkpOworICAgIGlmIChuYW1lKSB7CisgICAgICAgIHN0cm5jcHkoaW8tPm5hbWUsIG5hbWUsIHNpemVvZihpby0+bmFtZSkpOworICAgIH0KIH0KIAogaW50IERldm1hcHBlcjo6bG9va3VwQWN0aXZlKGNvbnN0IGNoYXIgKm5hbWUsIGNoYXIgKnVidWZmZXIsIHNpemVfdCBsZW4pIHsKZGlmZi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zdGF0Lmg+CiAKKyNpbmNsdWRlIDxsaW51eC9rZGV2X3QuaD4KKwogI2RlZmluZSBMT0dfVEFHICJWb2xkIgogCiAjaW5jbHVkZSA8Y3V0aWxzL2xvZy5oPgogCisjaW5jbHVkZSA8c3lzdXRpbHMvU29ja2V0Q2xpZW50Lmg+CiAjaW5jbHVkZSAiTG9vcC5oIgogCi1pbnQgTG9vcDo6bG9va3VwQWN0aXZlKGNvbnN0IGNoYXIgKmxvb3BGaWxlLCBjaGFyICpidWZmZXIsIHNpemVfdCBsZW4pIHsKK2ludCBMb29wOjpkdW1wU3RhdGUoU29ja2V0Q2xpZW50ICpjKSB7CisgICAgaW50IGk7CisgICAgaW50IGZkOworICAgIGNoYXIgZmlsZW5hbWVbMjU2XTsKKworICAgIGZvciAoaSA9IDA7IGkgPCBMT09QX01BWDsgaSsrKSB7CisgICAgICAgIHN0cnVjdCBsb29wX2luZm8gbGk7CisgICAgICAgIGludCByYzsKKworICAgICAgICBzcHJpbnRmKGZpbGVuYW1lLCAiL2Rldi9ibG9jay9sb29wJWQiLCBpKTsKKworICAgICAgICBpZiAoKGZkID0gb3BlbihmaWxlbmFtZSwgT19SRFdSKSkgPCAwKSB7CisgICAgICAgICAgICBpZiAoZXJybm8gIT0gRU5PRU5UKSB7CisgICAgICAgICAgICAgICAgTE9HRSgiVW5hYmxlIHRvIG9wZW4gJXMgKCVzKSIsIGZpbGVuYW1lLCBzdHJlcnJvcihlcnJubykpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgfQorCisgICAgICAgIHJjID0gaW9jdGwoZmQsIExPT1BfR0VUX1NUQVRVUywgJmxpKTsKKyAgICAgICAgY2xvc2UoZmQpOworICAgICAgICBpZiAocmMgPCAwICYmIGVycm5vID09IEVOWElPKSB7CisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChyYyA8IDApIHsKKyAgICAgICAgICAgIExPR0UoIlVuYWJsZSB0byBnZXQgbG9vcCBzdGF0dXMgZm9yICVzICglcykiLCBmaWxlbmFtZSwKKyAgICAgICAgICAgICAgICAgc3RyZXJyb3IoZXJybm8pKTsKKyAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgfQorICAgICAgICBjaGFyICp0bXAgPSBOVUxMOworICAgICAgICBhc3ByaW50ZigmdG1wLCAiJXMgJWQgJWQ6JWQgJWx1ICVkOiVkICVkIDB4JXggeyVzfSIsIGZpbGVuYW1lLCBsaS5sb19udW1iZXIsCisgICAgICAgICAgICAgICAgTUFKT1IobGkubG9fZGV2aWNlKSwgTUlOT1IobGkubG9fZGV2aWNlKSwgbGkubG9faW5vZGUsIE1BSk9SKGxpLmxvX3JkZXZpY2UpLAorICAgICAgICAgICAgICAgICAgICAgICAgTUlOT1IobGkubG9fcmRldmljZSksIGxpLmxvX29mZnNldCwgbGkubG9fZmxhZ3MsIGxpLmxvX25hbWUpOworICAgICAgICBjLT5zZW5kTXNnKDAsIHRtcCwgZmFsc2UpOworICAgICAgICBmcmVlKHRtcCk7CisgICAgfQorICAgIHJldHVybiAwOworfQorCitpbnQgTG9vcDo6bG9va3VwQWN0aXZlKGNvbnN0IGNoYXIgKmlkLCBjaGFyICpidWZmZXIsIHNpemVfdCBsZW4pIHsKICAgICBpbnQgaTsKICAgICBpbnQgZmQ7CiAgICAgY2hhciBmaWxlbmFtZVsyNTZdOwpAQCAtNDUsNiArODksOCBAQAogICAgICAgICBpZiAoKGZkID0gb3BlbihmaWxlbmFtZSwgT19SRFdSKSkgPCAwKSB7CiAgICAgICAgICAgICBpZiAoZXJybm8gIT0gRU5PRU5UKSB7CiAgICAgICAgICAgICAgICAgTE9HRSgiVW5hYmxlIHRvIG9wZW4gJXMgKCVzKSIsIGZpbGVuYW1lLCBzdHJlcnJvcihlcnJubykpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgfQpAQCAtNTMsNyArOTksNiBAQAogICAgICAgICBjbG9zZShmZCk7CiAgICAgICAgIGlmIChyYyA8IDAgJiYgZXJybm8gPT0gRU5YSU8pIHsKICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIH0KIAogICAgICAgICBpZiAocmMgPCAwKSB7CkBAIC02MSw3ICsxMDYsNyBAQAogICAgICAgICAgICAgICAgICBzdHJlcnJvcihlcnJubykpOwogICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICB9Ci0gICAgICAgIGlmICghc3RybmNtcChsaS5sb19uYW1lLCBsb29wRmlsZSwgTE9fTkFNRV9TSVpFKSkgeworICAgICAgICBpZiAoIXN0cm5jbXAobGkubG9fbmFtZSwgaWQsIExPX05BTUVfU0laRSkpIHsKICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICB9CiAgICAgfQpAQCAtNzQsNyArMTE5LDcgQEAKICAgICByZXR1cm4gMDsKIH0KIAotaW50IExvb3A6OmNyZWF0ZShjb25zdCBjaGFyICpsb29wRmlsZSwgY2hhciAqbG9vcERldmljZUJ1ZmZlciwgc2l6ZV90IGxlbikgeworaW50IExvb3A6OmNyZWF0ZShjb25zdCBjaGFyICppZCwgY29uc3QgY2hhciAqbG9vcEZpbGUsIGNoYXIgKmxvb3BEZXZpY2VCdWZmZXIsIHNpemVfdCBsZW4pIHsKICAgICBpbnQgaTsKICAgICBpbnQgZmQ7CiAgICAgY2hhciBmaWxlbmFtZVsyNTZdOwpAQCAtMTQyLDcgKzE4Nyw3IEBACiAgICAgc3RydWN0IGxvb3BfaW5mbyBsaTsKIAogICAgIG1lbXNldCgmbGksIDAsIHNpemVvZihsaSkpOwotICAgIHN0cm5jcHkobGkubG9fbmFtZSwgbG9vcEZpbGUsIExPX05BTUVfU0laRSk7Cis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URldmljZShsb29wRGV2aWNlKTsKQEAgLTI0Nyw3ICsyODgsNyBAQAogICAgIGlmIChzYmZkIDwgMCkgewogICAgICAgICBMT0dFKCJGYWlsZWQgdG8gb3BlbiBuZXcgRE0gZGV2aWNlIGZvciBzdXBlcmJsb2NrIHdyaXRlICglcykiLCBzdHJlcnJvcihlcnJubykpOwogICAgICAgICBpZiAoY2xlYW51cERtKSB7Ci0gICAgICAgICAgICBEZXZtYXBwZXI6OmRlc3Ryb3koaWQpOworICAgICAgICAgICAgRGV2bWFwcGVyOjpkZXN0cm95KGlkSGFzaCk7CiAgICAgICAgIH0KICAgICAgICAgTG9vcDo6ZGVzdHJveUJ5RGV2aWNlKGxvb3BEZXZpY2UpOwogICAgICAgICB1bmxpbmsoYXNlY0ZpbGVOYW1lKTsKQEAgLTI1OCw3ICsyOTksNyBAQAogICAgICAgICBjbG9zZShzYmZkKTsKICAgICAgICAgTE9HRSgiRmFpbGVkIHRvIGxzZWVrIGZvciBzdXBlcmJsb2NrICglcykiLCBzdHJlcnJvcihlcnJubykpOwogICAgICAgICBpZiAoY2xlYW51cERtKSB7Ci0gICAgICAgICAgICBEZXZtYXBwZXI6OmRlc3Ryb3koaWQpOworICAgICAgICAgICAgRGV2bWFwcGVyOjpkZXN0cm95KGlkSGFzaCk7CiAgICAgICAgIH0KICAgICAgICAgTG9vcDo6ZGVzdHJveUJ5RGV2aWNlKGxvb3BEZXZpY2UpOwogICAgICAgICB1bmxpbmsoYXNlY0ZpbGVOYW1lKTsKQEAgLTI2OSw3ICszMTAsNyBAQAogICAgICAgICBjbG9zZShzYmZkKTsKICAgICAgICAgTE9HRSgiRmFpbGVkIHRvIHdyaXRlIHN1cGVyYmxvY2sgKCVzKSIsIHN0cmVycm9yKGVycm5vKSk7CiAgICAgICAgIGlmIChjbGVhbnVwRG0pIHsKLSAgICAgICAgICAgIERldm1hcHBlcjo6ZGVzdHJveShpZCk7CisgICAgICAgICAgICBEZXZtYXBwZXI6OmRlc3Ryb3koaWRIYXNoKTsKICAgICAgICAgfQogICAgICAgICBMb29wOjpkZXN0cm95QnlEZXZpY2UobG9vcERldmljZSk7CiAgICAgICAgIHVubGluayhhc2VjRmlsZU5hbWUpOwpAQCAtMjg1LDcgKzMyNiw3IEBACiAgICAgICAgIGlmIChGYXQ6OmZvcm1hdChkbURldmljZSwgbnVtSW1nU2VjdG9ycykpIHsKICAgICAgICAgICAgIExPR0UoIkFTRUMgRkFUIGZvcm1hdCBmYWlsZWQgKCVzKSIsIHN0cmVycm9yKGVycm5vKSk7CiAgICAgICAgICAgICBpZiAoY2xlYW51cERtKSB7Ci0gICAgICAgICAgICAgICAgRGV2bWFwcGVyOjpkZXN0cm95KGlkKTsKKyAgICAgICAgICAgICAgICBEZXZtYXBwZXI6OmRlc3Ryb3koaWRIYXNoKTsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIExvb3A6OmRlc3Ryb3lCeURldmljZShsb29wRGV2aWNlKTsKICAgICAgICAgICAgIHVubGluayhhc2VjRmlsZU5hbWUpOwpAQCAtMjk4LDcgKzMzOSw3IEBACiAgICAgICAgICAgICBpZiAoZXJybm8gIT0gRUVYSVNUKSB7CiAgICAgICAgICAgICAgICAgTE9HRSgiTW91bnRwb2ludCBjcmVhdGlvbiBmYWlsZWQgKCVzKSIsIHN0cmVycm9yKGVycm5vKSk7CiAgICAgICAgICAgICAgICAgaWYgKGNsZWFudXBEbSkgewotICAgICAgICAgICAgICAgICAgICBEZXZtYXBwZXI6OmRlc3Ryb3koaWQpOworICAgICAgICAgICAgICAgICAgICBEZXZtYXBwZXI6OmRlc3Ryb3koaWRIYXNoKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgTG9vcDo6ZGVzdHJveUJ5RGV2aWNlKGxvb3BEZXZpY2UpOwogICAgICAgICAgICAgICAgIHVubGluayhhc2VjRmlsZU5hbWUpOwpAQCAtMzEwLDcgKzM1MSw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgMCwgMDAw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V0dXJuIC0xOwogICAgIH0KIAotICAgIExPR0QoIkFTRUMgJXMgZmluYWxpemVkIiwgaWQpOworICAgIGlmIChtRGVidWcpIHsKKyAgICAgICAgTE9HRCgiQVNFQyAlcyBmaW5hbGl6ZWQiLCBpZCk7CisgICAgfQogICAgIHJldHVybiAwOwogfQogCkBAIC0zOTgsNiArNDQ3LDEyIEBACiAgICAgc25wcmludGYoYXNlY0ZpbGVOYW1lLCBzaXplb2YoYXNlY0ZpbGVOYW1lKSwgIiVzLyVzLmFzZWMiLCBWb2x1bWU6OlNFQ19BU0VDRElSLCBpZCk7CiAgICAgc25wcmludGYobW91bnRQb2ludCwgc2l6ZW9mKG1vdW50UG9pbnQpLCAiJXMvJXMiLCBWb2x1bWU6OkFTRUNESVIsIGlkKTsKIAorICAgIGNoYXIgaWRIYXNoWzMzXTsKKyAgICBpZiAoIWFzZWNIYXNoKGlkLCBpZEhhc2gsIHNpemVvZihpZEhhc2gpKSkgeworICAgICAgICBMT0dFKCJIYXNoIG9mICclcycgZmFpbGVkICglcykiLCBpZCwgc3RyZXJyb3IoZXJybm8pKTsKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKwogICAgIGlmICghaXNNb3VudHBvaW50TW91bnRlZChtb3VudFBvaW50KSkgewogICAgICAgICBMT0dFKCJVbm1vdW50IHJlcXVlc3QgZm9yIEFTRUMgJXMgd2hlbiBub3QgbW91bnRlZCIsIGlkKTsKICAgICAgICAgZXJybm8gPSBFSU5WQUw7CkBAIC00NTIsMTMgKzUwNywxNSBAQAogICAgICAgICBMT0dFKCJUaW1lZCBvdXQgdHJ5aW5nIHRvIHJtZGlyICVzICglcykiLCBtb3VudFBvaW50LCBzdHJlcnJvcihlcnJubykpOwogICAgIH0KIAotICAgIGlmIChEZXZtYXBwZXI6OmRlc3Ryb3koaWQpICYmIGVycm5vICE9IEVOWElPKSB7CisgICAgaWYgKERldm1hcHBlcjo6ZGVzdHJveShpZEhhc2gpICYmIGVycm5vICE9IEVOWElP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gZGVzdHJveSAoJXMpIiwgaWQsIHN0cmVycm9yKGVycm5vKSk7CiAgICAgICAgICAgICByZXR1cm4gLTE7CkBAIC00OTUsNyArNTU0LDkgQEAKICAgICAgICAgcmV0dXJuIC0xOwogICAgIH0KIAotICAgIExPR0QoIkFTRUMgJXMgZGVzdHJveWVkIiwgaWQpOworICAgIGlmIChtRGVidWcpIHsKKyAgICAgICAgTE9HRCgiQVNFQyAlcyBkZXN0cm95ZWQiLCBpZCk7CisgICAgfQogICAgIHJldHVybiAwOwogfQogCkBAIC01MTIsMTUgKzU3MywyNCBAQAogICAgICAgICByZXR1cm4gLTE7CiAgICAgfQogCisgICAgY2hhciBpZEhhc2hbMzNdOworICAgIGlmICghYXNlY0hhc2goaWQsIGlkSGFzaCwgc2l6ZW9mKGlkSGFzaCkpKSB7CisgICAgICAgIExPR0UoIkhhc2ggb2YgJyVzJyBmYWlsZWQgKCVzKSIsIGlkLCBzdHJlcnJvcihlcnJubykpOworICAgICAgICByZXR1cm4gLTE7CisgICAgfQogICAgIGNoYXIgbG9vcERldmljZVsyNTVdOwotICAgIGlmIChMb29wOjpsb29rdXBBY3RpdmUoYXNlY0ZpbGVOYW1lLCBsb29wRGV2aWNlLCBzaXplb2YobG9vcERldmljZSkpKSB7Ci0gICAgICAgIGlmIChMb29wOjpjcmVhdGUoYXNlY0ZpbGVOYW1lLCBsb29wRGV2aWNlLCBzaXplb2YobG9vcERldmljZSkpKSB7CisgICAgaWYgKExvb3A6Omxvb2t1cEFjdGl2ZShpZEhhc2gsIGxvb3BEZXZpY2UsIHNpemVvZihsb29wRGV2aWNlKSkpIHsKKyAgICAgICAgaWYgKExvb3A6OmNyZWF0ZShpZEhhc2gsIGFzZWNGaWxlTmFtZSwgbG9vcERldmljZSwgc2l6ZW9mKGxvb3BEZXZpY2UpKSkgewogICAgICAgICAgICAgTE9HRSgiQVNFQyBsb29wIGRldmljZSBjcmVhdGlvbiBmYWlsZWQgKCVzKSIsIHN0cmVycm9yKGVycm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2aWNlKTsKQEAgLTU3MSwxNiArNjQzLDIwIEBACiAgICAgbnJfc2VjLS07IC8vIFdlIGRvbid0IHdhbnQgdGhlIGRldm1hcHBpbmcgdG8gZXh0ZW5kIG9udG8gb3VyIHN1cGVyYmxvY2sKIAogICAgIGlmIChzdHJjbXAoa2V5LCAibm9uZSIpKSB7Ci0gICAgICAgIGlmIChEZXZtYXBwZXI6Omxvb2t1cEFjdGl2ZShpZCwgZG1EZXZpY2UsIHNpemVvZihkbURldmljZSkpKSB7Ci0gICAgICAgICAgICBpZiAoRGV2bWFwcGVyOjpjcmVhdGUoaWQsIGxvb3BEZXZpY2UsIGtleSwgbnJfc2VjLAorICAgICAgICBpZiAoRGV2bWFwcGVyOjpsb29rdXBBY3RpdmUoaWRIYXNoLCBkbURldmljZSwgc2l6ZW9mKGRtRGV2aWNlKSkpIHsKKyAgICAgICAgICAgIGlmIChEZXZtYXBwZXI6OmNyZWF0ZShpZEhhc2gsIGxvb3BEZXZpY2UsIGtleSwgbnJfc2VjLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRtRGV2aWNlLCBzaXplb2YoZG1EZXZpY2UpKSkgewogICAgICAgICAgICAgICAgIExPR0UoIkFTRUMgZGV2aWNlIG1hcHBpbmcgZmFpbGVkICglcykiLCBzdHJlcnJvcihlcnJubykpOwogICAgICAgICAgICAgICAgIExvb3A6OmRlc3Ryb3lCeURldmljZShsb29wRGV2aWNlKTsKICAgICAgICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBMT0dEKCJOZXcgZGV2bWFwcGVyIGluc3RhbmNlIGNyZWF0ZWQgYXQgJXMiLCBkbURldmljZSk7CisgICAgICAgICAgICBpZiAobURlYnVnKSB7CisgICAgICAgICAgICAgICAgTE9HRCgiTmV3IGRldm1hcHBlciBpbnN0YW5jZSBjcmVhdGVkIGF0ICVzIiwgZG1EZXZpY2UpOworICAgICAgICAgICAgfQogICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgTE9HRCgiRm91bmQgYWN0aXZlIGRldm1hcHBlciBmb3IgJXMgYXQgJXMiLCBhc2VjRmlsZU5hbWUsIGRtRGV2aWNlKTsKKyAgICAgICAgICAgIGlmIChtRGVidWcpIHsKKyAgICAgICAgICAgICAgICBMT0dEKCJGb3VuZCBhY3RpdmUgZGV2bWFwcGVyIGZvciAlcyBhdCAlcyIsIGFzZWNGaWxlTmFtZSwgZG1EZXZpY2UpOworICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgICAgIGNsZWFudXBEbSA9IHRydWU7CiAgICAgfSBlbHNlIHsKQEAgLTU5MSw3ICs2NjcsNyBAQAogICAgICAgICBpZiAoZXJybm8gIT0gRUVYSVNUKSB7CiAgICAgICAgICAgICBMT0dFKCJNb3VudHBvaW50IGNyZWF0aW9uIGZhaWxlZCAoJXMpIiwgc3RyZXJyb3IoZXJybm8pKTsKICAgICAgICAgICAgIGlmIChjbGVhbnVwRG0pIHsKLSAgICAgICAgICAgICAgICBEZXZtYXBwZXI6OmRlc3Ryb3koaWQpOworICAgICAgICAgICAgICAgIERldm1hcHBlcjo6ZGVzdHJveShpZEhhc2gpOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgTG9vcDo6ZGVzdHJveUJ5RGV2aWNlKGxvb3BEZXZpY2UpOwogICAgICAgICAgICAgcmV0dXJuIC0xOwpAQCAtNjAzLDE0ICs2NzksMTYgQEAKIC8vICAgICAgICAgICAgICAgICAgICAgMDIyNywgZmFsc2UpKSB7CiAgICAgICAgIExPR0UoIkFTRUMgbW91bnQgZmFpbGVkICglcykiLCBzdHJlcnJvcihlcnJubykpOwogICAgICAgICBpZiAoY2xlYW51cERtKSB7Ci0gICAgICAgICAgICBEZXZtYXBwZXI6OmRlc3Ryb3koaWQpOworICAgICAgICAgICAgRGV2bWFwcGVyOjpkZXN0cm95KGlkSGFzaCk7CiAgICAgICAgIH0KICAgICAgICAgTG9vcDo6ZGVzdHJveUJ5RGV2aWNl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