Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nettle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andrew Lawrence
nettle
Commits
99f954f7
Commit
99f954f7
authored
9 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
Fix handling of unrecognized options for nettle-hash and nettle-pbkdf2.
parent
35666208
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ChangeLog
+8
-0
8 additions, 0 deletions
ChangeLog
tools/nettle-hash.c
+17
-8
17 additions, 8 deletions
tools/nettle-hash.c
tools/nettle-pbkdf2.c
+4
-1
4 additions, 1 deletion
tools/nettle-pbkdf2.c
with
29 additions
and
9 deletions
ChangeLog
+
8
−
0
View file @
99f954f7
2016-01-26 Niels Möller <nisse@lysator.liu.se>
* tools/nettle-pbkdf2.c (main): Fix handling of unrecognized
options. Bug reported by Dongsheng Zhang. Display usage message
and exit non-zero. Also added "Usage: "-prefix to the message.
* tools/nettle-hash.c (usage): New function, extracted from main.
(main): Analogous fix for unrecognized options.
2016-01-23 Niels Möller <nisse@lysator.liu.se>
2016-01-23 Niels Möller <nisse@lysator.liu.se>
* nettle.texinfo: Set UPDATED-FOR to 3.2.
* nettle.texinfo: Set UPDATED-FOR to 3.2.
...
...
This diff is collapsed.
Click to expand it.
tools/nettle-hash.c
+
17
−
8
View file @
99f954f7
...
@@ -134,6 +134,19 @@ digest_file(const struct nettle_hash *alg,
...
@@ -134,6 +134,19 @@ digest_file(const struct nettle_hash *alg,
return
1
;
return
1
;
}
}
static
void
usage
(
FILE
*
f
)
{
fprintf
(
f
,
"Usage: nettle-hash -a ALGORITHM [OPTIONS] [FILE ...]
\n
"
"Options:
\n
"
" --help Show this help.
\n
"
" -V, --version Show version information.
\n
"
" --list List supported hash algorithms.
\n
"
" -a, --algorithm=ALG Hash algorithm to use.
\n
"
" -l, --length=LENGTH Desired digest length (octets)
\n
"
" --raw Raw binary output.
\n
"
);
}
/* FIXME: Be more compatible with md5sum and sha1sum. Options -c
/* FIXME: Be more compatible with md5sum and sha1sum. Options -c
(check), -b (binary), -t (text), and output format with hex hash
(check), -b (binary), -t (text), and output format with hex hash
sum, optional star (meaning binary mode), and file name. */
sum, optional star (meaning binary mode), and file name. */
...
@@ -165,15 +178,11 @@ main (int argc, char **argv)
...
@@ -165,15 +178,11 @@ main (int argc, char **argv)
{
{
default:
default:
abort
();
abort
();
case
'?'
:
usage
(
stderr
);
return
EXIT_FAILURE
;
case
OPT_HELP
:
case
OPT_HELP
:
printf
(
"nettle-hash -a ALGORITHM [OPTIONS] [FILE ...]
\n
"
usage
(
stdout
);
"Options:
\n
"
" --help Show this help.
\n
"
" -V, --version Show version information.
\n
"
" --list List supported hash algorithms.
\n
"
" -a, --algorithm=ALG Hash algorithm to use.
\n
"
" -l, --length=LENGTH Desired digest length (octets)
\n
"
" --raw Raw binary output.
\n
"
);
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
case
'V'
:
case
'V'
:
printf
(
"nettle-hash ("
PACKAGE_STRING
")
\n
"
);
printf
(
"nettle-hash ("
PACKAGE_STRING
")
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
tools/nettle-pbkdf2.c
+
4
−
1
View file @
99f954f7
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
static
void
static
void
usage
(
FILE
*
f
)
usage
(
FILE
*
f
)
{
{
fprintf
(
f
,
"nettle-pbkdf2 [OPTIONS] SALT
\n
"
fprintf
(
f
,
"
Usage:
nettle-pbkdf2 [OPTIONS] SALT
\n
"
"Options:
\n
"
"Options:
\n
"
" --help Show this help.
\n
"
" --help Show this help.
\n
"
" -V, --version Show version information.
\n
"
" -V, --version Show version information.
\n
"
...
@@ -97,6 +97,9 @@ main (int argc, char **argv)
...
@@ -97,6 +97,9 @@ main (int argc, char **argv)
{
{
default:
default:
abort
();
abort
();
case
'?'
:
usage
(
stderr
);
return
EXIT_FAILURE
;
case
OPT_HELP
:
case
OPT_HELP
:
usage
(
stdout
);
usage
(
stdout
);
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment