-# Copyright (c) 2013, Google Inc.
+# Copyright (c) 2016, Google Inc.
#
# SPDX-License-Identifier: GPL-2.0+
#
For configuration verification:
- Corrupt signature and check for failure
- Create FIT (with unsigned configuration) with mkimage
-- Check that image veriication works
+- Check that image verification works
- Sign the FIT and mark the key as 'required' for verification
- Check that image verification works
- Corrupt the signature
key-generation process is quite slow and we want to avoid doing it twice.
"""
def dtc(dts):
- """Run the device-tree compiler to compile a .dts file
+ """Run the device tree compiler to compile a .dts file
The output file will be the same as the input file but with a .dtb
extension.
assert(expect_string in output)
def make_fit(its):
- """Make a new FIT from the .its source file
+ """Make a new FIT from the .its source file.
This runs 'mkimage -f' to create a new FIT.
Args:
- its: Filename containing .its source
+ its: Filename containing .its source.
"""
util.run_and_log(cons, [mkimage, '-D', dtc_args, '-f',
'%s%s' % (datadir, its), fit])
'-r', fit])
def test_with_algo(sha):
- """Test verified boot with the given hash algorithm
+ """Test verified boot with the given hash algorithm.
This is the main part of the test code. The same procedure is followed
for both hashing algorithms.
for each command in a list.
Args:
- cmd: List of commands (each a string)
+ cmd: List of commands (each a string).
Returns:
- Combined output of all commands, as a string
+ Combined output of all commands, as a string.
"""
output = ''
for cmd in cmds:
return run_and_log(u_boot_console, cmd_str.split())
def run_and_log_expect_exception(u_boot_console, cmd, retcode, msg):
- """Run a command which is expected to fail.
+ """Run a command that is expected to fail.
This runs a command and checks that it fails with the expected return code
and exception method. If not, an exception is raised.
u_boot_console: A console connection to U-Boot.
cmd: The command to run, as an array of argv[].
retcode: Expected non-zero return code from the command.
- msg: String which should be contained within the command's output.
+ msg: String that should be contained within the command's output.
"""
try:
runner = u_boot_console.log.get_runner(cmd[0], sys.stdout)