From 17c7c9caed3486797ce40ce56d0c383ebaf77ea6 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sat, 30 Jan 2016 18:45:22 +0000 Subject: epee: remove dodgy random code that nobody uses in case someone might want to use it --- contrib/epee/include/math_helper.h | 9 --------- 1 file changed, 9 deletions(-) (limited to 'contrib/epee') diff --git a/contrib/epee/include/math_helper.h b/contrib/epee/include/math_helper.h index 9b8765e60..90398acbb 100644 --- a/contrib/epee/include/math_helper.h +++ b/contrib/epee/include/math_helper.h @@ -229,15 +229,6 @@ namespace math_helper } } -PRAGMA_WARNING_PUSH -PRAGMA_GCC("GCC diagnostic ignored \"-Wstrict-aliasing\"") - inline - uint64_t generated_random_uint64() - { - boost::uuids::uuid id___ = boost::uuids::random_generator()(); - return *reinterpret_cast(&id___.data[0]); //(*reinterpret_cast(&id___.data[0]) ^ *reinterpret_cast(&id___.data[8])); - } -PRAGMA_WARNING_POP template class once_a_time_seconds { -- cgit v1.2.3 From d97582cf95adc78e631286a609cbeccead9751de Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sat, 30 Jan 2016 18:45:53 +0000 Subject: epee: use generate_random_bytes for new random uuids Instead of using boost::uuids::generate_random, which uses uninitialized stuff *on purpose*, just to annoy people who use valgrind --- contrib/epee/include/net/abstract_tcp_server2.inl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'contrib/epee') diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index 5bf65d7fd..934132ea2 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -141,7 +141,12 @@ PRAGMA_WARNING_DISABLE_VS(4355) context = boost::value_initialized(); long ip_ = boost::asio::detail::socket_ops::host_to_network_long(remote_ep.address().to_v4().to_ulong()); - context.set_details(boost::uuids::random_generator()(), ip_, remote_ep.port(), is_income); + // create a random uuid + boost::uuids::uuid random_uuid; + // that stuff turns out to be included, even though it's from src... Taking advantage + crypto::generate_random_bytes(sizeof(random_uuid), &random_uuid); + + context.set_details(random_uuid, ip_, remote_ep.port(), is_income); _dbg3("[sock " << socket_.native_handle() << "] new connection from " << print_connection_context_short(context) << " to " << local_ep.address().to_string() << ':' << local_ep.port() << ", total sockets objects " << m_ref_sock_count); -- cgit v1.2.3