aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-12-05 18:56:38 +0000
committerBart Polot <bart@net.in.tum.de>2013-12-05 18:56:38 +0000
commit8ba2dddfc8ca28972519a5d5e69ccba5719558c3 (patch)
treec40ca4ac03848e0caed76d8a06e3589992690d4f /src
parent120768fde7a54d51a67330d7744376dab671535f (diff)
downloadgnunet-8ba2dddfc8ca28972519a5d5e69ccba5719558c3.tar.gz
gnunet-8ba2dddfc8ca28972519a5d5e69ccba5719558c3.zip
- add peer cmp
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_crypto_lib.h13
-rw-r--r--src/util/crypto_ecc.c17
2 files changed, 30 insertions, 0 deletions
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index 8bb851ff1..ebe500339 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -1096,6 +1096,19 @@ int
1096GNUNET_CRYPTO_get_peer_identity (const struct GNUNET_CONFIGURATION_Handle *cfg, 1096GNUNET_CRYPTO_get_peer_identity (const struct GNUNET_CONFIGURATION_Handle *cfg,
1097 struct GNUNET_PeerIdentity *dst); 1097 struct GNUNET_PeerIdentity *dst);
1098 1098
1099/**
1100 * Compare two Peer Identities.
1101 *
1102 * @param first first peer identity
1103 * @param second second peer identity
1104 * @return bigger than 0 if first > second,
1105 * 0 if they are the same
1106 * smaller than 0 if second > first
1107 */
1108int
1109GNUNET_CRYPTO_cmp_peer_identity (const struct GNUNET_PeerIdentity *first,
1110 const struct GNUNET_PeerIdentity *second);
1111
1099 1112
1100/** 1113/**
1101 * @ingroup crypto 1114 * @ingroup crypto
diff --git a/src/util/crypto_ecc.c b/src/util/crypto_ecc.c
index c5e3b1008..0c9b2fcd7 100644
--- a/src/util/crypto_ecc.c
+++ b/src/util/crypto_ecc.c
@@ -1110,6 +1110,23 @@ GNUNET_CRYPTO_get_peer_identity (const struct GNUNET_CONFIGURATION_Handle *cfg,
1110 1110
1111 1111
1112/** 1112/**
1113 * Compare two Peer Identities.
1114 *
1115 * @param first first peer identity
1116 * @param second second peer identity
1117 * @return bigger than 0 if first > second,
1118 * 0 if they are the same
1119 * smaller than 0 if second > first
1120 */
1121int
1122GNUNET_CRYPTO_cmp_peer_identity (const struct GNUNET_PeerIdentity *first,
1123 const struct GNUNET_PeerIdentity *second)
1124{
1125 return memcmp (first, second, sizeof (struct GNUNET_PeerIdentity));
1126}
1127
1128
1129/**
1113 * Convert the data specified in the given purpose argument to an 1130 * Convert the data specified in the given purpose argument to an
1114 * S-expression suitable for signature operations. 1131 * S-expression suitable for signature operations.
1115 * 1132 *