From e5c632516a2a31f3e184d0ca9d8ac5ceba1f9015 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 18 Oct 2012 14:55:07 -0400 Subject: [PATCH 34/42] Make client use -e like pesign does, rather than --detached. This way we can use the same macros for them. Signed-off-by: Peter Jones --- src/client.c | 22 ++++++++++++++++++++-- src/pesign-client.1 | 3 ++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/client.c b/src/client.c index df1c8f2..5e5399d 100644 --- a/src/client.c +++ b/src/client.c @@ -434,6 +434,7 @@ main(int argc, char *argv[]) int action; char *infile = NULL; char *outfile = NULL; + char *exportfile = NULL; int attached = 1; int pinfd = -1; char *pinfile = NULL; @@ -456,8 +457,9 @@ main(int argc, char *argv[]) &infile, 0, "input filename", "" }, {"outfile", 'o', POPT_ARG_STRING, &outfile, 0, "output filename", "" }, - {"detached", 'd', POPT_ARG_VAL, &attached, 0, - "create detached signature", NULL }, + {"export", 'e', POPT_ARG_STRING, + &exportfile, 0, "create detached signature", + "" }, {"pinfd", 'f', POPT_ARG_INT, &pinfd, -1, "read file descriptor for pin information", "" }, @@ -494,6 +496,22 @@ main(int argc, char *argv[]) exit(1); } + if (!outfile && !exportfile) { + fprintf(stderr, "pesign-client: neither --outfile nor --export " + "specified\n"); + exit(1); + } + + if (outfile && exportfile) { + fprintf(stderr, "pesign-client: both --outfile and --export " + "specified\n"); + exit(1); + } + if (exportfile) { + outfile = exportfile; + attached = 0; + } + poptFreeContext(optCon); int sd = connect_to_server(); diff --git a/src/pesign-client.1 b/src/pesign-client.1 index 686383e..1ccfbb3 100644 --- a/src/pesign-client.1 +++ b/src/pesign-client.1 @@ -5,10 +5,11 @@ pesign-client \- command line tool for signing UEFI applications .SH SYNOPSIS \fBpesign\fR [--in=\fIinfile\fR | -i \fIinfile\fR] [--out=\fIoutfile\fR | -o \fIoutfile\fR] + [--export=\fIexportfile\fR | -e \fIexportfile\fR] [--token=\fItoken\fR | -t \fItoken\fR] [--certificate=\fInickname\fR | -c \fInickname\fR] [--unlock | -u] [--kill | -k] [--sign | -s] - [--detached | -d] [--pinfd=\fIpinfd\fR | -f \fIpinfd\fR] + [--pinfd=\fIpinfd\fR | -f \fIpinfd\fR] [--pinfile=\fIpinfile\fR | -F \fIpinfile\fR] .SH DESCRIPTION -- 1.7.12.1