]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
(rsa_keypair_to_openpgp): Some bugfixes.
authorNiels Möller <nisse@lysator.liu.se>
Mon, 12 May 2003 21:42:04 +0000 (23:42 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Mon, 12 May 2003 21:42:04 +0000 (23:42 +0200)
Rev: src/nettle/rsa.h:1.23
Rev: src/nettle/rsa2openpgp.c:1.3

rsa.h
rsa2openpgp.c

diff --git a/rsa.h b/rsa.h
index a924fb2be4c08d835e5bf9369689440e202631da..39b83b11ee6125aa5e4507c9845458208469aef6 100644 (file)
--- a/rsa.h
+++ b/rsa.h
@@ -289,7 +289,7 @@ rsa_keypair_to_openpgp(struct nettle_buffer *buffer,
                       const struct rsa_public_key *pub,
                       const struct rsa_private_key *priv,
                       /* A single user id. NUL-terminated utf8. */
-                      const char userid);
+                      const char *userid);
 
 /* Internal functions. */
 int
index f3f01f07b9e4fbc0372f51a57910f8a52aeef963..580cd3335a91d754678b43baeb2c967667fd2c15 100644 (file)
@@ -29,6 +29,7 @@
 
 #if WITH_PUBLIC_KEY
 
+#include <string.h>
 #include <time.h>
 
 #include "rsa.h"
  *
  * Currently, we generate a public key packet, a single user id, and a
  * signature. */
- */
+
 int
 rsa_keypair_to_openpgp(struct nettle_buffer *buffer,
                       const struct rsa_public_key *pub,
                       const struct rsa_private_key *priv,
                       /* A single user id. NUL-terminated utf8. */
-                      const char userid)
+                      const char *userid)
 {
   time_t now = time(NULL);
 
@@ -72,8 +73,6 @@ rsa_keypair_to_openpgp(struct nettle_buffer *buffer,
   struct sha1_ctx signature_hash;
   uint8_t fingerprint[SHA1_DIGEST_SIZE];
   
-  mpz_t s;
-  
   key_start = buffer->size;
   
   if (!pgp_put_public_rsa_key(buffer, pub, now))
@@ -91,7 +90,7 @@ rsa_keypair_to_openpgp(struct nettle_buffer *buffer,
              buffer->contents + key_start);
 
   signature_hash = key_hash;
-  sha1_digest(&key_hash, fingerprint, sizeof(fingerprint));
+  sha1_digest(&key_hash, sizeof(fingerprint), fingerprint);
 
   sha1_update(&signature_hash,
              buffer->size - userid_start,
@@ -101,6 +100,6 @@ rsa_keypair_to_openpgp(struct nettle_buffer *buffer,
                                    priv,
                                    fingerprint + SHA1_DIGEST_SIZE - 8,
                                    PGP_SIGN_CERTIFICATION,
-                                   signature_hash);
+                                   &signature_hash);
 }
 #endif /* WITH_PUBLIC_KEY */