Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(942)

Unified Diff: tests/gen_test_keys.sh

Issue 3423022: Fix test suite deficiencies. (Closed) Base URL: http://git.chromium.org/git/vboot_reference.git
Patch Set: Address review comments. Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/gen_fuzz_test_cases.sh ('k') | tests/run_rsa_tests.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/gen_test_keys.sh
diff --git a/tests/gen_test_keys.sh b/tests/gen_test_keys.sh
index edc3d204af4677da59a7a8b2e052f11e5edea084..1bf995b21fc18fde123657d7322c3f38cd2133af 100755
--- a/tests/gen_test_keys.sh
+++ b/tests/gen_test_keys.sh
@@ -9,20 +9,51 @@
# Load common constants and variables.
. "$(dirname "$0")/common.sh"
-# Generate RSA test keys of various lengths.
+set -e
+
+PATH="$(dirname "$0")/../build/utility:${PATH}"
+
+sha_types=( 1 256 512 )
+
+# Generate RSA test keys of various lengths.
function generate_keys {
+ key_index=0
+ key_name_base="${TESTKEY_DIR}/key_rsa"
for i in ${key_lengths[@]}
do
- if [ -f ${TESTKEY_DIR}/key_rsa$i.keyb ]; then
+ key_base="${key_name_base}${i}"
+ if [ -f "${key_base}.keyb" ]; then
continue
fi
- openssl genrsa -F4 -out ${TESTKEY_DIR}/key_rsa$i.pem $i
+
+ openssl genrsa -F4 -out ${key_base}.pem $i
# Generate self-signed certificate from key.
- openssl req -batch -new -x509 -key ${TESTKEY_DIR}/key_rsa$i.pem \
- -out ${TESTKEY_DIR}/key_rsa$i.crt
+ openssl req -batch -new -x509 -key ${key_base}.pem \
+ -out ${key_base}.crt
+
# Generate pre-processed key for use by RSA signature verification code.
- ${UTIL_DIR}/dumpRSAPublicKey ${TESTKEY_DIR}/key_rsa$i.crt \
- > ${TESTKEY_DIR}/key_rsa$i.keyb
+ ${UTIL_DIR}/dumpRSAPublicKey ${key_base}.crt \
+ > ${key_base}.keyb
+
+ alg_index=0
+ for sha_type in ${sha_types[@]}
+ do
+ alg=$((${key_index} * 3 + ${alg_index}))
+ # wrap the public key
+ vbutil_key \
+ --pack "${key_base}.sha${sha_type}.vbpubk" \
+ --key "${key_base}.keyb" \
+ --version 1 \
+ --algorithm ${alg}
+
+ # wrap the private key
+ vbutil_key \
+ --pack "${key_base}.sha${sha_type}.vbprivk" \
+ --key "${key_base}.pem" \
+ --algorithm ${alg}
+ alg_index=$((${alg_index} + 1))
+ done
+ key_index=$((${key_index} + 1))
done
}
« no previous file with comments | « tests/gen_fuzz_test_cases.sh ('k') | tests/run_rsa_tests.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698