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
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitry Baryshkov
nettle
Commits
fb4e324a
Commit
fb4e324a
authored
11 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
Convert dsa_keypair_to_sexp to use struct dsa_params.
parent
39ea0d27
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
ChangeLog
+4
-0
4 additions, 0 deletions
ChangeLog
dsa.h
+3
-2
3 additions, 2 deletions
dsa.h
dsa2sexp.c
+10
-8
10 additions, 8 deletions
dsa2sexp.c
tools/pkcs1-conv.c
+6
-2
6 additions, 2 deletions
tools/pkcs1-conv.c
with
23 additions
and
12 deletions
ChangeLog
+
4
−
0
View file @
fb4e324a
2014-03-26 Niels Möller <nisse@lysator.liu.se>
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.h (struct dsa_params): New struct.
* dsa-sign.c (dsa_sign): Use struct dsa_params, with key as a
* dsa-sign.c (dsa_sign): Use struct dsa_params, with key as a
...
...
This diff is collapsed.
Click to expand it.
dsa.h
+
3
−
2
View file @
fb4e324a
...
@@ -244,8 +244,9 @@ struct nettle_buffer;
...
@@ -244,8 +244,9 @@ struct nettle_buffer;
int
int
dsa_keypair_to_sexp
(
struct
nettle_buffer
*
buffer
,
dsa_keypair_to_sexp
(
struct
nettle_buffer
*
buffer
,
const
char
*
algorithm_name
,
/* NULL means "dsa" */
const
char
*
algorithm_name
,
/* NULL means "dsa" */
const
struct
dsa_public_key
*
pub
,
const
struct
dsa_params
*
params
,
const
struct
dsa_private_key
*
priv
);
const
mpz_t
pub
,
const
mpz_t
priv
);
struct
sexp_iterator
;
struct
sexp_iterator
;
...
...
This diff is collapsed.
Click to expand it.
dsa2sexp.c
+
10
−
8
View file @
fb4e324a
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
/* nettle, low-level cryptographics library
/* 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
* 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
* it under the terms of the GNU Lesser General Public License as published by
...
@@ -33,8 +33,9 @@
...
@@ -33,8 +33,9 @@
int
int
dsa_keypair_to_sexp
(
struct
nettle_buffer
*
buffer
,
dsa_keypair_to_sexp
(
struct
nettle_buffer
*
buffer
,
const
char
*
algorithm_name
,
const
char
*
algorithm_name
,
const
struct
dsa_public_key
*
pub
,
const
struct
dsa_params
*
params
,
const
struct
dsa_private_key
*
priv
)
const
mpz_t
pub
,
const
mpz_t
priv
)
{
{
if
(
!
algorithm_name
)
if
(
!
algorithm_name
)
algorithm_name
=
"dsa"
;
algorithm_name
=
"dsa"
;
...
@@ -43,12 +44,13 @@ dsa_keypair_to_sexp(struct nettle_buffer *buffer,
...
@@ -43,12 +44,13 @@ dsa_keypair_to_sexp(struct nettle_buffer *buffer,
return
sexp_format
(
buffer
,
return
sexp_format
(
buffer
,
"(private-key(%0s(p%b)(q%b)"
"(private-key(%0s(p%b)(q%b)"
"(g%b)(y%b)(x%b)))"
,
"(g%b)(y%b)(x%b)))"
,
algorithm_name
,
pub
->
p
,
pub
->
q
,
algorithm_name
,
params
->
p
,
params
->
q
,
pub
->
g
,
pub
->
y
,
priv
->
x
);
params
->
g
,
pub
,
priv
);
else
else
return
sexp_format
(
buffer
,
return
sexp_format
(
buffer
,
"(public-key(%0s(p%b)(q%b)"
"(public-key(%0s(p%b)(q%b)"
"(g%b)(y%b)))"
,
"(g%b)(y%b)))"
,
algorithm_name
,
p
ub
->
p
,
p
ub
->
q
,
algorithm_name
,
p
arams
->
p
,
p
arams
->
q
,
p
ub
->
g
,
pub
->
y
);
p
arams
->
g
,
pub
);
}
}
This diff is collapsed.
Click to expand it.
tools/pkcs1-conv.c
+
6
−
2
View file @
fb4e324a
...
@@ -323,7 +323,9 @@ convert_dsa_private_key(struct nettle_buffer *buffer, size_t length, const uint8
...
@@ -323,7 +323,9 @@ convert_dsa_private_key(struct nettle_buffer *buffer, size_t length, const uint8
{
{
/* Reuses the buffer */
/* Reuses the buffer */
nettle_buffer_reset
(
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
else
{
{
...
@@ -413,7 +415,9 @@ convert_public_key(struct nettle_buffer *buffer, size_t length, const uint8_t *d
...
@@ -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
))
&&
dsa_public_key_from_der_iterator
(
&
pub
,
0
,
&
j
))
{
{
nettle_buffer_reset
(
buffer
);
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
);
dsa_public_key_clear
(
&
pub
);
}
}
...
...
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