aboutsummaryrefslogtreecommitdiff
path: root/include/axolotl
diff options
context:
space:
mode:
Diffstat (limited to 'include/axolotl')
-rw-r--r--include/axolotl/memory.hh11
1 files changed, 9 insertions, 2 deletions
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 <cstddef>
+#include <cstdint>
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<typename T>
void unset(T & value) {
- unset(reinterpret_cast<volatile void *>(&value), sizeof(T));
+ unset(reinterpret_cast<void volatile *>(&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