diff options
Diffstat (limited to 'libs/libsignal/src/curve25519/ed25519/additions/zeroize.c')
-rw-r--r-- | libs/libsignal/src/curve25519/ed25519/additions/zeroize.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libs/libsignal/src/curve25519/ed25519/additions/zeroize.c b/libs/libsignal/src/curve25519/ed25519/additions/zeroize.c new file mode 100644 index 0000000000..187e725eb5 --- /dev/null +++ b/libs/libsignal/src/curve25519/ed25519/additions/zeroize.c @@ -0,0 +1,16 @@ +#include "zeroize.h" + +void zeroize(unsigned char* b, size_t len) +{ + size_t count = 0; + volatile unsigned char *p = b; + + for (count = 0; count < len; count++) + p[count] = 0; +} + +void zeroize_stack() +{ + unsigned char m[ZEROIZE_STACK_SIZE]; + zeroize(m, ZEROIZE_STACK_SIZE); +} |