From 8123ce62094bf88a4107506d7acd3e8e2866bc1f Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Tue, 3 Mar 2015 15:08:56 +0000 Subject: Constant time comparison for mac --- include/axolotl/memory.hh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/axolotl/memory.hh b/include/axolotl/memory.hh index 7749c54..8313a19 100644 --- a/include/axolotl/memory.hh +++ b/include/axolotl/memory.hh @@ -1,17 +1,24 @@ #include +#include namespace axolotl { /** Clear the memory held in the buffer */ void unset( - volatile void * buffer, std::size_t buffer_length + void volatile * buffer, std::size_t buffer_length ); /** Clear the memory backing an object */ template void unset(T & value) { - unset(reinterpret_cast(&value), sizeof(T)); + unset(reinterpret_cast(&value), sizeof(T)); } +/** Check if two buffers are equal in constant time. */ +bool is_equal( + std::uint8_t const * buffer_a, + std::uint8_t const * buffer_b, + std::size_t length +); } // namespace axolotl -- cgit v1.2.3