diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/Makefile.am | 1 | ||||
-rw-r--r-- | src/util/crypto_pow.c | 25 | ||||
-rw-r--r-- | src/util/gnunet-scrypt.c | 2 |
3 files changed, 14 insertions, 14 deletions
diff --git a/src/util/Makefile.am b/src/util/Makefile.am index f3373fc38..83b3b9c3d 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am | |||
@@ -131,7 +131,6 @@ libgnunetutil_la_LIBADD = \ | |||
131 | $(LIBIDN) $(LIBIDN2) \ | 131 | $(LIBIDN) $(LIBIDN2) \ |
132 | $(Z_LIBS) \ | 132 | $(Z_LIBS) \ |
133 | -lunistring \ | 133 | -lunistring \ |
134 | -largon2 \ | ||
135 | -lsodium \ | 134 | -lsodium \ |
136 | $(XLIB) \ | 135 | $(XLIB) \ |
137 | $(PTHREAD) | 136 | $(PTHREAD) |
diff --git a/src/util/crypto_pow.c b/src/util/crypto_pow.c index 6176afc33..cfa0676d0 100644 --- a/src/util/crypto_pow.c +++ b/src/util/crypto_pow.c | |||
@@ -25,14 +25,14 @@ | |||
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_crypto_lib.h" | 27 | #include "gnunet_crypto_lib.h" |
28 | #include <argon2.h> | 28 | #include <sodium.h> |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * Calculate the 'proof-of-work' hash (an expensive hash). | 31 | * Calculate the 'proof-of-work' hash (an expensive hash). |
32 | * We're using a non-standard formula to avoid issues with | 32 | * We're using a non-standard formula to avoid issues with |
33 | * ASICs appearing (see #3795). | 33 | * ASICs appearing (see #3795). |
34 | * | 34 | * |
35 | * @param salt salt for the hash | 35 | * @param salt salt for the hash. Must be crypto_pwhash_argon2id_SALTBYTES long. |
36 | * @param buf data to hash | 36 | * @param buf data to hash |
37 | * @param buf_len number of bytes in @a buf | 37 | * @param buf_len number of bytes in @a buf |
38 | * @param result where to write the resulting hash | 38 | * @param result where to write the resulting hash |
@@ -43,16 +43,17 @@ GNUNET_CRYPTO_pow_hash (const char *salt, | |||
43 | size_t buf_len, | 43 | size_t buf_len, |
44 | struct GNUNET_HashCode *result) | 44 | struct GNUNET_HashCode *result) |
45 | { | 45 | { |
46 | GNUNET_break (ARGON2_OK == | 46 | GNUNET_assert (strlen (salt) == crypto_pwhash_argon2id_SALTBYTES); |
47 | argon2id_hash_raw (3, /* iterations */ | 47 | /* Threads hardcoded at 1 in libsodium */ |
48 | 1024, /* memory (1 MiB) */ | 48 | GNUNET_break (0 == |
49 | 1, /* threads */ | 49 | crypto_pwhash_argon2id ((unsigned char *) result, |
50 | buf, | 50 | sizeof (struct GNUNET_HashCode), |
51 | buf_len, | 51 | buf, |
52 | salt, | 52 | buf_len, |
53 | strlen (salt), | 53 | (unsigned char*) salt, |
54 | result, | 54 | 3, /* iterations */ |
55 | sizeof (struct GNUNET_HashCode))); | 55 | 1024 * 1024, /* memory (1 MiB) */ |
56 | crypto_pwhash_argon2id_ALG_ARGON2ID13)); | ||
56 | } | 57 | } |
57 | 58 | ||
58 | 59 | ||
diff --git a/src/util/gnunet-scrypt.c b/src/util/gnunet-scrypt.c index 9bb766595..7d13ce469 100644 --- a/src/util/gnunet-scrypt.c +++ b/src/util/gnunet-scrypt.c | |||
@@ -117,7 +117,7 @@ find_proof (void *cls) | |||
117 | while ((counter != UINT64_MAX) && (i < ROUND_SIZE)) | 117 | while ((counter != UINT64_MAX) && (i < ROUND_SIZE)) |
118 | { | 118 | { |
119 | GNUNET_memcpy (buf, &counter, sizeof(uint64_t)); | 119 | GNUNET_memcpy (buf, &counter, sizeof(uint64_t)); |
120 | GNUNET_CRYPTO_pow_hash ("gnunet-nse-proof-of-work", | 120 | GNUNET_CRYPTO_pow_hash ("gnunet-nse-proof", |
121 | buf, | 121 | buf, |
122 | sizeof(buf), | 122 | sizeof(buf), |
123 | &result); | 123 | &result); |