aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-08-18 11:08:39 +0200
committerChristian Grothoff <christian@grothoff.org>2020-08-18 11:08:39 +0200
commit5570a5d03703c9e864544febe9fbaa6ccfef83ee (patch)
tree23b770538a53fb1c9dd09c1a36ee25bf435c6652
parent53cc51e0df6bcf1417ef058e0d5843c7f89933d5 (diff)
parent2bce42e5b3630f3835f401e5eeed23a56b7bd875 (diff)
downloadgnunet-5570a5d03703c9e864544febe9fbaa6ccfef83ee.tar.gz
gnunet-5570a5d03703c9e864544febe9fbaa6ccfef83ee.zip
Merge branch 'master' of git+ssh://gnunet.org/gnunet
-rwxr-xr-xbootstrap8
-rw-r--r--configure.ac6
-rw-r--r--po/POTFILES.in13
-rw-r--r--src/include/gnunet_crypto_lib.h12
-rw-r--r--src/nse/gnunet-service-nse.c9
-rw-r--r--src/nse/perf_kdf.c3
-rw-r--r--src/revocation/revocation_api.c6
-rw-r--r--src/util/crypto_pow.c3
-rw-r--r--src/util/gnunet-scrypt.c9
-rw-r--r--src/util/test_os_start_process.c19
10 files changed, 48 insertions, 40 deletions
diff --git a/bootstrap b/bootstrap
index df0e58dda..8fc4c4426 100755
--- a/bootstrap
+++ b/bootstrap
@@ -97,15 +97,15 @@ submodules()
97 if ! git --version >/dev/null; then 97 if ! git --version >/dev/null; then
98 echo "git not installed, skipping submodule update" 98 echo "git not installed, skipping submodule update"
99 else 99 else
100 git submodule update --init || true 100 git submodule update --init || exit 1
101 git submodule update --recursive || true 101 git submodule update --recursive || exit 1
102 git submodule sync || true 102 git submodule sync || exit 1
103 fi 103 fi
104} 104}
105 105
106init_buildcommon_include() 106init_buildcommon_include()
107{ 107{
108 cp contrib/build-common/Makefile.inc contrib/Makefile.inc || true 108 cp contrib/build-common/Makefile.inc contrib/Makefile.inc || exit 1
109} 109}
110 110
111main() 111main()
diff --git a/configure.ac b/configure.ac
index bb205220c..72309c78d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,9 +142,11 @@ AS_CASE(["$host_os"],
142 UNIXONLY="#" 142 UNIXONLY="#"
143 ], 143 ],
144 [*openbsd*],[ 144 [*openbsd*],[
145 LIBS=`echo $LIBS | sed -e "s/-ldl//"` 145 # We need to explicitly link libc
146 LDFLAGS="$LDFLAGS -Wl,-lc"
147 # We also need to enable PIC
148 CFLAGS="-fPIC $CFLAGS"
146 build_target="openbsd" 149 build_target="openbsd"
147 use_openbsd_libtool=true
148 LIBPREFIX= 150 LIBPREFIX=
149 DLLDIR=lib 151 DLLDIR=lib
150 UNIXONLY="#" 152 UNIXONLY="#"
diff --git a/po/POTFILES.in b/po/POTFILES.in
index c5503c343..7d19122ca 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -333,19 +333,8 @@ src/set/ibf.c
333src/set/ibf_sim.c 333src/set/ibf_sim.c
334src/set/plugin_block_set_test.c 334src/set/plugin_block_set_test.c
335src/set/set_api.c 335src/set/set_api.c
336src/seti/gnunet-service-set.c
337src/seti/gnunet-service-set_intersection.c
338src/seti/gnunet-service-set_union.c
339src/seti/gnunet-service-set_union_strata_estimator.c
340src/seti/gnunet-set-ibf-profiler.c
341src/seti/gnunet-set-profiler.c
342src/seti/ibf.c
343src/seti/ibf_sim.c
344src/seti/plugin_block_set_test.c
345src/seti/set_api.c
346src/setu/gnunet-service-set_union.c
347src/setu/gnunet-service-set_union_strata_estimator.c
348src/setu/gnunet-service-setu.c 336src/setu/gnunet-service-setu.c
337src/setu/gnunet-service-setu_strata_estimator.c
349src/setu/gnunet-setu-ibf-profiler.c 338src/setu/gnunet-setu-ibf-profiler.c
350src/setu/gnunet-setu-profiler.c 339src/setu/gnunet-setu-profiler.c
351src/setu/ibf.c 340src/setu/ibf.c
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index f8eef5406..8c3f4f058 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -50,6 +50,7 @@ extern "C" {
50#endif 50#endif
51#endif 51#endif
52 52
53#include <sodium.h>
53 54
54/** 55/**
55 * The identity of the host (wraps the signing key of the peer). 56 * The identity of the host (wraps the signing key of the peer).
@@ -668,6 +669,15 @@ GNUNET_CRYPTO_hash (const void *block,
668 669
669 670
670/** 671/**
672 * Value for a salt for #GNUNET_CRYPTO_pow_hash().
673 */
674struct GNUNET_CRYPTO_PowSalt
675{
676 char salt[crypto_pwhash_argon2id_SALTBYTES];
677};
678
679
680/**
671 * Calculate the 'proof-of-work' hash (an expensive hash). 681 * Calculate the 'proof-of-work' hash (an expensive hash).
672 * 682 *
673 * @param salt salt for the hash. Must be crypto_pwhash_argon2id_SALTBYTES long. 683 * @param salt salt for the hash. Must be crypto_pwhash_argon2id_SALTBYTES long.
@@ -676,7 +686,7 @@ GNUNET_CRYPTO_hash (const void *block,
676 * @param result where to write the resulting hash 686 * @param result where to write the resulting hash
677 */ 687 */
678void 688void
679GNUNET_CRYPTO_pow_hash (const char *salt, 689GNUNET_CRYPTO_pow_hash (const struct GNUNET_CRYPTO_PowSalt *salt,
680 const void *buf, 690 const void *buf,
681 size_t buf_len, 691 size_t buf_len,
682 struct GNUNET_HashCode *result); 692 struct GNUNET_HashCode *result);
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 */
119static 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);
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c
index e0b195aa9..75cfd8761 100644
--- a/src/revocation/revocation_api.c
+++ b/src/revocation/revocation_api.c
@@ -103,6 +103,8 @@ struct GNUNET_REVOCATION_PowCalculationHandle
103 103
104}; 104};
105 105
106static struct GNUNET_CRYPTO_PowSalt salt = { "GnsRevocationPow" };
107
106/** 108/**
107 * Generic error handler, called with the appropriate 109 * Generic error handler, called with the appropriate
108 * error code and the same closure specified at the creation of 110 * error code and the same closure specified at the creation of
@@ -483,7 +485,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
483 { 485 {
484 pow_val = GNUNET_ntohll (pow->pow[i]); 486 pow_val = GNUNET_ntohll (pow->pow[i]);
485 GNUNET_memcpy (buf, &pow->pow[i], sizeof(uint64_t)); 487 GNUNET_memcpy (buf, &pow->pow[i], sizeof(uint64_t));
486 GNUNET_CRYPTO_pow_hash ("GnsRevocationPow", 488 GNUNET_CRYPTO_pow_hash (&salt,
487 buf, 489 buf,
488 sizeof(buf), 490 sizeof(buf),
489 &result); 491 &result);
@@ -644,7 +646,7 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc)
644 GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], 646 GNUNET_memcpy (&buf[sizeof(uint64_t) * 2],
645 &pc->pow->key, 647 &pc->pow->key,
646 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); 648 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey));
647 GNUNET_CRYPTO_pow_hash ("GnsRevocationPow", 649 GNUNET_CRYPTO_pow_hash (&salt,
648 buf, 650 buf,
649 sizeof(buf), 651 sizeof(buf),
650 &result); 652 &result);
diff --git a/src/util/crypto_pow.c b/src/util/crypto_pow.c
index cfa0676d0..051a0c209 100644
--- a/src/util/crypto_pow.c
+++ b/src/util/crypto_pow.c
@@ -38,12 +38,11 @@
38 * @param result where to write the resulting hash 38 * @param result where to write the resulting hash
39 */ 39 */
40void 40void
41GNUNET_CRYPTO_pow_hash (const char *salt, 41GNUNET_CRYPTO_pow_hash (const struct GNUNET_CRYPTO_PowSalt *salt,
42 const void *buf, 42 const void *buf,
43 size_t buf_len, 43 size_t buf_len,
44 struct GNUNET_HashCode *result) 44 struct GNUNET_HashCode *result)
45{ 45{
46 GNUNET_assert (strlen (salt) == crypto_pwhash_argon2id_SALTBYTES);
47 /* Threads hardcoded at 1 in libsodium */ 46 /* Threads hardcoded at 1 in libsodium */
48 GNUNET_break (0 == 47 GNUNET_break (0 ==
49 crypto_pwhash_argon2id ((unsigned char *) result, 48 crypto_pwhash_argon2id ((unsigned char *) result,
diff --git a/src/util/gnunet-scrypt.c b/src/util/gnunet-scrypt.c
index aa64144a8..136c6debb 100644
--- a/src/util/gnunet-scrypt.c
+++ b/src/util/gnunet-scrypt.c
@@ -26,6 +26,13 @@
26#include "gnunet_util_lib.h" 26#include "gnunet_util_lib.h"
27#include <gcrypt.h> 27#include <gcrypt.h>
28 28
29
30/**
31 * Salt for PoW calcualations.
32 */
33static struct GNUNET_CRYPTO_PowSalt salt = { "gnunet-nse-proof" };
34
35
29/** 36/**
30 * Amount of work required (W-bit collisions) for NSE proofs, in collision-bits. 37 * Amount of work required (W-bit collisions) for NSE proofs, in collision-bits.
31 */ 38 */
@@ -117,7 +124,7 @@ find_proof (void *cls)
117 while ((counter != UINT64_MAX) && (i < ROUND_SIZE)) 124 while ((counter != UINT64_MAX) && (i < ROUND_SIZE))
118 { 125 {
119 GNUNET_memcpy (buf, &counter, sizeof(uint64_t)); 126 GNUNET_memcpy (buf, &counter, sizeof(uint64_t));
120 GNUNET_CRYPTO_pow_hash ("gnunet-nse-proof", 127 GNUNET_CRYPTO_pow_hash (&salt,
121 buf, 128 buf,
122 sizeof(buf), 129 sizeof(buf),
123 &result); 130 &result);
diff --git a/src/util/test_os_start_process.c b/src/util/test_os_start_process.c
index 6d4a131bb..ff5021d03 100644
--- a/src/util/test_os_start_process.c
+++ b/src/util/test_os_start_process.c
@@ -124,11 +124,8 @@ run_task (void *cls)
124 124
125 GNUNET_asprintf (&fn, "cat"); 125 GNUNET_asprintf (&fn, "cat");
126 126
127 hello_pipe_stdin = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_YES, 127 hello_pipe_stdin = GNUNET_DISK_pipe (GNUNET_DISK_PF_BLOCKING_RW);
128 GNUNET_NO); 128 hello_pipe_stdout = GNUNET_DISK_pipe (GNUNET_DISK_PF_BLOCKING_RW);
129 hello_pipe_stdout = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO,
130 GNUNET_YES);
131
132 if ((hello_pipe_stdout == NULL) || (hello_pipe_stdin == NULL)) 129 if ((hello_pipe_stdout == NULL) || (hello_pipe_stdin == NULL))
133 { 130 {
134 GNUNET_break (0); 131 GNUNET_break (0);
@@ -202,10 +199,8 @@ check_kill ()
202{ 199{
203 char *fn; 200 char *fn;
204 201
205 hello_pipe_stdin = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_YES, 202 hello_pipe_stdin = GNUNET_DISK_pipe (GNUNET_DISK_PF_BLOCKING_RW);
206 GNUNET_NO); 203 hello_pipe_stdout = GNUNET_DISK_pipe (GNUNET_DISK_PF_BLOCKING_RW);
207 hello_pipe_stdout = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO,
208 GNUNET_YES);
209 if ((hello_pipe_stdout == NULL) || (hello_pipe_stdin == NULL)) 204 if ((hello_pipe_stdout == NULL) || (hello_pipe_stdin == NULL))
210 { 205 {
211 return 1; 206 return 1;
@@ -247,10 +242,8 @@ check_instant_kill ()
247{ 242{
248 char *fn; 243 char *fn;
249 244
250 hello_pipe_stdin = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_YES, 245 hello_pipe_stdin = GNUNET_DISK_pipe (GNUNET_DISK_PF_BLOCKING_RW);
251 GNUNET_NO); 246 hello_pipe_stdout = GNUNET_DISK_pipe (GNUNET_DISK_PF_BLOCKING_RW);
252 hello_pipe_stdout = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO,
253 GNUNET_YES);
254 if ((hello_pipe_stdout == NULL) || (hello_pipe_stdin == NULL)) 247 if ((hello_pipe_stdout == NULL) || (hello_pipe_stdin == NULL))
255 { 248 {
256 return 1; 249 return 1;