aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/peerinfo-tool/Makefile.am2
-rw-r--r--src/peerinfo/Makefile.am6
-rw-r--r--src/util/common_logging.c51
-rw-r--r--src/util/crypto_random.c31
4 files changed, 63 insertions, 27 deletions
diff --git a/src/peerinfo-tool/Makefile.am b/src/peerinfo-tool/Makefile.am
index 648957a05..429224650 100644
--- a/src/peerinfo-tool/Makefile.am
+++ b/src/peerinfo-tool/Makefile.am
@@ -10,6 +10,8 @@ if USE_COVERAGE
10 XLIB = -lgcov 10 XLIB = -lgcov
11endif 11endif
12 12
13plugindir = $(libdir)/gnunet
14
13bin_PROGRAMS = \ 15bin_PROGRAMS = \
14 gnunet-peerinfo 16 gnunet-peerinfo
15 17
diff --git a/src/peerinfo/Makefile.am b/src/peerinfo/Makefile.am
index 3f68becb5..ef79d6720 100644
--- a/src/peerinfo/Makefile.am
+++ b/src/peerinfo/Makefile.am
@@ -5,8 +5,6 @@ pkgcfgdir= $(pkgdatadir)/config.d/
5 5
6libexecdir= $(pkglibdir)/libexec/ 6libexecdir= $(pkglibdir)/libexec/
7 7
8plugindir = $(libdir)/gnunet
9
10pkgcfg_DATA = \ 8pkgcfg_DATA = \
11 peerinfo.conf 9 peerinfo.conf
12 10
@@ -38,12 +36,12 @@ libexec_PROGRAMS = \
38 gnunet-service-peerinfo 36 gnunet-service-peerinfo
39 37
40gnunet_service_peerinfo_SOURCES = \ 38gnunet_service_peerinfo_SOURCES = \
41 gnunet-service-peerinfo.c 39 gnunet-service-peerinfo.c
42gnunet_service_peerinfo_LDADD = \ 40gnunet_service_peerinfo_LDADD = \
43 $(top_builddir)/src/hello/libgnunethello.la \ 41 $(top_builddir)/src/hello/libgnunethello.la \
44 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 42 $(top_builddir)/src/statistics/libgnunetstatistics.la \
45 $(top_builddir)/src/util/libgnunetutil.la 43 $(top_builddir)/src/util/libgnunetutil.la
46 44
47if HAVE_BENCHMARKS 45if HAVE_BENCHMARKS
48 PEERINFO_BENCHMARKS = \ 46 PEERINFO_BENCHMARKS = \
49 perf_peerinfo_api 47 perf_peerinfo_api
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index f875d165d..be2e084b5 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -817,32 +817,39 @@ output_message (enum GNUNET_ErrorType kind,
817 if ( (NULL != GNUNET_stderr) && 817 if ( (NULL != GNUNET_stderr) &&
818 (NULL == loggers) ) 818 (NULL == loggers) )
819 { 819 {
820 if (kind == GNUNET_ERROR_TYPE_MESSAGE) { 820 if (kind == GNUNET_ERROR_TYPE_MESSAGE)
821 /* The idea here is to produce "normal" output messages 821 {
822 * for end users while still having the power of the 822 /* The idea here is to produce "normal" output messages
823 * logging engine for developer needs. So ideally this 823 * for end users while still having the power of the
824 * is what it should look like when CLI tools are used 824 * logging engine for developer needs. So ideally this
825 * interactively, yet the same message shouldn't look 825 * is what it should look like when CLI tools are used
826 * this way if the output is going to logfiles or robots 826 * interactively, yet the same message shouldn't look
827 * instead. Is this the right place to do this? --lynX 827 * this way if the output is going to logfiles or robots
828 */ 828 * instead.
829 FPRINTF (GNUNET_stderr, 829 */
830 "* %s", 830 FPRINTF (GNUNET_stderr,
831 msg); 831 "* %s",
832 } else { 832 msg);
833 FPRINTF (GNUNET_stderr, 833 }
834 "%s %s %s %s", 834 else
835 datestr, 835 {
836 comp, 836 FPRINTF (GNUNET_stderr,
837 GNUNET_error_type_to_string (kind), 837 "%s %s %s %s",
838 msg); 838 datestr,
839 comp,
840 GNUNET_error_type_to_string (kind),
841 msg);
839 } 842 }
840 fflush (GNUNET_stderr); 843 fflush (GNUNET_stderr);
841 } 844 }
842 pos = loggers; 845 pos = loggers;
843 while (pos != NULL) 846 while (NULL != pos)
844 { 847 {
845 pos->logger (pos->logger_cls, kind, comp, datestr, msg); 848 pos->logger (pos->logger_cls,
849 kind,
850 comp,
851 datestr,
852 msg);
846 pos = pos->next; 853 pos = pos->next;
847 } 854 }
848#if WINDOWS 855#if WINDOWS
diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c
index 2163a9731..df6d3fb9b 100644
--- a/src/util/crypto_random.c
+++ b/src/util/crypto_random.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -269,6 +269,28 @@ GNUNET_CRYPTO_random_u64 (enum GNUNET_CRYPTO_Quality mode, uint64_t max)
269 269
270 270
271/** 271/**
272 * Allocation wrapper for libgcrypt, used to avoid bad locking
273 * strategy of libgcrypt implementation.
274 */
275static void *
276w_malloc (size_t n)
277{
278 return calloc (n, 1);
279}
280
281
282/**
283 * Allocation wrapper for libgcrypt, used to avoid bad locking
284 * strategy of libgcrypt implementation.
285 */
286static int
287w_check (const void *p)
288{
289 return 0; /* not secure memory */
290}
291
292
293/**
272 * Initialize libgcrypt. 294 * Initialize libgcrypt.
273 */ 295 */
274void __attribute__ ((constructor)) 296void __attribute__ ((constructor))
@@ -283,6 +305,13 @@ GNUNET_CRYPTO_random_init ()
283 NEED_LIBGCRYPT_VERSION); 305 NEED_LIBGCRYPT_VERSION);
284 GNUNET_assert (0); 306 GNUNET_assert (0);
285 } 307 }
308 /* set custom allocators */
309 gcry_set_allocation_handler (&w_malloc,
310 &w_malloc,
311 &w_check,
312 &realloc,
313 &free);
314 /* Disable use of secure memory */
286 if ((rc = gcry_control (GCRYCTL_DISABLE_SECMEM, 0))) 315 if ((rc = gcry_control (GCRYCTL_DISABLE_SECMEM, 0)))
287 FPRINTF (stderr, 316 FPRINTF (stderr,
288 "Failed to set libgcrypt option %s: %s\n", 317 "Failed to set libgcrypt option %s: %s\n",