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# Run tests for RSA Signature verification. 8 9# Load common constants and variables. 10. "$(dirname "$0")/common.sh" 11 12set -e 13 14return_code=0 15TEST_FILE=${TESTCASE_DIR}/test_file 16 17function test_signatures { 18 algorithmcounter=0 19 for keylen in "${key_lengths[@]}" 20 do 21 for hashalgo in "${hash_algos[@]}" 22 do 23 echo -e "For ${COL_YELLOW}RSA-$keylen and $hashalgo${COL_STOP}:" 24 if ! "${BIN_DIR}/verify_data" "$algorithmcounter" \ 25 "${TESTKEY_DIR}/key_rsa${keylen}.keyb" \ 26 "${TEST_FILE}.rsa${keylen}_${hashalgo}.sig" \ 27 "${TEST_FILE}" 28 then 29 return_code=255 30 fi 31 algorithmcounter=$((algorithmcounter + 1)) 32 done 33 done 34 echo -e "Peforming ${COL_YELLOW}PKCS #1 v1.5 Padding Tests${COL_STOP}..." 35 "${TEST_DIR}/vb20_rsa_padding_tests" \ 36 "${TESTKEY_DIR}/rsa_padding_test_pubkey.keyb" 37 if [ -e "${TEST_DIR}/vb20_hwcrypto_rsa_padding_tests" ] 38 then 39 "${TEST_DIR}/vb20_hwcrypto_rsa_padding_tests" \ 40 "${TESTKEY_DIR}/rsa_padding_test_pubkey.keyb" 41 fi 42} 43 44check_test_keys 45echo "Testing signature verification..." 46test_signatures 47 48exit $return_code 49