From 4d892eb7237b6cca58b0181947588f4381e398bc Mon Sep 17 00:00:00 2001 From: Ivan Hu Date: Tue, 19 Jun 2012 11:19:48 +0800 Subject: [PATCH] tests: Add a test to check invalid PKCS7 signature attaching Add a test for the invalid PKCS7 signature attaching. This test generates 1K of zero bytes as an invalid signature to attach. Signed-off-by: Ivan Hu Signed-off-by: Jeremy Kerr --- tests/Makefile.am | 3 ++- tests/sign-invalidattach-verify.sh | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 tests/sign-invalidattach-verify.sh diff --git a/tests/Makefile.am b/tests/Makefile.am index 29adb2c..c1bccd4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -42,7 +42,8 @@ TESTS = sign-verify.sh \ sign-missing-cert.sh \ sign-missing-key.sh \ verify-missing-image.sh \ - verify-missing-cert.sh + verify-missing-cert.sh \ + sign-invalidattach-verify.sh EXTRA_DIST = $(test_lds) test.S $(TESTS) $(check_SCRIPTS) CLEANFILES = $(test_key) $(test_cert) $(test_image) diff --git a/tests/sign-invalidattach-verify.sh b/tests/sign-invalidattach-verify.sh new file mode 100755 index 0000000..981ac66 --- /dev/null +++ b/tests/sign-invalidattach-verify.sh @@ -0,0 +1,15 @@ +#!/bin/bash -e + +. "$srcdir/common.sh" + +invsig="test.invsig" +dd if=/dev/zero of="$invsig" bs=1 count=1k +tmp_image=test.pecoff +cp "$image" "$tmp_image" + +set +e +"$sbattach" --attach "$invsig" "$tmp_image" +rc=$? +set -e + +test $rc -eq 1