Update plibc header
[oweals/gnunet.git] / src / util / gnunet-ecc.c
index 103f8eff25110f9e631f91df735ca3747f08eec9..23e562cbee98ad94b87e56264d0450011d48e351 100644 (file)
@@ -66,7 +66,7 @@ create_keys (const char *fn)
           _("Generating %u keys, please wait"),
           make_keys);
   while (0 < make_keys--)
-  {    
+  {
     fprintf (stderr,
             ".");
     if (NULL == (pk = GNUNET_CRYPTO_ecc_key_create ()))
@@ -74,7 +74,7 @@ create_keys (const char *fn)
        GNUNET_break (0);
        break;
     }
-    if (GNUNET_TESTING_HOSTKEYFILESIZE != 
+    if (GNUNET_TESTING_HOSTKEYFILESIZE !=
        fwrite (pk, 1,
                GNUNET_TESTING_HOSTKEYFILESIZE, f))
     {
@@ -82,10 +82,10 @@ create_keys (const char *fn)
               _("\nFailed to write to `%s': %s\n"),
               fn,
               STRERROR (errno));
-      GNUNET_CRYPTO_ecc_key_free (pk);
+      GNUNET_free (pk);
       break;
     }
-    GNUNET_CRYPTO_ecc_key_free (pk);
+    GNUNET_free (pk);
   }
   if (UINT_MAX == make_keys)
     fprintf (stderr,
@@ -110,8 +110,7 @@ run (void *cls, char *const *args, const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
   struct GNUNET_CRYPTO_EccPrivateKey *pk;
-  struct GNUNET_CRYPTO_EccPublicKey pub;
-  struct GNUNET_PeerIdentity pid;
+  struct GNUNET_CRYPTO_EccPublicSignKey pub;
 
   if (NULL == args[0])
   {
@@ -130,21 +129,23 @@ run (void *cls, char *const *args, const char *cfgfile,
   {
     char *s;
 
-    GNUNET_CRYPTO_ecc_key_get_public (pk, &pub);
-    s = GNUNET_CRYPTO_ecc_public_key_to_string (&pub);
+    GNUNET_CRYPTO_ecc_key_get_public_for_signature (pk, &pub);
+    s = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pub);
     fprintf (stdout, "%s\n", s);
     GNUNET_free (s);
   }
   if (print_peer_identity)
   {
-    struct GNUNET_CRYPTO_HashAsciiEncoded enc;
-
-    GNUNET_CRYPTO_ecc_key_get_public (pk, &pub);
-    GNUNET_CRYPTO_hash (&pub, sizeof (pub), &pid.hashPubKey);
-    GNUNET_CRYPTO_hash_to_enc (&pid.hashPubKey, &enc);
-    fprintf (stdout, "%s\n", enc.encoding);
+    char *str;
+
+    GNUNET_CRYPTO_ecc_key_get_public_for_signature (pk, &pub);
+    str = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pub);
+    fprintf (stdout,
+             "%s\n",
+             str);
+    GNUNET_free (str);
   }
-  GNUNET_CRYPTO_ecc_key_free (pk);
+  GNUNET_free (pk);
 }