sbsign: Add --detached option to create detached PKCS7 signatures
Add an option (--detached) to sbsign, which creates a detached signature, rather than embedding it in the PE/COFF signature table. Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
This commit is contained in:
parent
f98a885cfa
commit
3c9815acc6
3 changed files with 37 additions and 3 deletions
16
image.c
16
image.c
|
@ -362,3 +362,19 @@ out:
|
|||
close(fd);
|
||||
return !rc;
|
||||
}
|
||||
|
||||
int image_write_detached(struct image *image, const char *filename)
|
||||
{
|
||||
int fd, rc;
|
||||
|
||||
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if (fd < 0) {
|
||||
perror("open");
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = write_all(fd, image->sigbuf, image->sigsize);
|
||||
|
||||
close(fd);
|
||||
return !rc;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue