Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: client/site_tests/hardware_Components/hardware_Components.py

Issue 3328013: Change ROM hash calculation to trust FMAP (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import glob, hashlib, logging, os, pprint, re, sys 5 import glob, hashlib, logging, os, pprint, re, sys
6 from autotest_lib.client.bin import factory 6 from autotest_lib.client.bin import factory
7 from autotest_lib.client.bin import test, utils 7 from autotest_lib.client.bin import test, utils
8 from autotest_lib.client.common_lib import error 8 from autotest_lib.client.common_lib import error
9 from autotest_lib.client.common_lib import flashrom_util 9 from autotest_lib.client.common_lib import flashrom_util
10 from autotest_lib.client.common_lib import gbb_util 10 from autotest_lib.client.common_lib import gbb_util
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 Returns a hash of Read Only firmware parts, 245 Returns a hash of Read Only firmware parts,
246 to confirm we have proper keys / boot code / recovery image installed. 246 to confirm we have proper keys / boot code / recovery image installed.
247 """ 247 """
248 # hash_ro_list: RO section to be hashed 248 # hash_ro_list: RO section to be hashed
249 hash_ro_list = ['FV_BSTUB', 'FV_GBB', 'FVDEV'] 249 hash_ro_list = ['FV_BSTUB', 'FV_GBB', 'FVDEV']
250 flashrom = flashrom_util.flashrom_util() 250 flashrom = flashrom_util.flashrom_util()
251 if not flashrom.select_bios_flashrom(): 251 if not flashrom.select_bios_flashrom():
252 raise error.TestError('Cannot select BIOS flashrom') 252 raise error.TestError('Cannot select BIOS flashrom')
253 base_img = flashrom.read_whole() 253 base_img = flashrom.read_whole()
254 flashrom_size = len(base_img) 254 flashrom_size = len(base_img)
255 # XXX we can NOT trust base image here for layout, otherwise firmware 255 # XXX Allowing the FMAP to override our default layout may be an exploit
256 # can provide fake (non-used) GBB/BSTUB in garbage area. 256 # here, because vendor can provide fake (non-used) GBB/BSTUB in unused
257 layout = flashrom.detect_chromeos_bios_layout(flashrom_size, None) 257 # area. However since the flash memory layout may change, we need to
258 # trust FMAP here.
259 layout = flashrom.detect_chromeos_bios_layout(flashrom_size, base_img)
258 if not layout: 260 if not layout:
259 raise error.TestError('Cannot detect ChromeOS flashrom layout') 261 raise error.TestError('Cannot detect ChromeOS flashrom layout')
260 hash_src = '' 262 hash_src = ''
261 for section in hash_ro_list: 263 for section in hash_ro_list:
262 src = flashrom.get_section(base_img, layout, section) 264 src = flashrom.get_section(base_img, layout, section)
263 if not src: 265 if not src:
264 raise error.TestError('Cannot get section [%s] from flashrom' % 266 raise error.TestError('Cannot get section [%s] from flashrom' %
265 section) 267 section)
266 hash_src = hash_src + src 268 hash_src = hash_src + src
267 if not hash_src: 269 if not hash_src:
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 cids_need_to_be_record = ['part_id_hwqual'] 375 cids_need_to_be_record = ['part_id_hwqual']
374 for cid in cids_need_to_be_record: 376 for cid in cids_need_to_be_record:
375 factory.log_shared_data(cid, self._approved[cid][0]) 377 factory.log_shared_data(cid, self._approved[cid][0])
376 return 378 return
377 379
378 if only_cardreader_failed: 380 if only_cardreader_failed:
379 all_failures = ('You may forget to insert an SD card.\n' + 381 all_failures = ('You may forget to insert an SD card.\n' +
380 all_failures) 382 all_failures)
381 383
382 raise error.TestFail(all_failures) 384 raise error.TestFail(all_failures)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698