mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 18:25:10 +00:00
Add tests/run_preamble_tests.sh and associated data.
This change prepares for modifying VbFirmwarePreambleHeader and VbKernelPreambleHeader by adding a bunch of current-version data and tests of that data. Once we change the structs, we'll still need to be sure that we can still generate, sign, and verify things using the old-style structs too so that we can release updates to existing devices. If we changed the structs and then created the test data, we couldn't be certain that we're still doing it right. BUG=chromium-os:20124 TEST=manual make make runtests Change-Id: I39310a0d853dbf63a8ca8ff9a0fb4440017c692a Reviewed-on: https://gerrit.chromium.org/gerrit/17530 Commit-Ready: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
@@ -158,6 +158,7 @@ runmisctests:
|
|||||||
#This will exercise vbutil_kernel and vbutil_firmware
|
#This will exercise vbutil_kernel and vbutil_firmware
|
||||||
runfuzztests:
|
runfuzztests:
|
||||||
./gen_fuzz_test_cases.sh
|
./gen_fuzz_test_cases.sh
|
||||||
|
./run_preamble_tests.sh
|
||||||
|
|
||||||
# Run bmpblk_utility tests
|
# Run bmpblk_utility tests
|
||||||
runbmptests:
|
runbmptests:
|
||||||
|
|||||||
84
tests/gen_preamble_testdata.sh
Executable file
84
tests/gen_preamble_testdata.sh
Executable file
@@ -0,0 +1,84 @@
|
|||||||
|
#!/bin/bash -eu
|
||||||
|
#
|
||||||
|
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||||
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
|
# found in the LICENSE file.
|
||||||
|
#
|
||||||
|
# This generates the pre-change test data used to ensure that modifications to
|
||||||
|
# VbFirmwarePreambleHeader and VbKernelPreambleHeader will not break the
|
||||||
|
# signing tools for older releases. This was run *before* any modifications, so
|
||||||
|
# be sure to revert the repo back to the correct point if you need to run it
|
||||||
|
# again.
|
||||||
|
|
||||||
|
|
||||||
|
# Load common constants and variables for tests.
|
||||||
|
. "$(dirname "$0")/common.sh"
|
||||||
|
|
||||||
|
# Load routines to generate keypairs
|
||||||
|
. "${ROOT_DIR}/scripts/keygeneration/common.sh"
|
||||||
|
|
||||||
|
# all algs
|
||||||
|
algs="0 1 2 3 4 5 6 7 8 9 10 11"
|
||||||
|
|
||||||
|
# output directories
|
||||||
|
PREAMBLE_DIR="${SCRIPT_DIR}/preamble_tests"
|
||||||
|
DATADIR="${PREAMBLE_DIR}/data"
|
||||||
|
V2DIR="${PREAMBLE_DIR}/preamble_v2x"
|
||||||
|
|
||||||
|
for d in "${PREAMBLE_DIR}" "${DATADIR}" "${V2DIR}"; do
|
||||||
|
[ -d "$d" ] || mkdir -p "$d"
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# generate a bunch of data keys
|
||||||
|
for d in $algs; do
|
||||||
|
make_pair "${DATADIR}/data_$d" "$d"
|
||||||
|
done
|
||||||
|
|
||||||
|
# generate a bunch of root keys
|
||||||
|
for r in $algs; do
|
||||||
|
make_pair "${DATADIR}/root_$r" "$r"
|
||||||
|
done
|
||||||
|
|
||||||
|
# generate keyblocks using all possible combinations
|
||||||
|
for d in $algs; do
|
||||||
|
for r in $algs; do
|
||||||
|
make_keyblock "${DATADIR}/kb_${d}_${r}" 15 \
|
||||||
|
"${DATADIR}/data_$d" "${DATADIR}/root_$r"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
# make a dummy kernel key because we have to have one (crosbug.com/27142)
|
||||||
|
make_pair "${DATADIR}/dummy_0" 0
|
||||||
|
|
||||||
|
# and a few more dummy files just because (crosbug.com/23548)
|
||||||
|
echo "hi there" > "${DATADIR}/dummy_config.txt"
|
||||||
|
dd if=/dev/urandom bs=32768 count=1 of="${DATADIR}/dummy_bootloader.bin"
|
||||||
|
|
||||||
|
# make some fake data
|
||||||
|
dd if=/dev/urandom of="${DATADIR}/FWDATA" bs=32768 count=1
|
||||||
|
dd if=/dev/urandom of="${DATADIR}/KERNDATA" bs=32768 count=1
|
||||||
|
|
||||||
|
|
||||||
|
# Now sign the firmware and kernel data in all the possible ways using the
|
||||||
|
# pre-change tools.
|
||||||
|
for d in $algs; do
|
||||||
|
for r in $algs; do
|
||||||
|
vbutil_firmware --vblock "${V2DIR}/fw_${d}_${r}.vblock" \
|
||||||
|
--keyblock "${DATADIR}/kb_${d}_${r}.keyblock" \
|
||||||
|
--signprivate "${DATADIR}/data_${d}.vbprivk" \
|
||||||
|
--version 1 \
|
||||||
|
--kernelkey "${DATADIR}/dummy_0.vbpubk" \
|
||||||
|
--fv "${DATADIR}/FWDATA"
|
||||||
|
vbutil_kernel --pack "${V2DIR}/kern_${d}_${r}.vblock" \
|
||||||
|
--keyblock "${DATADIR}/kb_${d}_${r}.keyblock" \
|
||||||
|
--signprivate "${DATADIR}/data_${d}.vbprivk" \
|
||||||
|
--version 1 \
|
||||||
|
--arch arm \
|
||||||
|
--vmlinuz "${DATADIR}/KERNDATA" \
|
||||||
|
--bootloader "${DATADIR}/dummy_bootloader.bin" \
|
||||||
|
--config "${DATADIR}/dummy_config.txt"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
BIN
tests/preamble_tests/data/FWDATA
Normal file
BIN
tests/preamble_tests/data/FWDATA
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/KERNDATA
Normal file
BIN
tests/preamble_tests/data/KERNDATA
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_0.vbprivk
Normal file
BIN
tests/preamble_tests/data/data_0.vbprivk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_0.vbpubk
Normal file
BIN
tests/preamble_tests/data/data_0.vbpubk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_1.vbprivk
Normal file
BIN
tests/preamble_tests/data/data_1.vbprivk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_1.vbpubk
Normal file
BIN
tests/preamble_tests/data/data_1.vbpubk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_10.vbprivk
Normal file
BIN
tests/preamble_tests/data/data_10.vbprivk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_10.vbpubk
Normal file
BIN
tests/preamble_tests/data/data_10.vbpubk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_11.vbprivk
Normal file
BIN
tests/preamble_tests/data/data_11.vbprivk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_11.vbpubk
Normal file
BIN
tests/preamble_tests/data/data_11.vbpubk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_2.vbprivk
Normal file
BIN
tests/preamble_tests/data/data_2.vbprivk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_2.vbpubk
Normal file
BIN
tests/preamble_tests/data/data_2.vbpubk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_3.vbprivk
Normal file
BIN
tests/preamble_tests/data/data_3.vbprivk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_3.vbpubk
Normal file
BIN
tests/preamble_tests/data/data_3.vbpubk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_4.vbprivk
Normal file
BIN
tests/preamble_tests/data/data_4.vbprivk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_4.vbpubk
Normal file
BIN
tests/preamble_tests/data/data_4.vbpubk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_5.vbprivk
Normal file
BIN
tests/preamble_tests/data/data_5.vbprivk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_5.vbpubk
Normal file
BIN
tests/preamble_tests/data/data_5.vbpubk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_6.vbprivk
Normal file
BIN
tests/preamble_tests/data/data_6.vbprivk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_6.vbpubk
Normal file
BIN
tests/preamble_tests/data/data_6.vbpubk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_7.vbprivk
Normal file
BIN
tests/preamble_tests/data/data_7.vbprivk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_7.vbpubk
Normal file
BIN
tests/preamble_tests/data/data_7.vbpubk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_8.vbprivk
Normal file
BIN
tests/preamble_tests/data/data_8.vbprivk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_8.vbpubk
Normal file
BIN
tests/preamble_tests/data/data_8.vbpubk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_9.vbprivk
Normal file
BIN
tests/preamble_tests/data/data_9.vbprivk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/data_9.vbpubk
Normal file
BIN
tests/preamble_tests/data/data_9.vbpubk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/dummy_0.vbprivk
Normal file
BIN
tests/preamble_tests/data/dummy_0.vbprivk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/dummy_0.vbpubk
Normal file
BIN
tests/preamble_tests/data/dummy_0.vbpubk
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/dummy_bootloader.bin
Normal file
BIN
tests/preamble_tests/data/dummy_bootloader.bin
Normal file
Binary file not shown.
1
tests/preamble_tests/data/dummy_config.txt
Normal file
1
tests/preamble_tests/data/dummy_config.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
hi there
|
||||||
BIN
tests/preamble_tests/data/kb_0_0.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_0_0.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_0_1.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_0_1.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_0_10.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_0_10.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_0_11.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_0_11.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_0_2.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_0_2.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_0_3.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_0_3.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_0_4.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_0_4.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_0_5.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_0_5.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_0_6.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_0_6.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_0_7.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_0_7.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_0_8.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_0_8.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_0_9.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_0_9.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_10_0.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_10_0.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_10_1.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_10_1.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_10_10.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_10_10.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_10_11.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_10_11.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_10_2.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_10_2.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_10_3.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_10_3.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_10_4.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_10_4.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_10_5.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_10_5.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_10_6.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_10_6.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_10_7.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_10_7.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_10_8.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_10_8.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_10_9.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_10_9.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_11_0.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_11_0.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_11_1.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_11_1.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_11_10.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_11_10.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_11_11.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_11_11.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_11_2.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_11_2.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_11_3.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_11_3.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_11_4.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_11_4.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_11_5.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_11_5.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_11_6.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_11_6.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_11_7.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_11_7.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_11_8.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_11_8.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_11_9.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_11_9.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_1_0.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_1_0.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_1_1.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_1_1.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_1_10.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_1_10.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_1_11.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_1_11.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_1_2.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_1_2.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_1_3.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_1_3.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_1_4.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_1_4.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_1_5.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_1_5.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_1_6.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_1_6.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_1_7.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_1_7.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_1_8.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_1_8.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_1_9.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_1_9.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_2_0.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_2_0.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_2_1.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_2_1.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_2_10.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_2_10.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_2_11.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_2_11.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_2_2.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_2_2.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_2_3.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_2_3.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_2_4.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_2_4.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_2_5.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_2_5.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_2_6.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_2_6.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_2_7.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_2_7.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_2_8.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_2_8.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_2_9.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_2_9.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_3_0.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_3_0.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_3_1.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_3_1.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_3_10.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_3_10.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_3_11.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_3_11.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_3_2.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_3_2.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_3_3.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_3_3.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_3_4.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_3_4.keyblock
Normal file
Binary file not shown.
BIN
tests/preamble_tests/data/kb_3_5.keyblock
Normal file
BIN
tests/preamble_tests/data/kb_3_5.keyblock
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user