mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 02:05:01 +00:00
pad_digest_utility: fix usage output
The usage string wasn't appending a newline to the end which caused weird output when shown. Add a proper usage() helper and extend the output a bit to be more human friendly. BUG=chromium:660209 TEST=`pad_digest_utility` is nice BRANCH=None Change-Id: I01c3c5372a4202bc6f5a9b2c5fe0e2a59c3ca5cf Reviewed-on: https://chromium-review.googlesource.com/404768 Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
49e517d818
commit
f41cd04d9e
@@ -1,14 +1,12 @@
|
||||
/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*
|
||||
* Utility for to generate a padded hash suitable for generating
|
||||
* PKCS#1.5 signatures.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "2sysincludes.h"
|
||||
|
||||
@@ -19,6 +17,14 @@
|
||||
#include "padding.h"
|
||||
#include "signature_digest.h"
|
||||
|
||||
static void usage(char* argv[]) {
|
||||
fprintf(stderr,
|
||||
"Usage: %s <alg_id> <digest_file>\n"
|
||||
"\n"
|
||||
"Generate a padded hash suitable for generating PKCS#1.5 "
|
||||
"signatures.\n",
|
||||
basename(argv[0]));
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
int algorithm = -1;
|
||||
@@ -29,7 +35,7 @@ int main(int argc, char* argv[]) {
|
||||
uint32_t padded_digest_len;
|
||||
|
||||
if (argc != 3) {
|
||||
fprintf(stderr, "Usage: %s <alg_id> <digest_file>", argv[0]);
|
||||
usage(argv);
|
||||
return -1;
|
||||
}
|
||||
algorithm = atoi(argv[1]);
|
||||
|
||||
Reference in New Issue
Block a user