2012-08-13 05:49:40 +00:00
|
|
|
#!/bin/bash -ex
|
|
|
|
|
|
|
|
signed="test.signed"
|
|
|
|
unsigned="test.unsigned"
|
|
|
|
|
|
|
|
"$sbsign" --cert "$cert" --key "$key" --output "$signed" "$image"
|
|
|
|
cp "$signed" "$unsigned"
|
|
|
|
"$sbattach" --remove "$unsigned"
|
|
|
|
|
|
|
|
# ensure that there is no security directory
|
|
|
|
objdump -p $unsigned | grep -q '0\+ 0\+ Security Directory'
|
|
|
|
|
2017-10-19 01:17:29 +00:00
|
|
|
##
|
|
|
|
# somewhat tricky: i386 pecoff binaries can be too short, so we add padding
|
|
|
|
# when signing, so make sure the sizes match modulo the padding
|
|
|
|
##
|
2012-08-13 05:49:40 +00:00
|
|
|
# ensure that the unsigned file is the same size as our original binary
|
2017-10-19 01:17:29 +00:00
|
|
|
[ $(( ($(stat --format=%s "$image")+7)&~7)) -eq $(( ($(stat --format=%s "$unsigned")+7)&~7)) ]
|
2012-08-13 05:49:40 +00:00
|
|
|
|