aboutsummaryrefslogtreecommitdiff
path: root/src/nse/gnunet-service-nse.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nse/gnunet-service-nse.c')
-rw-r--r--src/nse/gnunet-service-nse.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c
index 7aabca6b5..29a038d3b 100644
--- a/src/nse/gnunet-service-nse.c
+++ b/src/nse/gnunet-service-nse.c
@@ -190,7 +190,7 @@ struct GNUNET_NSE_FloodMessage
190 /** 190 /**
191 * Public key of the originator. 191 * Public key of the originator.
192 */ 192 */
193 struct GNUNET_CRYPTO_EccPublicKey pkey; 193 struct GNUNET_CRYPTO_EccPublicSignKey pkey;
194 194
195 /** 195 /**
196 * Proof of work, causing leading zeros when hashed with pkey. 196 * Proof of work, causing leading zeros when hashed with pkey.
@@ -289,7 +289,7 @@ static struct GNUNET_TIME_Absolute current_timestamp;
289/** 289/**
290 * The public key of this peer. 290 * The public key of this peer.
291 */ 291 */
292static struct GNUNET_CRYPTO_EccPublicKey my_public_key; 292static struct GNUNET_CRYPTO_EccPublicSignKey my_public_key;
293 293
294/** 294/**
295 * The private key of this peer. 295 * The private key of this peer.
@@ -845,16 +845,16 @@ count_leading_zeroes (const struct GNUNET_HashCode * hash)
845 * @return GNUNET_YES if valid, GNUNET_NO if not 845 * @return GNUNET_YES if valid, GNUNET_NO if not
846 */ 846 */
847static int 847static int
848check_proof_of_work (const struct GNUNET_CRYPTO_EccPublicKey *pkey, 848check_proof_of_work (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey,
849 uint64_t val) 849 uint64_t val)
850{ 850{
851 char buf[sizeof (struct GNUNET_CRYPTO_EccPublicKey) + 851 char buf[sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
852 sizeof (val)] GNUNET_ALIGN; 852 sizeof (val)] GNUNET_ALIGN;
853 struct GNUNET_HashCode result; 853 struct GNUNET_HashCode result;
854 854
855 memcpy (buf, &val, sizeof (val)); 855 memcpy (buf, &val, sizeof (val));
856 memcpy (&buf[sizeof (val)], pkey, 856 memcpy (&buf[sizeof (val)], pkey,
857 sizeof (struct GNUNET_CRYPTO_EccPublicKey)); 857 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey));
858 pow_hash (buf, sizeof (buf), &result); 858 pow_hash (buf, sizeof (buf), &result);
859 return (count_leading_zeroes (&result) >= 859 return (count_leading_zeroes (&result) >=
860 nse_work_required) ? GNUNET_YES : GNUNET_NO; 860 nse_work_required) ? GNUNET_YES : GNUNET_NO;
@@ -893,14 +893,14 @@ find_proof (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
893{ 893{
894#define ROUND_SIZE 10 894#define ROUND_SIZE 10
895 uint64_t counter; 895 uint64_t counter;
896 char buf[sizeof (struct GNUNET_CRYPTO_EccPublicKey) + 896 char buf[sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
897 sizeof (uint64_t)] GNUNET_ALIGN; 897 sizeof (uint64_t)] GNUNET_ALIGN;
898 struct GNUNET_HashCode result; 898 struct GNUNET_HashCode result;
899 unsigned int i; 899 unsigned int i;
900 900
901 proof_task = GNUNET_SCHEDULER_NO_TASK; 901 proof_task = GNUNET_SCHEDULER_NO_TASK;
902 memcpy (&buf[sizeof (uint64_t)], &my_public_key, 902 memcpy (&buf[sizeof (uint64_t)], &my_public_key,
903 sizeof (struct GNUNET_CRYPTO_EccPublicKey)); 903 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey));
904 i = 0; 904 i = 0;
905 counter = my_proof; 905 counter = my_proof;
906 while ((counter != UINT64_MAX) && (i < ROUND_SIZE)) 906 while ((counter != UINT64_MAX) && (i < ROUND_SIZE))
@@ -1053,7 +1053,7 @@ handle_p2p_size_estimate (void *cls, const struct GNUNET_PeerIdentity *peer,
1053 struct GNUNET_PeerIdentity os; 1053 struct GNUNET_PeerIdentity os;
1054 1054
1055 GNUNET_CRYPTO_hash (&incoming_flood->pkey, 1055 GNUNET_CRYPTO_hash (&incoming_flood->pkey,
1056 sizeof (struct GNUNET_CRYPTO_EccPublicKey), 1056 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
1057 &os.hashPubKey); 1057 &os.hashPubKey);
1058 GNUNET_snprintf (origin, sizeof (origin), "%s", GNUNET_i2s (&os)); 1058 GNUNET_snprintf (origin, sizeof (origin), "%s", GNUNET_i2s (&os));
1059 GNUNET_snprintf (pred, sizeof (pred), "%s", GNUNET_i2s (peer)); 1059 GNUNET_snprintf (pred, sizeof (pred), "%s", GNUNET_i2s (peer));
@@ -1461,7 +1461,7 @@ run (void *cls,
1461 GNUNET_free (keyfile); 1461 GNUNET_free (keyfile);
1462 GNUNET_assert (NULL != pk); 1462 GNUNET_assert (NULL != pk);
1463 my_private_key = pk; 1463 my_private_key = pk;
1464 GNUNET_CRYPTO_ecc_key_get_public (my_private_key, &my_public_key); 1464 GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, &my_public_key);
1465 GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key), 1465 GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key),
1466 &my_identity.hashPubKey); 1466 &my_identity.hashPubKey);
1467 if (GNUNET_OK != 1467 if (GNUNET_OK !=