xref: /aosp_15_r20/external/vboot_reference/tests/gen_test_vbpubks.sh (revision 8617a60d3594060b7ecbd21bc622a7c14f3cf2bc)
1#!/bin/bash
2
3# Copyright 2010 The ChromiumOS Authors
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6#
7# Generate test vboot public keys and keyblocks for testing.
8
9# Load common constants and variables.
10. "$(dirname "$0")/common.sh"
11
12function generate_vpubks {
13  algorithmcounter=0
14  for keylen in "${key_lengths[@]}"
15  do
16    for hashalgo in "${hash_algos[@]}"
17    do
18      "${FUTILITY}" vbutil_key --pack \
19        --in "${TESTKEY_DIR}/key_rsa${keylen}.keyb" \
20        --out "${TESTKEY_DIR}/key_rsa${keylen}.${hashalgo}.vbpubk" \
21        --version 1 \
22        --algorithm "${algorithmcounter}"
23      algorithmcounter=$((algorithmcounter + 1))
24    done
25  done
26}
27
28check_test_keys
29generate_vpubks
30