diff options
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/util/crypto_pow.c | 40 |
3 files changed, 4 insertions, 40 deletions
@@ -96,6 +96,8 @@ These are the direct dependencies for running GNUnet: | |||
96 | - which (contrib/apparmor(?), gnunet-bugreport, | 96 | - which (contrib/apparmor(?), gnunet-bugreport, |
97 | and possibly more) | 97 | and possibly more) |
98 | - zlib | 98 | - zlib |
99 | - argon2 >= 20190702 (for proof-of-work calculations in | ||
100 | revocation) | ||
99 | 101 | ||
100 | These are the dependencies for GNUnet's testsuite: | 102 | These are the dependencies for GNUnet's testsuite: |
101 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 103 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
diff --git a/configure.ac b/configure.ac index 3b3c9cbe9..b6e44f90e 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1033,6 +1033,8 @@ AS_IF([test x$nss = xfalse], | |||
1033 | AC_CHECK_LIB([kvm],[kvm_open]) | 1033 | AC_CHECK_LIB([kvm],[kvm_open]) |
1034 | AC_CHECK_LIB([kstat],[kstat_open]) | 1034 | AC_CHECK_LIB([kstat],[kstat_open]) |
1035 | 1035 | ||
1036 | # test for argon2 (for POW) | ||
1037 | AC_CHECK_LIB([argon2],[argon2d_hash_raw]) | ||
1036 | 1038 | ||
1037 | # test for libextractor | 1039 | # test for libextractor |
1038 | extractor=0 | 1040 | extractor=0 |
diff --git a/src/util/crypto_pow.c b/src/util/crypto_pow.c index 1ab4443d1..35511a130 100644 --- a/src/util/crypto_pow.c +++ b/src/util/crypto_pow.c | |||
@@ -25,11 +25,8 @@ | |||
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_crypto_lib.h" | 27 | #include "gnunet_crypto_lib.h" |
28 | #include <gcrypt.h> | ||
29 | #include <argon2.h> | 28 | #include <argon2.h> |
30 | 29 | ||
31 | #define LSD0001 | ||
32 | |||
33 | /** | 30 | /** |
34 | * Calculate the 'proof-of-work' hash (an expensive hash). | 31 | * Calculate the 'proof-of-work' hash (an expensive hash). |
35 | * We're using a non-standard formula to avoid issues with | 32 | * We're using a non-standard formula to avoid issues with |
@@ -46,7 +43,6 @@ GNUNET_CRYPTO_pow_hash (const char *salt, | |||
46 | size_t buf_len, | 43 | size_t buf_len, |
47 | struct GNUNET_HashCode *result) | 44 | struct GNUNET_HashCode *result) |
48 | { | 45 | { |
49 | #ifdef LSD0001 | ||
50 | GNUNET_break (ARGON2_OK == argon2d_hash_raw (3, /* iterations */ | 46 | GNUNET_break (ARGON2_OK == argon2d_hash_raw (3, /* iterations */ |
51 | 1024, /* memory (1 MiB) */ | 47 | 1024, /* memory (1 MiB) */ |
52 | 1, /* threads */ | 48 | 1, /* threads */ |
@@ -58,42 +54,6 @@ GNUNET_CRYPTO_pow_hash (const char *salt, | |||
58 | sizeof (struct | 54 | sizeof (struct |
59 | GNUNET_HashCode))); | 55 | GNUNET_HashCode))); |
60 | 56 | ||
61 | #else | ||
62 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; | ||
63 | struct GNUNET_CRYPTO_SymmetricSessionKey skey; | ||
64 | char rbuf[buf_len]; | ||
65 | |||
66 | GNUNET_break (0 == gcry_kdf_derive (buf, | ||
67 | buf_len, | ||
68 | GCRY_KDF_SCRYPT, | ||
69 | 1 /* subalgo */, | ||
70 | salt, | ||
71 | strlen (salt), | ||
72 | 2 /* iterations; keep cost of individual op small */, | ||
73 | sizeof(skey), | ||
74 | &skey)); | ||
75 | GNUNET_CRYPTO_symmetric_derive_iv (&iv, | ||
76 | &skey, | ||
77 | "gnunet-proof-of-work-iv", | ||
78 | strlen ("gnunet-proof-of-work-iv"), | ||
79 | salt, | ||
80 | strlen (salt), | ||
81 | NULL, 0); | ||
82 | GNUNET_CRYPTO_symmetric_encrypt (buf, | ||
83 | buf_len, | ||
84 | &skey, | ||
85 | &iv, | ||
86 | &rbuf); | ||
87 | GNUNET_break (0 == gcry_kdf_derive (rbuf, | ||
88 | buf_len, | ||
89 | GCRY_KDF_SCRYPT, | ||
90 | 1 /* subalgo */, | ||
91 | salt, | ||
92 | strlen (salt), | ||
93 | 2 /* iterations; keep cost of individual op small */, | ||
94 | sizeof(struct GNUNET_HashCode), | ||
95 | result)); | ||
96 | #endif | ||
97 | } | 57 | } |
98 | 58 | ||
99 | 59 | ||