gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r26262 - in gnunet/src: fs include


From: gnunet
Subject: [GNUnet-SVN] r26262 - in gnunet/src: fs include
Date: Sun, 3 Mar 2013 02:57:10 +0100

Author: LRN
Date: 2013-03-03 02:57:10 +0100 (Sun, 03 Mar 2013)
New Revision: 26262

Modified:
   gnunet/src/fs/fs_namespace.c
   gnunet/src/fs/fs_uri.c
   gnunet/src/include/gnunet_fs_service.h
Log:
Implement and use GNUNET_FS_namespace_get_public_key_hash

Modified: gnunet/src/fs/fs_namespace.c
===================================================================
--- gnunet/src/fs/fs_namespace.c        2013-03-03 01:57:04 UTC (rev 26261)
+++ gnunet/src/fs/fs_namespace.c        2013-03-03 01:57:10 UTC (rev 26262)
@@ -496,6 +496,25 @@
 
 
 /**
+ * Get hash of the public key of a namespace.
+ *
+ * @param ns namespace
+ * @param id buffer to store the key in
+ * @return GNUNET_OK on success
+ *         GNUNET_SYSERR on failure (contents of id remain intact)
+ */
+int
+GNUNET_FS_namespace_get_public_key_hash (struct GNUNET_FS_Namespace *ns,
+    struct GNUNET_HashCode *id)
+{
+  if ((NULL == ns) || (NULL == id))
+    return GNUNET_SYSERR;
+  GNUNET_CRYPTO_rsa_get_public_key_hash (ns->key, id);
+  return GNUNET_OK;
+}
+
+
+/**
  * Function called with a filename of a namespace. Reads the key and
  * calls the callback.
  *

Modified: gnunet/src/fs/fs_uri.c
===================================================================
--- gnunet/src/fs/fs_uri.c      2013-03-03 01:57:04 UTC (rev 26261)
+++ gnunet/src/fs/fs_uri.c      2013-03-03 01:57:10 UTC (rev 26262)
@@ -948,8 +948,7 @@
 
   ns_uri = GNUNET_malloc (sizeof (struct GNUNET_FS_Uri));
   ns_uri->type = GNUNET_FS_URI_SKS;
-  GNUNET_CRYPTO_rsa_key_get_public (ns->key, &pk);
-  GNUNET_CRYPTO_hash (&pk, sizeof (pk), &ns_uri->data.sks.ns);
+  GNUNET_FS_namespace_get_public_key_hash (ns, &ns_uri->data.sks.ns);
   ns_uri->data.sks.identifier = GNUNET_strdup (id);
   return ns_uri;
 }

Modified: gnunet/src/include/gnunet_fs_service.h
===================================================================
--- gnunet/src/include/gnunet_fs_service.h      2013-03-03 01:57:04 UTC (rev 
26261)
+++ gnunet/src/include/gnunet_fs_service.h      2013-03-03 01:57:10 UTC (rev 
26262)
@@ -2289,6 +2289,19 @@
 
 
 /**
+ * Get hash of the public key of a namespace.
+ *
+ * @param ns namespace
+ * @param id buffer to store the key in
+ * @return GNUNET_OK on success
+ *         GNUNET_SYSERR on failure (contents of id remain intact)
+ */
+int
+GNUNET_FS_namespace_get_public_key_hash (struct GNUNET_FS_Namespace *ns,
+    struct GNUNET_HashCode *id);
+
+
+/**
  * Delete a namespace handle.  Can be used for a clean shutdown (free
  * memory) or also to freeze the namespace to prevent further
  * insertions by anyone.




reply via email to

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