xref: /aosp_15_r20/external/vboot_reference/scripts/keygeneration/make_keyblock.sh (revision 8617a60d3594060b7ecbd21bc622a7c14f3cf2bc)
1*8617a60dSAndroid Build Coastguard Worker#!/bin/bash
2*8617a60dSAndroid Build Coastguard Worker# Copyright 2011 The ChromiumOS Authors
3*8617a60dSAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license that can be
4*8617a60dSAndroid Build Coastguard Worker# found in the LICENSE file.
5*8617a60dSAndroid Build Coastguard Worker#
6*8617a60dSAndroid Build Coastguard Worker# Generates a keyblock containing a public key and signed using the given
7*8617a60dSAndroid Build Coastguard Worker# signing key.
8*8617a60dSAndroid Build Coastguard Worker
9*8617a60dSAndroid Build Coastguard Worker# Load common constants and functions.
10*8617a60dSAndroid Build Coastguard Worker# shellcheck source=common.sh
11*8617a60dSAndroid Build Coastguard Worker. "$(dirname "$0")/common.sh"
12*8617a60dSAndroid Build Coastguard Worker
13*8617a60dSAndroid Build Coastguard Workerif [ $# -ne 4 ]; then
14*8617a60dSAndroid Build Coastguard Worker  cat <<EOF
15*8617a60dSAndroid Build Coastguard WorkerUsage: $0 <in_public_key> <in_signing_key> <flags> <out_keyblock>
16*8617a60dSAndroid Build Coastguard Worker
17*8617a60dSAndroid Build Coastguard WorkerEmits <out_keyblock>.keyblock containing <in_public_key>.vbpubk signed with
18*8617a60dSAndroid Build Coastguard Worker<in_signing_key>.vbprivk with the given keyblock <flags>.
19*8617a60dSAndroid Build Coastguard WorkerEOF
20*8617a60dSAndroid Build Coastguard Worker  exit 1
21*8617a60dSAndroid Build Coastguard Workerfi
22*8617a60dSAndroid Build Coastguard Worker
23*8617a60dSAndroid Build Coastguard Workerin_pubkey=$1
24*8617a60dSAndroid Build Coastguard Workerin_signkey=$2
25*8617a60dSAndroid Build Coastguard Workerkeyblock_flags=$3
26*8617a60dSAndroid Build Coastguard Workerout_keyblock=$4
27*8617a60dSAndroid Build Coastguard Worker
28*8617a60dSAndroid Build Coastguard Workermake_keyblock $out_keyblock $keyblock_flags $in_pubkey $in_signkey
29