insecure_memzero.c 404 B

1234567891011121314151617181920
  1. #include <stddef.h>
  2. #include <stdint.h>
  3. #include "insecure_memzero.h"
  4. /* Function which does the zeroing. */
  5. static void
  6. insecure_memzero_func(volatile void * buf, size_t len)
  7. {
  8. volatile uint8_t * _buf = buf;
  9. size_t i;
  10. for (i = 0; i < len; i++)
  11. _buf[i] = 0;
  12. }
  13. /* Pointer to memory-zeroing function. */
  14. void (* volatile insecure_memzero_ptr)(volatile void *, size_t) =
  15. insecure_memzero_func;