summaryrefslogtreecommitdiff
path: root/scripts/keygeneration
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@google.com>2022-05-05 16:18:38 -0700
committerMike Frysinger <vapier@chromium.org>2022-05-06 18:03:20 +0000
commite49bfbca21a3aeec31472aac7774c8dec94a4f17 (patch)
tree5a1bc36128b60bf4c85f4555cc2bb64950f11eb9 /scripts/keygeneration
parent23a1f64d4704cd1d69365eaf33cbc55af48ca34b (diff)
downloadvboot-e49bfbca21a3aeec31472aac7774c8dec94a4f17.tar.gz
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-xscripts/keygeneration/accessory/create_new_gsc_key.sh19
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 "$@"