Skip to content

Commit 32f046b

Browse files
committed
Cover corruption lines
1 parent 80342f1 commit 32f046b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

include/boost/crypt2/detail/clear_mem.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ BOOST_CRYPT_GPU_ENABLED void clear_mem(T& arr)
5151

5252
namespace boost::crypt::detail {
5353

54+
/*
5455
using memset_span_t = void(*)(std::span<std::byte>);
5556
5657
inline constexpr memset_span_t default_memset = [](std::span<std::byte> s) constexpr
@@ -90,6 +91,7 @@ constexpr void clear_mem(std::span<std::byte> data)
9091
runtime_memset_func(data);
9192
}
9293
}
94+
*/
9395

9496
using generic_meset_t = void(*)(void*, size_t);
9597

test/test_sha1.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ void test_class()
125125

126126
for (const auto& test_value : test_values)
127127
{
128+
hasher.init();
128129
const auto msg {std::get<0>(test_value)};
129130
hasher.process_bytes(msg);
130131
const auto message_result {hasher.get_digest()};
@@ -140,9 +141,11 @@ void test_class()
140141
// LCOV_EXCL_STOP
141142
}
142143
}
143-
144-
hasher.init();
145144
}
145+
146+
const std::string bad_update_msg {"bad"};
147+
BOOST_TEST(hasher.process_bytes(bad_update_msg) == boost::crypt::state::state_error);
148+
BOOST_TEST(hasher.get_digest() == boost::crypt::sha1_hasher::return_type{});
146149
}
147150

148151
void test_file(const std::string& filename, const std::array<std::uint16_t, 20>& res)

0 commit comments

Comments
 (0)