gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r28711 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r28711 - gnunet/src/util
Date: Mon, 19 Aug 2013 21:09:28 +0200

Author: grothoff
Date: 2013-08-19 21:09:28 +0200 (Mon, 19 Aug 2013)
New Revision: 28711

Modified:
   gnunet/src/util/crypto_ecc.c
   gnunet/src/util/gnunet-ecc.c
   gnunet/src/util/network.c
Log:
-eliminate more uses of ShortHashCode, breaks signatures

Modified: gnunet/src/util/crypto_ecc.c
===================================================================
--- gnunet/src/util/crypto_ecc.c        2013-08-19 18:56:26 UTC (rev 28710)
+++ gnunet/src/util/crypto_ecc.c        2013-08-19 19:09:28 UTC (rev 28711)
@@ -711,14 +711,14 @@
 static gcry_sexp_t
 data_to_pkcs1 (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose)
 {
-  struct GNUNET_CRYPTO_ShortHashCode hc;
+  struct GNUNET_HashCode hc;
   gcry_sexp_t data;
   int rc;
 
-  GNUNET_CRYPTO_short_hash (purpose, ntohl (purpose->size), &hc);
+  GNUNET_CRYPTO_hash (purpose, ntohl (purpose->size), &hc);
   if (0 != (rc = gcry_sexp_build (&data, NULL,
                                  "(data(flags rfc6979)(hash %s %b))",
-                                 "sha256",
+                                 "sha512",
                                  sizeof (hc),
                                  &hc)))
   {

Modified: gnunet/src/util/gnunet-ecc.c
===================================================================
--- gnunet/src/util/gnunet-ecc.c        2013-08-19 18:56:26 UTC (rev 28710)
+++ gnunet/src/util/gnunet-ecc.c        2013-08-19 19:09:28 UTC (rev 28711)
@@ -40,11 +40,6 @@
 static int print_peer_identity;
 
 /**
- * Flag for printing short hash of public key.
- */
-static int print_short_identity;
-
-/**
  * Option set to create a bunch of keys at once.
  */
 static unsigned int make_keys;
@@ -149,16 +144,6 @@
     GNUNET_CRYPTO_hash_to_enc (&pid.hashPubKey, &enc);
     fprintf (stdout, "%s\n", enc.encoding);
   }
-  if (print_short_identity)
-  {
-    struct GNUNET_CRYPTO_ShortHashAsciiEncoded enc;
-    struct GNUNET_CRYPTO_ShortHashCode sh;
-
-    GNUNET_CRYPTO_ecc_key_get_public (pk, &pub);
-    GNUNET_CRYPTO_short_hash (&pub, sizeof (pub), &sh);
-    GNUNET_CRYPTO_short_hash_to_enc (&sh, &enc);
-    fprintf (stdout, "%s\n", enc.short_encoding);
-  }
   GNUNET_CRYPTO_ecc_key_free (pk);
 }
 
@@ -183,9 +168,6 @@
     { 'P', "print-peer-identity", NULL,
       gettext_noop ("print the hash of the public key in ASCII format"),
       0, &GNUNET_GETOPT_set_one, &print_peer_identity },
-    { 's', "print-short-identity", NULL,
-      gettext_noop ("print the short hash of the public key in ASCII format"),
-      0, &GNUNET_GETOPT_set_one, &print_short_identity },
     GNUNET_GETOPT_OPTION_END
   };
   int ret;

Modified: gnunet/src/util/network.c
===================================================================
--- gnunet/src/util/network.c   2013-08-19 18:56:26 UTC (rev 28710)
+++ gnunet/src/util/network.c   2013-08-19 19:09:28 UTC (rev 28711)
@@ -114,16 +114,16 @@
   struct sockaddr_un dummy;
   size_t slen;
   char *end;
-  struct GNUNET_CRYPTO_ShortHashCode sh;
-  struct GNUNET_CRYPTO_ShortHashAsciiEncoded ae;
+  struct GNUNET_HashCode sh;
+  struct GNUNET_CRYPTO_HashAsciiEncoded ae;
   size_t upm;
 
   upm = sizeof (dummy.sun_path);   
   slen = strlen (unixpath);
   if (slen < upm)
     return unixpath; /* no shortening required */
-  GNUNET_CRYPTO_short_hash (unixpath, slen, &sh);
-  while (sizeof (struct GNUNET_CRYPTO_ShortHashAsciiEncoded) + 
+  GNUNET_CRYPTO_hash (unixpath, slen, &sh);
+  while (sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) + 
         strlen (unixpath) >= upm)
   {
     if (NULL == (end = strrchr (unixpath, '/')))
@@ -136,8 +136,8 @@
     }
     *end = '\0';
   }
-  GNUNET_CRYPTO_short_hash_to_enc (&sh, &ae);
-  strcat (unixpath, (char*) ae.short_encoding);
+  GNUNET_CRYPTO_hash_to_enc (&sh, &ae);
+  strcat (unixpath, (char*) ae.encoding);
   return unixpath;
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]