1#!/bin/bash -eux 2# Copyright 2014 The Chromium OS Authors. All rights reserved. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6me=${0##*/} 7TMP="$me.tmp" 8 9# Work in scratch directory 10cd "$OUTDIR" 11 12KEYDIR=${SRCDIR}/tests/devkeys 13 14# create a firmware blob 15dd bs=1024 count=16 if=/dev/urandom of=${TMP}.fw_main 16 17# try the old way 18${FUTILITY} vbutil_firmware --vblock ${TMP}.vblock.old \ 19 --keyblock ${KEYDIR}/firmware.keyblock \ 20 --signprivate ${KEYDIR}/firmware_data_key.vbprivk \ 21 --version 12 \ 22 --fv ${TMP}.fw_main \ 23 --kernelkey ${KEYDIR}/kernel_subkey.vbpubk \ 24 --flags 42 25 26# verify 27${FUTILITY} vbutil_firmware --verify ${TMP}.vblock.old \ 28 --signpubkey ${KEYDIR}/root_key.vbpubk \ 29 --fv ${TMP}.fw_main 30 31# and the new way 32${FUTILITY} sign --debug \ 33 --signprivate ${KEYDIR}/firmware_data_key.vbprivk \ 34 --keyblock ${KEYDIR}/firmware.keyblock \ 35 --kernelkey ${KEYDIR}/kernel_subkey.vbpubk \ 36 --version 12 \ 37 --fv ${TMP}.fw_main \ 38 --flags 42 \ 39 ${TMP}.vblock.new 40 41# They should match 42cmp ${TMP}.vblock.old ${TMP}.vblock.new 43 44# cleanup 45rm -rf ${TMP}* 46exit 0 47