VBoot Reference: Make RSA verification test script return the right error code.

Also rename and modify run_tests.sh to only run the RSA verification tests. The SHA message digest tests must now be invoked separately.

Review URL: http://codereview.chromium.org/596080
This commit is contained in:
Gaurav Shah
2010-02-12 13:05:03 -08:00
parent cc1dd99ae7
commit 1a055adf7b

View File

@@ -7,12 +7,11 @@
# Run tests for cryptographic routine implementations - Message digests # Run tests for cryptographic routine implementations - Message digests
# and RSA Signature verification. # and RSA Signature verification.
return_code=0
hash_algos=( sha1 sha256 sha512 ) hash_algos=( sha1 sha256 sha512 )
key_lengths=( 1024 2048 4096 8192 ) key_lengths=( 1024 2048 4096 8192 )
TEST_FILE=test_file TEST_FILE=test_file
TEST_FILE_SIZE=1000000 TEST_FILE_SIZE=1000000
UTIL_DIR=../utils/
KEY_DIR=testkeys
# Generate public key signatures on an input file for various combinations # Generate public key signatures on an input file for various combinations
# of message digest algorithms and RSA key sizes. # of message digest algorithms and RSA key sizes.
@@ -40,6 +39,10 @@ function test_signatures {
${UTIL_DIR}/verify_data $algorithmcounter \ ${UTIL_DIR}/verify_data $algorithmcounter \
${KEY_DIR}/key_rsa${keylen}.keyb \ ${KEY_DIR}/key_rsa${keylen}.keyb \
${TEST_FILE}.rsa${keylen}_${hashalgo}.sig ${TEST_FILE} ${TEST_FILE}.rsa${keylen}_${hashalgo}.sig ${TEST_FILE}
if [ $? -ne 0 ]
then
return_code=255
fi
let algorithmcounter=algorithmcounter+1 let algorithmcounter=algorithmcounter+1
done done
done done
@@ -57,16 +60,29 @@ function cleanup {
rm ${TEST_FILE} ${TEST_FILE}.*.sig rm ${TEST_FILE} ${TEST_FILE}.*.sig
} }
echo "Testing message digests..." # Determine script directory.
./sha_tests if [[ $0 == '/'* ]];
then
SCRIPT_DIR="`dirname $0`"
elif [[ $0 == './'* ]];
then
SCRIPT_DIR="`pwd`"
else
SCRIPT_DIR="`pwd`"/"`dirname $0`"
fi
UTIL_DIR=`dirname ${SCRIPT_DIR}`/utils
KEY_DIR=${SCRIPT_DIR}/testkeys
echo "Generating test cases..."
pre_work
echo echo
echo "Testing signature verification..." echo "Testing signature verification..."
pre_work
test_signatures test_signatures
echo echo
echo "Cleaning up..." echo "Cleaning up..."
cleanup cleanup
exit $return_code