gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r31084 - in gnunet/src: include util


From: gnunet
Subject: [GNUnet-SVN] r31084 - in gnunet/src: include util
Date: Thu, 5 Dec 2013 19:56:38 +0100

Author: bartpolot
Date: 2013-12-05 19:56:38 +0100 (Thu, 05 Dec 2013)
New Revision: 31084

Modified:
   gnunet/src/include/gnunet_crypto_lib.h
   gnunet/src/util/crypto_ecc.c
Log:
- add peer cmp


Modified: gnunet/src/include/gnunet_crypto_lib.h
===================================================================
--- gnunet/src/include/gnunet_crypto_lib.h      2013-12-05 18:55:46 UTC (rev 
31083)
+++ gnunet/src/include/gnunet_crypto_lib.h      2013-12-05 18:56:38 UTC (rev 
31084)
@@ -1096,7 +1096,20 @@
 GNUNET_CRYPTO_get_peer_identity (const struct GNUNET_CONFIGURATION_Handle *cfg,
                                  struct GNUNET_PeerIdentity *dst);
 
+/**
+ * Compare two Peer Identities.
+ *
+ * @param first first peer identity
+ * @param second second peer identity
+ * @return bigger than 0 if first > second,
+ *         0 if they are the same
+ *         smaller than 0 if second > first
+ */
+int
+GNUNET_CRYPTO_cmp_peer_identity (const struct GNUNET_PeerIdentity *first,
+                                 const struct GNUNET_PeerIdentity *second);
 
+
 /**
  * @ingroup crypto
  * Derive key material from a public and a private ECC key.

Modified: gnunet/src/util/crypto_ecc.c
===================================================================
--- gnunet/src/util/crypto_ecc.c        2013-12-05 18:55:46 UTC (rev 31083)
+++ gnunet/src/util/crypto_ecc.c        2013-12-05 18:56:38 UTC (rev 31084)
@@ -1110,6 +1110,23 @@
 
 
 /**
+ * Compare two Peer Identities.
+ *
+ * @param first first peer identity
+ * @param second second peer identity
+ * @return bigger than 0 if first > second,
+ *         0 if they are the same
+ *         smaller than 0 if second > first
+ */
+int
+GNUNET_CRYPTO_cmp_peer_identity (const struct GNUNET_PeerIdentity *first,
+                                 const struct GNUNET_PeerIdentity *second)
+{
+  return memcmp (first, second, sizeof (struct GNUNET_PeerIdentity));
+}
+
+
+/**
  * Convert the data specified in the given purpose argument to an
  * S-expression suitable for signature operations.
  *




reply via email to

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