00001 #ifndef VSF_SECBUF_H 00002 #define VSF_SECBUF_H 00003 00004 /* vsf_secbuf_alloc() 00005 * PURPOSE 00006 * Allocate a "secure buffer". A secure buffer is one which will attempt to 00007 * catch out of bounds accesses by crashing the program (rather than 00008 * corrupting memory). It works by using UNIX memory protection. It isn't 00009 * foolproof. 00010 * PARAMETERS 00011 * p_ptr - pointer to a pointer which is to contain the secure buffer. 00012 * Any previous buffer pointed to is freed. 00013 * size - size in bytes required for the secure buffer. 00014 */ 00015 void vsf_secbuf_alloc(char** p_ptr, unsigned int size); 00016 00017 /* vsf_secbuf_free() 00018 * PURPOSE 00019 * Frees a "secure buffer". 00020 * PARAMETERS 00021 * p_ptr - pointer to a pointer containing the buffer to be freed. The 00022 * buffer pointer is nullified by this call. 00023 */ 00024 void vsf_secbuf_free(char** p_ptr); 00025 00026 #endif /* VSF_SECBUF_H */ 00027