summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@google.com>2018-06-05 15:18:54 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-06-14 14:40:55 -0700
commit33581f7a5f4c657b94b254537671ffe0a6fe6bd2 (patch)
treebb5ab6a243f9789456a020769a781197717ebb64 /extra
parentac4246bac6b14c1a764a73b76d1429b47a9b95cd (diff)
downloadchrome-ec-33581f7a5f4c657b94b254537671ffe0a6fe6bd2.tar.gz
cr50_rma_open: add support for new challenge format
We started printing the challenge as generated challenge: ABHNDKD4Q7P6KHTKPN9E7...full challenge instead of ABHND KD4Q7 P6KHT KPN9E 7FSQX P249S PCP64 LVA8S W4XCH 7PZX6 FVWN5 QTUSK U3KBJ HH7RQ SEE5T JX78X add support for extracting the challenge from both formats. BUG=none BRANCH=none TEST=try to open tot image, 0.4.7 image, and 0.3.4 image Change-Id: I99a81f1f78284b21777242d27edaa474a0f12367 Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1088130 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
Diffstat (limited to 'extra')
-rw-r--r--extra/cr50_rma_open/cr50_rma_open.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/extra/cr50_rma_open/cr50_rma_open.py b/extra/cr50_rma_open/cr50_rma_open.py
index 3912a9c4e2..3de6532e40 100644
--- a/extra/cr50_rma_open/cr50_rma_open.py
+++ b/extra/cr50_rma_open/cr50_rma_open.py
@@ -13,7 +13,7 @@ import subprocess
import sys
import time
-SCRIPT_VERSION = 2
+SCRIPT_VERSION = 3
CCD_IS_UNRESTRICTED = 1 << 0
WP_IS_DISABLED = 1 << 1
TESTLAB_IS_ENABLED = 1 << 2
@@ -243,12 +243,30 @@ class RMAOpen(object):
def get_rma_challenge(self):
"""Get the rma_auth challenge
+ There are two challenge formats
+
+ "
+ ABEQ8 UGA4F AVEQP SHCKV
+ DGGPR N8JHG V8PNC LCHR2
+ T27VF PRGBS N3ZXF RCCT2
+ UBMKP ACM7E WUZUA A4GTN
+ "
+ and
+ "
+ generated challenge:
+
+ CBYRYBEMH2Y75TC...rest of challenge
+ "
+ support extracting the challenge from both.
+
Returns:
The RMA challenge with all whitespace removed.
"""
output = self.send_cmd_get_output('rma_auth').strip()
print 'rma_auth output:\n', output
# Extract the challenge from the console output
+ if 'generated challenge:' in output:
+ return output.split('generated challenge:')[-1].strip()
challenge = ''.join(re.findall(' \S{5}' * 4, output))
# Remove all whitespace
return re.sub('\s', '', challenge)