152a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson#!/bin/bash -eux 252a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson# Copyright 2014 The Chromium OS Authors. All rights reserved. 352a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson# Use of this source code is governed by a BSD-style license that can be 452a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson# found in the LICENSE file. 552a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 652a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardsonme=${0##*/} 752a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill RichardsonTMP="$me.tmp" 852a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 952a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson# Work in scratch directory 1052a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardsoncd "$OUTDIR" 1152a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 1252a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson# some stuff we'll need 1352a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill RichardsonDEVKEYS=${SRCDIR}/tests/devkeys 1452a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 1552a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson# The show command exits with 0 if the data is consistent. 1652a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson# The verify command exits with 0 only if all the data is verified. 1752a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 1852a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson#### keyblock 1952a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 2052a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson${FUTILITY} show ${DEVKEYS}/firmware.keyblock 2152a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 2252a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardsonif ${FUTILITY} verify ${DEVKEYS}/firmware.keyblock ; then false; fi 2352a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 2452a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson${FUTILITY} verify ${DEVKEYS}/firmware.keyblock \ 2552a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson --publickey ${DEVKEYS}/root_key.vbpubk 2652a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 2752a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 2852a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson#### firmware vblock 2952a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 3052a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson# Get some bits to look at 3152a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson${FUTILITY} dump_fmap -x ${SCRIPTDIR}/data/bios_peppy_mp.bin \ 3252a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson GBB:${TMP}.gbb VBLOCK_A:${TMP}.vblock_a FW_MAIN_A:${TMP}.fw_main_a 3352a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson${FUTILITY} gbb_utility -g -k ${TMP}.rootkey ${TMP}.gbb 3452a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 3552a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 3652a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson${FUTILITY} show ${TMP}.vblock_a 3752a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 3852a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson${FUTILITY} show ${TMP}.vblock_a --publickey ${TMP}.rootkey 3952a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 4052a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson${FUTILITY} show ${TMP}.vblock_a \ 4152a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson --publickey ${TMP}.rootkey \ 4252a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson --fv ${TMP}.fw_main_a 4352a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 4452a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardsonif ${FUTILITY} verify ${TMP}.vblock_a ; then false ; fi 4552a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 4652a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardsonif ${FUTILITY} verify ${TMP}.vblock_a \ 4752a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson --publickey ${TMP}.rootkey ; then false ; fi 4852a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 4952a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson${FUTILITY} verify ${TMP}.vblock_a \ 5052a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson --publickey ${TMP}.rootkey \ 5152a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson --fv ${TMP}.fw_main_a 5252a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 5352a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 5452a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson#### kernel partition 5552a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 5652a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson${FUTILITY} show ${SCRIPTDIR}/data/rec_kernel_part.bin 5752a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 5852a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson${FUTILITY} show ${SCRIPTDIR}/data/rec_kernel_part.bin \ 5952a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson --publickey ${DEVKEYS}/kernel_subkey.vbpubk 6052a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 6152a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson${FUTILITY} show ${SCRIPTDIR}/data/rec_kernel_part.bin \ 6252a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson --publickey ${DEVKEYS}/recovery_key.vbpubk 6352a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 6452a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardsonif ${FUTILITY} verify ${SCRIPTDIR}/data/rec_kernel_part.bin ; then false ; fi 6552a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 6652a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardsonif ${FUTILITY} verify ${SCRIPTDIR}/data/rec_kernel_part.bin \ 6752a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson --publickey ${DEVKEYS}/kernel_subkey.vbpubk ; then false ; fi 6852a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 6952a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson${FUTILITY} verify ${SCRIPTDIR}/data/rec_kernel_part.bin \ 7052a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson --publickey ${DEVKEYS}/recovery_key.vbpubk 7152a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 7252a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson 7352a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardson# cleanup 7452a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardsonrm -rf ${TMP}* 7552a15f96ac009222ebf7d1299c7d17825e5a4ab5Bill Richardsonexit 0 76