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 <ivan.hu@canonical.com>
Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
This commit is contained in:
Ivan Hu 2012-06-19 11:19:48 +08:00 committed by Jeremy Kerr
parent e80a975ff9
commit 4d892eb723
2 changed files with 17 additions and 1 deletions

View file

@ -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)

View file

@ -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