Debian Codegraph @

3rdparty/vboot/scripts/keygeneration/uefi/increment_db_child_key.sh

raw symbols SCIP
1 #!/bin/bash
2 # Copyright 2018 The ChromiumOS Authors
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 # Script to increment UEFI DB child key.
7
8 # Load common constants and variables.
9 # shellcheck source=uefi_common.sh
10 . "$(dirname "$0")/uefi_common.sh"
11
12 # Abort on errors.
13 set -e
14
15 if [ $# -ne 1 ]; then
16 cat <<EOF
17 Usage: $0 <keyset directory>
18
19 Increments the UEFI DB child key in the specified keyset.
20 EOF
21 exit 1
22 fi
23
24 KEY_DIR="$1"
25
26 main() {
27 check_uefi_key_dir_name "${KEY_DIR}"
28
29 load_current_uefi_key_versions "${KEY_DIR}"
30 new_db_child_key_ver=$(increment_uefi_version "${KEY_DIR}" \
31 "db_child_key_version")
32
33 cd "${KEY_DIR}"
34 backup_db_child_keypair "${CURR_DB_CHILD_KEY_VER}"
35
36 cat <<EOF
37 Generating new UEFI DB child key version.
38
39 New DB child key version: ${new_db_child_key_ver}.
40 EOF
41 make_db_child_keypair "${CURR_DB_KEY_VER}" "${new_db_child_key_ver}"
42 write_updated_uefi_version_file "${CURR_PK_KEY_VER}" "${CURR_KEK_KEY_VER}" \
43 "${CURR_DB_KEY_VER}" "${new_db_child_key_ver}"
44 }
45
46 main "$@"