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
Deploy
Releases
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
Brian Smith
nettle
Commits
5a3de636
Commit
5a3de636
authored
21 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
(rsa_keypair_to_openpgp): Some bugfixes.
Rev: src/nettle/rsa.h:1.23 Rev: src/nettle/rsa2openpgp.c:1.3
parent
44027ec6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
rsa.h
+1
-1
1 addition, 1 deletion
rsa.h
rsa2openpgp.c
+5
-6
5 additions, 6 deletions
rsa2openpgp.c
with
6 additions
and
7 deletions
rsa.h
+
1
−
1
View file @
5a3de636
...
@@ -289,7 +289,7 @@ rsa_keypair_to_openpgp(struct nettle_buffer *buffer,
...
@@ -289,7 +289,7 @@ rsa_keypair_to_openpgp(struct nettle_buffer *buffer,
const
struct
rsa_public_key
*
pub
,
const
struct
rsa_public_key
*
pub
,
const
struct
rsa_private_key
*
priv
,
const
struct
rsa_private_key
*
priv
,
/* A single user id. NUL-terminated utf8. */
/* A single user id. NUL-terminated utf8. */
const
char
userid
);
const
char
*
userid
);
/* Internal functions. */
/* Internal functions. */
int
int
...
...
This diff is collapsed.
Click to expand it.
rsa2openpgp.c
+
5
−
6
View file @
5a3de636
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#if WITH_PUBLIC_KEY
#if WITH_PUBLIC_KEY
#include
<string.h>
#include
<time.h>
#include
<time.h>
#include
"rsa.h"
#include
"rsa.h"
...
@@ -54,13 +55,13 @@
...
@@ -54,13 +55,13 @@
*
*
* Currently, we generate a public key packet, a single user id, and a
* Currently, we generate a public key packet, a single user id, and a
* signature. */
* signature. */
*/
int
int
rsa_keypair_to_openpgp
(
struct
nettle_buffer
*
buffer
,
rsa_keypair_to_openpgp
(
struct
nettle_buffer
*
buffer
,
const
struct
rsa_public_key
*
pub
,
const
struct
rsa_public_key
*
pub
,
const
struct
rsa_private_key
*
priv
,
const
struct
rsa_private_key
*
priv
,
/* A single user id. NUL-terminated utf8. */
/* A single user id. NUL-terminated utf8. */
const
char
userid
)
const
char
*
userid
)
{
{
time_t
now
=
time
(
NULL
);
time_t
now
=
time
(
NULL
);
...
@@ -72,8 +73,6 @@ rsa_keypair_to_openpgp(struct nettle_buffer *buffer,
...
@@ -72,8 +73,6 @@ rsa_keypair_to_openpgp(struct nettle_buffer *buffer,
struct
sha1_ctx
signature_hash
;
struct
sha1_ctx
signature_hash
;
uint8_t
fingerprint
[
SHA1_DIGEST_SIZE
];
uint8_t
fingerprint
[
SHA1_DIGEST_SIZE
];
mpz_t
s
;
key_start
=
buffer
->
size
;
key_start
=
buffer
->
size
;
if
(
!
pgp_put_public_rsa_key
(
buffer
,
pub
,
now
))
if
(
!
pgp_put_public_rsa_key
(
buffer
,
pub
,
now
))
...
@@ -91,7 +90,7 @@ rsa_keypair_to_openpgp(struct nettle_buffer *buffer,
...
@@ -91,7 +90,7 @@ rsa_keypair_to_openpgp(struct nettle_buffer *buffer,
buffer
->
contents
+
key_start
);
buffer
->
contents
+
key_start
);
signature_hash
=
key_hash
;
signature_hash
=
key_hash
;
sha1_digest
(
&
key_hash
,
fingerprint
,
sizeof
(
fingerprint
));
sha1_digest
(
&
key_hash
,
sizeof
(
fingerprint
)
,
fingerprint
);
sha1_update
(
&
signature_hash
,
sha1_update
(
&
signature_hash
,
buffer
->
size
-
userid_start
,
buffer
->
size
-
userid_start
,
...
@@ -101,6 +100,6 @@ rsa_keypair_to_openpgp(struct nettle_buffer *buffer,
...
@@ -101,6 +100,6 @@ rsa_keypair_to_openpgp(struct nettle_buffer *buffer,
priv
,
priv
,
fingerprint
+
SHA1_DIGEST_SIZE
-
8
,
fingerprint
+
SHA1_DIGEST_SIZE
-
8
,
PGP_SIGN_CERTIFICATION
,
PGP_SIGN_CERTIFICATION
,
signature_hash
);
&
signature_hash
);
}
}
#endif
/* WITH_PUBLIC_KEY */
#endif
/* WITH_PUBLIC_KEY */
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