diff options
author | Randall Spangler <rspangler@chromium.org> | 2014-05-13 09:24:52 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-06-05 23:14:23 +0000 |
commit | e166d04e797b605dd2f6784bc863a262c418c0c4 (patch) | |
tree | 1ddb71af00e1080d5687fdd72cee5000af79f078 /tests/vb2_rsa_tests.sh | |
parent | 786acdabcc15f023330d7c628aca9679e757a238 (diff) | |
download | vboot-e166d04e797b605dd2f6784bc863a262c418c0c4.tar.gz |
vboot2: Add crypto functions
This is the first of several CLs adding a more memory- and
code-efficient firmware verification library. This CL adds the crypto
library (modified from firmware/lib/cryptolib) and unit tests for it.
BUG=chromium:370082
BRANCH=none
TEST=make clean && VBOOT2=1 COV=1 make
Change-Id: I4240eab227bb197cacc6c8e7a6397127d74414a2
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/199578
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'tests/vb2_rsa_tests.sh')
-rwxr-xr-x | tests/vb2_rsa_tests.sh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/vb2_rsa_tests.sh b/tests/vb2_rsa_tests.sh new file mode 100755 index 00000000..331b0669 --- /dev/null +++ b/tests/vb2_rsa_tests.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# Copyright (c) 2010 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# +# Run tests for RSA Signature verification. + +# Load common constants and variables. +. "$(dirname "$0")/common.sh" + +set -e + +return_code=0 +TEST_FILE=${TESTCASE_DIR}/test_file + +function test_signatures { + algorithmcounter=0 + for keylen in ${key_lengths[@]} + do + for hashalgo in ${hash_algos[@]} + do + echo -e "For ${COL_YELLOW}RSA-$keylen and $hashalgo${COL_STOP}:" + ${UTIL_DIR}/verify_data $algorithmcounter \ + ${TESTKEY_DIR}/key_rsa${keylen}.keyb \ + ${TEST_FILE}.rsa${keylen}_${hashalgo}.sig \ + ${TEST_FILE} + if [ $? -ne 0 ] + then + return_code=255 + fi + let algorithmcounter=algorithmcounter+1 + done + done + echo -e "Peforming ${COL_YELLOW}PKCS #1 v1.5 Padding Tests${COL_STOP}..." + ${TEST_DIR}/vb2_rsa_padding_tests ${TESTKEY_DIR}/rsa_padding_test_pubkey.keyb +} + +check_test_keys +echo "Testing signature verification..." +test_signatures + +exit $return_code + |