Skip to content

Commit

Permalink
Fixing an asan issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
clemahieu committed Nov 5, 2014
1 parent 961600d commit 2289096
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 49 deletions.
1 change: 1 addition & 0 deletions asan_blacklist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src:*ed25519*
2 changes: 1 addition & 1 deletion rai/core/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace
{
bool constexpr ledger_logging ()
{
return false;
return true;
}
bool constexpr ledger_duplicate_logging ()
{
Expand Down
37 changes: 0 additions & 37 deletions rai/secure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,43 +650,6 @@ bool rai::uint512_union::decode_hex (std::string const & text)
return result;
}

namespace
{
uint32_t R (uint32_t value_a, unsigned amount_a)
{
return (value_a << amount_a) | (value_a >> (32 - amount_a));
}
}

rai::uint512_union rai::uint512_union::salsa20_8 ()
{
rai::uint512_union result;
auto & x (result.dwords);
auto & in (dwords);
int i;
for (i = 0;i < 16;++i) x[i] = in[i];
for (i = 8;i > 0;i -= 2) {
x[ 4] ^= R(x[ 0]+x[12], 7); x[ 8] ^= R(x[ 4]+x[ 0], 9);
x[12] ^= R(x[ 8]+x[ 4],13); x[ 0] ^= R(x[12]+x[ 8],18);
x[ 9] ^= R(x[ 5]+x[ 1], 7); x[13] ^= R(x[ 9]+x[ 5], 9);
x[ 1] ^= R(x[13]+x[ 9],13); x[ 5] ^= R(x[ 1]+x[13],18);
x[14] ^= R(x[10]+x[ 6], 7); x[ 2] ^= R(x[14]+x[10], 9);
x[ 6] ^= R(x[ 2]+x[14],13); x[10] ^= R(x[ 6]+x[ 2],18);
x[ 3] ^= R(x[15]+x[11], 7); x[ 7] ^= R(x[ 3]+x[15], 9);
x[11] ^= R(x[ 7]+x[ 3],13); x[15] ^= R(x[11]+x[ 7],18);
x[ 1] ^= R(x[ 0]+x[ 3], 7); x[ 2] ^= R(x[ 1]+x[ 0], 9);
x[ 3] ^= R(x[ 2]+x[ 1],13); x[ 0] ^= R(x[ 3]+x[ 2],18);
x[ 6] ^= R(x[ 5]+x[ 4], 7); x[ 7] ^= R(x[ 6]+x[ 5], 9);
x[ 4] ^= R(x[ 7]+x[ 6],13); x[ 5] ^= R(x[ 4]+x[ 7],18);
x[11] ^= R(x[10]+x[ 9], 7); x[ 8] ^= R(x[11]+x[10], 9);
x[ 9] ^= R(x[ 8]+x[11],13); x[10] ^= R(x[ 9]+x[ 8],18);
x[12] ^= R(x[15]+x[14], 7); x[13] ^= R(x[12]+x[15], 9);
x[14] ^= R(x[13]+x[12],13); x[15] ^= R(x[14]+x[13],18);
}
for (i = 0;i < 16;++i) x[i] += in[i];
return result;
}

bool rai::uint512_union::operator != (rai::uint512_union const & other_a) const
{
return ! (*this == other_a);
Expand Down
1 change: 0 additions & 1 deletion rai/secure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ namespace rai
rai::uint512_union & operator ^= (rai::uint512_union const &);
void encode_hex (std::string &);
bool decode_hex (std::string const &);
rai::uint512_union salsa20_8 ();
std::array <uint8_t, 64> bytes;
std::array <uint32_t, 16> dwords;
std::array <uint64_t, 8> qwords;
Expand Down
9 changes: 0 additions & 9 deletions rai/test/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,15 +420,6 @@ TEST (frontier_req, serialization)
ASSERT_EQ (request1, request2);
}

TEST (salsa20_8, one)
{
rai::uint512_union value;
value.clear ();
value.bytes [0] = 1;
auto result (value.salsa20_8 ());
ASSERT_NE (value, result);
}

TEST (work, one)
{
rai::work work;
Expand Down
2 changes: 1 addition & 1 deletion rai/test/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ TEST (bulk, offline_send)
client1->wallet.insert (key2.prv);
ASSERT_FALSE (system.clients [0]->transactions.send (key2.pub, 100));
ASSERT_NE (std::numeric_limits <rai::uint256_t>::max (), system.clients [0]->ledger.account_balance (rai::test_genesis_key.pub));
bool finished;
bool finished (false);
client1->processor.bootstrap (system.clients [0]->bootstrap.endpoint (), [&finished] () {finished = true;});
do
{
Expand Down

0 comments on commit 2289096

Please sign in to comment.