File: make_arv_root.sh

package info (click to toggle)
coreboot 24.12%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 210,640 kB
  • sloc: ansic: 1,640,478; sh: 15,676; python: 10,743; perl: 10,186; asm: 8,483; makefile: 5,097; cpp: 4,724; pascal: 2,327; ada: 1,928; yacc: 1,264; lex: 731; sed: 75; lisp: 5; ruby: 5; awk: 4
file content (47 lines) | stat: -rwxr-xr-x 1,007 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Create AP RO verification Root key pair for PreMp signing.

# Load common constants and functions.
# shellcheck source=common.sh
. "$(dirname "$0")/common.sh"

usage() {
  cat <<EOF
Usage: $0 [destination directory]

Output: arv_root.vbprivk and arv_root.vbpubk created in [destination dirctory]
        which by default is "./${ARV_ROOT_DIR}"
EOF
  exit 1
}

main() {
  local key_dir

  case $# in
    (0) # Use default directory.
      key_dir="${ARV_ROOT_DIR}"
      ;;
    (1)
      key_dir="$1"
      ;;
    (*)
      usage
  esac

  if [[ -d ${key_dir} ]]; then
    die "Destination directory \"${key_dir}\" exists. There can be only one!"
  fi

  mkdir -p "${key_dir}" || die "Failed to create \"${key_dir}\"."

  cd "${key_dir}" || die "Failed to cd to \"${key_dir}\"."

  make_pair "${ARV_ROOT_NAME_BASE}" "${ARV_ROOT_ALGOID}"
}

main "$@"