It is possible to make Libgcrypt use special memory allocation functions instead of the built-in ones.
Memory allocation functions are of the following types:
This type is defined as:
void *(*gcry_handler_alloc_t) (size_t n)
.
This type is defined as:
int *(*gcry_handler_secure_check_t) (const void *)
.
This type is defined as:
void *(*gcry_handler_realloc_t) (void *p, size_t n)
.
Special memory allocation functions can be installed with the following function:
Install the provided functions and use them instead of the built-in functions for doing memory allocation. Using this function is in general not recommended because the standard Libgcrypt allocation functions are guaranteed to zeroize memory if needed.
This function may be used only during initialization and may not be used in fips mode.