Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Wim Lewis
nettle
Commits
fb4e324a
Commit
fb4e324a
authored
Mar 26, 2014
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert dsa_keypair_to_sexp to use struct dsa_params.
parent
39ea0d27
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
12 deletions
+23
-12
ChangeLog
ChangeLog
+4
-0
dsa.h
dsa.h
+3
-2
dsa2sexp.c
dsa2sexp.c
+10
-8
tools/pkcs1-conv.c
tools/pkcs1-conv.c
+6
-2
No files found.
ChangeLog
View file @
fb4e324a
2014-03-26 Niels Möller <nisse@lysator.liu.se>
* dsa2sexp.c (dsa_keypair_to_sexp): Converted to new DSA
interface.
* tools/pkcs1-conv.c: Updated uses of dsa_keypair_to_sexp.
* dsa.h (struct dsa_params): New struct.
* dsa-sign.c (dsa_sign): Use struct dsa_params, with key as a
...
...
dsa.h
View file @
fb4e324a
...
...
@@ -244,8 +244,9 @@ struct nettle_buffer;
int
dsa_keypair_to_sexp
(
struct
nettle_buffer
*
buffer
,
const
char
*
algorithm_name
,
/* NULL means "dsa" */
const
struct
dsa_public_key
*
pub
,
const
struct
dsa_private_key
*
priv
);
const
struct
dsa_params
*
params
,
const
mpz_t
pub
,
const
mpz_t
priv
);
struct
sexp_iterator
;
...
...
dsa2sexp.c
View file @
fb4e324a
...
...
@@ -4,7 +4,7 @@
/* nettle, low-level cryptographics library
*
* Copyright (C) 2002, 2009 Niels Möller, Magnus Holmgren
* Copyright (C) 2002, 2009
, 2014
Niels Möller, Magnus Holmgren
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
...
...
@@ -33,22 +33,24 @@
int
dsa_keypair_to_sexp
(
struct
nettle_buffer
*
buffer
,
const
char
*
algorithm_name
,
const
struct
dsa_public_key
*
pub
,
const
struct
dsa_private_key
*
priv
)
const
struct
dsa_params
*
params
,
const
mpz_t
pub
,
const
mpz_t
priv
)
{
if
(
!
algorithm_name
)
algorithm_name
=
"dsa"
;
if
(
priv
)
return
sexp_format
(
buffer
,
"(private-key(%0s(p%b)(q%b)"
"(g%b)(y%b)(x%b)))"
,
algorithm_name
,
pub
->
p
,
pub
->
q
,
pub
->
g
,
pub
->
y
,
priv
->
x
);
algorithm_name
,
params
->
p
,
params
->
q
,
params
->
g
,
pub
,
priv
);
else
return
sexp_format
(
buffer
,
"(public-key(%0s(p%b)(q%b)"
"(g%b)(y%b)))"
,
algorithm_name
,
p
ub
->
p
,
p
ub
->
q
,
p
ub
->
g
,
pub
->
y
);
algorithm_name
,
p
arams
->
p
,
p
arams
->
q
,
p
arams
->
g
,
pub
);
}
tools/pkcs1-conv.c
View file @
fb4e324a
...
...
@@ -323,7 +323,9 @@ convert_dsa_private_key(struct nettle_buffer *buffer, size_t length, const uint8
{
/* Reuses the buffer */
nettle_buffer_reset
(
buffer
);
res
=
dsa_keypair_to_sexp
(
buffer
,
NULL
,
&
pub
,
&
priv
);
res
=
dsa_keypair_to_sexp
(
buffer
,
NULL
,
(
const
struct
dsa_params
*
)
&
pub
,
pub
.
y
,
priv
.
x
);
}
else
{
...
...
@@ -413,7 +415,9 @@ convert_public_key(struct nettle_buffer *buffer, size_t length, const uint8_t *d
&&
dsa_public_key_from_der_iterator
(
&
pub
,
0
,
&
j
))
{
nettle_buffer_reset
(
buffer
);
res
=
dsa_keypair_to_sexp
(
buffer
,
NULL
,
&
pub
,
NULL
)
>
0
;
res
=
dsa_keypair_to_sexp
(
buffer
,
NULL
,
(
const
struct
dsa_params
*
)
&
pub
,
pub
.
y
,
NULL
)
>
0
;
}
dsa_public_key_clear
(
&
pub
);
}
...
...
Write
Preview
Markdown
is supported
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