aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ffi/ffi.cpp6
-rw-r--r--src/lib/ffi/ffi.h6
2 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/ffi/ffi.cpp b/src/lib/ffi/ffi.cpp
index 7e96e5514..46755ff54 100644
--- a/src/lib/ffi/ffi.cpp
+++ b/src/lib/ffi/ffi.cpp
@@ -393,6 +393,12 @@ int botan_same_mem(const uint8_t* x, const uint8_t* y, size_t len)
return Botan::same_mem(x, y, len) ? 0 : -1;
}
+int botan_scrub_mem(uint8_t* mem, size_t bytes)
+ {
+ Botan::secure_scrub_memory(mem, bytes);
+ return 0;
+ }
+
int botan_hex_encode(const uint8_t* in, size_t len, char* out, uint32_t flags)
{
try
diff --git a/src/lib/ffi/ffi.h b/src/lib/ffi/ffi.h
index 5ce86a9b0..d194c4794 100644
--- a/src/lib/ffi/ffi.h
+++ b/src/lib/ffi/ffi.h
@@ -147,6 +147,12 @@ doesn't exactly work well either!
*/
BOTAN_DLL int botan_same_mem(const uint8_t* x, const uint8_t* y, size_t len);
+/**
+* Clear out memory using a system specific approach to bypass elision by the
+* compiler (currently using RtlSecureZeroMemory or tricks with volatile pointers).
+*/
+BOTAN_DLL int botan_scrub_mem(uint8_t* mem, size_t bytes);
+
#define BOTAN_FFI_HEX_LOWER_CASE 1
/**