diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-08-17 14:45:46 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-08-17 14:46:08 +0200 |
commit | 6f2ee9eb3c3642147fe381976ffeb88d0c3288e5 (patch) | |
tree | 26a66a4d123c667aa88d2aa5595add21390d53a8 /src/nse | |
parent | f6acda6d3299bda2e6ea6e38bef5cabfb01b8ab9 (diff) | |
download | gnunet-6f2ee9eb3c3642147fe381976ffeb88d0c3288e5.tar.gz gnunet-6f2ee9eb3c3642147fe381976ffeb88d0c3288e5.zip |
clean up GNUNET_CRYPTO_pow_hash API
Diffstat (limited to 'src/nse')
-rw-r--r-- | src/nse/gnunet-service-nse.c | 9 | ||||
-rw-r--r-- | src/nse/perf_kdf.c | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index ebf39585e..dfd71e57a 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c | |||
@@ -113,6 +113,11 @@ static struct GNUNET_BIO_WriteHandle *histogram; | |||
113 | 113 | ||
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | /** | ||
117 | * Salt for PoW calcualations. | ||
118 | */ | ||
119 | static struct GNUNET_CRYPTO_PowSalt salt = { "gnunet-nse-proof" }; | ||
120 | |||
116 | 121 | ||
117 | /** | 122 | /** |
118 | * Per-peer information. | 123 | * Per-peer information. |
@@ -806,7 +811,7 @@ check_proof_of_work (const struct GNUNET_CRYPTO_EddsaPublicKey *pkey, | |||
806 | GNUNET_memcpy (&buf[sizeof(val)], | 811 | GNUNET_memcpy (&buf[sizeof(val)], |
807 | pkey, | 812 | pkey, |
808 | sizeof(struct GNUNET_CRYPTO_EddsaPublicKey)); | 813 | sizeof(struct GNUNET_CRYPTO_EddsaPublicKey)); |
809 | GNUNET_CRYPTO_pow_hash ("gnunet-nse-proof", | 814 | GNUNET_CRYPTO_pow_hash (&salt, |
810 | buf, | 815 | buf, |
811 | sizeof(buf), | 816 | sizeof(buf), |
812 | &result); | 817 | &result); |
@@ -861,7 +866,7 @@ find_proof (void *cls) | |||
861 | while ((counter != UINT64_MAX) && (i < ROUND_SIZE)) | 866 | while ((counter != UINT64_MAX) && (i < ROUND_SIZE)) |
862 | { | 867 | { |
863 | GNUNET_memcpy (buf, &counter, sizeof(uint64_t)); | 868 | GNUNET_memcpy (buf, &counter, sizeof(uint64_t)); |
864 | GNUNET_CRYPTO_pow_hash ("gnunet-nse-proof", | 869 | GNUNET_CRYPTO_pow_hash (&salt, |
865 | buf, | 870 | buf, |
866 | sizeof(buf), | 871 | sizeof(buf), |
867 | &result); | 872 | &result); |
diff --git a/src/nse/perf_kdf.c b/src/nse/perf_kdf.c index 89b70903a..10207675f 100644 --- a/src/nse/perf_kdf.c +++ b/src/nse/perf_kdf.c | |||
@@ -34,10 +34,11 @@ perfHash () | |||
34 | { | 34 | { |
35 | struct GNUNET_HashCode hc; | 35 | struct GNUNET_HashCode hc; |
36 | char buf[64]; | 36 | char buf[64]; |
37 | struct GNUNET_CRYPTO_PowSalt salt = { "gnunet-nse-proof" }; | ||
37 | 38 | ||
38 | memset (buf, 1, sizeof(buf)); | 39 | memset (buf, 1, sizeof(buf)); |
39 | for (unsigned int i = 0; i < 1024; i++) | 40 | for (unsigned int i = 0; i < 1024; i++) |
40 | GNUNET_CRYPTO_pow_hash ("gnunet-nse-proof", | 41 | GNUNET_CRYPTO_pow_hash (&salt, |
41 | buf, | 42 | buf, |
42 | sizeof(buf), | 43 | sizeof(buf), |
43 | &hc); | 44 | &hc); |