diff options
author | Vadim Bendebury <vbendeb@google.com> | 2022-05-05 16:18:38 -0700 |
---|---|---|
committer | Mike Frysinger <vapier@chromium.org> | 2022-05-06 18:03:20 +0000 |
commit | e49bfbca21a3aeec31472aac7774c8dec94a4f17 (patch) | |
tree | 5a1bc36128b60bf4c85f4555cc2bb64950f11eb9 /scripts/keygeneration | |
parent | 23a1f64d4704cd1d69365eaf33cbc55af48ca34b (diff) | |
download | vboot-e49bfbca21a3aeec31472aac7774c8dec94a4f17.tar.gz |
create_new_gsc_key.sh: generate key file with the requested base namestabilize-14816.84.Bstabilize-14816.82.Bstabilize-14816.138.Bstabilize-14816.131.Bstabilize-14803.Bstabilize-14790.Brelease-R103-14816.B
Let's require the user of this script to explicitly provide the base
file name of the generated key.
BRANCH=none
BUG=b:221423468
TEST=verified generating the new key in various directories (local and
non local).
Verified that the script fails if the user does not supply the
required key file base name.
Change-Id: Iaf85e5822d06c65ca4b7d51f17579269576e4707
Signed-off-by: Vadim Bendebury <vbendeb@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3630287
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'scripts/keygeneration')
-rwxr-xr-x | scripts/keygeneration/accessory/create_new_gsc_key.sh | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/scripts/keygeneration/accessory/create_new_gsc_key.sh b/scripts/keygeneration/accessory/create_new_gsc_key.sh index 674f8530..a7e81c1a 100755 --- a/scripts/keygeneration/accessory/create_new_gsc_key.sh +++ b/scripts/keygeneration/accessory/create_new_gsc_key.sh @@ -9,7 +9,7 @@ usage() { cat <<EOF -Usage: ${PROG} [options] +Usage: ${PROG} [options] <key_file_base_name> Options: -o, --output_dir <dir>: Where to write the keys (default is cwd) @@ -23,8 +23,7 @@ EOF } generate_rsa3070_key() { - local output_dir="$1" - local base_name="gsc_3070" + local base_name="$1" local len="3070" echo "creating ${base_name} key pair..." @@ -38,8 +37,10 @@ generate_rsa3070_key() { main() { set -euo pipefail + local base_name local output_dir="${PWD}" + base_name="" while [[ $# -gt 0 ]]; do case "$1" in -h|--help) @@ -56,13 +57,21 @@ main() { usage "Unknown option: $1" ;; *) - usage "Unknown argument $1" + if [[ -z ${base_name} ]]; then + base_name="$1" + else + usage "Unknown argument $1" + fi ;; esac shift done - generate_rsa3070_key "${output_dir}" + if [[ -z ${base_name} ]]; then + usage "Key file base name missing" + fi + + generate_rsa3070_key "${output_dir}/${base_name}" } main "$@" |