5466f381dd
When detaching a signature, we need to know the size of the non-signature data. So, add a data_size member to struct image, and populate it when we iterate through the section table. When writing the image, use data_size rather than size, so we don't unnecessarily add the (now unused) signature data. Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
15 lines
437 B
Bash
Executable file
15 lines
437 B
Bash
Executable file
#!/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'
|
|
|
|
# ensure that the unsigned file is the same size as our original binary
|
|
[ $(stat --format=%s "$image") -eq $(stat --format=%s "$unsigned") ]
|
|
|