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

Unified Diff: src/platform/vboot_reference/tests/run_tests.sh

Issue 604016: Vboot Reference: Move test key generation to a separate script and add sample test keys. (Closed)
Patch Set: Fix spacing. Created 10 years, 10 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
Index: src/platform/vboot_reference/tests/run_tests.sh
diff --git a/src/platform/vboot_reference/tests/run_tests.sh b/src/platform/vboot_reference/tests/run_tests.sh
index e5ee196cc5c619c222f9f78b2ff34a3cbd197d00..f728dd07219692449e5ecc0167037b9ed71dcd2b 100755
--- a/src/platform/vboot_reference/tests/run_tests.sh
+++ b/src/platform/vboot_reference/tests/run_tests.sh
@@ -12,18 +12,7 @@ key_lengths=( 1024 2048 4096 8192 )
TEST_FILE=test_file
TEST_FILE_SIZE=1000000
UTIL_DIR=../utils/
-
-# Generate RSA test keys of various lengths.
-function generate_keys {
- for i in ${key_lengths[@]}
- do
- openssl genrsa -F4 -out key_rsa$i.pem $i
- # Generate self-signed certificate from key.
- openssl req -batch -new -x509 -key key_rsa$i.pem -out key_rsa$i.crt
- # Generate pre-processed key for use by RSA signature verification code.
- ${UTIL_DIR}/dumpRSAPublicKey key_rsa$i.crt > key_rsa$i.keyb
- done
-}
+KEY_DIR=testkeys
# Generate public key signatures on an input file for various combinations
# of message digest algorithms and RSA key sizes.
@@ -34,7 +23,8 @@ function generate_signatures {
for hashalgo in ${hash_algos[@]}
do
${UTIL_DIR}/signature_digest $algorithmcounter $1 | openssl rsautl -sign \
- -pkcs -inkey key_rsa${keylen}.pem > $1.rsa${keylen}\_${hashalgo}.sig
+ -pkcs -inkey ${KEY_DIR}/key_rsa${keylen}.pem \
+ > $1.rsa${keylen}\_${hashalgo}.sig
let algorithmcounter=algorithmcounter+1
done
done
@@ -47,8 +37,9 @@ function test_signatures {
for hashalgo in ${hash_algos[@]}
do
echo "For RSA-$keylen and $hashalgo:"
- ${UTIL_DIR}/verify_data $algorithmcounter key_rsa${keylen}.keyb \
- ${TEST_FILE}.rsa${keylen}\_${hashalgo}.sig ${TEST_FILE}
+ ${UTIL_DIR}/verify_data $algorithmcounter \
+ ${KEY_DIR}/key_rsa${keylen}.keyb \
+ ${TEST_FILE}.rsa${keylen}_${hashalgo}.sig ${TEST_FILE}
let algorithmcounter=algorithmcounter+1
done
done
@@ -58,14 +49,12 @@ function pre_work {
# Generate a file with random bytes for signature tests.
echo "Generating test file..."
dd if=/dev/urandom of=${TEST_FILE} bs=${TEST_FILE_SIZE} count=1
- echo "Generating test keys..."
- generate_keys
echo "Generating signatures..."
generate_signatures $TEST_FILE
}
function cleanup {
- rm ${TEST_FILE} ${TEST_FILE}.*.sig key_rsa*.*
+ rm ${TEST_FILE} ${TEST_FILE}.*.sig
}
echo "Testing message digests..."
« no previous file with comments | « src/platform/vboot_reference/tests/gen_test_keys.sh ('k') | src/platform/vboot_reference/tests/testkeys/key_rsa1024.crt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698