From: David Howells <dhowells@redhat.com>
To: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
Cc: dhowells@redhat.com, Ming Lei <ming.lei@canonical.com>,
Rusty Russell <rusty@rustcorp.com.au>,
Linus Torvalds <torvalds@linux-foundation.org>,
Seth Forshee <seth.forshee@canonical.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Paul Bolle <pebolle@tiscali.nl>,
linux-wireless <linux-wireless@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
jlee@suse.com, Takashi Iwai <tiwai@suse.de>,
Casey Schaufler <casey@schaufler-ca.com>,
Kees Cook <keescook@chromium.org>,
Matthew Garrett <mjg59@srcf.ucam.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [RFC v2 4/6] scripts/sign-file.c: add support to only create signature file
Date: Thu, 14 May 2015 16:02:25 +0100 [thread overview]
Message-ID: <9134.1431615745@warthog.procyon.org.uk> (raw)
In-Reply-To: <CAB=NE6WQoq-Es+rVsLgagGLxwzGJAMh2jy08Bf1wuy45xqwnmA@mail.gmail.com>
Luis R. Rodriguez <mcgrof@do-not-panic.com> wrote:
> > Use "-d". I added the flag but then never made it do anything.
>
> Sure, but since this C file is not upstream, how about just squashing
> the commit with yours that adds the C file?
I've got various Tested-by's on that.
Anyway, I'm going to stack the attached patch on my branch if that's okay by
you...
David
---
commit 092c720a627b913918eb22f6700f189b34f70693
Author: Luis R. Rodriguez <mcgrof@suse.com>
Date: Wed May 13 11:23:54 2015 -0700
sign-file: Add option to only create signature file
Make the -d option (which currently isn't actually wired to anything) write
out the PKCS#7 message as per the -p option and then exit without either
modifying the source or writing out a compound file of the source, signature
and metadata.
This will be useful when firmware signature support is added
upstream as firmware will be left intact, and we'll only require
the signature file. The descriptor is implicit by file extension
and the file's own size.
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Signed-off-by: David Howells <dhowells@redhat.com>
diff --git a/scripts/sign-file.c b/scripts/sign-file.c
index 5b8a6dda3235..39aaabe89388 100755
--- a/scripts/sign-file.c
+++ b/scripts/sign-file.c
@@ -86,13 +86,14 @@ int main(int argc, char **argv)
char *hash_algo = NULL;
char *private_key_name, *x509_name, *module_name, *dest_name;
bool save_pkcs7 = false, replace_orig;
+ bool sign_only = false;
unsigned char buf[4096];
unsigned long module_size, pkcs7_size;
const EVP_MD *digest_algo;
EVP_PKEY *private_key;
PKCS7 *pkcs7;
X509 *x509;
- BIO *b, *bd, *bm;
+ BIO *b, *bd = NULL, *bm;
int opt, n;
ERR_load_crypto_strings();
@@ -102,6 +103,7 @@ int main(int argc, char **argv)
opt = getopt(argc, argv, "dp");
switch (opt) {
case 'p': save_pkcs7 = true; break;
+ case 'd': sign_only = true; save_pkcs7 = true; break;
case -1: break;
default: format();
}
@@ -148,8 +150,10 @@ int main(int argc, char **argv)
/* Open the destination file now so that we can shovel the module data
* across as we read it.
*/
- bd = BIO_new_file(dest_name, "wb");
- ERR(!bd, "%s", dest_name);
+ if (!sign_only) {
+ bd = BIO_new_file(dest_name, "wb");
+ ERR(!bd, "%s", dest_name);
+ }
/* Digest the module data. */
OpenSSL_add_all_digests();
@@ -180,6 +184,9 @@ int main(int argc, char **argv)
BIO_free(b);
}
+ if (sign_only)
+ return 0;
+
/* Append the marker and the PKCS#7 message to the destination file */
ERR(BIO_reset(bm) < 0, "%s", module_name);
while ((n = BIO_read(bm, buf, sizeof(buf))),
next prev parent reply other threads:[~2015-05-14 15:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-13 18:23 [RFC v2 0/6] firmware: add PKCS#7 firmware signature support Luis R. Rodriguez
2015-05-13 18:23 ` [RFC v2 1/6] firmware: generalize reading file contents as a helper Luis R. Rodriguez
2015-05-13 18:23 ` [RFC v2 2/6] kernel: generalize module signing as system data signing Luis R. Rodriguez
2015-05-13 18:23 ` [RFC v2 3/6] crypto: qat - address recursive dependency when fw signing is enabled Luis R. Rodriguez
2015-05-14 3:04 ` Herbert Xu
2015-05-14 19:34 ` Luis R. Rodriguez
2015-05-13 18:23 ` [RFC v2 4/6] scripts/sign-file.c: add support to only create signature file Luis R. Rodriguez
2015-05-14 14:50 ` David Howells
2015-05-14 14:52 ` David Howells
2015-05-14 14:52 ` Luis R. Rodriguez
2015-05-14 15:02 ` David Howells [this message]
2015-05-14 15:16 ` Luis R. Rodriguez
2015-05-13 18:23 ` [RFC v2 5/6] kernel/sysdata_signing: export data_verify_pkcs7() Luis R. Rodriguez
2015-05-13 18:23 ` [RFC v2 6/6] firmware: add firmware signature checking support Luis R. Rodriguez
2015-05-13 18:46 ` Luis R. Rodriguez
2015-05-14 0:31 ` Julian Calaby
2015-05-14 1:35 ` Luis R. Rodriguez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9134.1431615745@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=casey@schaufler-ca.com \
--cc=gregkh@linuxfoundation.org \
--cc=jlee@suse.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mcgrof@do-not-panic.com \
--cc=ming.lei@canonical.com \
--cc=mjg59@srcf.ucam.org \
--cc=pebolle@tiscali.nl \
--cc=rusty@rustcorp.com.au \
--cc=seth.forshee@canonical.com \
--cc=tiwai@suse.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox