Next: Logging handler, Previous: Allocation handler, Up: Handler Functions [Contents][Index]
The following functions may be used to register handler functions that
are called by Libgcrypt in case certain error conditions occur. They
may and should be registered prior to calling gcry_check_version
.
This type is defined as: int (*gcry_handler_no_mem_t) (void *, size_t, unsigned int)
This function registers func_no_mem as ‘out-of-core handler’, which means that it will be called in the case of not having enough memory available. The handler is called with 3 arguments: The first one is the pointer cb_data as set with this function, the second is the requested memory size and the last being a flag. If bit 0 of the flag is set, secure memory has been requested. The handler should either return true to indicate that Libgcrypt should try again allocating memory or return false to let Libgcrypt use its default fatal error handler.
This type is defined as: void (*gcry_handler_error_t) (void *, int, const char *)
This function registers func_error as ‘error handler’, which means that it will be called in error conditions.