secbuf.h 865 B

123456789101112131415161718192021222324252627
  1. #ifndef VSF_SECBUF_H
  2. #define VSF_SECBUF_H
  3. /* vsf_secbuf_alloc()
  4. * PURPOSE
  5. * Allocate a "secure buffer". A secure buffer is one which will attempt to
  6. * catch out of bounds accesses by crashing the program (rather than
  7. * corrupting memory). It works by using UNIX memory protection. It isn't
  8. * foolproof.
  9. * PARAMETERS
  10. * p_ptr - pointer to a pointer which is to contain the secure buffer.
  11. * Any previous buffer pointed to is freed.
  12. * size - size in bytes required for the secure buffer.
  13. */
  14. void vsf_secbuf_alloc(char** p_ptr, unsigned int size);
  15. /* vsf_secbuf_free()
  16. * PURPOSE
  17. * Frees a "secure buffer".
  18. * PARAMETERS
  19. * p_ptr - pointer to a pointer containing the buffer to be freed. The
  20. * buffer pointer is nullified by this call.
  21. */
  22. void vsf_secbuf_free(char** p_ptr);
  23. #endif /* VSF_SECBUF_H */