Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
LSH
lsh
Commits
0144844f
Commit
0144844f
authored
Feb 12, 2003
by
Niels Möller
Browse files
(die, xalloc): Moved functions to
misc.c. Rev: src/spki/tools/spki-make-signature.c:1.2
parent
da734895
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/spki/tools/spki-make-signature.c
View file @
0144844f
...
...
@@ -23,28 +23,16 @@
#include "certificate.h"
#include "parse.h"
#include "
io
.h"
#include "
misc
.h"
#include <nettle/rsa.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "getopt.h"
static
void
die
(
const
char
*
format
,
...)
{
va_list
args
;
va_start
(
args
,
format
);
vfprintf
(
stderr
,
format
,
args
);
va_end
(
args
);
exit
(
EXIT_FAILURE
);
}
static
void
usage
(
void
)
{
...
...
@@ -78,13 +66,14 @@ parse_options(struct sign_options *o,
/* Name, args, flag, val */
{
"digest"
,
no_argument
,
NULL
,
'd'
},
{
"seed-file"
,
required_argument
,
NULL
,
's'
},
{
"version"
,
no_argument
,
NULL
,
'V'
},
{
"help"
,
no_argument
,
NULL
,
'?'
},
{
NULL
,
0
,
NULL
,
0
}
};
int
c
;
int
option_index
=
0
;
c
=
getopt_long
(
argc
,
argv
,
"V?s:w:"
,
options
,
&
option_index
);
c
=
getopt_long
(
argc
,
argv
,
"V?s:w:"
,
options
,
NULL
);
switch
(
c
)
{
...
...
@@ -101,6 +90,9 @@ parse_options(struct sign_options *o,
return
;
case
'V'
:
die
(
"spki-make-signature --version not implemented
\n
"
);
case
's'
:
o
->
seed_file
=
optarg
;
break
;
...
...
@@ -115,15 +107,6 @@ parse_options(struct sign_options *o,
}
}
static
void
*
xalloc
(
size_t
size
)
{
void
*
p
=
malloc
(
size
);
if
(
!
p
)
die
(
"Virtual memory exhausted.
\n
"
);
return
p
;
}
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -183,12 +166,10 @@ main(int argc, char **argv)
}
else
{
void
*
ctx
=
xalloc
(
hash_algorithm
->
context_size
);
digest
=
xalloc
(
hash_algorithm
->
digest_size
);
digest
=
hash_file
(
hash_algorithm
,
stdin
);
hash_algorithm
->
init
(
ctx
);
hash_file
(
hash_algorithm
,
ctx
,
stdin
);
hash_algorithm
->
digest
(
ctx
,
hash_algorithm
->
digest_size
,
digest
);
if
(
!
digest
)
die
(
"Reading stdin failed.
\n
"
);
}
mpz_init
(
s
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment