🌊 Sailfish pool (sfpool)
Secure and Fast memory pool, in 300 lines of portable, header-only C code.
Loading...
Searching...
No Matches
Functions
Internal Utilities

Functions

void sfutil_zero (void *ptr, uint32_t size)
 Zeroes out a block of memory.
 
void * sfutil_memalign (const void *ptr)
 Aligns a pointer to the nearest boundary.
 
void * sfutil_secalloc (size_t size)
 Allocates memory securely.
 
void sfutil_secfree (void *ptr, size_t size)
 Frees memory allocated securely.
 

Detailed Description

Function Documentation

◆ sfutil_memalign()

void * sfutil_memalign ( const void *  ptr)

Aligns a pointer to the nearest boundary.

This function aligns the given pointer to the nearest boundary specified by ptr_align.

Parameters
ptrPointer to align.
Returns
Aligned pointer.

◆ sfutil_secalloc()

void * sfutil_secalloc ( size_t  size)

Allocates memory securely.

This function allocates memory securely, ensuring it is aligned and locked (if supported by the platform).

Parameters
sizeSize of the memory block to allocate.
Returns
Pointer to the allocated memory block, or NULL on failure.

◆ sfutil_secfree()

void sfutil_secfree ( void *  ptr,
size_t  size 
)

Frees memory allocated securely.

This function frees memory that was allocated using sfutil_secalloc.

Parameters
ptrPointer to the memory block to free.
sizeSize of the memory block in bytes.

◆ sfutil_zero()

void sfutil_zero ( void *  ptr,
uint32_t  size 
)

Zeroes out a block of memory.

This function sets a block of memory to zero using 32-bit writes for efficiency.

Parameters
ptrPointer to the memory block to zero out.
sizeSize of the memory block in bytes.